Fix rotation class imbalance

This commit is contained in:
Yunfan Li
2024-01-15 13:21:49 +08:00
parent 8d4064d84c
commit dc4ec06164
2 changed files with 12 additions and 7 deletions

View File

@@ -29,6 +29,7 @@
#include "Unit.h"
#include "World.h"
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <boost/thread/thread.hpp>
@@ -347,7 +348,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
continue;
std::vector<uint32> guids;
do
{
Field* fields = result->Fetch();
@@ -364,10 +365,15 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
if (std::find(currentBots.begin(), currentBots.end(), guid) != currentBots.end())
continue;
guids.push_back(guid);
} while (result->NextRow());
std::random_shuffle(guids.begin(), guids.end());
for (uint32 &guid : guids) {
uint32 add_time = sPlayerbotAIConfig->enableRotation ?
urand(sPlayerbotAIConfig->minRandomBotInWorldTime, sPlayerbotAIConfig->maxRandomBotInWorldTime) :
sPlayerbotAIConfig->randomBotInWorldWithRotaionDisabled;
urand(sPlayerbotAIConfig->minRandomBotInWorldTime, sPlayerbotAIConfig->maxRandomBotInWorldTime) :
sPlayerbotAIConfig->randomBotInWorldWithRotaionDisabled;
SetEventValue(guid, "add", 1, add_time);
SetEventValue(guid, "logout", 0, 0);
@@ -376,8 +382,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
maxAllowedBotCount--;
if (!maxAllowedBotCount)
break;
} while (result->NextRow());
}
if (!maxAllowedBotCount)
break;

View File

@@ -81,7 +81,7 @@ std::string ChangeTalentsAction::SpecList()
std::vector<std::vector<uint32>> parsed = sPlayerbotAIConfig->parsedSpecLinkOrder[cls][specNo][80];
std::unordered_map<int, int> tabCount;
tabCount[0] = tabCount[1] = tabCount[2] = 0;
for (auto item : parsed) {
for (auto &item : parsed) {
tabCount[item[0]] += item[3];
}
out << specFound << ". " << sPlayerbotAIConfig->premadeSpecName[cls][specNo] << " (";