From c4722de46aae1b6e695768ffc965315c5a19bc2e Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:09:25 -0300 Subject: [PATCH] fix(Scripts/Karazhan): Fix Temptation target (#17710) --- .../rev_1699998320216999100.sql | 4 ++++ src/server/game/Entities/Unit/Unit.cpp | 1 - .../EasternKingdoms/Karazhan/karazhan.cpp | 24 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 data/sql/updates/pending_db_world/rev_1699998320216999100.sql diff --git a/data/sql/updates/pending_db_world/rev_1699998320216999100.sql b/data/sql/updates/pending_db_world/rev_1699998320216999100.sql new file mode 100644 index 000000000..856f4f390 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1699998320216999100.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id` = 29494; +INSERT INTO `spell_script_names` VALUES +(29494, 'spell_karazhan_temptation'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8d1a42411..93e901ca2 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9625,7 +9625,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // Cast positive spell on enemy target case 7099: // Curse of Mending case 39703: // Curse of Mending - case 29494: // Temptation case 20233: // Improved Lay on Hands (cast on target) { target = victim; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index d818a42c0..455b8de6e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -34,6 +34,9 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" +#include "SpellAuras.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" enum Spells { @@ -585,9 +588,30 @@ public: } }; +class spell_karazhan_temptation : public AuraScript +{ + PrepareAuraScript(spell_karazhan_temptation); + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + if (eventInfo.GetActionTarget()) + { + GetTarget()->CastSpell(eventInfo.GetActionTarget(), GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + } + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_karazhan_temptation::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } +}; + void AddSC_karazhan() { new npc_barnes(); new npc_image_of_medivh(); new at_karazhan_side_entrance(); + RegisterSpellScript(spell_karazhan_temptation); }