[10336] Server side checks for casting non-combat spells in combat.

Interrupt casting non combat spell spell at neter to combat
and prevent it casting in combat (last checked by client
but better recheck at server for prevent cheating).
This commit is contained in:
VladimirMangos 2010-08-10 01:47:24 +04:00
parent 7e251dd408
commit 085811fc06
3 changed files with 15 additions and 6 deletions

View file

@ -7457,6 +7457,12 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
if (isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->isPet()))
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
// interrupt all delayed non-combat casts
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i)))
if (IsNonCombatSpell(spell->m_spellInfo))
InterruptSpell(CurrentSpellTypes(i),false);
if (creatureNotInCombat)
{
// should probably be removed for the attacked (+ it's party/group) only, not global