Core/Spells: Handle GAMEOBJECT_TYPE_UI_LINK spellFocus (#25132)

This commit is contained in:
Traesh
2020-07-26 16:51:43 +02:00
committed by GitHub
parent 588dce6bb0
commit 97afa3a609
2 changed files with 22 additions and 5 deletions

View File

@@ -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;
};

View File

@@ -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);
}