From a80b36c2f374adf16a60bfedf05589aaf326aa03 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 1 Aug 2011 11:17:34 +0200 Subject: Core/Spells: Limited SPELL_ATTR3_PLAYERS_ONLY attribute to only allow players, not pets and totems. This fixes many boss area spells incorrectly selecting pets and totems as their targets. --- src/server/game/Grids/Notifiers/GridNotifiers.h | 14 ++++++++++++++ src/server/game/Spells/Spell.cpp | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index f24fa018925..2ad81b8b3a7 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -1285,6 +1285,20 @@ namespace Trinity float m_fRange; }; + class ObjectTypeIdCheck + { + public: + ObjectTypeIdCheck(TypeID typeId, bool equals) : _typeId(typeId), _equals(equals) {} + bool operator()(WorldObject* object) + { + return (object->GetTypeId() == _typeId) == _equals; + } + + private: + TypeID _typeId; + bool _equals; + }; + // Player checks and do // Prepare using Builder localized packets with caching and send to player diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 40ab5748f92..104f786c99b 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1832,7 +1832,10 @@ void Spell::SearchAreaTarget(std::list &TagUnitMap, float radius, SpellNo Trinity::SpellNotifierCreatureAndPlayer notifier(m_caster, TagUnitMap, radius, type, TargetType, pos, entry, m_spellInfo); if ((m_spellInfo->AttributesEx3 & SPELL_ATTR3_PLAYERS_ONLY) || (TargetType == SPELL_TARGETS_ENTRY && !entry)) + { m_caster->GetMap()->VisitWorld(pos->m_positionX, pos->m_positionY, radius, notifier); + TagUnitMap.remove_if(Trinity::ObjectTypeIdCheck(TYPEID_PLAYER, false)); // above line will select also pets and totems, remove them + } else m_caster->GetMap()->VisitAll(pos->m_positionX, pos->m_positionY, radius, notifier); @@ -4945,7 +4948,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (castResult != SPELL_CAST_OK) return castResult; } - + if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURAS)) { castResult = CheckCasterAuras(); -- cgit v1.2.3