diff options
| author | megamage <none@none> | 2009-07-30 11:37:08 +0800 |
|---|---|---|
| committer | megamage <none@none> | 2009-07-30 11:37:08 +0800 |
| commit | af2d5e3fd4a57147280d265d1bc5ac1c2b70a3a3 (patch) | |
| tree | eddb20436980a4ce6be2d5d623fa25d2a653d653 /src/game/SpellMgr.cpp | |
| parent | 7121d98480d58a4214abcc2e22f678bad76cdecf (diff) | |
[8250] Cleanup code and data for `spell_threat` Author: nos4r2zod
* Load table data to std::map instead SQLStorage and add check loaded spell existance.
* Drop from table not existed spells.
--HG--
branch : trunk
Diffstat (limited to 'src/game/SpellMgr.cpp')
| -rw-r--r-- | src/game/SpellMgr.cpp | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 73aebc61490..942ab52e3da 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1505,12 +1505,50 @@ void SpellMgr::LoadSpellElixirs() void SpellMgr::LoadSpellThreats() { - sSpellThreatStore.Free(); // for reload + mSpellThreatMap.clear(); // need for reload case - sSpellThreatStore.Load(); + uint32 count = 0; + + // 0 1 + QueryResult *result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat"); + if( !result ) + { + + barGoLink bar( 1 ); + + bar.step(); + + sLog.outString(); + sLog.outString( ">> Loaded %u aggro generating spells", count ); + return; + } + + barGoLink bar( result->GetRowCount() ); + + do + { + Field *fields = result->Fetch(); + + bar.step(); + + uint32 entry = fields[0].GetUInt32(); + uint16 Threat = fields[1].GetUInt16(); + + if (!sSpellStore.LookupEntry(entry)) + { + sLog.outErrorDb("Spell %u listed in `spell_threat` does not exist", entry); + continue; + } + + mSpellThreatMap[entry] = Threat; + + ++count; + } while( result->NextRow() ); + + delete result; - sLog.outString( ">> Loaded %u aggro generating spells", sSpellThreatStore.RecordCount ); sLog.outString(); + sLog.outString( ">> Loaded %u aggro generating spells", count ); } bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const |
