From 1dd53b17f9198bda9dfd3cd96119ccedad36e315 Mon Sep 17 00:00:00 2001 From: jestermaniac <88903576+jestermaniac@users.noreply.github.com> Date: Mon, 27 Sep 2021 23:21:51 +0200 Subject: [PATCH] fix(DB/Spells): Contagion of rot (#8021) Co-authored-by: John Smith --- .../rev_1632243404005705911.sql | 35 ++++++++++++++++++ src/server/scripts/Spells/spell_generic.cpp | 37 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1632243404005705911.sql diff --git a/data/sql/updates/pending_db_world/rev_1632243404005705911.sql b/data/sql/updates/pending_db_world/rev_1632243404005705911.sql new file mode 100644 index 000000000..cb549c978 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1632243404005705911.sql @@ -0,0 +1,35 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1632243404005705911'); + +DELETE FROM `spell_script_names` WHERE `spell_id` = 7102 AND `ScriptName` = "spell_contagion_of_rot"; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (7102, "spell_contagion_of_rot"); + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 13) AND (`SourceGroup` = 4) AND (`SourceEntry` = 7103) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 1) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 7103) AND (`ConditionValue2` = 0) AND (`ConditionValue3` = 0); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 4, 7103, 0, 0, 1, 0, 7103, 0, 0, 1, 0, 0, '', ''); + + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 13) AND (`SourceGroup` = 4) AND (`SourceEntry` = 7103) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 1) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 7102) AND (`ConditionValue2` = 0) AND (`ConditionValue3` = 0); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 4, 7103, 0, 0, 1, 0, 7102, 0, 0, 1, 0, 0, '', ''); + + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 13) AND (`SourceGroup` = 1) AND (`SourceEntry` = 7103) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 1) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 7103) AND (`ConditionValue2` = 0) AND (`ConditionValue3` = 0); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 7103, 0, 0, 1, 0, 7103, 0, 0, 1, 0, 0, '', ''); + + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 13) AND (`SourceGroup` = 1) AND (`SourceEntry` = 7103) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 1) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 7102) AND (`ConditionValue2` = 0) AND (`ConditionValue3` = 0); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 7103, 0, 0, 1, 0, 7102, 0, 0, 1, 0, 0, '', ''); + + + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 13) AND (`SourceGroup` = 2) AND (`SourceEntry` = 7103) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 1) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 7103) AND (`ConditionValue2` = 0) AND (`ConditionValue3` = 0); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 2, 7103, 0, 0, 1, 0, 7103, 0, 0, 1, 0, 0, '', ''); + + + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 13) AND (`SourceGroup` = 2) AND (`SourceEntry` = 7103) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 1) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 7102) AND (`ConditionValue2` = 0) AND (`ConditionValue3` = 0); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 2, 7103, 0, 0, 1, 0, 7102, 0, 0, 1, 0, 0, '', ''); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 1a2bd04e3..929072112 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5454,6 +5454,42 @@ public: } }; +// 7102 Contagion of Rot +class spell_contagion_of_rot : public SpellScriptLoader +{ +public: + spell_contagion_of_rot() : SpellScriptLoader("spell_contagion_of_rot") {} + + class spell_contagion_of_rot_AuraScript : public AuraScript + { + PrepareAuraScript(spell_contagion_of_rot_AuraScript); + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + // 7103 => triggered spell that spreads to others + while (Aura* aur = GetUnitOwner()->GetOwnedAura(7103, ObjectGuid::Empty, ObjectGuid::Empty, 0, GetAura())) + { + GetUnitOwner()->RemoveOwnedAura(aur); + } + // 7102 => contagion of rot casted by mobs + while (Aura* aur = GetUnitOwner()->GetOwnedAura(7102, ObjectGuid::Empty, ObjectGuid::Empty, 0, GetAura())) + { + GetUnitOwner()->RemoveOwnedAura(aur); + } + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_contagion_of_rot_AuraScript::OnApply, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_contagion_of_rot_AuraScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_5000_gold(); @@ -5583,4 +5619,5 @@ void AddSC_generic_spell_scripts() new spell_gen_eject_passenger(); new spell_gen_charmed_unit_spell_cooldown(); new spell_gen_shadowmeld(); + new spell_contagion_of_rot(); }