mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/Entities: Ethereal Soul-Trader (#22050)
This commit is contained in:
@@ -1614,6 +1614,118 @@ class spell_gen_elune_candle : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 50051 - Ethereal Pet Aura
|
||||
enum EtherealPet
|
||||
{
|
||||
NPC_ETHEREAL_SOUL_TRADER = 27914,
|
||||
|
||||
SAY_STEAL_ESSENCE = 1,
|
||||
SAY_CREATE_TOKEN = 2,
|
||||
|
||||
SPELL_PROC_TRIGGER_ON_KILL_AURA = 50051,
|
||||
SPELL_ETHEREAL_PET_AURA = 50055,
|
||||
SPELL_CREATE_TOKEN = 50063,
|
||||
SPELL_STEAL_ESSENCE_VISUAL = 50101
|
||||
};
|
||||
|
||||
// 50051 - Ethereal Pet Aura
|
||||
class spell_ethereal_pet_aura : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_ethereal_pet_aura);
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
uint32 levelDiff = std::abs(GetTarget()->getLevel() - eventInfo.GetProcTarget()->getLevel());
|
||||
return levelDiff <= 9;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
std::list<Creature*> minionList;
|
||||
GetUnitOwner()->GetAllMinionsByEntry(minionList, NPC_ETHEREAL_SOUL_TRADER);
|
||||
for (Creature* minion : minionList)
|
||||
{
|
||||
if (minion->IsAIEnabled)
|
||||
{
|
||||
minion->AI()->Talk(SAY_STEAL_ESSENCE);
|
||||
minion->CastSpell(eventInfo.GetProcTarget(), SPELL_STEAL_ESSENCE_VISUAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_ethereal_pet_aura::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_ethereal_pet_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
// 50052 - Ethereal Pet onSummon
|
||||
class spell_ethereal_pet_onsummon : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_ethereal_pet_onsummon);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_PROC_TRIGGER_ON_KILL_AURA });
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* target = GetHitUnit();
|
||||
target->CastSpell(target, SPELL_PROC_TRIGGER_ON_KILL_AURA, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_ethereal_pet_onsummon::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 50055 - Ethereal Pet Aura Remove
|
||||
class spell_ethereal_pet_aura_remove : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_ethereal_pet_aura_remove);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_ETHEREAL_PET_AURA });
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetHitUnit()->RemoveAurasDueToSpell(SPELL_ETHEREAL_PET_AURA);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_ethereal_pet_aura_remove::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 50101 - Steal Essence Visual
|
||||
class spell_steal_essence_visual : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_steal_essence_visual);
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
caster->CastSpell(caster, SPELL_CREATE_TOKEN, true);
|
||||
if (Creature* soulTrader = caster->ToCreature())
|
||||
soulTrader->AI()->Talk(SAY_CREATE_TOKEN);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_steal_essence_visual::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
enum TransporterBackfires
|
||||
{
|
||||
SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH = 23444,
|
||||
@@ -3977,6 +4089,10 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_gen_ds_flush_knockback);
|
||||
RegisterSpellScript(spell_gen_dungeon_credit);
|
||||
RegisterSpellScript(spell_gen_elune_candle);
|
||||
RegisterAuraScript(spell_ethereal_pet_aura);
|
||||
RegisterSpellScript(spell_ethereal_pet_onsummon);
|
||||
RegisterSpellScript(spell_ethereal_pet_aura_remove);
|
||||
RegisterAuraScript(spell_steal_essence_visual);
|
||||
RegisterSpellScript(spell_gen_gadgetzan_transporter_backfire);
|
||||
RegisterAuraScript(spell_gen_gift_of_naaru);
|
||||
RegisterSpellScript(spell_gen_gnomish_transporter);
|
||||
|
||||
Reference in New Issue
Block a user