diff options
author | w12x <none@none> | 2008-10-21 03:58:38 -0500 |
---|---|---|
committer | w12x <none@none> | 2008-10-21 03:58:38 -0500 |
commit | 5e1c19e4d9b6e2deb247e6ce6b25ea132b8118d4 (patch) | |
tree | 57a6e1b306028999076e3e80bb52cadbc4af24e1 /src/game/ObjectMgr.cpp | |
parent | 23ff96ded9d418402b78832fd0555c781942eb5b (diff) |
[svn] Implement a new table (spell_disabled) to allow disabling some spells for players and / or creatures. To disable a spell for a players and pets, set 2^0 in the disable_mask, to disable for creatures, set 2^1. The comment field is optional. Original patch provided by Craker.
--HG--
branch : trunk
Diffstat (limited to 'src/game/ObjectMgr.cpp')
-rw-r--r-- | src/game/ObjectMgr.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index a93f21af369..9b37a3351d9 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -6291,6 +6291,51 @@ const char *ObjectMgr::GetTrinityString(int32 entry, int locale_idx) const return "<error>"; } +void ObjectMgr::LoadSpellDisabledEntrys() +{ + m_DisabledPlayerSpells.clear(); // need for reload case + m_DisabledCreatureSpells.clear(); + QueryResult *result = WorldDatabase.Query("SELECT entry, disable_mask FROM spell_disabled"); + + uint32 total_count = 0; + + if( !result ) + { + barGoLink bar( 1 ); + bar.step(); + + sLog.outString(); + sLog.outString( ">> Loaded %u disabled spells", total_count ); + return; + } + + barGoLink bar( result->GetRowCount() ); + + Field* fields; + do + { + bar.step(); + fields = result->Fetch(); + uint32 spellid = fields[0].GetUInt32(); + if(!sSpellStore.LookupEntry(spellid)) + { + sLog.outErrorDb("Spell entry %u from `spell_disabled` doesn't exist in dbc, ignoring.",spellid); + continue; + } + uint32 disable_mask = fields[1].GetUInt32(); + if(disable_mask & SPELL_DISABLE_PLAYER) + m_DisabledPlayerSpells.insert(spellid); + if(disable_mask & SPELL_DISABLE_CREATURE) + m_DisabledCreatureSpells.insert(spellid); + ++total_count; + } while ( result->NextRow() ); + + delete result; + + sLog.outString(); + sLog.outString( ">> Loaded %u disabled spells from `spell_disabled`", total_count); +} + void ObjectMgr::LoadFishingBaseSkillLevel() { mFishingBaseForArea.clear(); // for relaod case |