From ed338e77be4083b5253acfb42a191ef24e52db99 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 5 Sep 2022 22:21:23 -0400 Subject: [PATCH] Scripts/Events: Update few Love is in the Air quests & items Port From (https://github.com/TrinityCore/TrinityCore/commit/a01141c426be517c1d2bd40753b277b453d15ce0) --- Source/Scripts/Events/LoveIsInTheAir.cs | 162 +++++++++++++++++++++++- Source/Scripts/Spells/Generic.cs | 35 ----- 2 files changed, 160 insertions(+), 37 deletions(-) diff --git a/Source/Scripts/Events/LoveIsInTheAir.cs b/Source/Scripts/Events/LoveIsInTheAir.cs index c92b47983..691d506b2 100644 --- a/Source/Scripts/Events/LoveIsInTheAir.cs +++ b/Source/Scripts/Events/LoveIsInTheAir.cs @@ -43,8 +43,21 @@ namespace Scripts.Events.LoveIsInTheAir public const uint CreateHeartCandy6 = 26674; public const uint CreateHeartCandy7 = 26675; public const uint CreateHeartCandy8 = 26676; + + //SomethingStinks + public const uint HeavilyPerfumed = 71507; + + //PilferingPerfume + public const uint ServiceUniform = 71450; } - + + struct ModelIds + { + //PilferingPerfume + public const uint GoblinMale = 31002; + public const uint GoblinFemale = 31003; + } + [Script] // 45102 Romantic Picnic class spell_love_is_in_the_air_romantic_picnic : AuraScript { @@ -106,7 +119,7 @@ namespace Scripts.Events.LoveIsInTheAir } [Script] // 26678 - Create Heart Candy - class spell_item_create_heart_candy : SpellScript + class spell_love_is_in_the_air_create_heart_candy : SpellScript { uint[] CreateHeartCandySpells = { @@ -132,4 +145,149 @@ namespace Scripts.Events.LoveIsInTheAir OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); } } + + [Script] // 70192 - Fragrant Air Analysis + class spell_love_is_in_the_air_fragrant_air_analysis : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); + } + + void HandleScript(uint effIndex) + { + GetHitUnit().RemoveAurasDueToSpell((uint)GetEffectValue()); + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + } + } + + [Script] // 71507 - Heavily Perfumed + class spell_love_is_in_the_air_heavily_perfumed : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); + } + + void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().CastSpell(GetTarget(), (uint)GetEffectInfo(0).CalcValue()); + } + + public override void Register() + { + AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + [Script] // 71508 - Recently Analyzed + class spell_love_is_in_the_air_recently_analyzed : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.HeavilyPerfumed); + } + + void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().CastSpell(GetTarget(), SpellIds.HeavilyPerfumed); + } + + public override void Register() + { + AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } + + [Script] // 69438 - Sample Satisfaction + class spell_love_is_in_the_air_sample_satisfaction : AuraScript + { + void OnPeriodic(AuraEffect aurEff) + { + if (RandomHelper.randChance(30)) + Remove(); + } + + public override void Register() + { + OnEffectPeriodic.Add(new EffectPeriodicHandler(OnPeriodic, 0, AuraType.PeriodicDummy)); + } + } + + [Script] // 71450 - Crown Parcel Service Uniform + class spell_love_is_in_the_air_service_uniform : AuraScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); + } + + void AfterApply(AuraEffect aurEff, AuraEffectHandleModes mode) + { + Unit target = GetTarget(); + if (target.IsPlayer()) + { + if (target.GetNativeGender() == Gender.Male) + target.SetDisplayId(ModelIds.GoblinMale); + else + target.SetDisplayId(ModelIds.GoblinFemale); + } + } + + void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) + { + GetTarget().RemoveAurasDueToSpell((uint)GetEffectInfo(0).CalcValue()); + } + + public override void Register() + { + AfterEffectApply.Add(new EffectApplyHandler(AfterApply, 0, AuraType.Transform, AuraEffectHandleModes.Real)); + AfterEffectRemove.Add(new EffectApplyHandler(AfterRemove, 0, AuraType.Transform, AuraEffectHandleModes.Real)); + } + } + + // 71522 - Crown Chemical Co. Supplies + [Script] // 71539 - Crown Chemical Co. Supplies + class spell_love_is_in_the_air_cancel_service_uniform : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.ServiceUniform); + } + + void HandleScript(uint effIndex) + { + GetHitUnit().RemoveAurasDueToSpell(SpellIds.ServiceUniform); + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleScript, 1, SpellEffectName.ScriptEffect)); + } + } + + // 68529 - Perfume Immune + [Script] // 68530 - Cologne Immune + class spell_love_is_in_the_air_perfume_cologne_immune : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue(), (uint)spellInfo.GetEffect(1).CalcValue()); + } + + void HandleScript(uint effIndex) + { + GetCaster().RemoveAurasDueToSpell((uint)GetEffectValue()); + } + + public override void Register() + { + OnEffectHit.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + OnEffectHit.Add(new EffectHandler(HandleScript, 1, SpellEffectName.ScriptEffect)); + } + } } diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index 295a7a5d1..fa0c74ddb 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -725,41 +725,6 @@ namespace Scripts.Spells.Generic } } - [Script] - class spell_gen_aura_service_uniform : AuraScript - { - public override bool Validate(SpellInfo spellInfo) - { - return ValidateSpellInfo(SpellIds.ServiceUniform); - } - - void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode) - { - // Apply model goblin - Unit target = GetTarget(); - if (target.IsTypeId(TypeId.Player)) - { - if (target.GetNativeGender() == Gender.Male) - target.SetDisplayId(ModelIds.GoblinMale); - else - target.SetDisplayId(ModelIds.GoblinFemale); - } - } - - void OnRemove(AuraEffect aurEff, AuraEffectHandleModes mode) - { - Unit target = GetTarget(); - if (target.IsTypeId(TypeId.Player)) - target.RestoreDisplayId(); - } - - public override void Register() - { - AfterEffectApply.Add(new EffectApplyHandler(OnApply, 0, AuraType.Transform, AuraEffectHandleModes.Real)); - AfterEffectRemove.Add(new EffectApplyHandler(OnRemove, 0, AuraType.Transform, AuraEffectHandleModes.Real)); - } - } - [Script] class spell_gen_av_drekthar_presence : AuraScript {