Added global disable system and moved all disable fields/tables/configs into it

NOTE: instance disables were not converted for new system! if you had some then you need to fix that using new system

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-07-21 12:14:23 +02:00
parent 0bda7fd361
commit 6a539270ec
23 changed files with 435 additions and 258 deletions
+5 -46
View File
@@ -45,6 +45,7 @@
#include "GossipDef.h"
#include "Vehicle.h"
#include "AchievementMgr.h"
#include "DisableMgr.h"
ScriptMapMap sQuestEndScripts;
ScriptMapMap sQuestStartScripts;
@@ -3701,6 +3702,10 @@ void ObjectMgr::LoadQuests()
// Post processing
for (QuestMap::iterator iter = mQuestTemplates.begin(); iter != mQuestTemplates.end(); ++iter)
{
// skip post-loading checks for disabled quests
if (sDisableMgr.IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, NULL))
continue;
Quest * qinfo = iter->second;
// additional quest integrity checks (GO, creature_template and item_template must be loaded already)
@@ -7574,52 +7579,6 @@ 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();
m_DisabledPetSpells.clear();
QueryResult_AutoPtr 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);
if (disable_mask & SPELL_DISABLE_PET)
m_DisabledPetSpells.insert(spellid);
++total_count;
} while (result->NextRow());
sLog.outString();
sLog.outString(">> Loaded %u disabled spells from `spell_disabled`", total_count);
}
void ObjectMgr::LoadFishingBaseSkillLevel()
{
mFishingBaseForArea.clear(); // for reload case
-9
View File
@@ -837,11 +837,6 @@ class ObjectMgr
static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names);
void LoadSpellDisabledEntrys();
bool IsPlayerSpellDisabled(uint32 spellid) { return (m_DisabledPlayerSpells.count(spellid) != 0); }
bool IsCreatureSpellDisabled(uint32 spellid) { return (m_DisabledCreatureSpells.count(spellid) != 0); }
bool IsPetSpellDisabled(uint32 spellid) { return (m_DisabledPetSpells.count(spellid) != 0); }
int GetIndexForLocale(LocaleConstant loc);
LocaleConstant GetLocaleForIndex(int i);
@@ -999,10 +994,6 @@ class ObjectMgr
typedef std::set<std::wstring> ReservedNamesMap;
ReservedNamesMap m_ReservedNames;
std::set<uint32> m_DisabledPlayerSpells;
std::set<uint32> m_DisabledCreatureSpells;
std::set<uint32> m_DisabledPetSpells;
// GraveYardMap mGraveYardMap;
GameTeleMap m_GameTeleMap;