From 9858773ab65f969c14bc0b570e000c469c25cc0b Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Thu, 7 Apr 2022 20:55:01 +0200 Subject: [PATCH] fix(Scripts/UtgardPinnacle): Implement Beast's Mark (#11298) * chery-pick commit (https://github.com/TrinityCore/TrinityCore/commit/f6409efcf664a21d43243f8d2048025014c76afb) Co-Authored-By: Lucas Nascimento Co-authored-by: Lucas Nascimento --- .../rev_1649181854899342300.sql | 6 ++ .../UtgardePinnacle/utgarde_pinnacle.cpp | 74 +++++++++++++++++++ .../Northrend/northrend_script_loader.cpp | 2 + 3 files changed, 82 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1649181854899342300.sql create mode 100644 src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.cpp diff --git a/data/sql/updates/pending_db_world/rev_1649181854899342300.sql b/data/sql/updates/pending_db_world/rev_1649181854899342300.sql new file mode 100644 index 000000000..c2eb2b260 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1649181854899342300.sql @@ -0,0 +1,6 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1649181854899342300'); + +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_utgarde_pinnacle_beast_mark'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(48876,'spell_utgarde_pinnacle_beast_mark'), +(59237,'spell_utgarde_pinnacle_beast_mark'); diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.cpp new file mode 100644 index 000000000..b9c71bbef --- /dev/null +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.cpp @@ -0,0 +1,74 @@ +/* + * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by the + * Free Software Foundation; either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "ScriptMgr.h" +#include "SpellInfo.h" +#include "SpellScript.h" +#include "Unit.h" +#include "utgarde_pinnacle.h" + +enum UtgardeSpells +{ + SPELL_BEAST_MARK_NORMAL = 48876, + SPELL_BEAST_MARK_DAMAGE_N = 48877, + SPELL_BEAST_MARK_DAMAGE_H = 59233 +}; + +// 48876 - Beast's Mark +// 59237 - Beast's Mark +class spell_utgarde_pinnacle_beast_mark : public AuraScript +{ + PrepareAuraScript(spell_utgarde_pinnacle_beast_mark); + + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_BEAST_MARK_DAMAGE_N, SPELL_BEAST_MARK_DAMAGE_H }); + } + + bool CheckProc(ProcEventInfo& eventInfo) + { + if (DamageInfo* damageInfo = eventInfo.GetDamageInfo()) + { + Unit* attacker = damageInfo->GetAttacker(); + if (!attacker || !damageInfo->GetDamage()) + return false; + + return attacker->GetCreatureType() == CREATURE_TYPE_BEAST; + } + + return false; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + Unit* target = GetTarget(); + uint32 spellId = (m_scriptSpellId == SPELL_BEAST_MARK_NORMAL) ? SPELL_BEAST_MARK_DAMAGE_N : SPELL_BEAST_MARK_DAMAGE_H; + target->CastSpell(target, spellId, aurEff); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_utgarde_pinnacle_beast_mark::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_utgarde_pinnacle_beast_mark::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } +}; + +void AddSC_utgarde_pinnacle() +{ + RegisterSpellScript(spell_utgarde_pinnacle_beast_mark); +} diff --git a/src/server/scripts/Northrend/northrend_script_loader.cpp b/src/server/scripts/Northrend/northrend_script_loader.cpp index 6c877898d..0a505a1df 100644 --- a/src/server/scripts/Northrend/northrend_script_loader.cpp +++ b/src/server/scripts/Northrend/northrend_script_loader.cpp @@ -111,6 +111,7 @@ void AddSC_boss_palehoof(); void AddSC_boss_skadi(); void AddSC_boss_ymiron(); void AddSC_instance_utgarde_pinnacle(); +void AddSC_utgarde_pinnacle(); void AddSC_utgarde_keep(); void AddSC_boss_archavon(); //Vault of Archavon void AddSC_boss_emalon(); @@ -276,6 +277,7 @@ void AddNorthrendScripts() AddSC_boss_skadi(); AddSC_boss_ymiron(); AddSC_instance_utgarde_pinnacle(); + AddSC_utgarde_pinnacle(); AddSC_utgarde_keep(); AddSC_boss_archavon(); //Vault of Archavon AddSC_boss_emalon();