From eed20b4647fb890bc980b55e8f9b2a94debe7c39 Mon Sep 17 00:00:00 2001 From: amed80 Date: Sat, 8 Jun 2024 12:07:39 +0100 Subject: [PATCH 1/9] fix(Scripts/Hyjal): Change the spawn and the movement of Doomfire (#19027) * Doomfire_spirit_speed * Update boss_archimonde.cpp * Rename --- .../Doomfire_spirit_speed.sql | 1 + .../BattleForMountHyjal/boss_archimonde.cpp | 35 +++++++++++++------ 2 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 data/sql/updates/pending_db_world/Doomfire_spirit_speed.sql diff --git a/data/sql/updates/pending_db_world/Doomfire_spirit_speed.sql b/data/sql/updates/pending_db_world/Doomfire_spirit_speed.sql new file mode 100644 index 000000000..a2998b324 --- /dev/null +++ b/data/sql/updates/pending_db_world/Doomfire_spirit_speed.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `speed_run` = 1.5 WHERE (`entry` = 18104); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 932e50325..b1851451d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -97,7 +97,7 @@ uint32 const availableChargeAurasAndSpells[3][2] = { Position const nordrassilPosition = { 5503.713f, -3523.436f, 1608.781f, 0.0f }; -float const DOOMFIRE_OFFSET = 25.0f; +float const DOOMFIRE_OFFSET = 15.0f; uint8 const WISP_OFFSET = 40; uint8 NEAR_POINT = 0; @@ -158,14 +158,26 @@ struct npc_doomfire_spirit : public ScriptedAI void Reset() override { + Position randomPosition; + scheduler.CancelAll(); - ScheduleTimedEvent(0s, [&]{ - if (Creature* archimonde = _instance->GetCreature(DATA_ARCHIMONDE)) - { - Position randomNearPosition = archimonde->GetRandomNearPosition(200.0f); - me->GetMotionMaster()->MovePoint(NEAR_POINT, randomNearPosition); - } - }, 6s); + ScheduleTimedEvent(0s, [&] { + DoomfireMovement(randomPosition, me->GetPosition()); + + me->GetMotionMaster()->MovePoint(NEAR_POINT, randomPosition); + }, 1500ms); + } + + void DoomfireMovement(Position& targetPos, Position mePos) + { + float angle = mePos.GetOrientation(); + float distance = 100.0f; + float newAngle = angle + ((rand() % 181) - 90) * M_PI / 180; + float x = mePos.GetPositionX() + distance * cos(newAngle); + float y = mePos.GetPositionY() + distance * sin(newAngle); + + targetPos = Position(x, y, me->GetPositionZ()); + return; } void UpdateAI(uint32 diff) override @@ -430,8 +442,11 @@ struct boss_archimonde : public BossAI { // hack because spell doesn't work? Talk(SAY_DOOMFIRE); - Position spiritPosition = me->GetRandomNearPosition(DOOMFIRE_OFFSET); - Position doomfirePosition = me->GetRandomNearPosition(DOOMFIRE_OFFSET); + float angle = 2 * M_PI * rand() / RAND_MAX; + float x = me->GetPositionX() + DOOMFIRE_OFFSET * cos(angle); + float y = me->GetPositionY() + DOOMFIRE_OFFSET * sin(angle); + Position spiritPosition = Position(x, y, me->GetPositionZ()); + Position doomfirePosition = Position(x, y, me->GetPositionZ()); if (Creature* doomfireSpirit = me->SummonCreature(CREATURE_DOOMFIRE_SPIRIT, spiritPosition, TEMPSUMMON_TIMED_DESPAWN, 27000)) { if (Creature* doomfire = me->SummonCreature(CREATURE_DOOMFIRE, doomfirePosition, TEMPSUMMON_TIMED_DESPAWN, 27000)) From cd00d8c9f7031f9ca8fd3303e1fee41ee176b357 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 8 Jun 2024 11:08:30 +0000 Subject: [PATCH 2/9] chore(DB): import pending files Referenced commit(s): eed20b4647fb890bc980b55e8f9b2a94debe7c39 --- .../Doomfire_spirit_speed.sql => db_world/2024_06_08_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/Doomfire_spirit_speed.sql => db_world/2024_06_08_00.sql} (62%) diff --git a/data/sql/updates/pending_db_world/Doomfire_spirit_speed.sql b/data/sql/updates/db_world/2024_06_08_00.sql similarity index 62% rename from data/sql/updates/pending_db_world/Doomfire_spirit_speed.sql rename to data/sql/updates/db_world/2024_06_08_00.sql index a2998b324..c1f38e242 100644 --- a/data/sql/updates/pending_db_world/Doomfire_spirit_speed.sql +++ b/data/sql/updates/db_world/2024_06_08_00.sql @@ -1 +1,2 @@ +-- DB update 2024_06_07_03 -> 2024_06_08_00 UPDATE `creature_template` SET `speed_run` = 1.5 WHERE (`entry` = 18104); From bbb0cb43eb0d0574c9a019a0b01cfe71e04ef80b Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Sat, 8 Jun 2024 16:50:43 +0200 Subject: [PATCH 3/9] fix(Scripts/Hyjal): some Archimonde fixes (#19031) * init * update spellscript * fix targetting * Update boss_archimonde.cpp --- .../pending_db_world/spell_scripts.sql | 4 ++ .../BattleForMountHyjal/boss_archimonde.cpp | 59 +++++++++++-------- 2 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 data/sql/updates/pending_db_world/spell_scripts.sql diff --git a/data/sql/updates/pending_db_world/spell_scripts.sql b/data/sql/updates/pending_db_world/spell_scripts.sql new file mode 100644 index 000000000..7b06a647b --- /dev/null +++ b/data/sql/updates/pending_db_world/spell_scripts.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id` = 32014; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(32014, 'spell_air_burst'); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index b1851451d..4ea6dc483 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -71,22 +71,12 @@ enum Summons enum Events { - EVENT_DRAIN_WORLD_TREE = 1, - EVENT_SPELL_FEAR = 2, - EVENT_SPELL_AIR_BURST = 3, - EVENT_SPELL_GRIP_OF_THE_LEGION = 4, - EVENT_SPELL_UNLEASH_SOUL_CHARGES = 5, - EVENT_SPELL_DOOMFIRE = 6, - EVENT_SPELL_FINGER_OF_DEATH = 7, - EVENT_SPELL_HAND_OF_DEATH = 8, - EVENT_SPELL_PROTECTION_OF_ELUNE = 9, - EVENT_ENRAGE = 10, - EVENT_CHECK_WORLD_TREE_DISTANCE = 11, // Enrage if too close to the tree - EVENT_BELOW_10_PERCENT_HP = 12, - EVENT_SUMMON_WISPS = 13, - EVENT_TOO_CLOSE_TO_WORLD_TREE = 14, - EVENT_ENRAGE_ROOT = 15, - EVENT_SPELL_FINGER_OF_DEATH_PHASE_4 = 16 + EVENT_ENRAGE = 0 +}; + +enum SpellGroups +{ + GROUP_FEAR = 0 }; uint32 const availableChargeAurasAndSpells[3][2] = { @@ -303,18 +293,15 @@ struct boss_archimonde : public BossAI Talk(SAY_AGGRO); ScheduleTimedEvent(25s, 35s, [&] { + scheduler.DelayGroup(GROUP_FEAR, 5s); Talk(SAY_AIR_BURST); - DoCastRandomTarget(SPELL_AIR_BURST, 0, 0.0f, true, false, false); + DoCastAOE(SPELL_AIR_BURST); }, 25s, 40s); ScheduleTimedEvent(25s, 35s, [&] { DoCastDoomFire(); }, 20s); ScheduleTimedEvent(25s, 35s, [&] - { - DoCastVictim(SPELL_FEAR); - }, 42s); - ScheduleTimedEvent(25s, 35s, [&] { DoCastRandomTarget(SPELL_GRIP_OF_THE_LEGION); }, 5s, 25s); @@ -356,9 +343,14 @@ struct boss_archimonde : public BossAI }, 3500ms); ScheduleTimedEvent(10min, [&] { - DoCastRandomTarget(SPELL_FINGER_OF_DEATH); - }, 3500ms); - + DoCastVictim(SPELL_RED_SKY_EFFECT); + DoCastVictim(SPELL_HAND_OF_DEATH); + }, 3s); + scheduler.Schedule(25s, 35s, GROUP_FEAR, [this](TaskContext context) + { + DoCastAOE(SPELL_FEAR); + context.Repeat(42s); + }); instance->SetData(DATA_SPAWN_WAVES, 1); } @@ -551,11 +543,30 @@ class spell_hand_of_death : public SpellScript } }; +class spell_air_burst : public SpellScript +{ + PrepareSpellScript(spell_air_burst); + + void FilterTargets(std::list& targets) + { + if (Unit* victim = GetCaster()->GetVictim()) + { + targets.remove_if(Acore::ObjectGUIDCheck(victim->GetGUID(), true)); + } + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_air_burst::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY); + } +}; + void AddSC_boss_archimonde() { RegisterSpellScript(spell_red_sky_effect); RegisterSpellScript(spell_hand_of_death); RegisterSpellScript(spell_finger_of_death); + RegisterSpellScript(spell_air_burst); RegisterHyjalAI(boss_archimonde); RegisterHyjalAI(npc_ancient_wisp); RegisterHyjalAI(npc_doomfire_spirit); From d14d34110b91e49ad01f1b8d7e47f438cc36e683 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 8 Jun 2024 14:51:34 +0000 Subject: [PATCH 4/9] chore(DB): import pending files Referenced commit(s): bbb0cb43eb0d0574c9a019a0b01cfe71e04ef80b --- .../spell_scripts.sql => db_world/2024_06_08_01.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/spell_scripts.sql => db_world/2024_06_08_01.sql} (78%) diff --git a/data/sql/updates/pending_db_world/spell_scripts.sql b/data/sql/updates/db_world/2024_06_08_01.sql similarity index 78% rename from data/sql/updates/pending_db_world/spell_scripts.sql rename to data/sql/updates/db_world/2024_06_08_01.sql index 7b06a647b..61a0ccfcd 100644 --- a/data/sql/updates/pending_db_world/spell_scripts.sql +++ b/data/sql/updates/db_world/2024_06_08_01.sql @@ -1,3 +1,4 @@ +-- DB update 2024_06_08_00 -> 2024_06_08_01 -- DELETE FROM `spell_script_names` WHERE `spell_id` = 32014; INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES From 299631f3b561fb63eb9aab8619663a20f76643fc Mon Sep 17 00:00:00 2001 From: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Date: Sat, 8 Jun 2024 15:03:53 -0400 Subject: [PATCH 5/9] fix(DB/Creature): Correct model info for Hyjal bosses. (#19032) * Init. * Remove comments. Bad CI. --- data/sql/updates/pending_db_world/hyjal-models.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 data/sql/updates/pending_db_world/hyjal-models.sql diff --git a/data/sql/updates/pending_db_world/hyjal-models.sql b/data/sql/updates/pending_db_world/hyjal-models.sql new file mode 100644 index 000000000..b249c4ba1 --- /dev/null +++ b/data/sql/updates/pending_db_world/hyjal-models.sql @@ -0,0 +1,3 @@ +UPDATE `creature_model_info` SET `BoundingRadius` = 4.5, `CombatReach` = 7.875 WHERE `DisplayID` = 17886; +UPDATE `creature_model_info` SET `BoundingRadius` = 4.2 WHERE `DisplayID` = 20939; +UPDATE `creature_model_info` SET `BoundingRadius` = 5, `CombatReach` = 7.5 WHERE `DisplayID` = 21069; From d77b3ac110d03c57459affc5ea81aa7fad1fab59 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 8 Jun 2024 19:04:44 +0000 Subject: [PATCH 6/9] chore(DB): import pending files Referenced commit(s): 299631f3b561fb63eb9aab8619663a20f76643fc --- .../hyjal-models.sql => db_world/2024_06_08_02.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/hyjal-models.sql => db_world/2024_06_08_02.sql} (86%) diff --git a/data/sql/updates/pending_db_world/hyjal-models.sql b/data/sql/updates/db_world/2024_06_08_02.sql similarity index 86% rename from data/sql/updates/pending_db_world/hyjal-models.sql rename to data/sql/updates/db_world/2024_06_08_02.sql index b249c4ba1..0aea159ff 100644 --- a/data/sql/updates/pending_db_world/hyjal-models.sql +++ b/data/sql/updates/db_world/2024_06_08_02.sql @@ -1,3 +1,4 @@ +-- DB update 2024_06_08_01 -> 2024_06_08_02 UPDATE `creature_model_info` SET `BoundingRadius` = 4.5, `CombatReach` = 7.875 WHERE `DisplayID` = 17886; UPDATE `creature_model_info` SET `BoundingRadius` = 4.2 WHERE `DisplayID` = 20939; UPDATE `creature_model_info` SET `BoundingRadius` = 5, `CombatReach` = 7.5 WHERE `DisplayID` = 21069; From 415f52d66263c3b3207e3dff925e8e5ffc643ad3 Mon Sep 17 00:00:00 2001 From: Jelle Meeus Date: Sun, 9 Jun 2024 13:39:16 +0200 Subject: [PATCH 7/9] refactor(Scripts/Naxxramas): Spell Scripts use registry macros (#19034) * ktz frost blast * ktz detonate mana * thaddius pos_neg_charge * thaddius polarity shift * sapph frost explosion * grobbulus poison * grobbulus mutating injection * gothik shadow bolt volley * gluth decimate * horsemen mark * add sql * trigger ci * Revert "trigger ci" This reverts commit d8b18d5c5c37d12da1deab0be50941bfe96641a6. * add validate horsemen mark * add validate gluth decimate * add validate gothik shadow mark * add validate ktz frost blast * add validate thaddius pos_neg_charge --- .../rev_1717886186186050826.sql | 4 + .../Naxxramas/boss_four_horsemen.cpp | 84 +++++----- .../Northrend/Naxxramas/boss_gluth.cpp | 53 +++---- .../Northrend/Naxxramas/boss_gothik.cpp | 32 ++-- .../Northrend/Naxxramas/boss_grobbulus.cpp | 98 +++++------- .../Northrend/Naxxramas/boss_kelthuzad.cpp | 99 +++++------- .../Northrend/Naxxramas/boss_sapphiron.cpp | 45 ++---- .../Northrend/Naxxramas/boss_thaddius.cpp | 147 ++++++++---------- 8 files changed, 241 insertions(+), 321 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1717886186186050826.sql diff --git a/data/sql/updates/pending_db_world/rev_1717886186186050826.sql b/data/sql/updates/pending_db_world/rev_1717886186186050826.sql new file mode 100644 index 000000000..c6fc9ff7c --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1717886186186050826.sql @@ -0,0 +1,4 @@ +-- +UPDATE `spell_script_names` SET `ScriptName`='spell_four_horsemen_mark_aura' WHERE `spell_id` IN (28832, 28833, 28834, 28835); +UPDATE `spell_script_names` SET `ScriptName`='spell_grobbulus_mutating_injection_aura' WHERE `spell_id`=28169; +UPDATE `spell_script_names` SET `ScriptName`='spell_kelthuzad_detonate_mana_aura' WHERE `spell_id`=27819; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index c3bd17fa1..9da029cf3 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -380,66 +380,60 @@ public: }; }; -class spell_four_horsemen_mark : public SpellScriptLoader +class spell_four_horsemen_mark_aura : public AuraScript { -public: - spell_four_horsemen_mark() : SpellScriptLoader("spell_four_horsemen_mark") { } + PrepareAuraScript(spell_four_horsemen_mark_aura); - class spell_four_horsemen_mark_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_four_horsemen_mark_AuraScript); + return ValidateSpellInfo({ SPELL_MARK_DAMAGE }); + } - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) { - if (Unit* caster = GetCaster()) + int32 damage; + switch (GetStackAmount()) { - int32 damage; - switch (GetStackAmount()) - { - case 1: - damage = 0; - break; - case 2: - damage = 500; - break; - case 3: - damage = 1500; - break; - case 4: - damage = 4000; - break; - case 5: - damage = 12500; - break; - case 6: - damage = 20000; - break; - default: - damage = 20000 + 1000 * (GetStackAmount() - 7); - break; - } - if (damage) - { - caster->CastCustomSpell(SPELL_MARK_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget()); - } + case 1: + damage = 0; + break; + case 2: + damage = 500; + break; + case 3: + damage = 1500; + break; + case 4: + damage = 4000; + break; + case 5: + damage = 12500; + break; + case 6: + damage = 20000; + break; + default: + damage = 20000 + 1000 * (GetStackAmount() - 7); + break; + } + if (damage) + { + caster->CastCustomSpell(SPELL_MARK_DAMAGE, SPELLVALUE_BASE_POINT0, damage, GetTarget()); } } + } - void Register() override - { - AfterEffectApply += AuraEffectApplyFn(spell_four_horsemen_mark_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_four_horsemen_mark_AuraScript(); + AfterEffectApply += AuraEffectApplyFn(spell_four_horsemen_mark_aura::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); } }; void AddSC_boss_four_horsemen() { new boss_four_horsemen(); - new spell_four_horsemen_mark(); + RegisterSpellScript(spell_four_horsemen_mark_aura); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index 9f98655d0..9fddd3647 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -29,6 +29,7 @@ enum Spells SPELL_ENRAGE_25 = 54427, SPELL_DECIMATE_10 = 28374, SPELL_DECIMATE_25 = 54426, + SPELL_DECIMATE_DAMAGE = 28375, SPELL_BERSERK = 26662, SPELL_INFECTED_WOUND = 29306, SPELL_CHOW_SEARCHER = 28404 @@ -237,50 +238,44 @@ public: }; }; -class spell_gluth_decimate : public SpellScriptLoader +class spell_gluth_decimate : public SpellScript { -public: - spell_gluth_decimate() : SpellScriptLoader("spell_gluth_decimate") { } + PrepareSpellScript(spell_gluth_decimate); - class spell_gluth_decimate_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_gluth_decimate_SpellScript); + return ValidateSpellInfo({ SPELL_DECIMATE_DAMAGE }); + } - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* unitTarget = GetHitUnit()) { - if (Unit* unitTarget = GetHitUnit()) + int32 damage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5)); + if (damage <= 0) + return; + + if (Creature* cTarget = unitTarget->ToCreature()) { - int32 damage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5)); - if (damage <= 0) - return; - - if (Creature* cTarget = unitTarget->ToCreature()) - { - cTarget->SetWalk(true); - cTarget->GetMotionMaster()->MoveFollow(GetCaster(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); - cTarget->SetReactState(REACT_PASSIVE); - Unit::DealDamage(GetCaster(), cTarget, damage); - return; - } - GetCaster()->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget); + cTarget->SetWalk(true); + cTarget->GetMotionMaster()->MoveFollow(GetCaster(), 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); + cTarget->SetReactState(REACT_PASSIVE); + Unit::DealDamage(GetCaster(), cTarget, damage); + return; } + GetCaster()->CastCustomSpell(SPELL_DECIMATE_DAMAGE, SPELLVALUE_BASE_POINT0, damage, unitTarget); } + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_gluth_decimate_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_gluth_decimate_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_gluth_decimate::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; void AddSC_boss_gluth() { new boss_gluth(); - new spell_gluth_decimate(); + RegisterSpellScript(spell_gluth_decimate); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 43bc0090f..cc22c9234 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -688,29 +688,23 @@ public: }; }; -class spell_gothik_shadow_bolt_volley : public SpellScriptLoader +class spell_gothik_shadow_bolt_volley : public SpellScript { -public: - spell_gothik_shadow_bolt_volley() : SpellScriptLoader("spell_gothik_shadow_bolt_volley") { } + PrepareSpellScript(spell_gothik_shadow_bolt_volley); - class spell_gothik_shadow_bolt_volley_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_gothik_shadow_bolt_volley_SpellScript); + return ValidateSpellInfo({ SPELL_SHADOW_MARK }); + } - void FilterTargets(std::list& targets) - { - targets.remove_if(Acore::UnitAuraCheck(false, SPELL_SHADOW_MARK)); - } - - void Register() override - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gothik_shadow_bolt_volley_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - } - }; - - SpellScript* GetSpellScript() const override + void FilterTargets(std::list& targets) { - return new spell_gothik_shadow_bolt_volley_SpellScript(); + targets.remove_if(Acore::UnitAuraCheck(false, SPELL_SHADOW_MARK)); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gothik_shadow_bolt_volley::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; @@ -718,6 +712,6 @@ void AddSC_boss_gothik() { new boss_gothik(); new npc_boss_gothik_minion(); - new spell_gothik_shadow_bolt_volley(); + RegisterSpellScript(spell_gothik_shadow_bolt_volley); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index d0abfad0b..cd55faf04 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -240,91 +240,69 @@ public: }; }; -class spell_grobbulus_poison : public SpellScriptLoader +class spell_grobbulus_poison : public SpellScript { -public: - spell_grobbulus_poison() : SpellScriptLoader("spell_grobbulus_poison") { } + PrepareSpellScript(spell_grobbulus_poison); - class spell_grobbulus_poison_SpellScript : public SpellScript + void FilterTargets(std::list& targets) { - PrepareSpellScript(spell_grobbulus_poison_SpellScript); - - void FilterTargets(std::list& targets) + std::list tmplist; + for (auto& target : targets) { - std::list tmplist; - for (auto& target : targets) + if (GetCaster()->IsWithinDist3d(target, 0.0f)) { - if (GetCaster()->IsWithinDist3d(target, 0.0f)) - { - tmplist.push_back(target); - } - } - targets.clear(); - for (auto& itr : tmplist) - { - targets.push_back(itr); + tmplist.push_back(target); } } - - void Register() override + targets.clear(); + for (auto& itr : tmplist) { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_grobbulus_poison_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + targets.push_back(itr); } - }; + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_grobbulus_poison_SpellScript(); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_grobbulus_poison::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; -class spell_grobbulus_mutating_injection : public SpellScriptLoader +class spell_grobbulus_mutating_injection_aura : public AuraScript { - public: - spell_grobbulus_mutating_injection() : SpellScriptLoader("spell_grobbulus_mutating_injection") { } + PrepareAuraScript(spell_grobbulus_mutating_injection_aura); - class spell_grobbulus_mutating_injection_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_MUTATING_EXPLOSION }); + } + + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + switch (GetTargetApplication()->GetRemoveMode()) { - PrepareAuraScript(spell_grobbulus_mutating_injection_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_MUTATING_EXPLOSION }); - } - - void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - switch (GetTargetApplication()->GetRemoveMode()) + case AURA_REMOVE_BY_ENEMY_SPELL: + case AURA_REMOVE_BY_EXPIRE: + if (auto caster = GetCaster()) { - case AURA_REMOVE_BY_ENEMY_SPELL: - case AURA_REMOVE_BY_EXPIRE: - if (auto caster = GetCaster()) - { - caster->CastSpell(GetTarget(), SPELL_MUTATING_EXPLOSION, true); - } - break; - default: - return; + caster->CastSpell(GetTarget(), SPELL_MUTATING_EXPLOSION, true); } - } - - void Register() override - { - AfterEffectRemove += AuraEffectRemoveFn(spell_grobbulus_mutating_injection_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_grobbulus_mutating_injection_AuraScript(); + break; + default: + return; } + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_grobbulus_mutating_injection_aura::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } }; void AddSC_boss_grobbulus() { new boss_grobbulus(); new boss_grobbulus_poison_cloud(); - new spell_grobbulus_mutating_injection(); - new spell_grobbulus_poison(); + RegisterSpellScript(spell_grobbulus_mutating_injection_aura); + RegisterSpellScript(spell_grobbulus_poison); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 4ec9cf976..9358c9877 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -665,82 +665,65 @@ public: }; }; -class spell_kelthuzad_frost_blast : public SpellScriptLoader +class spell_kelthuzad_frost_blast : public SpellScript { -public: - spell_kelthuzad_frost_blast() : SpellScriptLoader("spell_kelthuzad_frost_blast") { } + PrepareSpellScript(spell_kelthuzad_frost_blast); - class spell_kelthuzad_frost_blast_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spell*/) override { - PrepareSpellScript(spell_kelthuzad_frost_blast_SpellScript); + return ValidateSpellInfo({ SPELL_FROST_BLAST }); + } - void FilterTargets(std::list& targets) + void FilterTargets(std::list& targets) + { + Unit* caster = GetCaster(); + if (!caster || !caster->ToCreature()) + return; + + std::list tmplist; + for (auto& target : targets) { - Unit* caster = GetCaster(); - if (!caster || !caster->ToCreature()) - return; - - std::list tmplist; - for (auto& target : targets) + if (!target->ToUnit()->HasAura(SPELL_FROST_BLAST)) { - if (!target->ToUnit()->HasAura(SPELL_FROST_BLAST)) - { - tmplist.push_back(target); - } - } - targets.clear(); - for (auto& itr : tmplist) - { - targets.push_back(itr); + tmplist.push_back(target); } } - - void Register() override + targets.clear(); + for (auto& itr : tmplist) { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kelthuzad_frost_blast_SpellScript::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY); + targets.push_back(itr); } - }; + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_kelthuzad_frost_blast_SpellScript(); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_kelthuzad_frost_blast::FilterTargets, EFFECT_ALL, TARGET_UNIT_DEST_AREA_ENEMY); } }; -class spell_kelthuzad_detonate_mana : public SpellScriptLoader +class spell_kelthuzad_detonate_mana_aura : public AuraScript { -public: - spell_kelthuzad_detonate_mana() : SpellScriptLoader("spell_kelthuzad_detonate_mana") { } + PrepareAuraScript(spell_kelthuzad_detonate_mana_aura); - class spell_kelthuzad_detonate_mana_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spell*/) override { - PrepareAuraScript(spell_kelthuzad_detonate_mana_AuraScript); + return ValidateSpellInfo({ SPELL_MANA_DETONATION_DAMAGE }); + } - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo({ SPELL_MANA_DETONATION_DAMAGE }); - } - - void HandleScript(AuraEffect const* aurEff) - { - PreventDefaultAction(); - Unit* target = GetTarget(); - if (auto mana = int32(target->GetMaxPower(POWER_MANA) / 10)) - { - mana = target->ModifyPower(POWER_MANA, -mana); - target->CastCustomSpell(SPELL_MANA_DETONATION_DAMAGE, SPELLVALUE_BASE_POINT0, -mana * 10, target, true, nullptr, aurEff); - } - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_kelthuzad_detonate_mana_AuraScript::HandleScript, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override + void HandleScript(AuraEffect const* aurEff) { - return new spell_kelthuzad_detonate_mana_AuraScript(); + PreventDefaultAction(); + Unit* target = GetTarget(); + if (auto mana = int32(target->GetMaxPower(POWER_MANA) / 10)) + { + mana = target->ModifyPower(POWER_MANA, -mana); + target->CastCustomSpell(SPELL_MANA_DETONATION_DAMAGE, SPELLVALUE_BASE_POINT0, -mana * 10, target, true, nullptr, aurEff); + } + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_kelthuzad_detonate_mana_aura::HandleScript, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; @@ -748,7 +731,7 @@ void AddSC_boss_kelthuzad() { new boss_kelthuzad(); new boss_kelthuzad_minion(); - new spell_kelthuzad_frost_blast(); - new spell_kelthuzad_detonate_mana(); + RegisterSpellScript(spell_kelthuzad_frost_blast); + RegisterSpellScript(spell_kelthuzad_detonate_mana_aura); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index 47cccd7e2..b2e6b4c5f 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -417,51 +417,40 @@ public: }; }; -class spell_sapphiron_frost_explosion : public SpellScriptLoader +class spell_sapphiron_frost_explosion : public SpellScript { -public: - spell_sapphiron_frost_explosion() : SpellScriptLoader("spell_sapphiron_frost_explosion") { } + PrepareSpellScript(spell_sapphiron_frost_explosion); - class spell_sapphiron_frost_explosion_SpellScript : public SpellScript + void FilterTargets(std::list& targets) { - PrepareSpellScript(spell_sapphiron_frost_explosion_SpellScript); + Unit* caster = GetCaster(); + if (!caster || !caster->ToCreature()) + return; - void FilterTargets(std::list& targets) + std::list tmplist; + for (auto& target : targets) { - Unit* caster = GetCaster(); - if (!caster || !caster->ToCreature()) - return; - - std::list tmplist; - for (auto& target : targets) + if (CAST_AI(boss_sapphiron::boss_sapphironAI, caster->ToCreature()->AI())->IsValidExplosionTarget(target)) { - if (CAST_AI(boss_sapphiron::boss_sapphironAI, caster->ToCreature()->AI())->IsValidExplosionTarget(target)) - { - tmplist.push_back(target); - } - } - targets.clear(); - for (auto& itr : tmplist) - { - targets.push_back(itr); + tmplist.push_back(target); } } - - void Register() override + targets.clear(); + for (auto& itr : tmplist) { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sapphiron_frost_explosion_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); + targets.push_back(itr); } - }; + } - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_sapphiron_frost_explosion_SpellScript(); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sapphiron_frost_explosion::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); } }; void AddSC_boss_sapphiron() { new boss_sapphiron(); - new spell_sapphiron_frost_explosion(); + RegisterSpellScript(spell_sapphiron_frost_explosion); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index b2bf2a727..58ec8e4ce 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -606,121 +606,104 @@ public: }; }; -class spell_thaddius_pos_neg_charge : public SpellScriptLoader +class spell_thaddius_pos_neg_charge : public SpellScript { -public: - spell_thaddius_pos_neg_charge() : SpellScriptLoader("spell_thaddius_pos_neg_charge") { } + PrepareSpellScript(spell_thaddius_pos_neg_charge); - class spell_thaddius_pos_neg_charge_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareSpellScript(spell_thaddius_pos_neg_charge_SpellScript); + return ValidateSpellInfo({ SPELL_POSITIVE_CHARGE, SPELL_POSITIVE_CHARGE_STACK }); + } - void HandleTargets(std::list& targets) + void HandleTargets(std::list& targets) + { + uint8 count = 0; + for (auto& ihit : targets) { - uint8 count = 0; - for (auto& ihit : targets) + if (ihit->GetGUID() != GetCaster()->GetGUID()) { - if (ihit->GetGUID() != GetCaster()->GetGUID()) + if (Player* target = ihit->ToPlayer()) { - if (Player* target = ihit->ToPlayer()) + if (target->HasAura(GetTriggeringSpell()->Id)) { - if (target->HasAura(GetTriggeringSpell()->Id)) - { - ++count; - } + ++count; } } } - - if (count) - { - uint32 spellId = GetSpellInfo()->Id == SPELL_POSITIVE_CHARGE ? SPELL_POSITIVE_CHARGE_STACK : SPELL_NEGATIVE_CHARGE_STACK; - GetCaster()->SetAuraStack(spellId, GetCaster(), count); - } } - void HandleDamage(SpellEffIndex /*effIndex*/) + if (count) { - if (!GetTriggeringSpell()) - return; - - Unit* target = GetHitUnit(); - if (!target) - return; - - if (target->HasAura(GetTriggeringSpell()->Id) || target->GetTypeId() != TYPEID_PLAYER) - { - SetHitDamage(0); - } - else if (target->GetInstanceScript()) - { - target->GetInstanceScript()->SetData(DATA_CHARGES_CROSSED, 0); - } + uint32 spellId = GetSpellInfo()->Id == SPELL_POSITIVE_CHARGE ? SPELL_POSITIVE_CHARGE_STACK : SPELL_NEGATIVE_CHARGE_STACK; + GetCaster()->SetAuraStack(spellId, GetCaster(), count); } + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thaddius_pos_neg_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); - } - }; - - SpellScript* GetSpellScript() const override + void HandleDamage(SpellEffIndex /*effIndex*/) { - return new spell_thaddius_pos_neg_charge_SpellScript(); + if (!GetTriggeringSpell()) + return; + + Unit* target = GetHitUnit(); + if (!target) + return; + + if (target->HasAura(GetTriggeringSpell()->Id) || target->GetTypeId() != TYPEID_PLAYER) + { + SetHitDamage(0); + } + else if (target->GetInstanceScript()) + { + target->GetInstanceScript()->SetData(DATA_CHARGES_CROSSED, 0); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_thaddius_pos_neg_charge::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_thaddius_pos_neg_charge::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); } }; -class spell_thaddius_polarity_shift : public SpellScriptLoader +class spell_thaddius_polarity_shift : public SpellScript { -public: - spell_thaddius_polarity_shift() : SpellScriptLoader("spell_thaddius_polarity_shift") { } + PrepareSpellScript(spell_thaddius_polarity_shift); - class spell_thaddius_polarity_shift_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spell*/) override { - PrepareSpellScript(spell_thaddius_polarity_shift_SpellScript); + return ValidateSpellInfo({ SPELL_POSITIVE_POLARITY, SPELL_NEGATIVE_POLARITY }); + } - bool Validate(SpellInfo const* /*spell*/) override + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) { - return ValidateSpellInfo({ SPELL_POSITIVE_POLARITY, SPELL_NEGATIVE_POLARITY }); + target->RemoveAurasDueToSpell(SPELL_POSITIVE_CHARGE_STACK); + target->RemoveAurasDueToSpell(SPELL_NEGATIVE_CHARGE_STACK); + target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, nullptr, nullptr, caster->GetGUID()); } + } - void HandleDummy(SpellEffIndex /* effIndex */) + void HandleAfterCast() + { + if (GetCaster()) { - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) + if (Creature* caster = GetCaster()->ToCreature()) { - target->RemoveAurasDueToSpell(SPELL_POSITIVE_CHARGE_STACK); - target->RemoveAurasDueToSpell(SPELL_NEGATIVE_CHARGE_STACK); - target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, nullptr, nullptr, caster->GetGUID()); - } - } - - void HandleAfterCast() - { - if (GetCaster()) - { - if (Creature* caster = GetCaster()->ToCreature()) + if (caster->GetEntry() == NPC_THADDIUS) { - if (caster->GetEntry() == NPC_THADDIUS) - { - caster->AI()->Talk(SAY_ELECT); - caster->AI()->Talk(EMOTE_POLARITY_SHIFTED); - } + caster->AI()->Talk(SAY_ELECT); + caster->AI()->Talk(EMOTE_POLARITY_SHIFTED); } } } + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_thaddius_polarity_shift_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - AfterCast += SpellCastFn(spell_thaddius_polarity_shift_SpellScript::HandleAfterCast); - } - }; - - SpellScript* GetSpellScript() const override + void Register() override { - return new spell_thaddius_polarity_shift_SpellScript(); + OnEffectHitTarget += SpellEffectFn(spell_thaddius_polarity_shift::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + AfterCast += SpellCastFn(spell_thaddius_polarity_shift::HandleAfterCast); } }; @@ -771,7 +754,7 @@ void AddSC_boss_thaddius() new boss_thaddius(); new boss_thaddius_summon(); new npc_tesla(); - new spell_thaddius_pos_neg_charge(); - new spell_thaddius_polarity_shift(); + RegisterSpellScript(spell_thaddius_pos_neg_charge); + RegisterSpellScript(spell_thaddius_polarity_shift); new at_thaddius_entrance(); } From f48219f30b7af793e4a87788d7c6e25a582abb39 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 9 Jun 2024 11:40:10 +0000 Subject: [PATCH 8/9] chore(DB): import pending files Referenced commit(s): 415f52d66263c3b3207e3dff925e8e5ffc643ad3 --- .../rev_1717886186186050826.sql => db_world/2024_06_09_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1717886186186050826.sql => db_world/2024_06_09_00.sql} (88%) diff --git a/data/sql/updates/pending_db_world/rev_1717886186186050826.sql b/data/sql/updates/db_world/2024_06_09_00.sql similarity index 88% rename from data/sql/updates/pending_db_world/rev_1717886186186050826.sql rename to data/sql/updates/db_world/2024_06_09_00.sql index c6fc9ff7c..bdf42eaaa 100644 --- a/data/sql/updates/pending_db_world/rev_1717886186186050826.sql +++ b/data/sql/updates/db_world/2024_06_09_00.sql @@ -1,3 +1,4 @@ +-- DB update 2024_06_08_02 -> 2024_06_09_00 -- UPDATE `spell_script_names` SET `ScriptName`='spell_four_horsemen_mark_aura' WHERE `spell_id` IN (28832, 28833, 28834, 28835); UPDATE `spell_script_names` SET `ScriptName`='spell_grobbulus_mutating_injection_aura' WHERE `spell_id`=28169; From 82d5a42402d9ce9f3babd91014644f6a97d2738e Mon Sep 17 00:00:00 2001 From: Walter Pagani Date: Sun, 9 Jun 2024 08:45:17 -0300 Subject: [PATCH 9/9] chore(Command/unstuck) use command with offline players (#18913) Co-authored-by: Andrew <47818697+Nyeriah@users.noreply.github.com> Co-authored-by: Anton Popovichenko --- .../Implementation/CharacterDatabase.cpp | 2 +- src/server/scripts/Commands/cs_misc.cpp | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/server/database/Database/Implementation/CharacterDatabase.cpp b/src/server/database/Database/Implementation/CharacterDatabase.cpp index c3794fef4..eaa1ffc10 100644 --- a/src/server/database/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/database/Database/Implementation/CharacterDatabase.cpp @@ -95,7 +95,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_SEL_MAIL_SERVER_CHARACTER, "SELECT mailId from mail_server_character WHERE guid = ? and mailId = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_REP_MAIL_SERVER_CHARACTER, "REPLACE INTO mail_server_character (guid, mailId) values (?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_SEL_CHARACTER_SOCIALLIST, "SELECT friend, flags, note FROM character_social JOIN characters ON characters.guid = character_social.friend WHERE character_social.guid = ? AND deleteinfos_name IS NULL LIMIT 255", CONNECTION_ASYNC); - PrepareStatement(CHAR_SEL_CHARACTER_HOMEBIND, "SELECT mapId, zoneId, posX, posY, posZ, posO FROM character_homebind WHERE guid = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_SEL_CHARACTER_HOMEBIND, "SELECT mapId, zoneId, posX, posY, posZ, posO FROM character_homebind WHERE guid = ?", CONNECTION_BOTH); PrepareStatement(CHAR_SEL_CHARACTER_SPELLCOOLDOWNS, "SELECT spell, category, item, time, needSend FROM character_spell_cooldown WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_SEL_CHARACTER_DECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_SEL_CHARACTER_ACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = ?", CONNECTION_ASYNC); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 0dc93612c..14cac42ad 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1386,7 +1386,26 @@ public: if (!target || !target->IsConnected()) { - return false; + if (handler->HasLowerSecurity(nullptr, target->GetGUID())) + return false; + + CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_HOMEBIND); + stmt->SetData(0, target->GetGUID().GetCounter()); + + PreparedQueryResult result = CharacterDatabase.Query(stmt); + + if (result) + { + Field* fieldsDB = result->Fetch(); + WorldLocation loc(fieldsDB[0].Get(), fieldsDB[2].Get(), fieldsDB[3].Get(), fieldsDB[4].Get(), 0.0f); + uint32 zoneId = fieldsDB[1].Get(); + + Player::SavePositionInDB(loc, zoneId, target->GetGUID(), nullptr); + + handler->PSendSysMessage(LANG_SUMMONING, target->GetName(), handler->GetAcoreString(LANG_OFFLINE)); + } + + return true; } Player* player = target->GetConnectedPlayer();