Extend the spell_disabled table to have a seperate flag for pet spells from player spells, Patch by Koani
--HG-- branch : trunk
This commit is contained in:
@@ -6289,6 +6289,7 @@ void ObjectMgr::LoadSpellDisabledEntrys()
|
|||||||
{
|
{
|
||||||
m_DisabledPlayerSpells.clear(); // need for reload case
|
m_DisabledPlayerSpells.clear(); // need for reload case
|
||||||
m_DisabledCreatureSpells.clear();
|
m_DisabledCreatureSpells.clear();
|
||||||
|
m_DisabledPetSpells.clear();
|
||||||
QueryResult *result = WorldDatabase.Query("SELECT entry, disable_mask FROM spell_disabled");
|
QueryResult *result = WorldDatabase.Query("SELECT entry, disable_mask FROM spell_disabled");
|
||||||
|
|
||||||
uint32 total_count = 0;
|
uint32 total_count = 0;
|
||||||
@@ -6321,6 +6322,8 @@ void ObjectMgr::LoadSpellDisabledEntrys()
|
|||||||
m_DisabledPlayerSpells.insert(spellid);
|
m_DisabledPlayerSpells.insert(spellid);
|
||||||
if(disable_mask & SPELL_DISABLE_CREATURE)
|
if(disable_mask & SPELL_DISABLE_CREATURE)
|
||||||
m_DisabledCreatureSpells.insert(spellid);
|
m_DisabledCreatureSpells.insert(spellid);
|
||||||
|
if(disable_mask & SPELL_DISABLE_PET)
|
||||||
|
m_DisabledPetSpells.insert(spellid);
|
||||||
++total_count;
|
++total_count;
|
||||||
} while ( result->NextRow() );
|
} while ( result->NextRow() );
|
||||||
|
|
||||||
|
|||||||
@@ -712,6 +712,7 @@ class ObjectMgr
|
|||||||
void LoadSpellDisabledEntrys();
|
void LoadSpellDisabledEntrys();
|
||||||
bool IsPlayerSpellDisabled(uint32 spellid) { return (m_DisabledPlayerSpells.count(spellid) != 0); }
|
bool IsPlayerSpellDisabled(uint32 spellid) { return (m_DisabledPlayerSpells.count(spellid) != 0); }
|
||||||
bool IsCreatureSpellDisabled(uint32 spellid) { return (m_DisabledCreatureSpells.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);
|
int GetIndexForLocale(LocaleConstant loc);
|
||||||
LocaleConstant GetLocaleForIndex(int i);
|
LocaleConstant GetLocaleForIndex(int i);
|
||||||
@@ -831,6 +832,7 @@ class ObjectMgr
|
|||||||
|
|
||||||
std::set<uint32> m_DisabledPlayerSpells;
|
std::set<uint32> m_DisabledPlayerSpells;
|
||||||
std::set<uint32> m_DisabledCreatureSpells;
|
std::set<uint32> m_DisabledCreatureSpells;
|
||||||
|
std::set<uint32> m_DisabledPetSpells;
|
||||||
|
|
||||||
GraveYardMap mGraveYardMap;
|
GraveYardMap mGraveYardMap;
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -2048,7 +2048,7 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet()))
|
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
if(objmgr.IsPlayerSpellDisabled(m_spellInfo->Id))
|
if(objmgr.IsPlayerSpellDisabled(m_spellInfo->Id))
|
||||||
{
|
{
|
||||||
@@ -2057,6 +2057,15 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet())
|
||||||
|
{
|
||||||
|
if(objmgr.IsPetSpellDisabled(m_spellInfo->Id))
|
||||||
|
{
|
||||||
|
SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE);
|
||||||
|
finish(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(objmgr.IsCreatureSpellDisabled(m_spellInfo->Id))
|
if(objmgr.IsCreatureSpellDisabled(m_spellInfo->Id))
|
||||||
|
|||||||
+2
-1
@@ -230,7 +230,8 @@ enum SpellFamilyNames
|
|||||||
enum SpellDisableTypes
|
enum SpellDisableTypes
|
||||||
{
|
{
|
||||||
SPELL_DISABLE_PLAYER = 1,
|
SPELL_DISABLE_PLAYER = 1,
|
||||||
SPELL_DISABLE_CREATURE = 2
|
SPELL_DISABLE_CREATURE = 2,
|
||||||
|
SPELL_DISABLE_PET = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SpellEffectTargetTypes
|
enum SpellEffectTargetTypes
|
||||||
|
|||||||
Reference in New Issue
Block a user