mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 16:10:49 +01:00
Core/Entities: Ethereal Soul-Trader (#22050)
This commit is contained in:
7
sql/updates/world/3.3.5/2018_07_25_00_world.sql
Normal file
7
sql/updates/world/3.3.5/2018_07_25_00_world.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
UPDATE `creature_template` SET `ScriptName`='npc_pet_gen_soul_trader' WHERE `entry`=27914;
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_ethereal_pet_aura','spell_ethereal_pet_onsummon','spell_ethereal_pet_aura_remove','spell_steal_essence_visual');
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(50051,'spell_ethereal_pet_aura'),
|
||||
(50052,'spell_ethereal_pet_onsummon'),
|
||||
(50055,'spell_ethereal_pet_aura_remove'),
|
||||
(50101,'spell_steal_essence_visual');
|
||||
@@ -320,10 +320,37 @@ class npc_pet_gen_mojo : public CreatureScript
|
||||
}
|
||||
};
|
||||
|
||||
enum SoulTrader
|
||||
{
|
||||
SAY_SOUL_TRADER_INTRO = 0,
|
||||
|
||||
SPELL_ETHEREAL_ONSUMMON = 50052,
|
||||
SPELL_ETHEREAL_PET_REMOVE_AURA = 50055
|
||||
};
|
||||
|
||||
struct npc_pet_gen_soul_trader : public ScriptedAI
|
||||
{
|
||||
npc_pet_gen_soul_trader(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void LeavingWorld() override
|
||||
{
|
||||
if (Unit* owner = me->GetOwner())
|
||||
DoCast(owner, SPELL_ETHEREAL_PET_REMOVE_AURA);
|
||||
}
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
Talk(SAY_SOUL_TRADER_INTRO);
|
||||
if (Unit* owner = me->GetOwner())
|
||||
DoCast(owner, SPELL_ETHEREAL_ONSUMMON);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_pet_scripts()
|
||||
{
|
||||
new npc_pet_gen_baby_blizzard_bear();
|
||||
new npc_pet_gen_egbert();
|
||||
new npc_pet_gen_pandaren_monk();
|
||||
new npc_pet_gen_mojo();
|
||||
RegisterCreatureAI(npc_pet_gen_soul_trader);
|
||||
}
|
||||
|
||||
@@ -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