aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Redko <ovitnez@gmail.com>2021-01-06 21:47:58 +0200
committerGitHub <noreply@github.com>2021-01-06 20:47:58 +0100
commita9db8a9b9a2f40ade5038c68321f0e9f4f566dcf (patch)
tree55d877f7a587186bfc83a270287d82810537cd33
parent65083dc9365d218ea85314d3f7f5708c1cfd597a (diff)
Scripts/Spells: Implement effect "Party Time" & Add Rejuvenation when eating Deviate Fish (#25802)
* Scripts/Spells: Implement effect "Party Time" & Add Rejuvenation when eating Deviate Fish * Rename XXXX_XX_XX_XX_world.sql to 2021_01_06_08_world.sql Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
-rw-r--r--sql/updates/world/3.3.5/2021_01_06_08_world.sql3
-rw-r--r--src/server/scripts/Spells/spell_item.cpp49
2 files changed, 50 insertions, 2 deletions
diff --git a/sql/updates/world/3.3.5/2021_01_06_08_world.sql b/sql/updates/world/3.3.5/2021_01_06_08_world.sql
new file mode 100644
index 00000000000..bbfabf2b1d1
--- /dev/null
+++ b/sql/updates/world/3.3.5/2021_01_06_08_world.sql
@@ -0,0 +1,3 @@
+--
+DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_item_party_time';
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (8067, 'spell_item_party_time');
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 60e4d4b1f08..397078cc266 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -792,6 +792,7 @@ enum DeviateFishSpells
SPELL_SHRINK = 8066,
SPELL_PARTY_TIME = 8067,
SPELL_HEALTHY_SPIRIT = 8068,
+ SPELL_REJUVENATION = 8070
};
class spell_item_deviate_fish : public SpellScript
@@ -805,13 +806,13 @@ class spell_item_deviate_fish : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- return ValidateSpellInfo({ SPELL_SLEEPY, SPELL_INVIGORATE, SPELL_SHRINK, SPELL_PARTY_TIME, SPELL_HEALTHY_SPIRIT });
+ return ValidateSpellInfo({ SPELL_SLEEPY, SPELL_INVIGORATE, SPELL_SHRINK, SPELL_PARTY_TIME, SPELL_HEALTHY_SPIRIT, SPELL_REJUVENATION });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
- uint32 spellId = urand(SPELL_SLEEPY, SPELL_HEALTHY_SPIRIT);
+ uint32 spellId = RAND(SPELL_SLEEPY, SPELL_INVIGORATE, SPELL_SHRINK, SPELL_PARTY_TIME, SPELL_HEALTHY_SPIRIT, SPELL_REJUVENATION);
caster->CastSpell(caster, spellId, true);
}
@@ -821,6 +822,49 @@ class spell_item_deviate_fish : public SpellScript
}
};
+class PartyTimeEmoteEvent : public BasicEvent
+{
+public:
+ PartyTimeEmoteEvent(Player* player) : _player(player) { }
+
+ bool Execute(uint64 /*time*/, uint32 /*diff*/) override
+ {
+ if (!_player->HasAura(SPELL_PARTY_TIME))
+ return true;
+
+ if (_player->isMoving())
+ _player->HandleEmoteCommand(RAND(EMOTE_ONESHOT_APPLAUD, EMOTE_ONESHOT_LAUGH, EMOTE_ONESHOT_CHEER, EMOTE_ONESHOT_CHICKEN));
+ else
+ _player->HandleEmoteCommand(RAND(EMOTE_ONESHOT_APPLAUD, EMOTE_ONESHOT_DANCESPECIAL, EMOTE_ONESHOT_LAUGH, EMOTE_ONESHOT_CHEER, EMOTE_ONESHOT_CHICKEN));
+
+ _player->m_Events.AddEventAtOffset(this, RAND(5s, 10s, 15s));
+
+ return false; // do not delete re-added event in EventProcessor::Update
+ }
+
+private:
+ Player* _player;
+};
+
+class spell_item_party_time : public AuraScript
+{
+ PrepareAuraScript(spell_item_party_time);
+
+ void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Player* player = GetOwner()->ToPlayer();
+ if (!player)
+ return;
+
+ player->m_Events.AddEventAtOffset(new PartyTimeEmoteEvent(player), RAND(5s, 10s, 15s));
+ }
+
+ void Register() override
+ {
+ OnEffectApply += AuraEffectApplyFn(spell_item_party_time::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+};
+
enum DiscerningEyeBeastMisc
{
SPELL_DISCERNING_EYE_BEAST = 59914
@@ -4317,6 +4361,7 @@ void AddSC_item_spell_scripts()
new spell_item_defibrillate("spell_item_gnomish_army_knife", 33);
RegisterSpellScript(spell_item_desperate_defense);
RegisterSpellScript(spell_item_deviate_fish);
+ RegisterSpellScript(spell_item_party_time);
RegisterSpellScript(spell_item_discerning_eye_beast_dummy);
RegisterSpellScript(spell_item_echoes_of_light);
RegisterSpellScript(spell_item_extract_gas);