From e32249f926996b1ec8632048511ad8352532987e Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Tue, 28 Apr 2026 21:31:00 -0300 Subject: [PATCH] fix(Scripts/Spells): Shadow Vault Decree engages Thane Ufrang (#25645) Co-authored-by: Claude Opus 4.7 --- .../rev_1777417304651314500.sql | 20 +++++++++++++++++++ src/server/scripts/Spells/spell_quest.cpp | 17 +++++----------- 2 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1777417304651314500.sql diff --git a/data/sql/updates/pending_db_world/rev_1777417304651314500.sql b/data/sql/updates/pending_db_world/rev_1777417304651314500.sql new file mode 100644 index 000000000..bc92a7d40 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1777417304651314500.sql @@ -0,0 +1,20 @@ +-- +-- Quest 12943 "Shadow Vault Decree" - Thane Ufrang the Mighty (29919) +-- +-- The CheckCast "Thane is nearby" check moves out of spell_q12943_shadow_vault_decree +-- and into a CONDITION_NEAR_CREATURE on spell 31696. The script now also clears +-- Thane's idle unit flags via ReplaceAllUnitFlags before calling AttackStart, so +-- combat actually engages instead of the player getting stuck unable to attack. +-- +-- The old SAI "Remove Unit Flags" action (id 6) chained off the 12s "Say Line 4" +-- timer is removed - the C++ handles flag removal at cast time. +-- + +-- Cast-time precondition: Thane (alive) must be within 30y of the caster. +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 17 AND `SourceEntry` = 31696; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(17, 0, 31696, 0, 0, 29, 0, 29919, 30, 0, 0, 12, 0, '', 'Spell Shadow Vault Decree requires nearby Thane Ufrang the Mighty'); + +-- Drop the now-redundant linked Remove-Unit-Flags action and its parent's link to it. +UPDATE `smart_scripts` SET `link` = 0 WHERE `entryorguid` = 29919 AND `source_type` = 0 AND `id` = 5; +DELETE FROM `smart_scripts` WHERE `entryorguid` = 29919 AND `source_type` = 0 AND `id` = 6; diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index bbf9bb52e..65596dd4a 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -381,27 +381,20 @@ class spell_q12943_shadow_vault_decree : public SpellScript { PrepareSpellScript(spell_q12943_shadow_vault_decree); - SpellCastResult CheckRequirement() - { - // if thane is present and not in combat - allow cast - Unit* caster = GetCaster(); - if (Creature* thane = caster->FindNearestCreature(NPC_THANE_UFRANG, 30.0f)) - if (!thane->IsInCombat()) - return SPELL_CAST_OK; - - return SPELL_FAILED_CASTER_AURASTATE; - } - void HandleScriptEffect(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); if (Creature* thane = caster->FindNearestCreature(NPC_THANE_UFRANG, 30.0f)) + { + if (thane->IsInCombat()) + return; + thane->ReplaceAllUnitFlags(UNIT_FLAG_NONE); thane->AI()->AttackStart(caster); + } } void Register() override { - OnCheckCast += SpellCheckCastFn(spell_q12943_shadow_vault_decree::CheckRequirement); OnEffectHitTarget += SpellEffectFn(spell_q12943_shadow_vault_decree::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } };