Fix formatting and use correct value data type

This commit is contained in:
CrypticAvacado
2024-07-29 20:45:00 +12:00
parent f1114d71d2
commit 804c3adbd3
5 changed files with 77 additions and 62 deletions

View File

@@ -3278,7 +3278,8 @@ void PlayerbotFactory::InitArenaTeam()
{ {
LOG_INFO("playerbots", "Deleting random bot arena teams..."); LOG_INFO("playerbots", "Deleting random bot arena teams...");
for (auto it = sArenaTeamMgr->GetArenaTeams().begin(); it != sArenaTeamMgr->GetArenaTeams().end(); ++it) { for (auto it = sArenaTeamMgr->GetArenaTeams().begin(); it != sArenaTeamMgr->GetArenaTeams().end(); ++it)
{
ArenaTeam* arenateam = it->second; ArenaTeam* arenateam = it->second;
if (arenateam->GetCaptain() && arenateam->GetCaptain().IsPlayer()) if (arenateam->GetCaptain() && arenateam->GetCaptain().IsPlayer())
{ {
@@ -3338,7 +3339,8 @@ void PlayerbotFactory::InitArenaTeam()
continue; continue;
ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(arenaTeamId); ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (team){ if (team)
{
if (sCharacterCache->GetCharacterArenaTeamIdByGuid(bot->GetGUID(), team->GetSlot()) != 0) if (sCharacterCache->GetCharacterArenaTeamIdByGuid(bot->GetGUID(), team->GetSlot()) != 0)
{ {
return; return;

View File

@@ -751,7 +751,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
if(bot->InBattleground()) if(bot->InBattleground())
{ {
std::vector<int>* instanceIds = nullptr; std::vector<uint32>* instanceIds = nullptr;
uint32 instanceId = bot->GetBattleground()->GetInstanceID(); uint32 instanceId = bot->GetBattleground()->GetInstanceID();
bool isArena = false; bool isArena = false;
bool isRated = false; bool isRated = false;
@@ -843,14 +843,16 @@ void RandomPlayerbotMgr::CheckBgQueue()
void RandomPlayerbotMgr::LogBattlegroundInfo() void RandomPlayerbotMgr::LogBattlegroundInfo()
{ {
for (const auto& queueTypePair : BattlegroundData) { for (const auto& queueTypePair : BattlegroundData)
{
uint8 queueType = queueTypePair.first; uint8 queueType = queueTypePair.first;
BattlegroundQueueTypeId queueTypeId = BattlegroundQueueTypeId(queueType); BattlegroundQueueTypeId queueTypeId = BattlegroundQueueTypeId(queueType);
if (uint8 type = BattlegroundMgr::BGArenaType(queueTypeId)) if (uint8 type = BattlegroundMgr::BGArenaType(queueTypeId))
{ {
for (const auto& bracketIdPair : queueTypePair.second) { for (const auto& bracketIdPair : queueTypePair.second)
{
auto& bgInfo = bracketIdPair.second; auto& bgInfo = bracketIdPair.second;
LOG_INFO("playerbots", "ARENA:{} {}: Player (Skirmish:{}, Rated:{}) Bots (Skirmish:{}, Rated:{}) Total (Skirmish:{} Rated:{}), Instances (Skirmish:{} Rated:{})", LOG_INFO("playerbots", "ARENA:{} {}: Player (Skirmish:{}, Rated:{}) Bots (Skirmish:{}, Rated:{}) Total (Skirmish:{} Rated:{}), Instances (Skirmish:{} Rated:{})",
@@ -892,7 +894,8 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
break; break;
} }
for (const auto& bracketIdPair : queueTypePair.second) { for (const auto& bracketIdPair : queueTypePair.second)
{
auto& bgInfo = bracketIdPair.second; auto& bgInfo = bracketIdPair.second;
LOG_INFO("playerbots", "BG:{} {}: Player ({}:{}) Bot ({}:{}) Total (A:{} H:{}), Instances {}", LOG_INFO("playerbots", "BG:{} {}: Player ({}:{}) Bot ({}:{}) Total (A:{} H:{}), Instances {}",
@@ -902,7 +905,7 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
bgInfo.bgInstanceCount); bgInfo.bgInstanceCount);
} }
} }
LOG_INFO("playerbots", "====== BATTLEGROUND/ARENA Check Finished ======="); LOG_INFO("playerbots", "BG Queue check finished");
} }
void RandomPlayerbotMgr::CheckLfgQueue() void RandomPlayerbotMgr::CheckLfgQueue()

View File

@@ -8,33 +8,33 @@
#include "PlayerbotMgr.h" #include "PlayerbotMgr.h"
struct BattlegroundInfo { struct BattlegroundInfo {
std::vector<int> bgInstances; std::vector<uint32> bgInstances;
std::vector<int> ratedArenaInstances; std::vector<uint32> ratedArenaInstances;
std::vector<int> skirmishArenaInstances; std::vector<uint32> skirmishArenaInstances;
int bgInstanceCount = 0; uint32 bgInstanceCount = 0;
int ratedArenaInstanceCount = 0; uint32 ratedArenaInstanceCount = 0;
int skirmishArenaInstanceCount = 0; uint32 skirmishArenaInstanceCount = 0;
int minLevel = 0; uint32 minLevel = 0;
int maxLevel = 0; uint32 maxLevel = 0;
int activeRatedArenaQueue = 0; // 0 = Inactive, 1 = Active uint32 activeRatedArenaQueue = 0; // 0 = Inactive, 1 = Active
int activeSkirmishArenaQueue = 0; // 0 = Inactive, 1 = Active uint32 activeSkirmishArenaQueue = 0; // 0 = Inactive, 1 = Active
int activeBgQueue = 0; // 0 = Inactive, 1 = Active uint32 activeBgQueue = 0; // 0 = Inactive, 1 = Active
// Bots (Arena) // Bots (Arena)
int ratedArenaBotCount = 0; uint32 ratedArenaBotCount = 0;
int skirmishArenaBotCount = 0; uint32 skirmishArenaBotCount = 0;
// Bots (Battleground) // Bots (Battleground)
int bgHordeBotCount = 0; uint32 bgHordeBotCount = 0;
int bgAllianceBotCount = 0; uint32 bgAllianceBotCount = 0;
// Players (Arena) // Players (Arena)
int ratedArenaPlayerCount = 0; uint32 ratedArenaPlayerCount = 0;
int skirmishArenaPlayerCount = 0; uint32 skirmishArenaPlayerCount = 0;
// Players (Battleground) // Players (Battleground)
int bgHordePlayerCount = 0; uint32 bgHordePlayerCount = 0;
int bgAlliancePlayerCount = 0; uint32 bgAlliancePlayerCount = 0;
}; };
class ChatHandler; class ChatHandler;
@@ -141,7 +141,7 @@ class RandomPlayerbotMgr : public PlayerbotHolder
ObjectGuid const GetBattleMasterGUID(Player* bot, BattlegroundTypeId bgTypeId); ObjectGuid const GetBattleMasterGUID(Player* bot, BattlegroundTypeId bgTypeId);
CreatureData const* GetCreatureDataByEntry(uint32 entry); CreatureData const* GetCreatureDataByEntry(uint32 entry);
void LoadBattleMastersCache(); void LoadBattleMastersCache();
std::map<int32_t, std::map<int32_t, BattlegroundInfo>> BattlegroundData; std::map<uint32, std::map<uint32, BattlegroundInfo>> BattlegroundData;
std::map<uint32, std::map<uint32, std::map<TeamId, uint32>>> VisualBots; std::map<uint32, std::map<uint32, std::map<TeamId, uint32>>> VisualBots;
std::map<uint32, std::map<uint32, std::map<uint32, uint32>>> Supporters; std::map<uint32, std::map<uint32, std::map<uint32, uint32>>> Supporters;
std::map<TeamId, std::vector<uint32>> LfgDungeons; std::map<TeamId, std::vector<uint32>> LfgDungeons;

View File

@@ -250,10 +250,10 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
TeamSize = (uint32)type; TeamSize = (uint32)type;
// Check if bots should join Rated Arena (Only captains can queue) // Check if bots should join Rated Arena (Only captains can queue)
int ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount; uint32 ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
int ratedArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount; uint32 ratedArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
int ratedArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount; uint32 ratedArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
int activeRatedArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue; uint32 activeRatedArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) < (BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount)); bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) < (BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
@@ -269,11 +269,11 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
// Check if bots should join Skirmish Arena // Check if bots should join Skirmish Arena
// We have extra bots queue because same faction can vs each other but can't be in the same group. // We have extra bots queue because same faction can vs each other but can't be in the same group.
int skirmishArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount; uint32 skirmishArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
int skirmishArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount; uint32 skirmishArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
int skirmishArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount; uint32 skirmishArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
int activeSkirmishArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue; uint32 activeSkirmishArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
int maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount); uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
if (maxRequiredSkirmishBots != 0) if (maxRequiredSkirmishBots != 0)
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize; maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
@@ -286,18 +286,20 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
} }
// Check if bots should join Battleground // Check if bots should join Battleground
int bgAllianceBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount; uint32 bgAllianceBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
int bgAlliancePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount; uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
int bgHordeBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount; uint32 bgHordeBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
int bgHordePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount; uint32 bgHordePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
int activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue; uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
int bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount; uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
if(teamId == TEAM_ALLIANCE) if(teamId == TEAM_ALLIANCE)
{ {
if((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount)) if((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
return true; return true;
} else { }
else
{
if((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount)) if((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
return true; return true;
} }
@@ -578,10 +580,10 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
TeamSize = (uint32)type; TeamSize = (uint32)type;
// Check if bots should join Rated Arena (Only captains can queue) // Check if bots should join Rated Arena (Only captains can queue)
int ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount; uint32 ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
int ratedArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount; uint32 ratedArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
int ratedArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount; uint32 ratedArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
int activeRatedArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue; uint32 activeRatedArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) < (BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount)); bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) < (BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
@@ -597,11 +599,11 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
// Check if bots should join Skirmish Arena // Check if bots should join Skirmish Arena
// We have extra bots queue because same faction can vs each other but can't be in the same group. // We have extra bots queue because same faction can vs each other but can't be in the same group.
int skirmishArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount; uint32 skirmishArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
int skirmishArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount; uint32 skirmishArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
int skirmishArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount; uint32 skirmishArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
int activeSkirmishArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue; uint32 activeSkirmishArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
int maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount); uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
if (maxRequiredSkirmishBots != 0) if (maxRequiredSkirmishBots != 0)
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize; maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
@@ -614,18 +616,20 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
} }
// Check if bots should join Battleground // Check if bots should join Battleground
int bgAllianceBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount; uint32 bgAllianceBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
int bgAlliancePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount; uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
int bgHordeBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount; uint32 bgHordeBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
int bgHordePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount; uint32 bgHordePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
int activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue; uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
int bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount; uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
if(teamId == TEAM_ALLIANCE) if(teamId == TEAM_ALLIANCE)
{ {
if((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount)) if((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
return true; return true;
} else { }
else
{
if((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount)) if((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
return true; return true;
} }

View File

@@ -5210,7 +5210,9 @@ bool ArenaTactics::moveToCenter(Battleground* bg)
MoveTo(bg->GetMapId(), 6239.89f + frand(-1, +1), 261.11f + frand(-1, +1), 0.89f, false, true); MoveTo(bg->GetMapId(), 6239.89f + frand(-1, +1), 261.11f + frand(-1, +1), 0.89f, false, true);
else else
MoveTo(bg->GetMapId(), 6235.60f + frand(-1, +1), 258.27f + frand(-1, +1), 0.89f, false, true); MoveTo(bg->GetMapId(), 6235.60f + frand(-1, +1), 258.27f + frand(-1, +1), 0.89f, false, true);
} else { }
else
{
if (Preference == 3) if (Preference == 3)
MoveTo(bg->GetMapId(), 6265.72f + frand(-1, +1), 271.92f + frand(-1, +1), 3.65f, false, true); MoveTo(bg->GetMapId(), 6265.72f + frand(-1, +1), 271.92f + frand(-1, +1), 3.65f, false, true);
else if (Preference == 6) else if (Preference == 6)
@@ -5228,7 +5230,9 @@ bool ArenaTactics::moveToCenter(Battleground* bg)
MoveTo(bg->GetMapId(), 1266.85f + frand(-1, +1), 1663.52f + frand(-1, +1), 34.04f, false, true); MoveTo(bg->GetMapId(), 1266.85f + frand(-1, +1), 1663.52f + frand(-1, +1), 34.04f, false, true);
else else
MoveTo(bg->GetMapId(), 1274.07f + frand(-1, +1), 1656.36f + frand(-1, +1), 34.58f, false, true); MoveTo(bg->GetMapId(), 1274.07f + frand(-1, +1), 1656.36f + frand(-1, +1), 34.58f, false, true);
} else { }
else
{
if (Preference == 3) if (Preference == 3)
MoveTo(bg->GetMapId(), 1261.93f + frand(-1, +1), 1669.27f + frand(-1, +1), 34.25f, false, true); MoveTo(bg->GetMapId(), 1261.93f + frand(-1, +1), 1669.27f + frand(-1, +1), 34.25f, false, true);
else if (Preference == 6) else if (Preference == 6)
@@ -5246,7 +5250,9 @@ bool ArenaTactics::moveToCenter(Battleground* bg)
MoveTo(bg->GetMapId(), 4056.99f + frand(-1, +1), 2919.75f + frand(-1, +1), 13.51f, false, true); MoveTo(bg->GetMapId(), 4056.99f + frand(-1, +1), 2919.75f + frand(-1, +1), 13.51f, false, true);
else else
MoveTo(bg->GetMapId(), 4056.27f + frand(-1, +1), 2905.33f + frand(-1, +1), 12.90f, false, true); MoveTo(bg->GetMapId(), 4056.27f + frand(-1, +1), 2905.33f + frand(-1, +1), 12.90f, false, true);
} else { }
else
{
if (Preference == 3) if (Preference == 3)
MoveTo(bg->GetMapId(), 4043.66f + frand(-1, +1), 2927.93f + frand(-1, +1), 13.17f, false, true); MoveTo(bg->GetMapId(), 4043.66f + frand(-1, +1), 2927.93f + frand(-1, +1), 13.17f, false, true);
else if (Preference == 6) else if (Preference == 6)