From a7026e7e39ef139626def5364d0b12aefd208ddd Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Tue, 12 Mar 2024 10:44:55 +0100 Subject: [PATCH 01/19] fix(Scripts/TheEye): make sure Al'ar doesn't cast anything during rebirt + phoenix spawning (#18540) * init * more * uh --- src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 1b2fe29e8..fc18c2cde 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -94,6 +94,10 @@ struct boss_alar : public BossAI boss_alar(Creature* creature) : BossAI(creature, DATA_ALAR) { me->SetCombatMovement(false); + scheduler.SetValidator([this] + { + return !me->HasUnitState(UNIT_STATE_CASTING); + }); } void JustReachedHome() override @@ -264,7 +268,7 @@ struct boss_alar : public BossAI _noMelee = true; scheduler.Schedule(2s, [this](TaskContext) { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 10.0f, true)) + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 110.0f, true)) { SpawnPhoenixes(2, target); } From 6b5289f373de503061e0acb0f6194abe11f1e640 Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Tue, 12 Mar 2024 10:46:12 +0100 Subject: [PATCH 02/19] fix(Scripts/TheEye): allow Solarian to cast on pets/totems (#18539) init --- src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index b497b00ed..85726a9b4 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -122,7 +122,7 @@ struct boss_high_astromancer_solarian : public BossAI scheduler.Schedule(3650ms, [this](TaskContext context) { me->GetMotionMaster()->Clear(); - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true, true, -SPELL_WRATH_OF_THE_ASTROMANCER)) + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, false, true, -SPELL_WRATH_OF_THE_ASTROMANCER)) { DoCast(target, SPELL_ARCANE_MISSILES); } From 9238c711052b0ef5d616ef6386c961ef7dcd8ff4 Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Wed, 13 Mar 2024 07:41:36 +0100 Subject: [PATCH 03/19] fix(DB/TheEye): make falconer move towards you (#18542) initial --- data/sql/updates/pending_db_world/tempest_falconer.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 data/sql/updates/pending_db_world/tempest_falconer.sql diff --git a/data/sql/updates/pending_db_world/tempest_falconer.sql b/data/sql/updates/pending_db_world/tempest_falconer.sql new file mode 100644 index 000000000..2b46589a7 --- /dev/null +++ b/data/sql/updates/pending_db_world/tempest_falconer.sql @@ -0,0 +1,2 @@ +-- +UPDATE `smart_scripts` SET `event_type` = 0, `comment` = 'Tempest Falconer - In Combat - Cast \'Shoot\'', `event_param6` = 0 WHERE `entryorguid` = 20037 AND `source_type` = 0 AND `id` = 1; From 6a58e611ed4ff05da84f1767b2687c1698c66f01 Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Wed, 13 Mar 2024 07:42:07 +0100 Subject: [PATCH 04/19] fix(Scripts/TheEye): remove auras from Solarian on invisiblity and sniffed spell (#18544) * init * add sniffed spell and remove auras on invisible * prevent true beam being cast on players --- .../scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 85726a9b4..911b6500d 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -36,7 +36,8 @@ enum Spells SPELL_WRATH_OF_THE_ASTROMANCER = 42783, SPELL_BLINDING_LIGHT = 33009, SPELL_PSYCHIC_SCREAM = 34322, - SPELL_VOID_BOLT = 39329 + SPELL_VOID_BOLT = 39329, + SPELL_TRUE_BEAM = 33365, }; enum Misc @@ -145,6 +146,7 @@ struct boss_high_astromancer_solarian : public BossAI { me->SetReactState(REACT_PASSIVE); Talk(SAY_SUMMON); + me->RemoveAllAuras(); me->SetModelVisible(false); scheduler.DelayAll(21s); scheduler.Schedule(6s, [this](TaskContext) @@ -157,6 +159,7 @@ struct boss_high_astromancer_solarian : public BossAI { if (light->GetDistance2d(CENTER_X, CENTER_Y) < 20.0f) { + DoCast(light, SPELL_TRUE_BEAM); me->SetPosition(*light); me->StopMovingOnCurrentPos(); } @@ -179,6 +182,7 @@ struct boss_high_astromancer_solarian : public BossAI light->RemoveAllAuras(); if (light->GetDistance2d(CENTER_X, CENTER_Y) < 20.0f) { + me->RemoveAllAuras(); me->SetModelVisible(true); } else From 447fcbe99e63e4db7e2aae1affbf60c1466947a9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 13 Mar 2024 06:42:35 +0000 Subject: [PATCH 05/19] chore(DB): import pending files Referenced commit(s): 9238c711052b0ef5d616ef6386c961ef7dcd8ff4 --- .../tempest_falconer.sql => db_world/2024_03_13_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/tempest_falconer.sql => db_world/2024_03_13_00.sql} (81%) diff --git a/data/sql/updates/pending_db_world/tempest_falconer.sql b/data/sql/updates/db_world/2024_03_13_00.sql similarity index 81% rename from data/sql/updates/pending_db_world/tempest_falconer.sql rename to data/sql/updates/db_world/2024_03_13_00.sql index 2b46589a7..d07b91319 100644 --- a/data/sql/updates/pending_db_world/tempest_falconer.sql +++ b/data/sql/updates/db_world/2024_03_13_00.sql @@ -1,2 +1,3 @@ +-- DB update 2024_03_11_01 -> 2024_03_13_00 -- UPDATE `smart_scripts` SET `event_type` = 0, `comment` = 'Tempest Falconer - In Combat - Cast \'Shoot\'', `event_param6` = 0 WHERE `entryorguid` = 20037 AND `source_type` = 0 AND `id` = 1; From fbfa2c21f371f307a02c6d5eba406619c3a24bb8 Mon Sep 17 00:00:00 2001 From: sudlud Date: Wed, 13 Mar 2024 10:52:11 +0100 Subject: [PATCH 06/19] fix(DB/Gameobject): fix phaseMask of two 'Bench' spawns (#18541) fix(DB/Gameobject): fix phaseMask of two 'heyitsbench' spawns --- data/sql/updates/pending_db_world/rev_1710238997622002200.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1710238997622002200.sql diff --git a/data/sql/updates/pending_db_world/rev_1710238997622002200.sql b/data/sql/updates/pending_db_world/rev_1710238997622002200.sql new file mode 100644 index 000000000..9c91308d1 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1710238997622002200.sql @@ -0,0 +1,2 @@ +-- fix phaseMask of two 'Bench' spawns +UPDATE `gameobject` SET `phaseMask` = 2 WHERE (`guid` IN (57773, 57784)); From 307c1ab09dc04aeed356254744854f0cb4771bf3 Mon Sep 17 00:00:00 2001 From: sudlud Date: Wed, 13 Mar 2024 10:52:43 +0100 Subject: [PATCH 07/19] refactor(Core): remove some unused variables (#18538) - let's get rid of some compiler warnings --- src/server/game/Entities/Creature/GossipDef.cpp | 2 -- src/server/game/Globals/ObjectMgr.cpp | 7 ------- src/server/scripts/Kalimdor/zone_silithus.cpp | 4 ---- 3 files changed, 13 deletions(-) diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index b2969580d..1f8a350f3 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -212,11 +212,9 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID) } data << uint32(_questMenu.GetMenuItemCount()); // max count 0x20 - uint32 count = 0; for (uint32 iI = 0; iI < _questMenu.GetMenuItemCount(); ++iI) { - ++count; QuestMenuItem const& item = _questMenu.GetItem(iI); uint32 questID = item.QuestId; if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID)) diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 3c001d792..12503649e 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2481,8 +2481,6 @@ void ObjectMgr::LoadGameobjects() { uint32 oldMSTime = getMSTime(); - uint32 count = 0; - // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, id, map, position_x, position_y, position_z, orientation, " // 7 8 9 10 11 12 13 14 15 16 17 @@ -2642,7 +2640,6 @@ void ObjectMgr::LoadGameobjects() if (gameEvent == 0 && PoolId == 0) // if not this is to be managed by GameEvent System or Pool system AddGameobjectToGrid(guid, &data); - ++count; } while (result->NextRow()); LOG_INFO("server.loading", ">> Loaded {} Gameobjects in {} ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); @@ -6343,8 +6340,6 @@ void ObjectMgr::LoadQuestGreetingsLocales() return; } - uint32 count = 0; - do { Field* fields = result->Fetch(); @@ -6379,8 +6374,6 @@ void ObjectMgr::LoadQuestGreetingsLocales() QuestGreetingLocale& data = _questGreetingLocaleStore[MAKE_PAIR32(type, id)]; AddLocaleString(fields[3].Get(), locale, data.Greeting); - - ++count; } while (result->NextRow()); LOG_INFO("server.loading", ">> Loaded {} quest greeting Locale Strings in {} ms", (uint32)_questGreetingLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 13a2de09b..9cc56778c 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -829,7 +829,6 @@ public: if (Group* EventGroup = player->GetGroup()) { uint8 GroupMemberCount = 0; - uint8 DeadMemberCount = 0; uint8 FailedMemberCount = 0; Group::MemberSlotList const& members = EventGroup->GetMemberSlots(); @@ -845,9 +844,6 @@ public: ++FailedMemberCount; } ++GroupMemberCount; - - if (groupMember->isDead()) - ++DeadMemberCount; } if (GroupMemberCount == FailedMemberCount || !player->IsWithinDistInMap(me, EVENT_AREA_RADIUS)) From 0da6b17f7ba80876be28996e096e86b036808863 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 13 Mar 2024 09:53:05 +0000 Subject: [PATCH 08/19] chore(DB): import pending files Referenced commit(s): fbfa2c21f371f307a02c6d5eba406619c3a24bb8 --- .../rev_1710238997622002200.sql => db_world/2024_03_13_01.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1710238997622002200.sql => db_world/2024_03_13_01.sql} (71%) diff --git a/data/sql/updates/pending_db_world/rev_1710238997622002200.sql b/data/sql/updates/db_world/2024_03_13_01.sql similarity index 71% rename from data/sql/updates/pending_db_world/rev_1710238997622002200.sql rename to data/sql/updates/db_world/2024_03_13_01.sql index 9c91308d1..92546e875 100644 --- a/data/sql/updates/pending_db_world/rev_1710238997622002200.sql +++ b/data/sql/updates/db_world/2024_03_13_01.sql @@ -1,2 +1,3 @@ +-- DB update 2024_03_13_00 -> 2024_03_13_01 -- fix phaseMask of two 'Bench' spawns UPDATE `gameobject` SET `phaseMask` = 2 WHERE (`guid` IN (57773, 57784)); From 28ea5ca879ba2f66c2624d4cc3f663e0a53a06cc Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Wed, 13 Mar 2024 20:53:17 +0100 Subject: [PATCH 09/19] fix(Scripts/TheEye): maybe fix Al'ar transition (#18552) initial --- .../Outland/TempestKeep/Eye/boss_alar.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index fc18c2cde..4013f01b6 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -115,6 +115,7 @@ struct boss_alar : public BossAI _canAttackCooldown = true; _baseAttackOverride = false; _spawnPhoenixes = false; + _transitionScheduler.CancelAll(); _platform = 0; _noMelee = false; _platformRoll = 0; @@ -183,20 +184,20 @@ struct boss_alar : public BossAI damage = 0; DoCastSelf(SPELL_EMBER_BLAST, true); PretendToDie(me); - ScheduleUniqueTimedEvent(1s, [&]{ + _transitionScheduler.Schedule(1s, [this](TaskContext) + { me->SetVisible(false); - }, EVENT_INVISIBLE); - ScheduleUniqueTimedEvent(8s, [&]{ + }).Schedule(8s, [this](TaskContext) + { me->SetPosition(alarPoints[POINT_MIDDLE]); - }, EVENT_RELOCATE_MIDDLE); - ScheduleUniqueTimedEvent(12s, [&] + }).Schedule(12s, [this](TaskContext) { me->SetStandState(UNIT_STAND_STATE_STAND); me->SetVisible(true); DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true); DoCastSelf(SPELL_REBIRTH_PHASE2); - }, EVENT_MOVE_TO_PHASE_2); - ScheduleUniqueTimedEvent(16001ms, [&]{ + }).Schedule(16001ms, [this](TaskContext) + { me->SetHealth(me->GetMaxHealth()); me->SetReactState(REACT_AGGRESSIVE); _noMelee = false; @@ -204,7 +205,7 @@ struct boss_alar : public BossAI _platform = POINT_MIDDLE; me->GetMotionMaster()->MoveChase(me->GetVictim()); ScheduleAbilities(); - }, EVENT_REBIRTH); + }); } } @@ -356,6 +357,8 @@ struct boss_alar : public BossAI void UpdateAI(uint32 diff) override { + _transitionScheduler.Update(diff); + if (!UpdateVictim()) { return; @@ -413,6 +416,7 @@ private: uint8 _platformRoll; uint8 _noQuillTimes; std::chrono::seconds _platformMoveRepeatTimer; + TaskScheduler _transitionScheduler; }; class CastQuill : public BasicEvent From e0bc7d73ddaae154dc113bbfa83390ffbb3040fb Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Thu, 14 Mar 2024 10:12:02 +0100 Subject: [PATCH 10/19] fix(Scripts/TheEye): make sure Al'ar doesn't schedule abilities multiple times (#18553) * init * fix --- src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 4013f01b6..b45f6d86c 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -115,6 +115,7 @@ struct boss_alar : public BossAI _canAttackCooldown = true; _baseAttackOverride = false; _spawnPhoenixes = false; + _hasPretendedToDie = false; _transitionScheduler.CancelAll(); _platform = 0; _noMelee = false; @@ -179,8 +180,9 @@ struct boss_alar : public BossAI void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) override { - if (damage >= me->GetHealth() && _platform < POINT_MIDDLE) + if (damage >= me->GetHealth() && _platform < POINT_MIDDLE && !_hasPretendedToDie) { + _hasPretendedToDie = true; damage = 0; DoCastSelf(SPELL_EMBER_BLAST, true); PretendToDie(me); @@ -224,6 +226,7 @@ struct boss_alar : public BossAI void ScheduleAbilities() { + _transitionScheduler.CancelAll(); ScheduleTimedEvent(57s, [&] { DoCastVictim(SPELL_MELT_ARMOR); @@ -408,6 +411,7 @@ struct boss_alar : public BossAI } private: + bool _hasPretendedToDie; bool _canAttackCooldown; bool _baseAttackOverride; bool _spawnPhoenixes; From a21ba7afc2c07a8d6515179414dded6e5690b44f Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Fri, 15 Mar 2024 05:05:50 +0100 Subject: [PATCH 11/19] fix(Scripts/TheEye): another Al'ar hotfix (#18554) init --- .../Outland/TempestKeep/Eye/boss_alar.cpp | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index b45f6d86c..39b23d5e8 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -180,34 +180,37 @@ struct boss_alar : public BossAI void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) override { - if (damage >= me->GetHealth() && _platform < POINT_MIDDLE && !_hasPretendedToDie) + if (damage >= me->GetHealth() && _platform < POINT_MIDDLE) { - _hasPretendedToDie = true; damage = 0; - DoCastSelf(SPELL_EMBER_BLAST, true); - PretendToDie(me); - _transitionScheduler.Schedule(1s, [this](TaskContext) + if (!_hasPretendedToDie) { - me->SetVisible(false); - }).Schedule(8s, [this](TaskContext) - { - me->SetPosition(alarPoints[POINT_MIDDLE]); - }).Schedule(12s, [this](TaskContext) - { - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetVisible(true); - DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true); - DoCastSelf(SPELL_REBIRTH_PHASE2); - }).Schedule(16001ms, [this](TaskContext) - { - me->SetHealth(me->GetMaxHealth()); - me->SetReactState(REACT_AGGRESSIVE); - _noMelee = false; - me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); - _platform = POINT_MIDDLE; - me->GetMotionMaster()->MoveChase(me->GetVictim()); - ScheduleAbilities(); - }); + _hasPretendedToDie = true; + DoCastSelf(SPELL_EMBER_BLAST, true); + PretendToDie(me); + _transitionScheduler.Schedule(1s, [this](TaskContext) + { + me->SetVisible(false); + }).Schedule(8s, [this](TaskContext) + { + me->SetPosition(alarPoints[POINT_MIDDLE]); + }).Schedule(12s, [this](TaskContext) + { + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetVisible(true); + DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true); + DoCastSelf(SPELL_REBIRTH_PHASE2); + }).Schedule(16001ms, [this](TaskContext) + { + me->SetHealth(me->GetMaxHealth()); + me->SetReactState(REACT_AGGRESSIVE); + _noMelee = false; + me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); + _platform = POINT_MIDDLE; + me->GetMotionMaster()->MoveChase(me->GetVictim()); + ScheduleAbilities(); + }); + } } } From 7a7ea27293854ada417304fad6b5bfa87ffe4936 Mon Sep 17 00:00:00 2001 From: Walter Pagani Date: Fri, 15 Mar 2024 01:20:36 -0300 Subject: [PATCH 12/19] fix(SpellInfoCorrections) Raid buffs should ignore LoS (#18518) --- .../game/Spells/SpellInfoCorrections.cpp | 164 +++++++++++++++++- 1 file changed, 156 insertions(+), 8 deletions(-) diff --git a/src/server/game/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index b222c1425..31e495f09 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.cpp @@ -212,13 +212,19 @@ void SpellMgr::LoadSpellInfoCorrections() ApplySpellFix({ 37790, // Spread Shot 54172, // Divine Storm (heal) - 66588, // Flaming Spear - 54171 // Divine Storm + 66588 // Flaming Spear }, [](SpellInfo* spellInfo) { spellInfo->MaxAffectedTargets = 3; }); + // Divine Storm + ApplySpellFix({ 54171 }, [](SpellInfo* spellInfo) + { + spellInfo->MaxAffectedTargets = 3; + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + // Divine Storm (Damage) ApplySpellFix({ 53385 }, [](SpellInfo* spellInfo) { @@ -566,12 +572,6 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->DmgClass = SPELL_DAMAGE_CLASS_MAGIC; }); - // Light's Beacon, Beacon of Light - ApplySpellFix({ 53651 }, [](SpellInfo* spellInfo) - { - spellInfo->AttributesEx3 |= SPELL_ATTR3_DOT_STACKING_RULE; - }); - // Hand of Reckoning ApplySpellFix({ 62124 }, [](SpellInfo* spellInfo) { @@ -854,6 +854,7 @@ void SpellMgr::LoadSpellInfoCorrections() ApplySpellFix({ 57330, 57623 }, [](SpellInfo* spellInfo) { spellInfo->Effects[EFFECT_1].TargetA = 0; + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; }); // Scourge Strike trigger @@ -1213,6 +1214,7 @@ void SpellMgr::LoadSpellInfoCorrections() ApplySpellFix({ 59725 }, [](SpellInfo* spellInfo) { spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_CASTER_AREA_PARTY); + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; }); // Hymn of Hope @@ -4033,6 +4035,8 @@ void SpellMgr::LoadSpellInfoCorrections() ApplySpellFix({ 53651 }, [](SpellInfo* spellInfo) { spellInfo->AttributesEx |= SPELL_ATTR1_NO_THREAT; + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + spellInfo->AttributesEx3 |= SPELL_ATTR3_DOT_STACKING_RULE; }); // Shadow Hunter Vosh'gajin - Hex @@ -4650,6 +4654,150 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->ProcChance = 100; }); + // Commanding Shout + ApplySpellFix({ 469, 47439, 47440 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Battle Shout + ApplySpellFix({ 2048, 5242, 6192, 6673, 11549, 11550, 11551, 25289, 47436 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Plague Effect + ApplySpellFix({ 19594, 26557 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Prayer of Fortitude + ApplySpellFix({ 21562, 21564, 25392, 48162 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Gift of the Wild + ApplySpellFix({ 21849, 21850, 26991, 48470, 69381 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Arcane Brilliance + ApplySpellFix({ 23028, 27127, 43002 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Prayer of Spirit + ApplySpellFix({ 27681, 32999, 48074 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Prayer of Shadow Protection + ApplySpellFix({ 27683, 39374, 48170 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Nagrand Fort Buff Reward Raid + ApplySpellFix({ 33006 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Demonic Pact + ApplySpellFix({ 48090 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Ancestral Awakening + ApplySpellFix({ 52759 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Turn the Tables + ApplySpellFix({ 52910, 52914, 52915 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Judgements of the Wise + ApplySpellFix({ 54180 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Replenishment + ApplySpellFix({ 57669 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Dalaran Brilliance + ApplySpellFix({ 61316 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // [DND] Dalaran Brilliance + ApplySpellFix({ 61332 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Infinite Replenishment + Wisdom + ApplySpellFix({ 61782 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Renewed Hope + ApplySpellFix({ 63944 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Fortitude + ApplySpellFix({ 69377 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Blessing of Forgotten Kings + ApplySpellFix({ 69378 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Lucky Charm + ApplySpellFix({ 69511 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Shiny Shard of the Scale Heal Targeter + ApplySpellFix({ 69749 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Purified Shard of the Scale Heal Targeter + ApplySpellFix({ 69754 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + + // Brilliance + ApplySpellFix({ 69994 }, [](SpellInfo* spellInfo) + { + spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; + }); + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo* spellInfo = mSpellInfoMap[i]; From 3bcdc4d23e9b9fa951bf02a74a77a4313078e823 Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Fri, 15 Mar 2024 04:20:51 -0300 Subject: [PATCH 13/19] fix(Core/Spells): Domination affect max 5 targets (#18555) --- src/server/game/Spells/SpellInfoCorrections.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/server/game/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index 31e495f09..fe687f238 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.cpp @@ -4798,6 +4798,12 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; }); + // Domination + ApplySpellFix({ 37135 }, [](SpellInfo* spellInfo) + { + spellInfo->MaxAffectedTargets = 5; + }); + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo* spellInfo = mSpellInfoMap[i]; From ab02c36e67045e2c6a166cbd6db96ae466e061d0 Mon Sep 17 00:00:00 2001 From: Elmsroth Date: Fri, 15 Mar 2024 14:23:31 +0100 Subject: [PATCH 14/19] feat(Scripts/Commands): Implement ".reset items" command (#18393) Syntax : .reset items equiped|bags|bank|keyring|currency|vendor_buyback|all|allbags #playername Delete items in the player inventory (equiped, bank, bags etc...) depending on the chosen option. #playername : Optionnal target player name (if player is online only). If not provided the command will execute on the selected target player. Update src/server/scripts/Commands/cs_reset.cpp Accepted Co-authored-by: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Update data/sql/updates/pending_db_world/rev_1708782048020249700.sql Accepted Co-authored-by: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Update data/sql/updates/pending_db_world/rev_1708782048020249700.sql Accepted Co-authored-by: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Update src/server/game/Miscellaneous/Language.h Accepted Co-authored-by: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> fix uint16 vs uint16_t fix crash and code cleanup Fix typo sql fix Missing typo selected instead or selecter AC code style fix Re-Fix typos MISSING typos missing typos --- .../rev_1708782048020249700.sql | 122 +++++ src/server/game/Entities/Player/Player.h | 2 +- src/server/game/Miscellaneous/Language.h | 14 +- src/server/scripts/Commands/cs_reset.cpp | 425 ++++++++++++++++++ 4 files changed, 561 insertions(+), 2 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1708782048020249700.sql diff --git a/data/sql/updates/pending_db_world/rev_1708782048020249700.sql b/data/sql/updates/pending_db_world/rev_1708782048020249700.sql new file mode 100644 index 000000000..8c795b423 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1708782048020249700.sql @@ -0,0 +1,122 @@ +-- [START] // DB Update for .reset items command + +/*--------------------------------- + + Command and associated help + +-----------------------------------*/ + +-- Always delete before insert to ensure script repeatability : +-- One value per line to facilitate readability +DELETE FROM `command` WHERE `name` IN( +'reset items', +'reset items equipped', +'reset items bags', +'reset items bank', +'reset items keyring', +'reset items currency', +'reset items vendor_buyback', +'reset items all', +'reset items allbags'); + +-- GM Security level associated with the commands +SET @GM_SECURITY_LEVEL = 3; + +-- Insert values : +INSERT INTO `command`(`name`,`security`,`help`) +VALUES ( +-- .reset items (main command) +'reset items', @GM_SECURITY_LEVEL, 'Syntax : .reset items equipped|bags|bank|keyring|currency|vendor_buyback|all|allbags #playername +Delete items in the player inventory (equipped, bank, bags etc...) depending on the chosen option. +#playername : Optional target player name (if player is online only). If not provided the command will execute on the selected target player.'), + +-- .reset items _____ (Sub-commands) +('reset items equipped', @GM_SECURITY_LEVEL, 'Syntax : .reset items equipped #playername +Delete all items equipped on the target player. +#playername : Optional target player name (if player is online only). If not provided the command will execute on the selected target player.'), + +('reset items bags', @GM_SECURITY_LEVEL, 'Syntax : .reset items bags #playername +Delete all items in the selected player\'s bags. +#playername : Optional target player name (if player is online only). If not provided the command will execute on the selected target player.'), + +('reset items bank', @GM_SECURITY_LEVEL, 'Syntax : .reset items bank #playername +Delete all items in the selected player\'s bank. +#playername : Optional target player name (if player is online only). If not provided the command will execute on the selected target player.'), + +('reset items keyring', @GM_SECURITY_LEVEL, 'Syntax : .reset items keyring #playername +Delete all items in the selected player\'s keyring. +#playername : Optional target player name (if player is online only). If not provided the command will execute on the selected target player.'), + +('reset items currency', @GM_SECURITY_LEVEL, 'Syntax : .reset items currency #playername +Delete all items in the selected player\'s currencies list. +#playername : Optional target player name (if player is online only). If not provided the command will execute on the selected target player.'), + +('reset items vendor_buyback', @GM_SECURITY_LEVEL, 'Syntax : .reset items vendor_buyback #playername +Delete all items in the selected player\'s vendor buyback tab. +#playername : Optional target player name (if player is online only). If not provided the command will execute on the selected target player.'), + +('reset items all', @GM_SECURITY_LEVEL, 'Syntax : .reset items all #playername +Delete all items in the selected player\'s inventory (equipped, in bags, in bank, in keyring, in currency list and in vendor buy back tab). +#playername : Optional target player name (if player is online only). If not provided the command will execute on the selected target player.'), + +('reset items allbags', @GM_SECURITY_LEVEL, 'Syntax : .reset items allbags #playername +Delete all items in the selected player\'s inventory (equipped, in bags, in bank, in keyring, in currency list and in vendor buy back tab) +This command also deletes the bags. +#playername : Optional target player name (if player is online only). If not provided the command will execute on the selected target player.'); + +/*--------------------------------------------------------------------------------- + LANG_* strings used by the core at command use. + All of them are stored in table `acore_string` + Note : We should think to add a `enum_tag` column to the `acore_string` table + in order to automatize the rebuild of Language.h file +------------------------------------------------------------------------------------*/ + +-- Always delete before insert to ensure script repeatability : +DELETE FROM `acore_string` WHERE `entry` IN (365, 366, 367, 368, 369, 370, 371, 372); + +-- Insert values : +-- Attention : Need to translate in other languages. Since I'm French I will set only english and french ones :-) +INSERT INTO `acore_string` (`entry`, `content_default`, `locale_frFR`) +VALUES (365, '|cffffffff%d|r equipped items deleted for %s', '|cffffffff%d|r objets équipés supprimés pour %s'), + (366, '|cffffffff%d|r items in equipped bags deleted for %s', '|cffffffff%d|r objets supprimés dans les sacs de %s'), + (367, '|cffffffff%d|r items in bank deleted for %s', '|cffffffff%d|r objets supprimés de la banque de %s'), + (368, '|cffffffff%d|r keys in keyring deleted for %s', '|cffffffff%d|r objets supprimés du porte-clés de %s'), + (369, '|cffffffff%d|r currencies deleted for %s', '|cffffffff%d|r types de monnaies supprimées l\'inventaire de %s'), + (370, '|cffffffff%d|r items in vendors buyback deleted for %s', '|cffffffff%d|r objets supprimés dans l\'onglet rachat des vendeurs pour %s'), + (371, 'All items were deleted for %s : +|cffffffff%d|r items equipped +|cffffffff%d|r items in bags +|cffffffff%d|r items in bank +|cffffffff%d|r keys in keyring +|cffffffff%d|r currency types +|cffffffff%d|r items in vendor buyback', +'Tous les objets de %s ont été supprimés : +|cffffffff%d|r objet équipés +|cffffffff%d|r objets dans les sacs +|cffffffff%d|r objets en banque +|cffffffff%d|r clés dans le porte-clés +|cffffffff%d|r types de monnaies +|cffffffff%d|r objets dans l\'onglet rachat des vendeurs'), + (372, 'All items were deleted for %s (bags included): +|cffffffff%d|r equipped +|cffffffff%d|r items in bags +|cffffffff%d|r items in bank +|cffffffff%d|r keys in keyring +|cffffffff%d|r currency types +|cffffffff%d|r items in vendor buyback +|cffffffff%d|r standard bags +|cffffffff%d|r bank bags', +'Tous les objets de %s ont été supprimés (sacs y-compris): +|cffffffff%d|r objet équipés +|cffffffff%d|r objets dans les sacs +|cffffffff%d|r objets en banque +|cffffffff%d|r clés dans le porte-clés +|cffffffff%d|r types de monnaies +|cffffffff%d|r objets dans l\'onglet rachat des vendeurs +|cffffffff%d|r sacs standard +|cffffffff%d|r sacs de banque' +); + +-- [END] // DB Update for .reset items command; + + diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 0358d14f6..a25f8698a 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -721,7 +721,7 @@ enum BankBagSlots // 7 slots enum BuyBackSlots // 12 slots { - // stored in m_buybackitems + // stored in m_items, there is no more m_buybackitems BUYBACK_SLOT_START = 74, BUYBACK_SLOT_END = 86 }; diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index bf1911b72..88dfbeb11 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -403,7 +403,19 @@ enum AcoreStrings LANG_COMMAND_CHEAT_WW = 362, LANG_COMMAND_WHISPEROFFPLAYER = 363, LANG_COMMAND_CHEAT_TAXINODES = 364, - // Room for more level 2 365-399 not used + + // [START] .reset items command strings: + LANG_COMMAND_RESET_ITEMS_EQUIPPED = 365, + LANG_COMMAND_RESET_ITEMS_BAGS = 366, + LANG_COMMAND_RESET_ITEMS_BANK = 367, + LANG_COMMAND_RESET_ITEMS_KEYRING = 368, + LANG_COMMAND_RESET_ITEMS_CURRENCY = 369, + LANG_COMMAND_RESET_ITEMS_BUYBACK = 370, + LANG_COMMAND_RESET_ITEMS_ALL = 371, + LANG_COMMAND_RESET_ITEMS_ALL_BAGS = 372, + // [END] reset items command strings + + // Room for more level 2 373-399 not used // level 3 chat LANG_SCRIPTS_RELOADED = 400, diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 81c4e742a..5ea17dca8 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -36,10 +36,22 @@ using namespace Acore::ChatCommands; class reset_commandscript : public CommandScript { public: + reset_commandscript() : CommandScript("reset_commandscript") { } ChatCommandTable GetCommands() const override { + static ChatCommandTable resetItemsCommandTable = + { + { "equipped", HandleResetItemsEquippedCommand, SEC_ADMINISTRATOR, Console::Yes }, + { "bags", HandleResetItemsInBagsCommand, SEC_ADMINISTRATOR, Console::Yes }, + { "bank", HandleResetItemsInBankCommand, SEC_ADMINISTRATOR, Console::Yes }, + { "keyring", HandleResetItemsKeyringCommand, SEC_ADMINISTRATOR, Console::Yes }, + { "currency", HandleResetItemsInCurrenciesListCommand, SEC_ADMINISTRATOR, Console::Yes }, + { "vendor_buyback", HandleResetItemsInVendorBuyBackTabCommand, SEC_ADMINISTRATOR, Console::Yes }, + { "all", HandleResetItemsAllCommand, SEC_ADMINISTRATOR, Console::Yes }, + { "allbags", HandleResetItemsAllAndDeleteBagsCommand, SEC_ADMINISTRATOR, Console::Yes }, + }; static ChatCommandTable resetCommandTable = { { "achievements", HandleResetAchievementsCommand, SEC_CONSOLE, Console::Yes }, @@ -48,6 +60,7 @@ public: { "spells", HandleResetSpellsCommand, SEC_ADMINISTRATOR, Console::Yes }, { "stats", HandleResetStatsCommand, SEC_ADMINISTRATOR, Console::Yes }, { "talents", HandleResetTalentsCommand, SEC_ADMINISTRATOR, Console::Yes }, + { "items", resetItemsCommandTable }, { "all", HandleResetAllCommand, SEC_CONSOLE, Console::Yes } }; static ChatCommandTable commandTable = @@ -296,6 +309,418 @@ public: return true; } + + static bool HandleResetItemsEquippedCommand(ChatHandler* handler, Optional target) + { + Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target); + + if (!targetPlayer) + { + return false; + } + else + { + int16 deletedItemsCount = ResetItemsEquipped(targetPlayer); + handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_EQUIPPED, deletedItemsCount, handler->GetNameLink(targetPlayer).c_str()); + } + + return true; + } + + static bool HandleResetItemsInBagsCommand(ChatHandler* handler, Optional target) + { + Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target); + + if (!targetPlayer) + { + return false; + } + else + { + int16 deletedItemsCount = ResetItemsInBags(targetPlayer); + handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_BAGS, deletedItemsCount, handler->GetNameLink(targetPlayer).c_str()); + } + + return true; + } + + static bool HandleResetItemsKeyringCommand(ChatHandler* handler, Optional target) + { + Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target); + + if (!targetPlayer) + { + return false; + } + else + { + int16 deletedItemsCount = ResetItemsInKeyring(targetPlayer); + handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_KEYRING, deletedItemsCount, handler->GetNameLink(targetPlayer).c_str()); + } + + return true; + } + + static bool HandleResetItemsInCurrenciesListCommand(ChatHandler* handler, Optional target) + { + Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target); + + if (!targetPlayer) + { + return false; + } + else + { + int16 deletedItemsCount = ResetItemsInCurrenciesList(targetPlayer); + handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_CURRENCY, deletedItemsCount, handler->GetNameLink(targetPlayer).c_str()); + } + + return true; + } + + static bool HandleResetItemsInBankCommand(ChatHandler* handler, Optional target) + { + Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target); + + if (!targetPlayer) + { + return false; + } + else + { + int16 deletedItemsCount = ResetItemsInBank(targetPlayer); + handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_BANK, deletedItemsCount, handler->GetNameLink(targetPlayer).c_str()); + } + + return true; + } + + static bool HandleResetItemsInVendorBuyBackTabCommand(ChatHandler* handler, Optional target) + { + Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target); + + if (!targetPlayer) + { + return false; + } + else + { + int16 deletedItemsCount = ResetItemsInVendorBuyBackTab(targetPlayer); + handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_BUYBACK, deletedItemsCount, handler->GetNameLink(targetPlayer).c_str()); + } + + return true; + } + + static bool HandleResetItemsAllCommand(ChatHandler* handler, Optional target) + { + Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target); + + if (!targetPlayer) + { + return false; + } + else + { + + // Delete all items destinations + int16 deletedItemsEquippedCount = ResetItemsEquipped(targetPlayer); + int16 deletedItemsInBagsCount = ResetItemsInBags(targetPlayer); + int16 deletedItemsInBankCount = ResetItemsInBank(targetPlayer); + int16 deletedItemsInKeyringCount = ResetItemsInKeyring(targetPlayer); + int16 deletedItemsInCurrenciesListCount = ResetItemsInCurrenciesList(targetPlayer); + int16 deletedItemsInVendorBuyBackTabCount = ResetItemsInVendorBuyBackTab(targetPlayer); + + handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_ALL, handler->GetNameLink(targetPlayer).c_str(), + deletedItemsEquippedCount, + deletedItemsInBagsCount, + deletedItemsInBankCount, + deletedItemsInKeyringCount, + deletedItemsInCurrenciesListCount, + deletedItemsInVendorBuyBackTabCount); + } + + return true; + } + + static bool HandleResetItemsAllAndDeleteBagsCommand(ChatHandler* handler, Optional target) + { + Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target); + + if (!targetPlayer) + { + return false; + } + else + { + + // Delete all items destinations + int16 deletedItemsEquippedCount = ResetItemsEquipped(targetPlayer); + int16 deletedItemsInBagsCount = ResetItemsInBags(targetPlayer); + int16 deletedItemsInBankCount = ResetItemsInBank(targetPlayer); + int16 deletedItemsInKeyringCount = ResetItemsInKeyring(targetPlayer); + int16 deletedItemsInCurrenciesListCount = ResetItemsInCurrenciesList(targetPlayer); + int16 deletedItemsInVendorBuyBackTabCount = ResetItemsInVendorBuyBackTab(targetPlayer); + int16 deletedItemsStandardBagsCount = ResetItemsDeleteStandardBags(targetPlayer); + int16 deletedItemsBankBagsCount = ResetItemsDeleteBankBags(targetPlayer); + + handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_ALL_BAGS, handler->GetNameLink(targetPlayer).c_str(), + deletedItemsEquippedCount, + deletedItemsInBagsCount, + deletedItemsInBankCount, + deletedItemsInKeyringCount, + deletedItemsInCurrenciesListCount, + deletedItemsInVendorBuyBackTabCount, + deletedItemsStandardBagsCount, + deletedItemsBankBagsCount); + } + + return true; + } + +private: + static Player* GetPlayerFromIdentifierOrSelectedTarget(ChatHandler* handler, Optional target) + { + Player* targetPlayer = nullptr; + + // Check if there is an optional target player name + // Do not use TargetOrSelf, we must be sure to select ourself + if (!target) + { + // No optional target, so try to get selected target + target = PlayerIdentifier::FromTarget(handler); + + if (!target) + { + // No character selected + handler->SendSysMessage(LANG_NO_CHAR_SELECTED); + return targetPlayer; + } + + targetPlayer = target->GetConnectedPlayer(); + } + else + { + targetPlayer = target->GetConnectedPlayer(); + + if (!targetPlayer || !target->IsConnected()) + { + // No character selected + handler->SendSysMessage(LANG_PLAYER_NOT_EXIST_OR_OFFLINE); + } + } + + return targetPlayer; + } + + static int16 ResetItemsEquipped(Player* playerTarget) + { + if (!playerTarget) + { + return -1; + } + + int16 count = 0; + for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) + { + Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem) + { + playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true); + ++count; + } + } + + return count; + } + + static int16 ResetItemsInBags(Player* playerTarget) + { + if (!playerTarget) + { + return -1; + } + + int16 count = 0; + // Default bagpack : + for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) + { + Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem) + { + playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true); + ++count; + } + } + + // Bag slots + for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + { + Bag* pBag = (Bag*)playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pBag) + { + for (uint8 j = 0; j < pBag->GetBagSize(); ++j) + { + Item* pItem = pBag->GetItemByPos(j); + if (pItem) + { + playerTarget->DestroyItem(i, j, true); + ++count; + } + } + } + } + + return count; + } + + static int16 ResetItemsInBank(Player* playerTarget) + { + if (!playerTarget) + { + return -1; + } + + int16 count = 0; + // Normal bank slot + for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + { + Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem) + { + playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true); + ++count; + } + } + + // Bank bagslots + for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) + { + Bag* pBag = (Bag*)playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pBag) + { + for (uint8 j = 0; j < pBag->GetBagSize(); ++j) + { + Item* pItem = pBag->GetItemByPos(j); + if (pItem) + { + playerTarget->DestroyItem(i, j, true); + ++count; + } + } + } + } + + return count; + } + + static int16 ResetItemsInKeyring(Player* playerTarget) + { + if (!playerTarget) + { + return -1; + } + + int16 count = 0; + for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i) + { + Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem) + { + playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true); + ++count; + } + } + + return count; + } + + static int16 ResetItemsInCurrenciesList(Player* playerTarget) + { + if (!playerTarget) + { + return -1; + } + + int16 count = 0; + for (uint8 i = CURRENCYTOKEN_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + { + Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pItem) + { + playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true); + ++count; + } + } + + return count; + } + + static int16 ResetItemsInVendorBuyBackTab(Player* playerTarget) + { + if (!playerTarget) + { + return -1; + } + + int16 count = 0; + for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; ++i) + { + Item* pItem = playerTarget->GetItemFromBuyBackSlot(i); + if (pItem) + { + playerTarget->RemoveItemFromBuyBackSlot(i, true); + ++count; + } + } + + return count; + } + + static int16 ResetItemsDeleteStandardBags(Player* playerTarget) + { + if (!playerTarget) + { + return -1; + } + + int16 count = 0; + // Standard bag slots + for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + { + Bag* pBag = (Bag*)playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pBag) + { + playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true); + ++count; + } + } + + return count; + } + + static int16 ResetItemsDeleteBankBags(Player* playerTarget) + { + if (!playerTarget) + { + return -1; + } + + int16 count = 0; + // Bank bags + for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) + { + Bag* pBag = (Bag*)playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (pBag) + { + // prevent no empty ? + playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true); + ++count; + } + } + + return count; + } }; void AddSC_reset_commandscript() From 9e5f65c5480dd217525f5448a594e77c0434477f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 15 Mar 2024 13:24:19 +0000 Subject: [PATCH 15/19] chore(DB): import pending files Referenced commit(s): ab02c36e67045e2c6a166cbd6db96ae466e061d0 --- .../rev_1708782048020249700.sql => db_world/2024_03_15_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1708782048020249700.sql => db_world/2024_03_15_00.sql} (99%) diff --git a/data/sql/updates/pending_db_world/rev_1708782048020249700.sql b/data/sql/updates/db_world/2024_03_15_00.sql similarity index 99% rename from data/sql/updates/pending_db_world/rev_1708782048020249700.sql rename to data/sql/updates/db_world/2024_03_15_00.sql index 8c795b423..492dfdbfc 100644 --- a/data/sql/updates/pending_db_world/rev_1708782048020249700.sql +++ b/data/sql/updates/db_world/2024_03_15_00.sql @@ -1,3 +1,4 @@ +-- DB update 2024_03_13_01 -> 2024_03_15_00 -- [START] // DB Update for .reset items command /*--------------------------------- From 64f372fca3b6dcffc4384f9eec227033fb7a3f26 Mon Sep 17 00:00:00 2001 From: Walter Pagani Date: Fri, 15 Mar 2024 20:09:10 -0300 Subject: [PATCH 16/19] chore. Avoid failures in the tests of custom items (#18519) * chore. Avoid failures in the tests of custom items * Report error but continue with the rest of the item * change LOG_ERROR for LOG_DEBUG --- src/server/game/Globals/ObjectMgr.cpp | 79 ++++++++++++++------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 12503649e..3eb3bdf2d 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2868,49 +2868,50 @@ void ObjectMgr::LoadItemTemplates() // Checks ItemEntry const* dbcitem = sItemStore.LookupEntry(entry); - if (dbcitem) + if (!dbcitem) { - if (enforceDBCAttributes) + LOG_DEBUG("sql.sql", "Item (Entry: {}) does not exist in item.dbc! (not correct id?).", entry); + continue; + } + + if (enforceDBCAttributes) + { + if (itemTemplate.Class != dbcitem->ClassID) { - if (itemTemplate.Class != dbcitem->ClassID) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Class value ({}), must be ({}).", entry, itemTemplate.Class, dbcitem->ClassID); - itemTemplate.Class = dbcitem->ClassID; - } - if (itemTemplate.SubClass != dbcitem->SubclassID) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Subclass value ({}) for class {}, must be ({}).", entry, itemTemplate.SubClass, itemTemplate.Class, dbcitem->SubclassID); - itemTemplate.SubClass = dbcitem->SubclassID; - } - if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclassID) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct SoundOverrideSubclass ({}), must be {}.", entry, itemTemplate.SoundOverrideSubclass, dbcitem->SoundOverrideSubclassID); - itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclassID; - } - if (itemTemplate.Material != dbcitem->Material) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct material ({}), must be {}.", entry, itemTemplate.Material, dbcitem->Material); - itemTemplate.Material = dbcitem->Material; - } - if (itemTemplate.InventoryType != dbcitem->InventoryType) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong InventoryType value ({}), must be {}.", entry, itemTemplate.InventoryType, dbcitem->InventoryType); - itemTemplate.InventoryType = dbcitem->InventoryType; - } - if (itemTemplate.DisplayInfoID != dbcitem->DisplayInfoID) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct display id ({}), must be {}.", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayInfoID); - itemTemplate.DisplayInfoID = dbcitem->DisplayInfoID; - } - if (itemTemplate.Sheath != dbcitem->SheatheType) - { - LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Sheath ({}), must be {}.", entry, itemTemplate.Sheath, dbcitem->SheatheType); - itemTemplate.Sheath = dbcitem->SheatheType; - } + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Class value ({}), must be ({}).", entry, itemTemplate.Class, dbcitem->ClassID); + itemTemplate.Class = dbcitem->ClassID; + } + if (itemTemplate.SubClass != dbcitem->SubclassID) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Subclass value ({}) for class {}, must be ({}).", entry, itemTemplate.SubClass, itemTemplate.Class, dbcitem->SubclassID); + itemTemplate.SubClass = dbcitem->SubclassID; + } + if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclassID) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct SoundOverrideSubclass ({}), must be {}.", entry, itemTemplate.SoundOverrideSubclass, dbcitem->SoundOverrideSubclassID); + itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclassID; + } + if (itemTemplate.Material != dbcitem->Material) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct material ({}), must be {}.", entry, itemTemplate.Material, dbcitem->Material); + itemTemplate.Material = dbcitem->Material; + } + if (itemTemplate.InventoryType != dbcitem->InventoryType) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong InventoryType value ({}), must be {}.", entry, itemTemplate.InventoryType, dbcitem->InventoryType); + itemTemplate.InventoryType = dbcitem->InventoryType; + } + if (itemTemplate.DisplayInfoID != dbcitem->DisplayInfoID) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have a correct display id ({}), must be {}.", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayInfoID); + itemTemplate.DisplayInfoID = dbcitem->DisplayInfoID; + } + if (itemTemplate.Sheath != dbcitem->SheatheType) + { + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Sheath ({}), must be {}.", entry, itemTemplate.Sheath, dbcitem->SheatheType); + itemTemplate.Sheath = dbcitem->SheatheType; } } - else - LOG_ERROR("sql.sql", "Item (Entry: {}) does not exist in item.dbc! (not correct id?).", entry); if (itemTemplate.Quality >= MAX_ITEM_QUALITY) { From 452ca39249428a94fda90368fe0d1397230e65c3 Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Sat, 16 Mar 2024 04:56:42 -0300 Subject: [PATCH 17/19] fix(Scripts/Commands): Fix crash when using additem from console (#18559) --- src/server/scripts/Commands/cs_misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 52fae57d5..0dc93612c 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1692,7 +1692,7 @@ public: Item* item = playerTarget->StoreNewItem(dest, itemId, true); - Player* p = handler->GetSession()->GetPlayer(); + Player* p = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; // remove binding (let GM give it to another player later) if (p && p == playerTarget) { From 42c41525dee79dc74bc06af8eabcc0055d5f7d3e Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Sat, 16 Mar 2024 21:28:40 +0100 Subject: [PATCH 18/19] fix(Scripts/TheEye): increase dagger proc chance and make sure mind control only targets players (#18563) --- data/sql/updates/pending_db_world/fix_dagger_proc.sql | 2 ++ src/server/game/Spells/SpellInfoCorrections.cpp | 6 ------ .../scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp | 3 +++ 3 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 data/sql/updates/pending_db_world/fix_dagger_proc.sql diff --git a/data/sql/updates/pending_db_world/fix_dagger_proc.sql b/data/sql/updates/pending_db_world/fix_dagger_proc.sql new file mode 100644 index 000000000..8948f54f6 --- /dev/null +++ b/data/sql/updates/pending_db_world/fix_dagger_proc.sql @@ -0,0 +1,2 @@ +-- +UPDATE `item_template` SET `spellppmRate_2` = 60 WHERE `entry` = 30312; diff --git a/src/server/game/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index fe687f238..560b68ceb 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.cpp @@ -4648,12 +4648,6 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT; }); - // Magic Disruption (KT dagger) - ApplySpellFix({ 36478 }, [](SpellInfo* spellInfo) - { - spellInfo->ProcChance = 100; - }); - // Commanding Shout ApplySpellFix({ 469, 47439, 47440 }, [](SpellInfo* spellInfo) { diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index d0b14118e..07bf60423 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -1159,7 +1159,10 @@ class spell_kaelthas_mind_control : public SpellScript void SelectTarget(std::list& targets) { if (Unit* victim = GetCaster()->GetVictim()) + { targets.remove_if(Acore::ObjectGUIDCheck(victim->GetGUID(), true)); + } + targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false)); } void Register() override From 1f878f7000d51fe5f14bafbb2cbb3806fb1c547e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 16 Mar 2024 20:29:41 +0000 Subject: [PATCH 19/19] chore(DB): import pending files Referenced commit(s): 42c41525dee79dc74bc06af8eabcc0055d5f7d3e --- .../fix_dagger_proc.sql => db_world/2024_03_16_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/fix_dagger_proc.sql => db_world/2024_03_16_00.sql} (63%) diff --git a/data/sql/updates/pending_db_world/fix_dagger_proc.sql b/data/sql/updates/db_world/2024_03_16_00.sql similarity index 63% rename from data/sql/updates/pending_db_world/fix_dagger_proc.sql rename to data/sql/updates/db_world/2024_03_16_00.sql index 8948f54f6..01822bb57 100644 --- a/data/sql/updates/pending_db_world/fix_dagger_proc.sql +++ b/data/sql/updates/db_world/2024_03_16_00.sql @@ -1,2 +1,3 @@ +-- DB update 2024_03_15_00 -> 2024_03_16_00 -- UPDATE `item_template` SET `spellppmRate_2` = 60 WHERE `entry` = 30312;