diff --git a/data/sql/updates/pending_db_world/rev_1636756491721328900.sql b/data/sql/updates/pending_db_world/rev_1636756491721328900.sql new file mode 100644 index 000000000..9589f2e01 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1636756491721328900.sql @@ -0,0 +1,5 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1636756491721328900'); + +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 727e60981..c32cab361 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1497,6 +1497,7 @@ enum DeviateFishSpells SPELL_SHRINK = 8066, SPELL_PARTY_TIME = 8067, SPELL_HEALTHY_SPIRIT = 8068, + SPELL_REJUVENATION = 8070 }; class spell_item_deviate_fish : public SpellScript @@ -1510,16 +1511,13 @@ class spell_item_deviate_fish : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override { - for (uint32 spellId = SPELL_SLEEPY; spellId <= SPELL_HEALTHY_SPIRIT; ++spellId) - if (!sSpellMgr->GetSpellInfo(spellId)) - return false; - return true; + 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, nullptr); } @@ -1529,6 +1527,57 @@ 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.AddEvent(this, RAND(_player->m_Events.CalculateTime(5000), _player->m_Events.CalculateTime(10000), _player->m_Events.CalculateTime(15000))); + + 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.AddEvent(new PartyTimeEmoteEvent(player), RAND(player->m_Events.CalculateTime(5000), player->m_Events.CalculateTime(10000), player->m_Events.CalculateTime(15000))); + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_item_party_time::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + // 71610, 71641 - Echoes of Light (Althor's Abacus) class spell_item_echoes_of_light : public SpellScript { @@ -3497,6 +3546,7 @@ void AddSC_item_spell_scripts() RegisterSpellScriptWithArgs(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_echoes_of_light); RegisterSpellScript(spell_item_fate_rune_of_unsurpassed_vigor); RegisterSpellScript(spell_item_flask_of_the_north);