aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRothend <67004168+Rothend@users.noreply.github.com>2020-06-24 21:26:01 +0200
committerShauren <shauren.trinity@gmail.com>2022-01-18 00:06:59 +0100
commitf5967b8a8745bc8ccd512c876bf821968a4ba1b2 (patch)
tree15875fa2379d80eed5240615835e5090acee5f9d
parentd8efda4ff335ce6252f32e1736b1f99d443bce7b (diff)
Script/Spell: fix Midsummer's Juggling Torch (#24885)
* Script/Spell: fix Midsummer's Juggling Torch. Closes #17446 * Remove unneeded GetPosition() call, thanks jackpoz for noticing! * Rename 9999_99_99_99_world_midsummer_torch_juggling.sql to 2020_06_24_01_world.sql Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com> (cherry picked from commit 5f35bf9e795ab0c8343d693062d3643dae2b7d8c)
-rw-r--r--sql/updates/world/master/2022_01_17_02_world_2020_06_24_01_world.sql6
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp102
2 files changed, 108 insertions, 0 deletions
diff --git a/sql/updates/world/master/2022_01_17_02_world_2020_06_24_01_world.sql b/sql/updates/world/master/2022_01_17_02_world_2020_06_24_01_world.sql
new file mode 100644
index 00000000000..e4b6613a706
--- /dev/null
+++ b/sql/updates/world/master/2022_01_17_02_world_2020_06_24_01_world.sql
@@ -0,0 +1,6 @@
+-- UPDATE `achievement_criteria_data` SET `type`=6, `value1`=4395 WHERE `criteria_id`=6937;
+
+DELETE FROM `spell_script_names` WHERE `ScriptName` IN ("spell_midsummer_juggle_torch", "spell_midsummer_torch_catch");
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(45819, "spell_midsummer_juggle_torch"),
+(45644, "spell_midsummer_torch_catch");
diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp
index 061b93c10ef..ee33b9920e5 100644
--- a/src/server/scripts/Spells/spell_holiday.cpp
+++ b/src/server/scripts/Spells/spell_holiday.cpp
@@ -1678,6 +1678,106 @@ class spell_midsummer_ribbon_pole_periodic_visual : public AuraScript
}
};
+enum JugglingTorch
+{
+ SPELL_JUGGLE_TORCH_SLOW = 45792,
+ SPELL_JUGGLE_TORCH_MEDIUM = 45806,
+ SPELL_JUGGLE_TORCH_FAST = 45816,
+ SPELL_JUGGLE_TORCH_SELF = 45638,
+
+ SPELL_JUGGLE_TORCH_SHADOW_SLOW = 46120,
+ SPELL_JUGGLE_TORCH_SHADOW_MEDIUM = 46118,
+ SPELL_JUGGLE_TORCH_SHADOW_FAST = 46117,
+ SPELL_JUGGLE_TORCH_SHADOW_SELF = 46121,
+
+ SPELL_GIVE_TORCH = 45280,
+ QUEST_TORCH_CATCHING_A = 11657,
+ QUEST_TORCH_CATCHING_H = 11923
+};
+
+// 45819 - Throw Torch
+class spell_midsummer_juggle_torch : public SpellScript
+{
+ PrepareSpellScript(spell_midsummer_juggle_torch);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({
+ SPELL_JUGGLE_TORCH_SLOW, SPELL_JUGGLE_TORCH_MEDIUM, SPELL_JUGGLE_TORCH_FAST,
+ SPELL_JUGGLE_TORCH_SELF, SPELL_JUGGLE_TORCH_SHADOW_SLOW, SPELL_JUGGLE_TORCH_SHADOW_MEDIUM,
+ SPELL_JUGGLE_TORCH_SHADOW_FAST, SPELL_JUGGLE_TORCH_SHADOW_SELF
+ });
+ }
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (!GetExplTargetDest())
+ return;
+
+ Position spellDest = *GetExplTargetDest();
+ float distance = GetCaster()->GetExactDist2d(spellDest.GetPositionX(), spellDest.GetPositionY());
+
+ uint32 torchSpellID = 0;
+ uint32 torchShadowSpellID = 0;
+
+ if (distance <= 1.5f)
+ {
+ torchSpellID = SPELL_JUGGLE_TORCH_SELF;
+ torchShadowSpellID = SPELL_JUGGLE_TORCH_SHADOW_SELF;
+ spellDest = GetCaster()->GetPosition();
+ }
+ else if (distance <= 10.0f)
+ {
+ torchSpellID = SPELL_JUGGLE_TORCH_SLOW;
+ torchShadowSpellID = SPELL_JUGGLE_TORCH_SHADOW_SLOW;
+ }
+ else if (distance <= 20.0f)
+ {
+ torchSpellID = SPELL_JUGGLE_TORCH_MEDIUM;
+ torchShadowSpellID = SPELL_JUGGLE_TORCH_SHADOW_MEDIUM;
+ }
+ else
+ {
+ torchSpellID = SPELL_JUGGLE_TORCH_FAST;
+ torchShadowSpellID = SPELL_JUGGLE_TORCH_SHADOW_FAST;
+ }
+
+ GetCaster()->CastSpell(spellDest, torchSpellID);
+ GetCaster()->CastSpell(spellDest, torchShadowSpellID);
+ }
+
+ void Register() override
+ {
+ OnEffectHit += SpellEffectFn(spell_midsummer_juggle_torch::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+};
+
+// 45644 - Juggle Torch (Catch)
+class spell_midsummer_torch_catch : public SpellScript
+{
+ PrepareSpellScript(spell_midsummer_torch_catch);
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_GIVE_TORCH });
+ }
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ Player* player = GetHitPlayer();
+ if (!player)
+ return;
+
+ if (player->GetQuestStatus(QUEST_TORCH_CATCHING_A) == QUEST_STATUS_REWARDED || player->GetQuestStatus(QUEST_TORCH_CATCHING_H) == QUEST_STATUS_REWARDED)
+ player->CastSpell(player, SPELL_GIVE_TORCH);
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_midsummer_torch_catch::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+};
+
void AddSC_holiday_spell_scripts()
{
// Love is in the Air
@@ -1731,4 +1831,6 @@ void AddSC_holiday_spell_scripts()
RegisterSpellScript(spell_midsummer_torch_toss_land);
RegisterAuraScript(spell_midsummer_test_ribbon_pole_channel);
RegisterAuraScript(spell_midsummer_ribbon_pole_periodic_visual);
+ RegisterSpellScript(spell_midsummer_juggle_torch);
+ RegisterSpellScript(spell_midsummer_torch_catch);
}