rendered paste bodyIndex: 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<std::string> ReservedNamesMap;
ReservedNamesMap m_ReservedNames;
+ typedef std::set<uint32> SpellDisabledMap;
+ SpellDisabledMap m_spell_disabled;
+
GraveYardMap mGraveYardMap;
typedef std::vector<LocaleConstant> 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)
{