diff options
author | joschiwald <joschiwald@online.de> | 2013-07-21 15:12:34 +0200 |
---|---|---|
committer | joschiwald <joschiwald@online.de> | 2013-07-24 23:52:06 +0200 |
commit | e6a146aba83d98b65c9cdb62cd17132637b98c4e (patch) | |
tree | 4f28f3e4b9e1c16b3c7a178d51066509b5911e28 /src | |
parent | bf100ffc3cd5ea1d08f57c31aa9612fd19977462 (diff) |
Core/Spells: allow to use ranked spells in `spell_proc_event` table (like in `spell_proc` table)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 86 |
1 files changed, 57 insertions, 29 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 9cedfdf922f..7b162b5abf0 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1741,52 +1741,76 @@ void SpellMgr::LoadSpellProcEvents() } uint32 count = 0; - uint32 customProc = 0; + do { Field* fields = result->Fetch(); - uint32 entry = fields[0].GetUInt32(); + int32 spellId = fields[0].GetInt32(); - SpellInfo const* spell = GetSpellInfo(entry); - if (!spell) + bool allRanks = false; + if (spellId < 0) + { + allRanks = true; + spellId = -spellId; + } + + SpellInfo const* spellInfo = GetSpellInfo(spellId); + if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` does not exist", entry); + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` does not exist", spellId); continue; } - SpellProcEventEntry spe; + if (allRanks) + { + if (!spellInfo->IsRanked()) + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` with all ranks, but spell has no ranks.", spellId); + + if (spellInfo->GetFirstRankSpell()->Id != uint32(spellId)) + { + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` is not first rank of spell.", spellId); + continue; + } + } - spe.schoolMask = fields[1].GetInt8(); - spe.spellFamilyName = fields[2].GetUInt16(); - spe.spellFamilyMask[0] = fields[3].GetUInt32(); - spe.spellFamilyMask[1] = fields[4].GetUInt32(); - spe.spellFamilyMask[2] = fields[5].GetUInt32(); - spe.procFlags = fields[6].GetUInt32(); - spe.procEx = fields[7].GetUInt32(); - spe.ppmRate = fields[8].GetFloat(); - spe.customChance = fields[9].GetFloat(); - spe.cooldown = fields[10].GetUInt32(); + SpellProcEventEntry spellProcEvent; - mSpellProcEventMap[entry] = spe; + spellProcEvent.schoolMask = fields[1].GetInt8(); + spellProcEvent.spellFamilyName = fields[2].GetUInt16(); + spellProcEvent.spellFamilyMask[0] = fields[3].GetUInt32(); + spellProcEvent.spellFamilyMask[1] = fields[4].GetUInt32(); + spellProcEvent.spellFamilyMask[2] = fields[5].GetUInt32(); + spellProcEvent.procFlags = fields[6].GetUInt32(); + spellProcEvent.procEx = fields[7].GetUInt32(); + spellProcEvent.ppmRate = fields[8].GetFloat(); + spellProcEvent.customChance = fields[9].GetFloat(); + spellProcEvent.cooldown = fields[10].GetUInt32(); - if (spell->ProcFlags == 0) + while (spellInfo) { - if (spe.procFlags == 0) + if (mSpellProcEventMap.find(spellInfo->Id) != mSpellProcEventMap.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` probally not triggered spell", entry); - continue; + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` already has its first rank in table.", spellInfo->Id); + break; } - customProc++; + + if (!spellInfo->ProcFlags && !spellProcEvent.procFlags) + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` probally not triggered spell", spellInfo->Id); + + mSpellProcEventMap[spellInfo->Id] = spellProcEvent; + + if (allRanks) + spellInfo = spellInfo->GetNextRankSpell(); + else + break; } - ++count; - } while (result->NextRow()); - if (customProc) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime)); - else - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + ++count; + } + while (result->NextRow()); + TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellProcs() @@ -1826,6 +1850,9 @@ void SpellMgr::LoadSpellProcs() if (allRanks) { + if (!spellInfo->IsRanked()) + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` with all ranks, but spell has no ranks.", spellId); + if (spellInfo->GetFirstRankSpell()->Id != uint32(spellId)) { TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` is not first rank of spell.", spellId); @@ -1855,9 +1882,10 @@ void SpellMgr::LoadSpellProcs() { if (mSpellProcMap.find(spellInfo->Id) != mSpellProcMap.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` has duplicate entry in the table", spellInfo->Id); + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` already has its first rank in table.", spellInfo->Id); break; } + SpellProcEntry procEntry = SpellProcEntry(baseProcEntry); // take defaults from dbcs |