fix(Core/Spell): Recall destination for Insignia trinkets using CFBG (#8679)

This commit is contained in:
Nefertumm
2021-10-24 07:04:24 -03:00
committed by GitHub
parent 4402398544
commit 5f28d35c37
2 changed files with 53 additions and 0 deletions

View File

@@ -4462,6 +4462,52 @@ public:
}
};
enum RecallSpellIds
{
SPELL_RECALL_HORDE = 22563,
SPELL_RECALL_ALLIANCE = 22564
};
class spell_item_recall : public SpellScriptLoader
{
public:
spell_item_recall() : SpellScriptLoader("spell_item_recall") { }
class spell_item_recall_SpellScript : public SpellScript
{
PrepareSpellScript(spell_item_recall_SpellScript);
void SetDest(SpellDestination& dest)
{
Player* player = GetCaster()->ToPlayer();
if (!player)
{
return;
}
TeamId bgTeam = player->GetBgTeamId();
if (player->GetTeamId(true) != bgTeam)
{
if (SpellTargetPosition const* recallSpellTarget = sSpellMgr->GetSpellTargetPosition(bgTeam == TEAM_HORDE ? SPELL_RECALL_HORDE : SPELL_RECALL_ALLIANCE, EFFECT_0))
{
Position pos = Position(recallSpellTarget->target_X, recallSpellTarget->target_Y, recallSpellTarget->target_Z, recallSpellTarget->target_Orientation);
dest.Relocate(pos);
}
}
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_item_recall_SpellScript::SetDest, EFFECT_0, TARGET_DEST_DB);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_item_recall_SpellScript();
};
};
void AddSC_item_spell_scripts()
{
// Ours
@@ -4572,4 +4618,5 @@ void AddSC_item_spell_scripts()
new spell_item_eggnog();
new spell_item_goblin_bomb();
new spell_item_linken_boomerang();
new spell_item_recall();
}