diff --git a/data/sql/updates/pending_db_world/rev_1748106287021534300.sql b/data/sql/updates/pending_db_world/rev_1748106287021534300.sql new file mode 100644 index 000000000..8921ad660 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1748106287021534300.sql @@ -0,0 +1,14 @@ +-- +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` IN (29102,29103)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(29102, 0, 0, 0, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hearthglen Crusader - On Reset - Set Event Phase 1'), +(29102, 0, 1, 0, 24, 1, 100, 0, 52196, 1, 1000, 2000, 0, 0, 11, 53348, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Hearthglen Crusader - On Target Buffed With \'Frostbrood Vanquisher\' - Cast \'Arrow Assault\' (Phase 1)'), +(29102, 0, 2, 0, 9, 1, 100, 0, 2000, 4000, 4000, 6000, 40, 150, 11, 53345, 64, 0, 1, 0, 0, 9, 0, 40, 150, 0, 0, 0, 0, 0, 'Hearthglen Crusader - Within 40-150 Range - Cast \'Arrow Assault\' (Phase 1)'), +(29102, 0, 3, 0, 8, 0, 100, 0, 53110, 1, 0, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Hearthglen Crusader - On Spellhit \'Devour Humanoid\' - Set Event Phase 2'), +(29103, 0, 0, 0, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tirisfal Crusader - On Reset - Set Event Phase 1'), +(29103, 0, 1, 0, 24, 1, 100, 0, 52196, 1, 1000, 2000, 0, 0, 11, 53348, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Tirisfal Crusader - On Target Buffed With \'Frostbrood Vanquisher\' - Cast \'Arrow Assault\' (Phase 1)'), +(29103, 0, 2, 0, 9, 1, 100, 0, 2000, 4000, 4000, 6000, 40, 150, 11, 53345, 64, 0, 1, 0, 0, 9, 0, 40, 150, 0, 0, 0, 0, 0, 'Tirisfal Crusader - Within 40-150 Range - Cast \'Arrow Assault\' (Phase 1)'), +(29103, 0, 3, 0, 8, 0, 100, 0, 53110, 0, 0, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tirisfal Crusader - On Spellhit \'Devour Humanoid\' - Set Event Phase 2'); + +DELETE FROM `spell_script_names` WHERE `spell_id`=53111 AND `ScriptName`='spell_q12779_an_end_to_all_things_devour_aura'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (53111, 'spell_q12779_an_end_to_all_things_devour_aura'); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index fcaa96b50..1c7e15fd8 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -3679,13 +3679,6 @@ void AuraEffect::HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 m } else { - if (GetId() == 53111) // Devour Humanoid - { - Unit::Kill(target, caster); - if (caster->IsCreature()) - caster->ToCreature()->RemoveCorpse(); - } - caster->_ExitVehicle(); // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them caster->RemoveAurasDueToSpell(GetId()); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter3.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter3.cpp index e10f3d12c..f659d0ffb 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter3.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter3.cpp @@ -15,27 +15,77 @@ * with this program. If not, see . */ +#include "CreatureScript.h" +#include "ScriptedCreature.h" +#include "SpellAuras.h" #include "SpellInfo.h" #include "SpellScript.h" #include "SpellScriptLoader.h" +enum DevourHumanoid +{ + NPC_HEARTHGLEN_CRUSADER = 29102, + NPC_TIRISFAL_CRUSADER = 29103 +}; + +// 53110 - Devour Humanoid class spell_q12779_an_end_to_all_things : public SpellScript { PrepareSpellScript(spell_q12779_an_end_to_all_things); + SpellCastResult CheckCast() + { + if (Unit* caster = GetCaster()) + if (caster->FindNearestCreature(NPC_HEARTHGLEN_CRUSADER, 15.0f, true) || caster->FindNearestCreature(NPC_TIRISFAL_CRUSADER, 15.0f, true)) + return SPELL_CAST_OK; + + return SPELL_FAILED_BAD_TARGETS; + } + void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - if (GetHitUnit()) - GetHitUnit()->CastSpell(GetCaster(), GetEffectValue(), true); + if (Creature* c = GetHitUnit()->ToCreature()) + if (Unit* caster = GetCaster()) + { + c->AI()->AttackStart(caster); + c->CastSpell(caster, GetEffectValue(), true); // 53111 + } } void Register() override { + OnCheckCast += SpellCheckCastFn(spell_q12779_an_end_to_all_things::CheckCast); OnEffectHitTarget += SpellEffectFn(spell_q12779_an_end_to_all_things::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; +// 53111 - Devour Humanoid (casted by the devoured creature) +class spell_q12779_an_end_to_all_things_devour_aura : public AuraScript +{ + PrepareAuraScript(spell_q12779_an_end_to_all_things_devour_aura); + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* caster = GetCaster(); + Unit* target = GetTarget(); + if (!caster || !target) + return; + + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) + { + caster->SetDisableGravity(true); + Unit::Kill(target, caster); + } + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_q12779_an_end_to_all_things_devour_aura::OnRemove, EFFECT_0, SPELL_AURA_CONTROL_VEHICLE, AURA_EFFECT_HANDLE_REAL); + } +}; + void AddSC_the_scarlet_enclave_c3() { RegisterSpellScript(spell_q12779_an_end_to_all_things); + RegisterSpellScript(spell_q12779_an_end_to_all_things_devour_aura); }