diff --git a/Source/Scripts/Pets/Generic.cs b/Source/Scripts/Pets/Generic.cs index 19defb38a..3791ea5ff 100644 --- a/Source/Scripts/Pets/Generic.cs +++ b/Source/Scripts/Pets/Generic.cs @@ -26,13 +26,22 @@ namespace Scripts.Pets { struct SpellIds { + //Mojo public const uint FeelingFroggy = 43906; public const uint SeductionVisual = 43919; + + //SoulTrader + public const uint EtherealOnSummon = 50052; + public const uint EtherealPetRemoveAura = 50055; } struct TextIds { + //Mojo public const uint SayMojo = 0; + + //SoulTrader + public const uint SaySoulTraderInto = 0; } [Script] @@ -81,5 +90,27 @@ namespace Scripts.Pets ObjectGuid _victimGUID; } + + [Script] + class npc_pet_gen_soul_trader : ScriptedAI + { + public npc_pet_gen_soul_trader(Creature creature) : base(creature) { } + + public override void LeavingWorld() + { + Unit owner = me.GetOwner(); + if (owner != null) + DoCast(owner, SpellIds.EtherealPetRemoveAura); + } + + public override void JustAppeared() + { + Talk(TextIds.SaySoulTraderInto); + + Unit owner = me.GetOwner(); + if (owner != null) + DoCast(owner, SpellIds.EtherealOnSummon); + } + } } } diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index d4bf03d71..b17ca6aa0 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -111,6 +111,12 @@ namespace Scripts.Spells.Generic public const uint OmenHandL = 26649; public const uint Normal = 26636; + //EtherealPet + public const uint ProcTriggerOnKillAura = 50051; + public const uint EtherealPetAura = 50055; + public const uint CreateToken = 50063; + public const uint StealEssenceVisual = 50101; + //Fishingspells public const uint FishingNoFishingPole = 131476; public const uint FishingWithPole = 131490; @@ -286,6 +292,9 @@ namespace Scripts.Spells.Generic //EluneCandle public const uint Omen = 15467; + //EtherealPet + public const uint EtherealSoulTrader = 27914; + //TournamentMounts public const uint StormwindSteed = 33217; public const uint IronforgeRam = 33316; @@ -327,6 +336,10 @@ namespace Scripts.Spells.Generic struct TextIds { + //EtherealPet + public const uint SayStealEssence = 1; + public const uint SayCreateToken = 2; + //VendorBarkTrigger public const uint SayAmphitheaterVendor = 0; } @@ -1518,6 +1531,102 @@ namespace Scripts.Spells.Generic } } + // 50051 - Ethereal Pet Aura + [Script] + class spell_ethereal_pet_aura : AuraScript + { + bool CheckProc(ProcEventInfo eventInfo) + { + uint levelDiff = (uint)Math.Abs(GetTarget().GetLevel() - eventInfo.GetProcTarget().GetLevel()); + return levelDiff <= 9; + } + + void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) + { + PreventDefaultAction(); + + List minionList = new(); + GetUnitOwner().GetAllMinionsByEntry(minionList, CreatureIds.EtherealSoulTrader); + foreach (Creature minion in minionList) + { + if (minion.IsAIEnabled) + { + minion.GetAI().Talk(TextIds.SayStealEssence); + minion.CastSpell(eventInfo.GetProcTarget(), SpellIds.StealEssenceVisual); + } + } + } + + public override void Register() + { + DoCheckProc.Add(new CheckProcHandler(CheckProc)); + OnEffectProc.Add(new EffectProcHandler(HandleProc, 0, AuraType.ProcTriggerSpell)); + } + } + + // 50052 - Ethereal Pet onSummon + [Script] + class spell_ethereal_pet_onsummon : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.ProcTriggerOnKillAura); + } + + void HandleScriptEffect(uint effIndex) + { + Unit target = GetHitUnit(); + target.CastSpell(target, SpellIds.ProcTriggerOnKillAura, true); + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect)); + } + } + + // 50055 - Ethereal Pet Aura Remove + [Script] + class spell_ethereal_pet_aura_remove : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.EtherealPetAura); + } + + void HandleScriptEffect(uint effIndex) + { + GetHitUnit().RemoveAurasDueToSpell(SpellIds.EtherealPetAura); + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleScriptEffect, 0, SpellEffectName.ScriptEffect)); + } + } + + // 50101 - Ethereal Pet OnKill Steal Essence + [Script] + class spell_steal_essence_visual : AuraScript + { + void HandleRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + Unit caster = GetCaster(); + if (caster != null) + { + caster.CastSpell(caster, SpellIds.CreateToken, true); + Creature soulTrader = caster.ToCreature(); + if (soulTrader != null) + soulTrader.GetAI().Talk(TextIds.SayCreateToken); + } + } + + public override void Register() + { + AfterEffectRemove.Add(new EffectApplyHandler(HandleRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + [Script] // 131474 - Fishing class spell_gen_fishing : SpellScript { diff --git a/sql/updates/world/master/2021_10_17_06_world_2018_07_25_00_world.sql b/sql/updates/world/master/2021_10_17_06_world_2018_07_25_00_world.sql new file mode 100644 index 000000000..e520ca224 --- /dev/null +++ b/sql/updates/world/master/2021_10_17_06_world_2018_07_25_00_world.sql @@ -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');