mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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>
(cherry picked from commit a9db8a9b9a)
This commit is contained in:
@@ -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');
|
||||
@@ -857,6 +857,7 @@ enum DeviateFishSpells
|
||||
SPELL_SHRINK = 8066,
|
||||
SPELL_PARTY_TIME = 8067,
|
||||
SPELL_HEALTHY_SPIRIT = 8068,
|
||||
SPELL_REJUVENATION = 8070
|
||||
};
|
||||
|
||||
class spell_item_deviate_fish : public SpellScript
|
||||
@@ -870,13 +871,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);
|
||||
}
|
||||
|
||||
@@ -886,6 +887,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
|
||||
@@ -4559,6 +4603,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);
|
||||
|
||||
Reference in New Issue
Block a user