aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjoschiwald <joschiwald@online.de>2013-07-24 15:18:42 +0200
committerjoschiwald <joschiwald@online.de>2013-07-24 15:18:42 +0200
commit10390465f2e964bbdaa892e3900980f50470c6c8 (patch)
treed0e79ce083ef809efc915d3f15a4abe11a0d0ab7 /src
parent00f3b01ea72069671b928f8b196a89d4b1a39d55 (diff)
Core/Spells: add some logs for loading spell_script_names
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp20
-rw-r--r--src/server/game/Spells/SpellMgr.cpp6
-rw-r--r--src/server/scripts/Commands/cs_learn.cpp8
3 files changed, 21 insertions, 13 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index bc9934c63eb..140fb6afea0 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -4862,10 +4862,10 @@ void ObjectMgr::LoadSpellScriptNames()
Field* fields = result->Fetch();
int32 spellId = fields[0].GetInt32();
- const char *scriptName = fields[1].GetCString();
+ char const* scriptName = fields[1].GetCString();
bool allRanks = false;
- if (spellId <= 0)
+ if (spellId < 0)
{
allRanks = true;
spellId = -spellId;
@@ -4874,17 +4874,21 @@ void ObjectMgr::LoadSpellScriptNames()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32());
+ TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname: `%s` spell (Id: %d) does not exist.", scriptName, spellId);
continue;
}
if (allRanks)
{
- if (sSpellMgr->GetFirstSpellInChain(spellId) != uint32(spellId))
+ if (!spellInfo->IsRanked())
+ TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname: `%s` spell (Id: %d) has no ranks of spell.", scriptName, fields[0].GetInt32());
+
+ if (spellInfo->GetFirstRankSpell()->Id != uint32(spellId))
{
- TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32());
+ TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname: `%s` spell (Id: %d) is not first rank of spell.", scriptName, fields[0].GetInt32());
continue;
}
+
while (spellInfo)
{
_spellScriptsStore.insert(SpellScriptsContainer::value_type(spellInfo->Id, GetScriptId(scriptName)));
@@ -4892,7 +4896,13 @@ void ObjectMgr::LoadSpellScriptNames()
}
}
else
+ {
+ if (spellInfo->IsRanked())
+ TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname: `%s` spell (Id: %d) is ranked spell. Properly not all ranks are assigned to this script.", scriptName, spellId);
+
_spellScriptsStore.insert(SpellScriptsContainer::value_type(spellInfo->Id, GetScriptId(scriptName)));
+ }
+
++count;
}
while (result->NextRow());
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index deb96c467e4..8e8dee97d1b 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -1335,14 +1335,14 @@ void SpellMgr::LoadSpellRequired()
continue;
}
- SpellInfo const* req_spell = GetSpellInfo(spell_req);
- if (!req_spell)
+ SpellInfo const* reqSpell = GetSpellInfo(spell_req);
+ if (!reqSpell)
{
TC_LOG_ERROR(LOG_FILTER_SQL, "req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
continue;
}
- if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req))
+ if (spell->IsRankOf(reqSpell))
{
TC_LOG_ERROR(LOG_FILTER_SQL, "req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
continue;
diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp
index 09060e2e01b..baebc3d0bd5 100644
--- a/src/server/scripts/Commands/cs_learn.cpp
+++ b/src/server/scripts/Commands/cs_learn.cpp
@@ -116,8 +116,7 @@ public:
else
targetPlayer->learnSpell(spell, false);
- uint32 firstSpell = sSpellMgr->GetFirstSpellInChain(spell);
- if (GetTalentSpellCost(firstSpell))
+ if (GetTalentSpellCost(spellInfo->GetFirstRankSpell()->Id))
targetPlayer->SendTalentsInfoData(false);
return true;
@@ -178,8 +177,7 @@ public:
continue;
// skip spells with first rank learned as talent (and all talents then also)
- uint32 firstRank = sSpellMgr->GetFirstSpellInChain(spellInfo->Id);
- if (GetTalentSpellCost(firstRank) > 0)
+ if (GetTalentSpellCost(spellInfo->GetFirstRankSpell()->Id) > 0)
continue;
// skip broken spells
@@ -493,7 +491,7 @@ public:
}
if (allRanks)
- spellId = sSpellMgr->GetFirstSpellInChain (spellId);
+ spellId = sSpellMgr->GetFirstSpellInChain(spellId);
if (target->HasSpell(spellId))
target->removeSpell(spellId, false, !allRanks);