From 762ef49e4a8a12ddb8a6763931615d49f486b9e6 Mon Sep 17 00:00:00 2001 From: Fuzz Date: Wed, 26 Jun 2024 16:34:47 +1000 Subject: [PATCH 1/4] [Log] Reduced spam of 'xxx failed because has current channeled spell' by making it respect the AiPlayerbot.LogInGroupOnly setting (like related spell errors) --- src/PlayerbotAI.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index 310cc3ad..f3e865d6 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -2174,8 +2174,10 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, } if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr) { - LOG_DEBUG("playerbots", "CanCastSpell() target name: {}, spellid: {}, bot name: {}, failed because has current channeled spell", - target->GetName(), spellid, bot->GetName()); + if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { + LOG_DEBUG("playerbots", "CanCastSpell() target name: {}, spellid: {}, bot name: {}, failed because has current channeled spell", + target->GetName(), spellid, bot->GetName()); + } return false; } From c7bc35975278cc84e8e6b7293e53df0de0bc45df Mon Sep 17 00:00:00 2001 From: Fuzz Date: Wed, 26 Jun 2024 17:10:24 +1000 Subject: [PATCH 2/4] [Typo] Fixed inconsistent name for the co adds strategy - added with co +ads removed with co -adds (ads verses adDs), now uses adds name for both. Fortunately this isn't referred to by 'ads' anywhere else (not in AiFactory.cpp and dont think its used by UnBot addon either) --- src/strategy/StrategyContext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strategy/StrategyContext.h b/src/strategy/StrategyContext.h index 53c3f699..55bdc4bc 100644 --- a/src/strategy/StrategyContext.h +++ b/src/strategy/StrategyContext.h @@ -87,7 +87,7 @@ class StrategyContext : public NamedObjectContext creators["map full"] = &StrategyContext::map_full; creators["sit"] = &StrategyContext::sit; creators["mark rti"] = &StrategyContext::mark_rti; - creators["ads"] = &StrategyContext::possible_adds; + creators["adds"] = &StrategyContext::possible_adds; creators["close"] = &StrategyContext::close; creators["ranged"] = &StrategyContext::ranged; creators["behind"] = &StrategyContext::behind; From 1e227382485f1d90a13bc08e382b643a2552ce02 Mon Sep 17 00:00:00 2001 From: Fuzz Date: Wed, 26 Jun 2024 17:24:39 +1000 Subject: [PATCH 3/4] [Crash Fix] Fixed crashing a few min after server start when AiPlayerbot.PerfMonEnabled=1 (would crash with ACCESS_VIOLATION on first PlayerbotFactory::Randomize() call due to pmo->finish() being called twice on same variable). Also fixed formatting used in PerformanceMonitor::PrintStats() (would print %7.3f etc to screen instead of format the number) --- src/PerformanceMonitor.cpp | 10 ++++------ src/PlayerbotFactory.cpp | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/PerformanceMonitor.cpp b/src/PerformanceMonitor.cpp index eac5fe3e..d74de730 100644 --- a/src/PerformanceMonitor.cpp +++ b/src/PerformanceMonitor.cpp @@ -59,7 +59,7 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) total += map.second->totalTime; LOG_INFO("playerbots", "--------------------------------------[TOTAL BOT]------------------------------------------------------"); - LOG_INFO("playerbots", "percentage time | min .. max ( avg of count ) - type : name "); + LOG_INFO("playerbots", "percentage time | min .. max ( avg of count) - type : name"); for (std::map>::iterator i = data.begin(); i != data.end(); ++i) { @@ -115,7 +115,7 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) if (avg >= 0.5f || pd->maxTime > 10) { - LOG_INFO("playerbots", "%7.3f%% %10.3fs | %6u .. %6u (%9.4f of %10u) - {} : {}" + LOG_INFO("playerbots", "{:7.3f}% {:10.3f}s | {:6d} .. {:6d} ({:10.3f} of {:10d}) - {:6} : {}" , perc , secs , pd->minTime @@ -134,10 +134,8 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) float totalCount = data[PERF_MON_TOTAL]["RandomPlayerbotMgr::FullTick"]->count; total = data[PERF_MON_TOTAL]["RandomPlayerbotMgr::FullTick"]->totalTime; - LOG_INFO("playerbots", " "); - LOG_INFO("playerbots", " "); LOG_INFO("playerbots", "---------------------------------------[PER TICK]------------------------------------------------------"); - LOG_INFO("playerbots", "percentage time | min .. max ( avg of count ) - type : name "); + LOG_INFO("playerbots", "percentage time | min .. max ( avg of count) - type : name"); for (std::map>::iterator i = data.begin(); i != data.end(); ++i) { @@ -190,7 +188,7 @@ void PerformanceMonitor::PrintStats(bool perTick, bool fullStack) if (avg >= 0.5f || pd->maxTime > 10) { - LOG_INFO("playerbots", "%7.3f%% %9ums | %6u .. %6u (%9.4f of %10.3f) - {} : {}" + LOG_INFO("playerbots", "{:7.3f}% {:9d}ms | {:6d} .. {:6d} ({:10.3f} of {:10.3f}) - {:6} : {}" , perc , secs , pd->minTime diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index 1512046d..6f7f0dfb 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -357,8 +357,8 @@ void PlayerbotFactory::Randomize(bool incremental) // bot->SaveToDB(false, false); // InitGuild(); // bot->SaveToDB(false, false); - if (pmo) - pmo->finish(); + //if (pmo) + // pmo->finish(); // if (bot->getLevel() >= 70) // { From 6dddab7c1a8e6c1c6e747eb63b31e38c580568ef Mon Sep 17 00:00:00 2001 From: Fuzz Date: Wed, 26 Jun 2024 17:28:50 +1000 Subject: [PATCH 4/4] [Misc] fixed dead code, unused variables other merge errors introduced by commit 3879b5116e344469b33d60e05bb7ad05a27cfe7f --- .../actions/BattleGroundJoinAction.cpp | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/strategy/actions/BattleGroundJoinAction.cpp b/src/strategy/actions/BattleGroundJoinAction.cpp index e64a2567..05ca2796 100644 --- a/src/strategy/actions/BattleGroundJoinAction.cpp +++ b/src/strategy/actions/BattleGroundJoinAction.cpp @@ -250,30 +250,13 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun bool hasBots = (sRandomPlayerbotMgr->BgBots[queueTypeId][bracketId][TEAM_ALLIANCE] + sRandomPlayerbotMgr->BgBots[queueTypeId][bracketId][TEAM_HORDE]) >= bg->GetMinPlayersPerTeam(); if (!sPlayerbotAIConfig->randomBotAutoJoinBG && !hasPlayers) - { return false; - if (sPlayerbotAIConfig->enablePrototypePerformanceDiff) - { - if (!noLag) - { - return false; - } - } - } - - if (!hasPlayers && !(isArena)) - { + if (!(hasPlayers || hasBots)) return false; - if (sPlayerbotAIConfig->enablePrototypePerformanceDiff) - { - if (!noLag) - { - return false; - } - } - } + if (sPlayerbotAIConfig->enablePrototypePerformanceDiff && !hasPlayers && !noLag) + return false; uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2; uint32 TeamSize = bg->GetMaxPlayersPerTeam(); @@ -607,7 +590,6 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg bool isArena = false; bool isRated = false; - bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty() ? sPlayerbotAIConfig->diffEmpty : sPlayerbotAIConfig->diffWithPlayer) * 1.1; ArenaType type = ArenaType(BattlegroundMgr::BGArenaType(queueTypeId)); if (type != ARENA_TYPE_NONE)