From 3ae3b08b85603b3e3f00f4bcc14e8d2460a9d0d5 Mon Sep 17 00:00:00 2001 From: avarishd <46330494+avarishd@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:11:34 +0200 Subject: [PATCH] fix(Scripts/Item): Multiphase Goggles not showing disturbances on minimap (#20446) * fix(Scripts/Item): Multiphase Goggles not showing disturbances on mimimap * Apply suggestions from code review --- .../rev_1730810247500544000.sql | 3 +++ src/server/scripts/Spells/spell_item.cpp | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1730810247500544000.sql diff --git a/data/sql/updates/pending_db_world/rev_1730810247500544000.sql b/data/sql/updates/pending_db_world/rev_1730810247500544000.sql new file mode 100644 index 000000000..4de58fe20 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1730810247500544000.sql @@ -0,0 +1,3 @@ +-- Multiphase Goggles +DELETE FROM `spell_script_names` WHERE `spell_id`=46273 AND `ScriptName`='spell_item_multiphase_goggles'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (46273, 'spell_item_multiphase_goggles'); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 1d033aeee..6441d7726 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -4162,6 +4162,30 @@ class spell_item_spell_reflectors: public AuraScript } }; +// 46273 - Multiphase Goggles +class spell_item_multiphase_goggles : public AuraScript +{ + PrepareAuraScript(spell_item_multiphase_goggles); + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* player = GetTarget()->ToPlayer()) + player->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (CREATURE_TYPE_GAS_CLOUD - 1)); + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* player = GetTarget()->ToPlayer()) + player->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (CREATURE_TYPE_GAS_CLOUD - 1)); + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_item_multiphase_goggles::OnApply, EFFECT_0, SPELL_AURA_MOD_INVISIBILITY_DETECT , AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_item_multiphase_goggles::OnRemove, EFFECT_0, SPELL_AURA_MOD_INVISIBILITY_DETECT , AURA_EFFECT_HANDLE_REAL); + } +}; + void AddSC_item_spell_scripts() { RegisterSpellScript(spell_item_massive_seaforium_charge); @@ -4289,4 +4313,5 @@ void AddSC_item_spell_scripts() RegisterSpellScript(spell_item_skyguard_blasting_charges); RegisterSpellScript(spell_item_luffa); RegisterSpellScript(spell_item_spell_reflectors); + RegisterSpellScript(spell_item_multiphase_goggles); }