diff --git a/data/sql/updates/pending_db_world/rev_1771742446580585.sql b/data/sql/updates/pending_db_world/rev_1771742446580585.sql new file mode 100644 index 000000000..8824f4494 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1771742446580585.sql @@ -0,0 +1,7 @@ +-- Honor Among Thieves spell script registration +DELETE FROM `spell_script_names` WHERE `spell_id` IN (51698, 51700, 51701, 52916); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(51698, 'spell_rog_honor_among_thieves'), +(51700, 'spell_rog_honor_among_thieves'), +(51701, 'spell_rog_honor_among_thieves'), +(52916, 'spell_rog_honor_among_thieves_proc'); diff --git a/src/server/game/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index 86bd0acc6..dc5218fba 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.cpp @@ -713,12 +713,6 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->Effects[EFFECT_0].Effect = SPELL_EFFECT_SCRIPT_EFFECT; }); - // Honor Among Thieves - ApplySpellFix({ 51698, 51700, 51701 }, [](SpellInfo* spellInfo) - { - spellInfo->Effects[EFFECT_0].TriggerSpell = 51699; - }); - ApplySpellFix({ 5171, // Slice and Dice 6774 // Slice and Dice @@ -4388,6 +4382,12 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->AttributesEx4 |= SPELL_ATTR4_NOT_IN_ARENA_OR_RATED_BATTLEGROUND; }); + // Honor Among Thieves - allow area aura from different casters to coexist + ApplySpellFix({ 51698, 51700, 51701 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx3 |= SPELL_ATTR3_DOT_STACKING_RULE; + }); + // Absorb Life ApplySpellFix({ 34239 }, [](SpellInfo* spellInfo) { diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 925bd78c4..72aeb1270 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -51,7 +51,9 @@ enum RogueSpells SPELL_ROGUE_TURN_THE_TABLES_R1 = 52910, SPELL_ROGUE_TURN_THE_TABLES_R2 = 52914, SPELL_ROGUE_TURN_THE_TABLES_R3 = 52915, - SPELL_ROGUE_OVERKILL_TRIGGERED = 58427 + SPELL_ROGUE_OVERKILL_TRIGGERED = 58427, + SPELL_ROGUE_HONOR_AMONG_THIEVES_PROC = 52916, + SPELL_ROGUE_HONOR_AMONG_THIEVES_TRIGGERED = 51699 }; enum RogueSpellIcons @@ -932,6 +934,87 @@ class spell_rog_setup : public AuraScript } }; +// 51698, 51700, 51701 - Honor Among Thieves +class spell_rog_honor_among_thieves : public AuraScript +{ + PrepareAuraScript(spell_rog_honor_among_thieves); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_ROGUE_HONOR_AMONG_THIEVES_TRIGGERED }); + } + + bool CheckProc(ProcEventInfo& /*eventInfo*/) + { + Unit* caster = GetCaster(); + if (!caster || caster->HasAura(SPELL_ROGUE_HONOR_AMONG_THIEVES_TRIGGERED)) + return false; + + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + + Unit* caster = GetCaster(); + if (!caster) + return; + + Unit* target = GetTarget(); + target->CastSpell(target, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, nullptr, aurEff, caster->GetGUID()); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_rog_honor_among_thieves::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_rog_honor_among_thieves::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } +}; + +// 52916 - Honor Among Thieves (Proc) +class spell_rog_honor_among_thieves_proc : public SpellScript +{ + PrepareSpellScript(spell_rog_honor_among_thieves_proc); + + void FilterTargets(std::list& targets) + { + targets.clear(); + + Unit* target = GetOriginalCaster(); + if (!target) + return; + + targets.push_back(target); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rog_honor_among_thieves_proc::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY); + } +}; + +// 52916 - Honor Among Thieves (Proc Aura) +class spell_rog_honor_among_thieves_proc_aura : public AuraScript +{ + PrepareAuraScript(spell_rog_honor_among_thieves_proc_aura); + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + if (Player* player = caster->ToPlayer()) + player->CastSpell(static_cast(nullptr), SPELL_ROGUE_HONOR_AMONG_THIEVES_TRIGGERED, true); + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_rog_honor_among_thieves_proc_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } +}; + // -51627 - Turn the Tables class spell_rog_turn_the_tables : public AuraScript { @@ -996,6 +1079,8 @@ void AddSC_rogue_spell_scripts() RegisterSpellScript(spell_rog_deadly_brew); RegisterSpellScript(spell_rog_quick_recovery); RegisterSpellScript(spell_rog_setup); + RegisterSpellScript(spell_rog_honor_among_thieves); + RegisterSpellAndAuraScriptPair(spell_rog_honor_among_thieves_proc, spell_rog_honor_among_thieves_proc_aura); RegisterSpellScript(spell_rog_turn_the_tables); RegisterSpellScript(spell_rog_turn_the_tables_proc); }