fix(Scripts/Pet): Fix Ethereal Soul-Trader Companion Pet (#26249)

Co-authored-by: lightinjay <lightinjay@gmail.com>
Co-authored-by: Ludwig <sudlud@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: DanVS <33371360+DanVS@users.noreply.github.com>
This commit is contained in:
lightninjay
2026-07-23 15:09:34 -04:00
committed by GitHub
parent dc8c9416dd
commit f8c2cc9b71
3 changed files with 63 additions and 3 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE (`spell_id` = 50051);
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(50051, 'spell_gen_ethereal_pet_aura');

View File

@@ -63,9 +63,10 @@ struct npc_pet_gen_soul_trader_beacon : public ScriptedAI
Player* GetOwner() const { return ObjectAccessor::GetPlayer(*me, ownerGUID); } Player* GetOwner() const { return ObjectAccessor::GetPlayer(*me, ownerGUID); }
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
{ {
if (spellInfo->Id == SPELL_STEAL_ESSENCE_VISUAL && target == me) // Handle the kill notification from the owner's kill aura (spell 50051)
if (spellInfo->Id == SPELL_OWNER_KILLED_INFORM)
{ {
Talk(1); Talk(1);
events.ScheduleEvent(EVENT_ADD_TOKEN, 3s); events.ScheduleEvent(EVENT_ADD_TOKEN, 3s);
@@ -83,7 +84,10 @@ struct npc_pet_gen_soul_trader_beacon : public ScriptedAI
break; break;
case EVENT_ADD_TOKEN: case EVENT_ADD_TOKEN:
me->RemoveAurasDueToSpell(SPELL_EMOTE_STATE_SWIM_RUN); me->RemoveAurasDueToSpell(SPELL_EMOTE_STATE_SWIM_RUN);
me->CastSpell(me, SPELL_CREATE_TOKEN, true); // Cast the token creation spell on the player owner, not on the pet
if (Player* owner = GetOwner())
me->CastSpell(owner, SPELL_CREATE_TOKEN, true);
Talk(2); Talk(2);
break; break;
} }

View File

@@ -4543,6 +4543,58 @@ class spell_gen_eject_passenger : public SpellScript
} }
}; };
// 50051 - Ethereal Pet Aura (Soultrader Beacon)
// Triggers when the owner kills an opponent, applying spell 50050 (SPELL_OWNER_KILLED_INFORM) to notify the pet
class spell_gen_ethereal_pet_aura : public AuraScript
{
PrepareAuraScript(spell_gen_ethereal_pet_aura);
enum EtherealSoulTrader
{
NPC_ETHEREAL_SOUL_TRADER = 27914,
SPELL_OWNER_KILLED_INFORM = 50050,
SPELL_STEAL_ESSENCE_VISUAL = 50101,
};
bool CheckProc(ProcEventInfo& eventInfo)
{
Unit* procTarget = eventInfo.GetProcTarget();
if (!procTarget)
return false;
// Only trigger on players killing creatures that are not grey mobs
int32 levelDiff = int32(GetTarget()->GetLevel()) - int32(procTarget->GetLevel());
return levelDiff <= 9;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
Unit* procTarget = eventInfo.GetProcTarget();
if (!procTarget)
return;
// Get all Ethereal Soul-Trader minions owned by this player
std::list<Creature*> minionList;
GetUnitOwner()->GetAllMinionsByEntry(minionList, NPC_ETHEREAL_SOUL_TRADER);
for (Creature* minion : minionList)
{
// Cast the laser beam visual from the pet to the killed mob
minion->CastSpell(procTarget, SPELL_STEAL_ESSENCE_VISUAL);
// Notify the pet AI that a valid kill occurred (triggers the pet's SpellHit handler)
minion->CastSpell(minion, SPELL_OWNER_KILLED_INFORM, true);
}
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_gen_ethereal_pet_aura::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_gen_ethereal_pet_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
/* 37727 - Touch of Darkness /* 37727 - Touch of Darkness
37851 - Tag Greater Felfire Diemetradon 37851 - Tag Greater Felfire Diemetradon
37917 - Arcano-Cloak 37917 - Arcano-Cloak
@@ -6263,6 +6315,7 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_whisper_gulch_yogg_saron_whisper); RegisterSpellScript(spell_gen_whisper_gulch_yogg_saron_whisper);
RegisterSpellScript(spell_gen_eject_all_passengers); RegisterSpellScript(spell_gen_eject_all_passengers);
RegisterSpellScript(spell_gen_eject_passenger); RegisterSpellScript(spell_gen_eject_passenger);
RegisterSpellScript(spell_gen_ethereal_pet_aura);
RegisterSpellScript(spell_gen_charmed_unit_spell_cooldown); RegisterSpellScript(spell_gen_charmed_unit_spell_cooldown);
RegisterSpellScript(spell_contagion_of_rot); RegisterSpellScript(spell_contagion_of_rot);
RegisterSpellScript(spell_gen_holiday_buff_food); RegisterSpellScript(spell_gen_holiday_buff_food);