fix(Script/Item): Elixir of Shadows for pets (#14514)

* closes https://github.com/azerothcore/azerothcore-wotlk/issues/13067
This commit is contained in:
Kitzunu
2023-01-07 23:08:19 +01:00
committed by GitHub
parent ed2997ab10
commit 97a01b430d
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
--
DELETE FROM `spell_script_names` WHERE `spell_id`=37678 AND `ScriptName`='spell_item_elixir_of_shadows';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(37678, 'spell_item_elixir_of_shadows');

View File

@@ -25,6 +25,7 @@
#include "GameTime.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Pet.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SkillDiscovery.h"
@@ -3758,6 +3759,26 @@ class spell_item_green_whelp_armor : public AuraScript
}
};
// 37678 - elixir of shadows
/// @todo Temporary fix until pet restrictions vs player restrictions are investigated
class spell_item_elixir_of_shadows : public SpellScript
{
PrepareSpellScript(spell_item_elixir_of_shadows);
void HandleEffect(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetCaster()->ToPlayer())
if (Pet* pet = player->GetPet())
pet->AddAura(37678 /*Elixir of Shadows*/, pet);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_elixir_of_shadows::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
OnEffectHitTarget += SpellEffectFn(spell_item_elixir_of_shadows::HandleEffect, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
}
};
enum TrollDice
{
TEXT_WORN_TROLL_DICE = 26152
@@ -3914,5 +3935,6 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_snowman);
RegisterSpellScript(spell_item_freeze_rookery_egg);
RegisterSpellScript(spell_item_green_whelp_armor);
RegisterSpellScript(spell_item_elixir_of_shadows);
RegisterSpellScript(spell_item_worn_troll_dice);
}