From 97afa3a609923bd9b7c0e9cfc52c29ba9dbfe35d Mon Sep 17 00:00:00 2001 From: Traesh Date: Sun, 26 Jul 2020 16:51:43 +0200 Subject: Core/Spells: Handle GAMEOBJECT_TYPE_UI_LINK spellFocus (#25132) --- src/server/game/Entities/GameObject/GameObjectData.h | 20 ++++++++++++++++++++ src/server/game/Grids/Notifiers/GridNotifiers.h | 7 ++----- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObjectData.h b/src/server/game/Entities/GameObject/GameObjectData.h index 638661e0420..7477b9b5137 100644 --- a/src/server/game/Entities/GameObject/GameObjectData.h +++ b/src/server/game/Entities/GameObject/GameObjectData.h @@ -926,6 +926,26 @@ struct GameObjectTemplate } } + uint32 GetSpellFocusType() const + { + switch (type) + { + case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.spellFocusType; + case GAMEOBJECT_TYPE_UI_LINK: return UILink.spellFocusType; + default: return 0; + } + } + + uint32 GetSpellFocusRadius() const + { + switch (type) + { + case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.radius; + case GAMEOBJECT_TYPE_UI_LINK: return UILink.radius; + default: return 0; + } + } + void InitializeQueryData(); WorldPacket BuildQueryData(LocaleConstant loc) const; }; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 23f3cf2ddc0..0b079eb610f 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -690,16 +690,13 @@ namespace Trinity bool operator()(GameObject* go) const { - if (go->GetGOInfo()->type != GAMEOBJECT_TYPE_SPELL_FOCUS) - return false; - - if (go->GetGOInfo()->spellFocus.spellFocusType != i_focusId) + if (go->GetGOInfo()->GetSpellFocusType() != i_focusId) return false; if (!go->isSpawned()) return false; - float dist = go->GetGOInfo()->spellFocus.radius / 2.f; + float dist = go->GetGOInfo()->GetSpellFocusRadius() / 2.f; return go->IsWithinDistInMap(i_unit, dist); } -- cgit v1.2.3