Index: src/game/Chat.cpp =================================================================== --- src/game/Chat.cpp (revision 5483) +++ src/game/Chat.cpp (working copy) @@ -189,6 +189,7 @@ { "spell_script_target", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellScriptTargetCommand, "", NULL }, { "spell_scripts", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellScriptsCommand, "", NULL }, { "spell_teleport", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellTeleportCommand, "", NULL }, + { "spell_disabled", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadSpellDisabledCommand, "", NULL }, { "", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadCommand, "", NULL }, { NULL, 0, NULL, "", NULL } Index: src/game/Chat.h =================================================================== --- src/game/Chat.h (revision 5483) +++ src/game/Chat.h (working copy) @@ -98,7 +98,7 @@ bool HandleDismountCommand(const char* args); bool HandleSaveCommand(const char* args); bool HandleGMListCommand(const char* args); - + bool HandleReloadSpellDisabledCommand(const char* args); bool HandleNamegoCommand(const char* args); bool HandleGonameCommand(const char* args); bool HandleGroupgoCommand(const char* args); Index: src/game/Level3.cpp =================================================================== --- src/game/Level3.cpp (revision 5483) +++ src/game/Level3.cpp (working copy) @@ -122,6 +122,7 @@ HandleReloadSpellProcEventCommand("a"); HandleReloadSpellScriptTargetCommand("a"); HandleReloadSpellTeleportCommand("a"); + HandleReloadSpellDisabledCommand("a"); return true; } @@ -446,6 +447,17 @@ return true; } +bool ChatHandler::HandleReloadSpellDisabledCommand(const char* /*arg*/) +{ + sLog.outString( "Re-Loading spell disabled table..."); + + objmgr.LoadSpellDisabledEntrys(); + + SendGlobalSysMessage("DB table `spell_disabled` reloaded."); + + return true; +} + bool ChatHandler::HandleLoadScriptsCommand(const char* args) { if(!LoadScriptingModule(args)) return true; Index: src/game/ObjectMgr.cpp =================================================================== --- src/game/ObjectMgr.cpp (revision 5483) +++ src/game/ObjectMgr.cpp (working copy) @@ -5286,3 +5286,39 @@ } return GetMangosStringDefault(entry); } + +void ObjectMgr::LoadSpellDisabledEntrys() +{ + m_spell_disabled.clear(); // need for reload case + QueryResult *result = WorldDatabase.Query("SELECT entry FROM spell_disabled where active=1"); + + uint32 count = 0; + + if( !result ) + { + barGoLink bar( 1 ); + bar.step(); + + sLog.outString(); + sLog.outString( ">> Loaded %u disabled spells", count ); + return; + } + + barGoLink bar( result->GetRowCount() ); + + Field* fields; + do + { + bar.step(); + fields = result->Fetch(); + uint32 entry = fields[0].GetUInt32(); + m_spell_disabled.insert(entry); + ++count; + + } while ( result->NextRow() ); + + delete result; + + sLog.outString(); + sLog.outString( ">> Loaded %u disabled spells", count ); +} Index: src/game/ObjectMgr.h =================================================================== --- src/game/ObjectMgr.h (revision 5483) +++ src/game/ObjectMgr.h (working copy) @@ -599,6 +599,12 @@ return m_ReservedNames.find(name) != m_ReservedNames.end(); } + void LoadSpellDisabledEntrys(); + bool IsSpellDisabled(uint32 spellid) const + { + return m_spell_disabled.find(spellid) != m_spell_disabled.end(); + } + int GetIndexForLocale(LocaleConstant loc); LocaleConstant GetLocalForIndex(int); // guild bank tabs @@ -658,6 +664,9 @@ typedef std::set ReservedNamesMap; ReservedNamesMap m_ReservedNames; + typedef std::set SpellDisabledMap; + SpellDisabledMap m_spell_disabled; + GraveYardMap mGraveYardMap; typedef std::vector LocalToIndex; Index: src/game/Spell.cpp =================================================================== --- src/game/Spell.cpp (revision 5483) +++ src/game/Spell.cpp (working copy) @@ -1519,6 +1519,13 @@ return; } + if(objmgr.IsSpellDisabled(m_spellInfo->Id)) + { + SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE); + finish(false); + return; + } + uint8 result = CanCast(true); if(result != 0) { Index: src/game/World.cpp =================================================================== --- src/game/World.cpp (revision 5483) +++ src/game/World.cpp (working copy) @@ -750,7 +750,10 @@ sLog.outString( "Loading Player Corpses..." ); objmgr.LoadCorpses(); - + + sLog.outString( "Loading Spell disabled..." ); + objmgr.LoadSpellDisabledEntrys(); + sLog.outString( "Loading Loot Tables..." ); LoadLootTables();