mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Add ratio config for alliance and horde rndbots (#818)
This commit is contained in:
@@ -495,6 +495,11 @@ AiPlayerbot.PreQuests = 0
|
||||
# Enable LFG for random bots
|
||||
AiPlayerbot.RandomBotJoinLfg = 1
|
||||
|
||||
# Percentage ratio of alliance and horde
|
||||
# Need to reset rndbot after changing the setting (.playerbot rndbot reset)
|
||||
AiPlayerbot.RandomBotAllianceRatio = 50
|
||||
AiPlayerbot.RandomBotHordeRatio = 50
|
||||
|
||||
# Disable death knight for bots login
|
||||
# Need to reset rndbot after changing the setting (.playerbot rndbot reset)
|
||||
AiPlayerbot.DisableDeathKnightLogin = 0
|
||||
|
||||
@@ -468,6 +468,8 @@ bool PlayerbotAIConfig::Initialize()
|
||||
autoGearScoreLimit = sConfigMgr->GetOption<int32>("AiPlayerbot.AutoGearScoreLimit", 0);
|
||||
|
||||
playerbotsXPrate = sConfigMgr->GetOption<int32>("AiPlayerbot.KillXPRate", 1);
|
||||
randomBotAllianceRatio = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotAllianceRatio", 50);
|
||||
randomBotHordeRatio = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotHordeRatio", 50);
|
||||
disableDeathKnightLogin = sConfigMgr->GetOption<bool>("AiPlayerbot.DisableDeathKnightLogin", 0);
|
||||
botActiveAlone = sConfigMgr->GetOption<int32>("AiPlayerbot.BotActiveAlone", 100);
|
||||
BotActiveAloneForceWhenInRadius = sConfigMgr->GetOption<uint32>("AiPlayerbot.BotActiveAloneForceWhenInRadius", 150);
|
||||
|
||||
@@ -262,6 +262,8 @@ public:
|
||||
bool randomBotFixedLevel;
|
||||
bool disableRandomLevels;
|
||||
uint32 playerbotsXPrate;
|
||||
uint32 randomBotAllianceRatio;
|
||||
uint32 randomBotHordeRatio;
|
||||
bool disableDeathKnightLogin;
|
||||
uint32 botActiveAlone;
|
||||
uint32 BotActiveAloneForceWhenInRadius;
|
||||
|
||||
@@ -464,6 +464,9 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
|
||||
maxAllowedBotCount -= currentBots.size();
|
||||
maxAllowedBotCount = std::min(sPlayerbotAIConfig->randomBotsPerInterval, maxAllowedBotCount);
|
||||
|
||||
uint32 allowedAllianceCount = maxAllowedBotCount * (sPlayerbotAIConfig->randomBotAllianceRatio) / (sPlayerbotAIConfig->randomBotAllianceRatio + sPlayerbotAIConfig->randomBotHordeRatio);
|
||||
uint32 allowedHordeCount = maxAllowedBotCount - allowedAllianceCount;
|
||||
|
||||
for (std::vector<uint32>::iterator i = sPlayerbotAIConfig->randomBotAccounts.begin();
|
||||
i != sPlayerbotAIConfig->randomBotAccounts.end(); i++)
|
||||
{
|
||||
@@ -500,18 +503,30 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
|
||||
|
||||
if (sPlayerbotAIConfig->disableDeathKnightLogin)
|
||||
{
|
||||
QueryResult result = CharacterDatabase.Query("Select class from characters where guid = {}", guid);
|
||||
if (!result)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Field* fields = result->Fetch();
|
||||
uint32 rClass = fields[0].Get<uint32>();
|
||||
uint32 rClass = fields[1].Get<uint8>();
|
||||
if (rClass == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
uint32 rRace = fields[2].Get<uint8>();
|
||||
uint32 isAlliance = IsAlliance(rRace);
|
||||
if (!allowedAllianceCount && isAlliance)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!allowedHordeCount && !isAlliance)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (isAlliance)
|
||||
{
|
||||
allowedAllianceCount--;
|
||||
}
|
||||
else
|
||||
{
|
||||
allowedHordeCount--;
|
||||
}
|
||||
guids.push_back(guid);
|
||||
} while (result->NextRow());
|
||||
|
||||
@@ -540,7 +555,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
|
||||
|
||||
if (maxAllowedBotCount)
|
||||
LOG_ERROR("playerbots",
|
||||
"Not enough random bot accounts available. Need {} more, try to increase RandomBotAccountCount "
|
||||
"Not enough random bot accounts available. Try to increase RandomBotAccountCount "
|
||||
"in your conf file",
|
||||
ceil(maxAllowedBotCount / 10));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user