Core/Spells: Implemented SPELL_ATTR7_IS_CHEAT_SPELL serverside checks and allow GMs to cast these spells

This commit is contained in:
Shauren
2011-06-11 13:02:54 +02:00
parent 677cbbb93a
commit 9b79df7074
4 changed files with 15 additions and 9 deletions
@@ -2782,6 +2782,7 @@ void Player::SetGameMaster(bool on)
m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
setFaction(35);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
if (Pet* pet = GetPet())
{
@@ -2815,6 +2816,7 @@ void Player::SetGameMaster(bool on)
m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
setFactionForRace(getRace());
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
if (Pet* pet = GetPet())
{
+2 -1
View File
@@ -591,7 +591,8 @@ enum UnitFlags2
UNIT_FLAG2_FORCE_MOVE = 0x00000040,
UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
UNIT_FLAG2_REGENERATE_POWER = 0x00000800
UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // allows casting spells with AttributesEx7 & SPELL_ATTR7_DISABLED_CLIENT_SIDE
};
/// Non Player Character flags
@@ -518,7 +518,7 @@ enum SpellAttr7
SPELL_ATTR7_UNK0 = 0x00000001, // 0 Shaman's new spells (Call of the ...), Feign Death.
SPELL_ATTR7_UNK1 = 0x00000002, // 1 Not set in 3.2.2a.
SPELL_ATTR7_REACTIVATE_AT_RESURRECT = 0x00000004, // 2 Paladin's auras and 65607 only.
SPELL_ATTR7_DISABLED_CLIENT_SIDE = 0x00000008, // 3 used only by client to disable spells client-side. some sort of special player flag (0x40000) bypasses that restriction
SPELL_ATTR7_IS_CHEAT_SPELL = 0x00000008, // 3 Cannot cast if caster doesn't have UnitFlag2 & UNIT_FLAG2_ALLOW_CHEAT_SPELLS
SPELL_ATTR7_UNK4 = 0x00000010, // 4 Only 66109 test spell.
SPELL_ATTR7_SUMMON_PLAYER_TOTEM = 0x00000020, // 5 Only Shaman player totems.
SPELL_ATTR7_UNK6 = 0x00000040, // 6 Dark Surge, Surge of Light, Burning Breath triggers (boss spells).
+3
View File
@@ -4606,6 +4606,9 @@ SpellCastResult Spell::CheckCast(bool strict)
}
}
if (m_spellInfo->AttributesEx7 & SPELL_ATTR7_DISABLED_CLIENT_SIDE && !m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS))
return SPELL_FAILED_SPELL_UNAVAILABLE;
// Check global cooldown
if (strict && !m_IsTriggeredSpell && HasGlobalCooldown())
return SPELL_FAILED_NOT_READY;