From a6c07ca16d1965a2e22433f2e6d4ae97b2e0301d Mon Sep 17 00:00:00 2001 From: brighton-chi Date: Sun, 3 Aug 2025 16:12:33 -0500 Subject: [PATCH 1/5] Improve attackaction failure message system (#1498) --- src/strategy/actions/AttackAction.cpp | 91 +++++++++++++-------------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/src/strategy/actions/AttackAction.cpp b/src/strategy/actions/AttackAction.cpp index 58c47128..e557a178 100644 --- a/src/strategy/actions/AttackAction.cpp +++ b/src/strategy/actions/AttackAction.cpp @@ -59,10 +59,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) bool sameTarget = oldTarget == target && bot->GetVictim() == target; bool inCombat = botAI->GetState() == BOT_STATE_COMBAT; bool sameAttackMode = bot->HasUnitState(UNIT_STATE_MELEE_ATTACKING) == shouldMelee; - // there's no reason to do attack again - if (sameTarget && inCombat && sameAttackMode) - return false; - + if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE || bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) { @@ -82,52 +79,53 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) if (!target->IsInWorld()) { + if (verbose) + botAI->TellError(std::string(target->GetName()) + " is no longer in the world."); + return false; + } + + if ((sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId()) || + sPlayerbotAIConfig->IsInPvpProhibitedArea(bot->GetAreaId())) + && (target->IsPlayer() || target->IsPet())) + { + if (verbose) + botAI->TellError("I cannot attack other players in PvP prohibited areas."); + + return false; + } + + if (bot->IsFriendlyTo(target)) + { + if (verbose) + botAI->TellError(std::string(target->GetName()) + " is friendly to me."); + return false; + } + + if (target->isDead()) + { + if (verbose) + botAI->TellError(std::string(target->GetName()) + " is dead."); + return false; + } + + if (!bot->IsWithinLOSInMap(target)) + { + if (verbose) + botAI->TellError(std::string(target->GetName()) + " is not in my sight."); + return false; + } + + if (sameTarget && inCombat && sameAttackMode) + { + if (verbose) + botAI->TellError("I am already attacking " + std::string(target->GetName()) + "."); return false; } if (!bot->IsValidAttackTarget(target)) { if (verbose) - botAI->TellError("I cannot attack an invalid target"); - - return false; - } - - std::ostringstream msg; - msg << target->GetName(); - - if (bot->IsFriendlyTo(target)) - { - msg << " is friendly to me"; - if (verbose) - botAI->TellError(msg.str()); - - return false; - } - - if (!bot->IsWithinLOSInMap(target)) - { - msg << " is not in my sight"; - if (verbose) - botAI->TellError(msg.str()); - - return false; - } - - if (target->isDead()) - { - msg << " is dead"; - if (verbose) - botAI->TellError(msg.str()); - - return false; - } - - if (sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId()) - && (target->IsPlayer() || target->IsPet())) - { - if (verbose) - botAI->TellError("I cannot attack others in PvP prohibited zones"); + botAI->TellError("I cannot attack an invalid target."); return false; } @@ -141,9 +139,7 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) ObjectGuid guid = target->GetGUID(); bot->SetSelection(target->GetGUID()); - - - context->GetValue("old target")->Set(oldTarget); + context->GetValue("old target")->Set(oldTarget); context->GetValue("current target")->Set(target); context->GetValue("available loot")->Get()->Add(guid); @@ -157,7 +153,6 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) bot->StopMoving(); } - if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target)) { sServerFacade->SetFacingTo(bot, target); From 0afcf2949095f87804cfca56bf4cc55432a27ee4 Mon Sep 17 00:00:00 2001 From: ThePenguinMan96 Date: Tue, 5 Aug 2025 00:10:06 -0700 Subject: [PATCH 2/5] Warlock Dismount Pet Fix (#1501) Hello everyone, This PR is to address #1489, where the warlock summons a pet when they dismount. A tester found that the cause was the "wrong pet" triggering "summon (pet)". I looked into the "wrong pet" trigger, and noticed that there was not a clause if there was no active pet. It was inadvertently casting "summon (pet)" because for a brief second after dismounting, the warlock didn't technically have a pet. I was able to recreate the issue based on tester feedback (dismounting with a warlock bot that has a pet). I tested this fix locally - it seems to work as intended. The warlock no longer attempts to summon a pet when dismounting. I tested it with nc +debug, and noticed that the "wrong pet" trigger was no longer firing. I also checked the logs - nothing. Thank y'all for the testing and feedback! --- src/strategy/warlock/WarlockTriggers.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/strategy/warlock/WarlockTriggers.cpp b/src/strategy/warlock/WarlockTriggers.cpp index 62d9c311..6a6aa865 100644 --- a/src/strategy/warlock/WarlockTriggers.cpp +++ b/src/strategy/warlock/WarlockTriggers.cpp @@ -207,7 +207,11 @@ bool WrongPetTrigger::IsActive() if (enabledCount != 1) return false; - // Step 3: At this point, we know only one pet strategy is enabled. + // Step 3: If there is no pet, do not trigger. + if (!pet) + return false; + + // Step 4: At this point, we know only one pet strategy is enabled. // We check if the currently summoned pet matches the enabled strategy. bool correctPet = false; if (pet) @@ -218,16 +222,16 @@ bool WrongPetTrigger::IsActive() correctPet = true; } - // Step 4: If the correct pet is already summoned, the trigger should not activate. + // Step 5: If the correct pet is already summoned, the trigger should not activate. if (correctPet) return false; - // Step 5: Finally, check if the bot actually knows the spell to summon the desired pet. + // Step 6: Finally, check if the bot actually knows the spell to summon the desired pet. // If so, the trigger is active (bot should summon the correct pet). if (bot->HasSpell(enabledPet->spellId)) return true; - // Step 6: If we get here, the bot doesn't know the spell required to support the active pet strategy + // Step 7: If we get here, the bot doesn't know the spell required to support the active pet strategy return false; } From f5ef5bd1c2039290be1b1108872d046e1e65ebe1 Mon Sep 17 00:00:00 2001 From: Alex Dcnh <140754794+Wishmaster117@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:31:00 +0200 Subject: [PATCH 3/5] Fix ACCESS_VIOLATION in mod-playerbots: purge stale AIs, add thread-safety, and harden HasRealPlayerMaster (#1507) --- src/PlayerbotAI.cpp | 30 +++++++++++++++++++++---- src/PlayerbotMgr.cpp | 52 ++++++++++++++++++++++++++++++++++++-------- src/PlayerbotMgr.h | 3 +++ src/Playerbots.cpp | 4 ++++ 4 files changed, 76 insertions(+), 13 deletions(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 48c44ae0..09a6ef82 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -3970,15 +3970,37 @@ bool IsAlliance(uint8 race) bool PlayerbotAI::HasRealPlayerMaster() { - if (master) +// if (master) +// { +// PlayerbotAI* masterBotAI = GET_PLAYERBOT_AI(master); +// return !masterBotAI || masterBotAI->IsRealPlayer(); +// } +// +// return false; + + // Removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) + /* 1) The "master" pointer can be null if the bot was created + without a master player or if the master was just removed. */ + if (!master) + return false; + + /* 2) Is the master player still present in the world? + If FindPlayer fails, we invalidate "master" and stop here. */ + if (!ObjectAccessor::FindPlayer(master->GetGUID())) { - PlayerbotAI* masterBotAI = GET_PLAYERBOT_AI(master); - return !masterBotAI || masterBotAI->IsRealPlayer(); + master = nullptr; // avoids repeating the check on the next tick + return false; } - return false; + /* 3) If the master is a bot, we check that it is itself controlled + by a real player. Otherwise, it's already a real player → true. */ + if (PlayerbotAI* masterBotAI = GET_PLAYERBOT_AI(master)) + return masterBotAI->IsRealPlayer(); // bot controlled by a player? + + return true; // master = real player } + bool PlayerbotAI::HasActivePlayerMaster() { return master && !GET_PLAYERBOT_AI(master); } bool PlayerbotAI::IsAlt() { return HasRealPlayerMaster() && !sRandomPlayerbotMgr->IsRandomBot(bot); } diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index 027e2bab..591512e3 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -38,6 +38,8 @@ #include "WorldSessionMgr.h" #include "DatabaseEnv.h" // Added for gender choice #include // Added for gender choice +#include "Log.h" // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) +#include // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) class BotInitGuard { @@ -1726,23 +1728,55 @@ void PlayerbotsMgr::RemovePlayerBotData(ObjectGuid const& guid, bool is_AI) PlayerbotAI* PlayerbotsMgr::GetPlayerbotAI(Player* player) { - if (!(sPlayerbotAIConfig->enabled) || !player) - { - return nullptr; - } - // if (player->GetSession()->isLogingOut() || player->IsDuringRemoveFromWorld()) { + // if (!(sPlayerbotAIConfig->enabled) || !player) + // { // return nullptr; // } - auto itr = _playerbotsAIMap.find(player->GetGUID()); - if (itr != _playerbotsAIMap.end()) - { - if (itr->second->IsBotAI()) + // // if (player->GetSession()->isLogingOut() || player->IsDuringRemoveFromWorld()) { + // // return nullptr; + // // } + // auto itr = _playerbotsAIMap.find(player->GetGUID()); + // if (itr != _playerbotsAIMap.end()) + // { + // if (itr->second->IsBotAI()) + // return reinterpret_cast(itr->second); + // } + // + // return nullptr; + + // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) + if (!sPlayerbotAIConfig->enabled || !player) + return nullptr; + + { // protected read + std::shared_lock lock(_aiMutex); + auto itr = _playerbotsAIMap.find(player->GetGUID()); + if (itr != _playerbotsAIMap.end() && itr->second->IsBotAI()) return reinterpret_cast(itr->second); } + // does the player still exist? + if (!ObjectAccessor::FindPlayer(player->GetGUID())) + RemovePlayerbotAI(player->GetGUID()); // orphaned AI -> cleanup + return nullptr; } +// removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) +void PlayerbotsMgr::RemovePlayerbotAI(ObjectGuid const& guid) +{ + std::unique_lock lock(_aiMutex); + + if (auto itr = _playerbotsAIMap.find(guid); itr != _playerbotsAIMap.end()) + { + delete itr->second; + _playerbotsAIMap.erase(itr); + LOG_DEBUG("playerbots", "Removed stale AI entry for GUID {}", static_cast(guid.GetRawValue())); + } + + _playerbotsMgrMap.erase(guid); +} + PlayerbotMgr* PlayerbotsMgr::GetPlayerbotMgr(Player* player) { if (!(sPlayerbotAIConfig->enabled) || !player) diff --git a/src/PlayerbotMgr.h b/src/PlayerbotMgr.h index 5ef31776..44343163 100644 --- a/src/PlayerbotMgr.h +++ b/src/PlayerbotMgr.h @@ -12,6 +12,7 @@ #include "PlayerbotAIBase.h" #include "QueryHolder.h" #include "QueryResult.h" +#include // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) class ChatHandler; class PlayerbotAI; @@ -114,11 +115,13 @@ public: void RemovePlayerBotData(ObjectGuid const& guid, bool is_AI); PlayerbotAI* GetPlayerbotAI(Player* player); + void RemovePlayerbotAI(ObjectGuid const& guid); // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) PlayerbotMgr* GetPlayerbotMgr(Player* player); private: std::unordered_map _playerbotsAIMap; std::unordered_map _playerbotsMgrMap; + mutable std::shared_mutex _aiMutex; // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) }; #define sPlayerbotsMgr PlayerbotsMgr::instance() diff --git a/src/Playerbots.cpp b/src/Playerbots.cpp index 07b2bf94..27c4c685 100644 --- a/src/Playerbots.cpp +++ b/src/Playerbots.cpp @@ -363,6 +363,10 @@ public: void OnPlayerbotLogout(Player* player) override { + // immediate purge of the bot's AI upon disconnection + if (player && player->GetSession()->IsBot()) + sPlayerbotsMgr->RemovePlayerbotAI(player->GetGUID()); // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) + if (PlayerbotMgr* playerbotMgr = GET_PLAYERBOT_MGR(player)) { PlayerbotAI* botAI = GET_PLAYERBOT_AI(player); From 966bf1d6afbf946ac92931b7d572fd76d79c56b0 Mon Sep 17 00:00:00 2001 From: Alex Dcnh <140754794+Wishmaster117@users.noreply.github.com> Date: Fri, 8 Aug 2025 20:36:03 +0200 Subject: [PATCH 4/5] Correct side effects of merge f5ef5bd1c2039290be1b1108872d046e1e65ebe1 (#1512) * Update PlayerbotMgr.h * Update PlayerbotMgr.cpp * Update PlayerbotMgr.cpp * Update PlayerbotMgr.cpp * Update PlayerbotMgr.cpp * Update PlayerbotMgr.cpp * Update PlayerbotMgr.cpp * Update PlayerbotMgr.h * Update PlayerbotMgr.cpp * Update PlayerbotMgr.h * Update PlayerbotMgr.cpp * Update PlayerbotMgr.h * Update PlayerbotMgr.h --- src/PlayerbotMgr.cpp | 53 +++++++++++++++++++++++++++++--------------- src/PlayerbotMgr.h | 25 ++++++++++++++++++++- 2 files changed, 59 insertions(+), 19 deletions(-) diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index 591512e3..0b6d3967 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -1745,36 +1745,53 @@ PlayerbotAI* PlayerbotsMgr::GetPlayerbotAI(Player* player) // return nullptr; // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) - if (!sPlayerbotAIConfig->enabled || !player) + if (!player || !sPlayerbotAIConfig->enabled) return nullptr; - - { // protected read - std::shared_lock lock(_aiMutex); - auto itr = _playerbotsAIMap.find(player->GetGUID()); - if (itr != _playerbotsAIMap.end() && itr->second->IsBotAI()) - return reinterpret_cast(itr->second); + + // First read the GUID into a local variable, but ONLY after the check! + ObjectGuid guid = player->GetGUID(); // <-- OK here, we know that player != nullptr + { + std::shared_lock rlock(_aiMutex); + auto it = _playerbotsAIMap.find(guid); + if (it != _playerbotsAIMap.end() && it->second->IsBotAI()) + return static_cast(it->second); } - // does the player still exist? - if (!ObjectAccessor::FindPlayer(player->GetGUID())) - RemovePlayerbotAI(player->GetGUID()); // orphaned AI -> cleanup - + // Transient state: NEVER break the master ⇄ bots relationship here. + if (!ObjectAccessor::FindPlayer(guid)) + { + RemovePlayerbotAI(guid, /*removeMgrEntry=*/false); + } return nullptr; } // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) -void PlayerbotsMgr::RemovePlayerbotAI(ObjectGuid const& guid) +PlayerbotAI* PlayerbotsMgr::GetPlayerbotAIByGuid(ObjectGuid guid) { - std::unique_lock lock(_aiMutex); + if (!sPlayerbotAIConfig->enabled) + return nullptr; - if (auto itr = _playerbotsAIMap.find(guid); itr != _playerbotsAIMap.end()) + std::shared_lock rlock(_aiMutex); + auto it = _playerbotsAIMap.find(guid); + if (it != _playerbotsAIMap.end() && it->second->IsBotAI()) + return static_cast(it->second); + return nullptr; +} + +void PlayerbotsMgr::RemovePlayerbotAI(ObjectGuid const& guid, bool removeMgrEntry /*= true*/) +{ + std::unique_lock wlock(_aiMutex); + + if (auto it = _playerbotsAIMap.find(guid); it != _playerbotsAIMap.end()) { - delete itr->second; - _playerbotsAIMap.erase(itr); - LOG_DEBUG("playerbots", "Removed stale AI entry for GUID {}", static_cast(guid.GetRawValue())); + delete it->second; + _playerbotsAIMap.erase(it); + LOG_DEBUG("playerbots", "Removed stale AI for GUID {}", + static_cast(guid.GetRawValue())); } - _playerbotsMgrMap.erase(guid); + if (removeMgrEntry) + _playerbotsMgrMap.erase(guid); // we NO longer touch the relation in a "soft" purge } PlayerbotMgr* PlayerbotsMgr::GetPlayerbotMgr(Player* player) diff --git a/src/PlayerbotMgr.h b/src/PlayerbotMgr.h index 44343163..17a49612 100644 --- a/src/PlayerbotMgr.h +++ b/src/PlayerbotMgr.h @@ -115,7 +115,11 @@ public: void RemovePlayerBotData(ObjectGuid const& guid, bool is_AI); PlayerbotAI* GetPlayerbotAI(Player* player); - void RemovePlayerbotAI(ObjectGuid const& guid); // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) + PlayerbotAI* GetPlayerbotAIByGuid(ObjectGuid guid); // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) + // void RemovePlayerbotAI(ObjectGuid const& guid); // removes a long-standing crash (0xC0000005 ACCESS_VIOLATION) + // removeMgrEntry = true => "hard" purge (AI + manager relation), for real logouts + // removeMgrEntry = false => "soft" purge (AI only), for detected "stale" cases + void RemovePlayerbotAI(ObjectGuid const& guid, bool removeMgrEntry = true); PlayerbotMgr* GetPlayerbotMgr(Player* player); private: @@ -126,4 +130,23 @@ private: #define sPlayerbotsMgr PlayerbotsMgr::instance() +// Temporary addition If it keeps crashing, we will use them. +// Like +// BEFORE : PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); +// AFTER (safe) : PlayerbotAI* botAI = GET_PLAYERBOT_AI_SAFE(bot); +// BEFORE : if (PlayerbotAI* botAI = GET_PLAYERBOT_AI(player)) { ... } +// AFTER (safe) : if (PlayerbotAI* botAI = GET_PLAYERBOT_AI_SAFE(player)) { ... } +// --- SAFE helpers (append to PlayerbotMgr.h) --- +inline PlayerbotAI* GET_PLAYERBOT_AI_SAFE(Player* p) +{ + // Avoid any dereference during transient states (nullptr, teleport, flight, etc.) + return p ? sPlayerbotsMgr->GetPlayerbotAI(p) : nullptr; +} + +inline PlayerbotMgr* GET_PLAYERBOT_MGR_SAFE(Player* p) +{ + return p ? sPlayerbotsMgr->GetPlayerbotMgr(p) : nullptr; +} +// --- end SAFE helpers --- + #endif From a307eb2f088f57c26feb425d2d817eef076ab5be Mon Sep 17 00:00:00 2001 From: Yunfan Li <56597220+liyunfan1223@users.noreply.github.com> Date: Sat, 9 Aug 2025 19:17:33 +0800 Subject: [PATCH 5/5] VisitAllObjects to VisitObjects (sync with acore) (#1513) --- src/RandomPlayerbotMgr.cpp | 2 +- src/strategy/actions/RevealGatheringItemAction.cpp | 2 +- src/strategy/actions/TravelAction.cpp | 2 +- src/strategy/actions/UseMeetingStoneAction.cpp | 4 ++-- src/strategy/raids/icecrown/RaidIccActions.cpp | 2 +- src/strategy/values/CollisionValue.cpp | 2 +- src/strategy/values/NearestCorpsesValue.cpp | 2 +- src/strategy/values/NearestFriendlyPlayersValue.cpp | 2 +- src/strategy/values/NearestGameObjects.cpp | 4 ++-- src/strategy/values/NearestNonBotPlayersValue.cpp | 2 +- src/strategy/values/NearestNpcsValue.cpp | 10 +++++----- src/strategy/values/PossibleRpgTargetsValue.cpp | 6 +++--- src/strategy/values/PossibleTargetsValue.cpp | 4 ++-- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index fd29b1df..1b69d7f3 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -2180,7 +2180,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot) float range = sPlayerbotAIConfig->randomBotTeleportDistance; Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); if (!targets.empty()) { diff --git a/src/strategy/actions/RevealGatheringItemAction.cpp b/src/strategy/actions/RevealGatheringItemAction.cpp index 75b6548d..5697347f 100644 --- a/src/strategy/actions/RevealGatheringItemAction.cpp +++ b/src/strategy/actions/RevealGatheringItemAction.cpp @@ -39,7 +39,7 @@ bool RevealGatheringItemAction::Execute(Event event) std::list targets; AnyGameObjectInObjectRangeCheck u_check(bot, sPlayerbotAIConfig->grindDistance); Acore::GameObjectListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, sPlayerbotAIConfig->reactDistance); + Cell::VisitObjects(bot, searcher, sPlayerbotAIConfig->reactDistance); std::vector result; for (GameObject* go : targets) diff --git a/src/strategy/actions/TravelAction.cpp b/src/strategy/actions/TravelAction.cpp index 60a3244c..4d7ce96e 100644 --- a/src/strategy/actions/TravelAction.cpp +++ b/src/strategy/actions/TravelAction.cpp @@ -23,7 +23,7 @@ bool TravelAction::Execute(Event event) std::list targets; Acore::AnyUnitInObjectRangeCheck u_check(bot, sPlayerbotAIConfig->sightDistance * 2); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, sPlayerbotAIConfig->sightDistance); + Cell::VisitObjects(bot, searcher, sPlayerbotAIConfig->sightDistance); for (Unit* unit : targets) { diff --git a/src/strategy/actions/UseMeetingStoneAction.cpp b/src/strategy/actions/UseMeetingStoneAction.cpp index 025092cf..8319ee3b 100644 --- a/src/strategy/actions/UseMeetingStoneAction.cpp +++ b/src/strategy/actions/UseMeetingStoneAction.cpp @@ -110,7 +110,7 @@ bool SummonAction::SummonUsingGos(Player* summoner, Player* player) std::list targets; AnyGameObjectInObjectRangeCheck u_check(summoner, sPlayerbotAIConfig->sightDistance); Acore::GameObjectListSearcher searcher(summoner, targets, u_check); - Cell::VisitAllObjects(summoner, searcher, sPlayerbotAIConfig->sightDistance); + Cell::VisitObjects(summoner, searcher, sPlayerbotAIConfig->sightDistance); for (GameObject* go : targets) { @@ -130,7 +130,7 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player) std::list targets; Acore::AnyUnitInObjectRangeCheck u_check(summoner, sPlayerbotAIConfig->sightDistance); Acore::UnitListSearcher searcher(summoner, targets, u_check); - Cell::VisitAllObjects(summoner, searcher, sPlayerbotAIConfig->sightDistance); + Cell::VisitObjects(summoner, searcher, sPlayerbotAIConfig->sightDistance); for (Unit* unit : targets) { diff --git a/src/strategy/raids/icecrown/RaidIccActions.cpp b/src/strategy/raids/icecrown/RaidIccActions.cpp index 5207290a..eaad5d2f 100644 --- a/src/strategy/raids/icecrown/RaidIccActions.cpp +++ b/src/strategy/raids/icecrown/RaidIccActions.cpp @@ -6549,7 +6549,7 @@ bool IccSindragosaFrostBombAction::Execute(Event event) float range = 200.0f; Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, units, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); for (Unit* unit : units) { diff --git a/src/strategy/values/CollisionValue.cpp b/src/strategy/values/CollisionValue.cpp index 119bfc94..52ae8f06 100644 --- a/src/strategy/values/CollisionValue.cpp +++ b/src/strategy/values/CollisionValue.cpp @@ -21,7 +21,7 @@ bool CollisionValue::Calculate() float range = sPlayerbotAIConfig->contactDistance; Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); for (Unit* target : targets) { diff --git a/src/strategy/values/NearestCorpsesValue.cpp b/src/strategy/values/NearestCorpsesValue.cpp index b79e7422..59fe3167 100644 --- a/src/strategy/values/NearestCorpsesValue.cpp +++ b/src/strategy/values/NearestCorpsesValue.cpp @@ -26,7 +26,7 @@ void NearestCorpsesValue::FindUnits(std::list& targets) { AnyDeadUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool NearestCorpsesValue::AcceptUnit(Unit* unit) { return true; } diff --git a/src/strategy/values/NearestFriendlyPlayersValue.cpp b/src/strategy/values/NearestFriendlyPlayersValue.cpp index 2a0ee89e..f8f92ad0 100644 --- a/src/strategy/values/NearestFriendlyPlayersValue.cpp +++ b/src/strategy/values/NearestFriendlyPlayersValue.cpp @@ -14,7 +14,7 @@ void NearestFriendlyPlayersValue::FindUnits(std::list& targets) { Acore::AnyFriendlyUnitInObjectRangeCheck u_check(bot, bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool NearestFriendlyPlayersValue::AcceptUnit(Unit* unit) diff --git a/src/strategy/values/NearestGameObjects.cpp b/src/strategy/values/NearestGameObjects.cpp index 85a34282..131c730f 100644 --- a/src/strategy/values/NearestGameObjects.cpp +++ b/src/strategy/values/NearestGameObjects.cpp @@ -17,7 +17,7 @@ GuidVector NearestGameObjects::Calculate() std::list targets; AnyGameObjectInObjectRangeCheck u_check(bot, range); Acore::GameObjectListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); GuidVector result; for (GameObject* go : targets) @@ -34,7 +34,7 @@ GuidVector NearestTrapWithDamageValue::Calculate() std::list targets; AnyGameObjectInObjectRangeCheck u_check(bot, range); Acore::GameObjectListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); GuidVector result; for (GameObject* go : targets) diff --git a/src/strategy/values/NearestNonBotPlayersValue.cpp b/src/strategy/values/NearestNonBotPlayersValue.cpp index 6ab733e8..1fb72360 100644 --- a/src/strategy/values/NearestNonBotPlayersValue.cpp +++ b/src/strategy/values/NearestNonBotPlayersValue.cpp @@ -14,7 +14,7 @@ void NearestNonBotPlayersValue::FindUnits(std::list& targets) { Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool NearestNonBotPlayersValue::AcceptUnit(Unit* unit) diff --git a/src/strategy/values/NearestNpcsValue.cpp b/src/strategy/values/NearestNpcsValue.cpp index 3b9e553f..b2b510da 100644 --- a/src/strategy/values/NearestNpcsValue.cpp +++ b/src/strategy/values/NearestNpcsValue.cpp @@ -15,7 +15,7 @@ void NearestNpcsValue::FindUnits(std::list& targets) { Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool NearestNpcsValue::AcceptUnit(Unit* unit) { return !unit->IsPlayer(); } @@ -24,7 +24,7 @@ void NearestHostileNpcsValue::FindUnits(std::list& targets) { Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool NearestHostileNpcsValue::AcceptUnit(Unit* unit) { return unit->IsHostileTo(bot) && !unit->IsPlayer(); } @@ -33,7 +33,7 @@ void NearestVehiclesValue::FindUnits(std::list& targets) { Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool NearestVehiclesValue::AcceptUnit(Unit* unit) @@ -52,7 +52,7 @@ void NearestTriggersValue::FindUnits(std::list& targets) { Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(bot, bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool NearestTriggersValue::AcceptUnit(Unit* unit) { return !unit->IsPlayer(); } @@ -61,7 +61,7 @@ void NearestTotemsValue::FindUnits(std::list& targets) { Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool NearestTotemsValue::AcceptUnit(Unit* unit) { return unit->IsTotem(); } diff --git a/src/strategy/values/PossibleRpgTargetsValue.cpp b/src/strategy/values/PossibleRpgTargetsValue.cpp index cee20d9b..858bc2ba 100644 --- a/src/strategy/values/PossibleRpgTargetsValue.cpp +++ b/src/strategy/values/PossibleRpgTargetsValue.cpp @@ -49,7 +49,7 @@ void PossibleRpgTargetsValue::FindUnits(std::list& targets) { Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit) @@ -141,7 +141,7 @@ void PossibleNewRpgTargetsValue::FindUnits(std::list& targets) { Acore::AnyUnitInObjectRangeCheck u_check(bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool PossibleNewRpgTargetsValue::AcceptUnit(Unit* unit) @@ -168,7 +168,7 @@ GuidVector PossibleNewRpgGameObjectsValue::Calculate() std::list targets; AnyGameObjectInObjectRangeCheck u_check(bot, range); Acore::GameObjectListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); std::vector> guidDistancePairs; diff --git a/src/strategy/values/PossibleTargetsValue.cpp b/src/strategy/values/PossibleTargetsValue.cpp index f4622298..6d31993d 100644 --- a/src/strategy/values/PossibleTargetsValue.cpp +++ b/src/strategy/values/PossibleTargetsValue.cpp @@ -21,7 +21,7 @@ void PossibleTargetsValue::FindUnits(std::list& targets) { Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(bot, bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool PossibleTargetsValue::AcceptUnit(Unit* unit) { return AttackersValue::IsPossibleTarget(unit, bot, range); } @@ -30,7 +30,7 @@ void PossibleTriggersValue::FindUnits(std::list& targets) { Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(bot, bot, range); Acore::UnitListSearcher searcher(bot, targets, u_check); - Cell::VisitAllObjects(bot, searcher, range); + Cell::VisitObjects(bot, searcher, range); } bool PossibleTriggersValue::AcceptUnit(Unit* unit)