aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2011-06-11 13:02:54 +0200
committerShauren <shauren.trinity@gmail.com>2011-06-11 13:02:54 +0200
commit9b79df7074c64cbab9e4929f83937a44b4ac705b (patch)
treed1922f9069d3219e6a6666bef07710634d121ba0 /src
parent677cbbb93aee09602d8c13ab2070412259c6a2e0 (diff)
Core/Spells: Implemented SPELL_ATTR7_IS_CHEAT_SPELL serverside checks and allow GMs to cast these spells
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp2
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h17
-rwxr-xr-xsrc/server/game/Miscellaneous/SharedDefines.h2
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp3
4 files changed, 15 insertions, 9 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 5a0c8fc0ab5..194c3f687de 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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())
{
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index e4180910bb3..fdacaf8f1fa 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -584,14 +584,15 @@ enum UnitFlags
// Value masks for UNIT_FIELD_FLAGS_2
enum UnitFlags2
{
- UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
- UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
- UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
- UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
- 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_FEIGN_DEATH = 0x00000001,
+ UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
+ UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
+ UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
+ 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_ALLOW_CHEAT_SPELLS = 0x00040000, // allows casting spells with AttributesEx7 & SPELL_ATTR7_DISABLED_CLIENT_SIDE
};
/// Non Player Character flags
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 9363435ebd4..184c25f8f6d 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -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).
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 6e23fe35f26..c083d1130be 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -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;