aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Grids
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-10-11 22:01:42 -0300
committerariel- <ariel-@users.noreply.github.com>2016-10-11 22:01:42 -0300
commit449ec0d6ff74ccd1874bc09073353d97c1d0151c (patch)
tree36f2bcf4155f035edd0909ea7780b3e79fd8ae81 /src/server/game/Grids
parent3cbd4bc22f013e8a4ab593c6f0afd2654fed6a66 (diff)
Core/Auras: don't ignore SPELL_ATTR3_ONLY_TARGET_PLAYERS in area auras.
Also, start abusing the arbitrary containers for searchers introduced in 8775f8b28a5ad4403371577787131ff81f14332b
Diffstat (limited to 'src/server/game/Grids')
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index 317378dfa8b..df4788a0a1e 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -877,10 +877,13 @@ namespace Trinity
class AnyGroupedUnitInObjectRangeCheck
{
public:
- AnyGroupedUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool raid) : _source(obj), _refUnit(funit), _range(range), _raid(raid) { }
+ AnyGroupedUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, bool raid, bool playerOnly = false) : _source(obj), _refUnit(funit), _range(range), _raid(raid), _playerOnly(playerOnly) { }
bool operator()(Unit* u)
{
- if (G3D::fuzzyEq(_range, 0))
+ if (G3D::fuzzyEq(_range, 0.0f))
+ return false;
+
+ if (_playerOnly && u->GetTypeId() != TYPEID_PLAYER)
return false;
if (_raid)
@@ -899,6 +902,7 @@ namespace Trinity
Unit const* _refUnit;
float _range;
bool _raid;
+ bool _playerOnly;
};
class AnyUnitInObjectRangeCheck
@@ -945,16 +949,18 @@ namespace Trinity
class AnyAoETargetUnitInObjectRangeCheck
{
public:
- AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range)
- : i_obj(obj), i_funit(funit), _spellInfo(NULL), i_range(range)
+ AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range, SpellInfo const* spellInfo = nullptr)
+ : i_obj(obj), i_funit(funit), _spellInfo(spellInfo), i_range(range)
{
Unit const* check = i_funit;
Unit const* owner = i_funit->GetOwner();
if (owner)
check = owner;
i_targetForPlayer = (check->GetTypeId() == TYPEID_PLAYER);
- if (DynamicObject const* dynObj = i_obj->ToDynObject())
- _spellInfo = sSpellMgr->GetSpellInfo(dynObj->GetSpellId());
+
+ if (!_spellInfo)
+ if (DynamicObject const* dynObj = i_obj->ToDynObject())
+ _spellInfo = sSpellMgr->GetSpellInfo(dynObj->GetSpellId());
}
bool operator()(Unit* u)
{
@@ -962,10 +968,10 @@ namespace Trinity
if (u->GetTypeId() == TYPEID_UNIT && u->IsTotem())
return false;
- if (i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : NULL) && i_obj->IsWithinDistInMap(u, i_range))
- return true;
+ if (_spellInfo && _spellInfo->HasAttribute(SPELL_ATTR3_ONLY_TARGET_PLAYERS) && u->GetTypeId() != TYPEID_PLAYER)
+ return false;
- return false;
+ return i_funit->_IsValidAttackTarget(u, _spellInfo, i_obj->GetTypeId() == TYPEID_DYNAMICOBJECT ? i_obj : nullptr) && i_obj->IsWithinDistInMap(u, i_range);
}
private:
bool i_targetForPlayer;