diff options
author | offl <11556157+offl@users.noreply.github.com> | 2022-06-04 23:56:37 +0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-06-10 19:22:08 +0200 |
commit | 04b0596021e63680f666052c1f0ed49498f59a2c (patch) | |
tree | 2d88c52b436e1d3ec225383e839fc987cb582fea /src | |
parent | 45bbbd5acd8b68b98860283d70d17b6ab527dcdf (diff) |
Scripts/Quest: Rework 'The Way to His Heart...' & make SAI's StopFollow work again (#28001)
(cherry picked from commit 861ec6a5b9a1e579e3cc3e415898fe7a2a28cf62)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 1 | ||||
-rw-r--r-- | src/server/scripts/Northrend/zone_howling_fjord.cpp | 46 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 19 |
3 files changed, 66 insertions, 0 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index ef5dac43d9d..345227c8e9f 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -852,6 +852,7 @@ void SmartAI::StopFollow(bool complete) _followArrivedTimer = 1000; _followArrivedEntry = 0; _followCreditType = 0; + me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); if (!complete) diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index a478177e1a4..b651bd917e9 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -514,6 +514,50 @@ class spell_fjord_the_way_to_his_heart_anuniaq_net : public SpellScript } }; +// 44455 - The Way to His Heart...: Character Script Effect Reverse Cast +class spell_fjord_the_way_to_his_heart_reverse_cast : public SpellScript +{ + PrepareSpellScript(spell_fjord_the_way_to_his_heart_reverse_cast); + + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_fjord_the_way_to_his_heart_reverse_cast::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 44462 - The Way to His Heart...: Cast Quest Complete on Master +class spell_fjord_the_way_to_his_heart_quest_complete : public SpellScript +{ + PrepareSpellScript(spell_fjord_the_way_to_his_heart_quest_complete); + + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (TempSummon* casterSummon = GetCaster()->ToTempSummon()) + if (Unit* summoner = casterSummon->GetSummonerUnit()) + summoner->CastSpell(summoner, uint32(GetEffectValue()), true); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_fjord_the_way_to_his_heart_quest_complete::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + void AddSC_howling_fjord() { RegisterCreatureAI(npc_daegarn); @@ -526,4 +570,6 @@ void AddSC_howling_fjord() RegisterSpellScript(spell_fjord_the_cleansing_mirror_image_script_effect); RegisterSpellScript(spell_fjord_the_cleansing_on_death_cast_on_master); RegisterSpellScript(spell_fjord_the_way_to_his_heart_anuniaq_net); + RegisterSpellScript(spell_fjord_the_way_to_his_heart_reverse_cast); + RegisterSpellScript(spell_fjord_the_way_to_his_heart_quest_complete); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 94b1b589014..5127602b02e 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -33,6 +33,7 @@ #include "InstanceScript.h" #include "Item.h" #include "Log.h" +#include "MotionMaster.h" #include "NPCPackets.h" #include "ObjectMgr.h" #include "Pet.h" @@ -2829,6 +2830,23 @@ class spell_gen_pet_summoned : public SpellScript } }; +// 36553 - PetWait +class spell_gen_pet_wait : public SpellScript +{ + PrepareSpellScript(spell_gen_pet_wait); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetCaster()->GetMotionMaster()->Clear(); + GetCaster()->GetMotionMaster()->MoveIdle(); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_gen_pet_wait::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + enum ProfessionResearch { SPELL_NORTHREND_INSCRIPTION_RESEARCH = 61177 @@ -5056,6 +5074,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_proc_charge_drop_only); RegisterSpellScript(spell_gen_parachute); RegisterSpellScript(spell_gen_pet_summoned); + RegisterSpellScript(spell_gen_pet_wait); RegisterSpellScript(spell_gen_profession_research); RegisterSpellScript(spell_gen_pvp_trinket); RegisterSpellScript(spell_gen_remove_flight_auras); |