aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroffl <11556157+offl@users.noreply.github.com>2022-06-04 23:56:37 +0300
committerGitHub <noreply@github.com>2022-06-04 23:56:37 +0300
commit861ec6a5b9a1e579e3cc3e415898fe7a2a28cf62 (patch)
treee8c541032e0ac475709122bb5d52968c3fbfde6d /src
parenta7fe0494bf6d6737b0a874ceddac0e2c089a7ce8 (diff)
Scripts/Quest: Rework 'The Way to His Heart...' & make SAI's StopFollow work again (#28001)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp1
-rw-r--r--src/server/scripts/Northrend/zone_howling_fjord.cpp46
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp19
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 c7dbdfe6653..a35676754e3 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -851,6 +851,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 fd063b3f7c4..9bdd11e9cbe 100644
--- a/src/server/scripts/Northrend/zone_howling_fjord.cpp
+++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp
@@ -515,6 +515,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);
@@ -527,4 +571,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 4f580c151c3..f566bc99e00 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -33,6 +33,7 @@
#include "Item.h"
#include "LFGMgr.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "ObjectMgr.h"
#include "Pet.h"
#include "ReputationMgr.h"
@@ -2894,6 +2895,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
@@ -4599,6 +4617,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_remove_flight_auras);
RegisterSpellScript(spell_gen_remove_impairing_auras);