mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
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_DisabledCreatureSpells.clear();
|
||||
m_DisabledPetSpells.clear();
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, disable_mask FROM spell_disabled");
|
||||
|
||||
uint32 total_count = 0;
|
||||
@@ -6321,6 +6322,8 @@ void ObjectMgr::LoadSpellDisabledEntrys()
|
||||
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() );
|
||||
|
||||
|
||||
@@ -712,6 +712,7 @@ class ObjectMgr
|
||||
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);
|
||||
@@ -831,6 +832,7 @@ class ObjectMgr
|
||||
|
||||
std::set<uint32> m_DisabledPlayerSpells;
|
||||
std::set<uint32> m_DisabledCreatureSpells;
|
||||
std::set<uint32> m_DisabledPetSpells;
|
||||
|
||||
GraveYardMap mGraveYardMap;
|
||||
|
||||
|
||||
@@ -2048,7 +2048,7 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura)
|
||||
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))
|
||||
{
|
||||
@@ -2057,6 +2057,15 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura)
|
||||
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
|
||||
{
|
||||
if(objmgr.IsCreatureSpellDisabled(m_spellInfo->Id))
|
||||
|
||||
@@ -230,7 +230,8 @@ enum SpellFamilyNames
|
||||
enum SpellDisableTypes
|
||||
{
|
||||
SPELL_DISABLE_PLAYER = 1,
|
||||
SPELL_DISABLE_CREATURE = 2
|
||||
SPELL_DISABLE_CREATURE = 2,
|
||||
SPELL_DISABLE_PET = 4
|
||||
};
|
||||
|
||||
enum SpellEffectTargetTypes
|
||||
|
||||
Reference in New Issue
Block a user