Core: Use new SpellInfo class in core. Sadly, this commit is not compatibile with some of the custom code. To make your code work again you may need to change:

*SpellEntry is now SpellInfo
*GetSpellProto is now GetSpellInfo
*SpellEntry::Effect*[effIndex] is now avalible under SpellInfo.Effects[effIndex].*
*sSpellStore.LookupEntry is no longer valid, use sSpellMgr->GetSpellInfo()
*SpellFunctions from SpellMgr.h like DoSpellStuff(spellId) are now: spellInfo->DoStuff()
*SpellMgr::CalculateEffectValue and similar functions are now avalible in SpellEffectInfo class.
*GET_SPELL macro is removed, code which used it is moved to SpellMgr::LoadDbcDataCorrections
*code which affected dbc data in SpellMgr::LoadSpellCustomAttr is now moved to LoadDbcDataCorrections
This commit is contained in:
QAston
2011-07-26 23:09:28 +02:00
parent 29c228a801
commit b0fe236265
195 changed files with 4630 additions and 6929 deletions
+6 -5
View File
@@ -18,6 +18,7 @@
#include "ChatLink.h"
#include "SpellMgr.h"
#include "ObjectMgr.h"
#include "SpellInfo.h"
// Supported shift-links (client generated and server side)
// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r
@@ -268,7 +269,7 @@ bool SpellChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate spell
_spell = sSpellStore.LookupEntry(spellId);
_spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId);
@@ -405,7 +406,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate spell
_spell = sSpellStore.LookupEntry(spellId);
_spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId);
@@ -463,7 +464,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate talent's spell
_spell = sSpellStore.LookupEntry(talentInfo->RankID[0]);
_spell = sSpellMgr->GetSpellInfo(talentInfo->RankID[0]);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]);
@@ -495,7 +496,7 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate spell
_spell = sSpellStore.LookupEntry(spellId);
_spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId);
@@ -534,7 +535,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate glyph's spell
_spell = sSpellStore.LookupEntry(_glyph->SpellId);
_spell = sSpellMgr->GetSpellInfo(_glyph->SpellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId);
+2 -2
View File
@@ -26,7 +26,7 @@ struct ItemLocale;
struct ItemTemplate;
struct ItemRandomSuffixEntry;
struct ItemRandomPropertiesEntry;
struct SpellEntry;
class SpellInfo;
struct AchievementEntry;
struct GlyphPropertiesEntry;
class Quest;
@@ -91,7 +91,7 @@ public:
virtual bool ValidateName(char* buffer, const char* context);
protected:
SpellEntry const* _spell;
SpellInfo const* _spell;
};
// AchievementChatLink - link to quest
+2 -2
View File
@@ -862,7 +862,7 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
uint32 spellId = extractSpellIdFromLink((char*)args);
if (!spellId || !sSpellStore.LookupEntry(spellId))
if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
return false;
// Check if pet already has it
@@ -874,7 +874,7 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
}
// Check if spell is valid
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
+17 -15
View File
@@ -198,7 +198,7 @@ bool ChatHandler::HandleCooldownCommand(const char *args)
if (!spell_id)
return false;
if (!sSpellStore.LookupEntry(spell_id))
if (!sSpellMgr->GetSpellInfo(spell_id))
{
PSendSysMessage(LANG_UNKNOWN_SPELL, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str());
SetSentErrorMessage(true);
@@ -1000,9 +1000,9 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
// Search in Spell.dbc
for (uint32 id = 0; id < sSpellStore.GetNumRows(); id++)
for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(id);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(id);
if (spellInfo)
{
int loc = GetSessionDbcLocale();
@@ -1036,17 +1036,19 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
}
bool known = target && target->HasSpell(id);
bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL);
bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
uint32 talentCost = GetTalentSpellCost(id);
bool talent = (talentCost > 0);
bool passive = IsPassiveSpell(id);
bool passive = spellInfo->IsPassive();
bool active = target && target->HasAura(id);
// unit32 used to prevent interpreting uint8 as char at output
// find rank of learned spell for learning spell, or talent rank
uint32 rank = talentCost ? talentCost : sSpellMgr->GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id);
uint32 rank = talentCost ? talentCost : learn ? learnSpellInfo->GetRank() : spellInfo->GetRank();
// send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
std::ostringstream ss;
@@ -1915,7 +1917,7 @@ bool ChatHandler::HandleDamageCommand(const char * args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spellid = extractSpellIdFromLink((char*)args);
if (!spellid || !sSpellStore.LookupEntry(spellid))
if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
return false;
m_session->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
@@ -1955,7 +1957,7 @@ bool ChatHandler::HandleAuraCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spellID = extractSpellIdFromLink((char*)args);
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID))
if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellID))
Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
return true;
@@ -2407,7 +2409,7 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
AuraApplication const* aurApp = itr->second;
Aura const* aura = aurApp->GetBase();
char const* name = aura->GetSpellProto()->SpellName[GetSessionDbcLocale()];
char const* name = aura->GetSpellInfo()->SpellName[GetSessionDbcLocale()];
std::ostringstream ss_name;
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
@@ -3794,7 +3796,7 @@ bool ChatHandler::HandleCastCommand(const char *args)
if (!spell)
return false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
@@ -3838,7 +3840,7 @@ bool ChatHandler::HandleCastBackCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
if (!spell || !sSpellStore.LookupEntry(spell))
if (!spell || !sSpellMgr->GetSpellInfo(spell))
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
SetSentErrorMessage(true);
@@ -3872,7 +3874,7 @@ bool ChatHandler::HandleCastDistCommand(const char *args)
if (!spell)
return false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
@@ -3931,7 +3933,7 @@ bool ChatHandler::HandleCastTargetCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
if (!spell || !sSpellStore.LookupEntry(spell))
if (!spell || !sSpellMgr->GetSpellInfo(spell))
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
SetSentErrorMessage(true);
@@ -4005,7 +4007,7 @@ bool ChatHandler::HandleCastSelfCommand(const char *args)
if (!spell)
return false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
return false;
@@ -4502,7 +4504,7 @@ bool ChatHandler::HandleFreezeCommand(const char *args)
}
//m_session->GetPlayer()->CastSpell(player, spellID, false);
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(9454))
if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(9454))
Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
//save player