From bc91e3492eb251b0e6f297d573855de13939b20b Mon Sep 17 00:00:00 2001 From: hondacrx Date: Fri, 7 Aug 2020 12:25:54 -0400 Subject: [PATCH] Core/Spells: Handle GAMEOBJECT_TYPE_UI_LINK spellFocus Port From (https://github.com/TrinityCore/TrinityCore/commit/97afa3a609923bd9b7c0e9cfc52c29ba9dbfe35d) --- .../Entities/GameObject/GameObjectData.cs | 26 +++++++++++++++++++ Source/Game/Maps/GridNotifiers.cs | 7 ++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Source/Game/Entities/GameObject/GameObjectData.cs b/Source/Game/Entities/GameObject/GameObjectData.cs index d988c14c8..41d3bb380 100644 --- a/Source/Game/Entities/GameObject/GameObjectData.cs +++ b/Source/Game/Entities/GameObject/GameObjectData.cs @@ -517,6 +517,32 @@ namespace Game.Entities } } + public uint GetSpellFocusType() + { + switch (type) + { + case GameObjectTypes.SpellFocus: + return SpellFocus.spellFocusType; + case GameObjectTypes.UILink: + return UILink.spellFocusType; + default: + return 0; + } + } + + public uint GetSpellFocusRadius() + { + switch (type) + { + case GameObjectTypes.SpellFocus: + return SpellFocus.radius; + case GameObjectTypes.UILink: + return UILink.radius; + default: + return 0; + } + } + public void InitializeQueryData() { QueryData = new QueryGameObjectResponse(); diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs index a4f7358f8..a46b57789 100644 --- a/Source/Game/Maps/GridNotifiers.cs +++ b/Source/Game/Maps/GridNotifiers.cs @@ -2247,16 +2247,13 @@ namespace Game.Maps public bool Invoke(GameObject go) { - if (go.GetGoInfo().type != GameObjectTypes.SpellFocus) - 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.0f; + float dist = go.GetGoInfo().GetSpellFocusRadius() / 2.0f; return go.IsWithinDistInMap(i_unit, dist); }