fix(Script/Item): Deviate Fish effects (#9163)
* fix(Script/Item): Deviate Fish effects * cherry-pick commit (https://github.com/TrinityCore/TrinityCore/commit/a9db8a9b9a2f40ade5038c68321f0e9f4f566dcf)
This commit is contained in:
@@ -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');
|
||||||
@@ -1497,6 +1497,7 @@ enum DeviateFishSpells
|
|||||||
SPELL_SHRINK = 8066,
|
SPELL_SHRINK = 8066,
|
||||||
SPELL_PARTY_TIME = 8067,
|
SPELL_PARTY_TIME = 8067,
|
||||||
SPELL_HEALTHY_SPIRIT = 8068,
|
SPELL_HEALTHY_SPIRIT = 8068,
|
||||||
|
SPELL_REJUVENATION = 8070
|
||||||
};
|
};
|
||||||
|
|
||||||
class spell_item_deviate_fish : public SpellScript
|
class spell_item_deviate_fish : public SpellScript
|
||||||
@@ -1510,16 +1511,13 @@ class spell_item_deviate_fish : public SpellScript
|
|||||||
|
|
||||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
{
|
{
|
||||||
for (uint32 spellId = SPELL_SLEEPY; spellId <= SPELL_HEALTHY_SPIRIT; ++spellId)
|
return ValidateSpellInfo({ SPELL_SLEEPY, SPELL_INVIGORATE, SPELL_SHRINK, SPELL_PARTY_TIME, SPELL_HEALTHY_SPIRIT, SPELL_REJUVENATION });
|
||||||
if (!sSpellMgr->GetSpellInfo(spellId))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||||
{
|
{
|
||||||
Unit* caster = GetCaster();
|
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);
|
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)
|
// 71610, 71641 - Echoes of Light (Althor's Abacus)
|
||||||
class spell_item_echoes_of_light : public SpellScript
|
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);
|
RegisterSpellScriptWithArgs(spell_item_defibrillate, "spell_item_gnomish_army_knife", 33);
|
||||||
RegisterSpellScript(spell_item_desperate_defense);
|
RegisterSpellScript(spell_item_desperate_defense);
|
||||||
RegisterSpellScript(spell_item_deviate_fish);
|
RegisterSpellScript(spell_item_deviate_fish);
|
||||||
|
RegisterSpellScript(spell_item_party_time);
|
||||||
RegisterSpellScript(spell_item_echoes_of_light);
|
RegisterSpellScript(spell_item_echoes_of_light);
|
||||||
RegisterSpellScript(spell_item_fate_rune_of_unsurpassed_vigor);
|
RegisterSpellScript(spell_item_fate_rune_of_unsurpassed_vigor);
|
||||||
RegisterSpellScript(spell_item_flask_of_the_north);
|
RegisterSpellScript(spell_item_flask_of_the_north);
|
||||||
|
|||||||
Reference in New Issue
Block a user