Skip to content

Commit

Permalink
Alt login: Login criteria lines are now full AND lines no longer slow…
Browse files Browse the repository at this point in the history
…ly dropping the criteria one by one
  • Loading branch information
mostlikely4r committed Dec 12, 2024
1 parent 84e107e commit 324bd5f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 38 deletions.
4 changes: 3 additions & 1 deletion playerbot/PlayerbotAIConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ bool PlayerbotAIConfig::Initialize()
loginCriteria.push_back({ "arena" });
loginCriteria.push_back({ "bg" });
loginCriteria.push_back({ "guild" });
loginCriteria.push_back({ "classrace,level,logoff" });
loginCriteria.push_back({ "logoff,classrace,level,online" });
loginCriteria.push_back({ "logoff,classrace,level" });
loginCriteria.push_back({ "logoff,classrace" });
}


Expand Down
31 changes: 3 additions & 28 deletions playerbot/PlayerbotLoginMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,40 +488,15 @@ void PlayerBotLoginMgr::UpdateOnlineBots()

uint32 PlayerBotLoginMgr::GetLoginCriteriaSize()
{
uint32 critiaAmount = 0;
for (auto& criteria : sPlayerbotAIConfig.loginCriteria)
critiaAmount += criteria.size();
return critiaAmount;
return sPlayerbotAIConfig.loginCriteria.size();
}

std::vector<std::string> PlayerBotLoginMgr::GetVariableLoginCriteria(const uint8 attempt)
{
if (sPlayerbotAIConfig.loginCriteria.empty()) {
if (sPlayerbotAIConfig.loginCriteria.empty() || attempt >= sPlayerbotAIConfig.loginCriteria.size())
return {};
}

std::vector<std::vector<std::string>> fullList = sPlayerbotAIConfig.loginCriteria;

int index = 0;
int iteration = attempt;
while (iteration >= 0 && index < fullList.size()) {
if (fullList[index].empty()) {
++index;
continue;
}

if (iteration < fullList[index].size()) {
std::vector<std::string> result = fullList[index];
result.erase(result.end() - iteration, result.end());
return result;
}
else {
iteration -= fullList[index].size();
++index;
}
}

return {};
return sPlayerbotAIConfig.loginCriteria[attempt];
}

LoginCriteria PlayerBotLoginMgr::GetLoginCriteria(const uint8 attempt)
Expand Down
8 changes: 5 additions & 3 deletions playerbot/aiplayerbot.conf.dist.in
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,8 @@ AiPlayerbot.PerfMonEnabled = 0
#
# How it works: All bots are evaluated based on configurd criteria wether they should be online of offline.
# The default criteria must all be true or the bot will be logged off and can not log in.
# Each line works as an AND construction where the back criteria are dropped to find more bots to log in.
# Example classrace,level means it tries to find all bots to properly maintain the level and classrace probabilties and if it needs more bots it only looks at classrace.
# Each line works as an AND construction where all criteria must be met. Note they are alphabetically sorted so use 01,02 for more than 9 lines.
# Example logoff,classrace,level,online means a bot needs to have room in available level and classrace brackets, be online and not be slated to log off.
# The multiple lines work as an OR construction where the top lines are used first and as more bots are needed it moves down.
# Example 1 = group, 2 = bg. First it tries to login all bots in player groups, then as more bots are needed it looks for bots that might be online inside battlegrounds.
#
Expand All @@ -1018,7 +1018,9 @@ AiPlayerbot.PerfMonEnabled = 0
# AiPlayerbot.LoginCriteria.2 = bg
# AiPlayerbot.LoginCriteria.3 = arena
# AiPlayerbot.LoginCriteria.4 = guild
# AiPlayerbot.LoginCriteria.5 = classrace,level,logoff
# AiPlayerbot.LoginCriteria.5 = logoff,classrace,level,online
# AiPlayerbot.LoginCriteria.6 = logoff,classrace,level
# AiPlayerbot.LoginCriteria.7 = logoff,classrace

# When bots are logged in that do not fully match all criteria selected it will do so up to xxx spaces below the maximum. Bots that suddenly match all the criteria will then have room to use this to log in.
# AiPlayerbot.FreeRoomForNonSpareBots = 0
Expand Down
8 changes: 5 additions & 3 deletions playerbot/aiplayerbot.conf.dist.in.tbc
Original file line number Diff line number Diff line change
Expand Up @@ -1027,8 +1027,8 @@ AiPlayerbot.PerfMonEnabled = 0
#
# How it works: All bots are evaluated based on configurd criteria wether they should be online of offline.
# The default criteria must all be true or the bot will be logged off and can not log in.
# Each line works as an AND construction where the back criteria are dropped to find more bots to log in.
# Example classrace,level means it tries to find all bots to properly maintain the level and classrace probabilties and if it needs more bots it only looks at classrace.
# Each line works as an AND construction where all criteria must be met. Note they are alphabetically sorted so use 01,02 for more than 9 lines.
# Example logoff,classrace,level,online means a bot needs to have room in available level and classrace brackets, be online and not be slated to log off.
# The multiple lines work as an OR construction where the top lines are used first and as more bots are needed it moves down.
# Example 1 = group, 2 = bg. First it tries to login all bots in player groups, then as more bots are needed it looks for bots that might be online inside battlegrounds.
#
Expand All @@ -1037,7 +1037,9 @@ AiPlayerbot.PerfMonEnabled = 0
# AiPlayerbot.LoginCriteria.2 = bg
# AiPlayerbot.LoginCriteria.3 = arena
# AiPlayerbot.LoginCriteria.4 = guild
# AiPlayerbot.LoginCriteria.5 = classrace,level,logoff
# AiPlayerbot.LoginCriteria.5 = logoff,classrace,level,online
# AiPlayerbot.LoginCriteria.6 = logoff,classrace,level
# AiPlayerbot.LoginCriteria.7 = logoff,classrace

# When bots are logged in that do not fully match all criteria selected it will do so up to xxx spaces below the maximum. Bots that suddenly match all the criteria will then have room to use this to log in.
# AiPlayerbot.FreeRoomForNonSpareBots = 0
Expand Down
8 changes: 5 additions & 3 deletions playerbot/aiplayerbot.conf.dist.in.wotlk
Original file line number Diff line number Diff line change
Expand Up @@ -967,8 +967,8 @@ AiPlayerbot.PerfMonEnabled = 0
#
# How it works: All bots are evaluated based on configurd criteria wether they should be online of offline.
# The default criteria must all be true or the bot will be logged off and can not log in.
# Each line works as an AND construction where the back criteria are dropped to find more bots to log in.
# Example classrace,level means it tries to find all bots to properly maintain the level and classrace probabilties and if it needs more bots it only looks at classrace.
# Each line works as an AND construction where all criteria must be met. Note they are alphabetically sorted so use 01,02 for more than 9 lines.
# Example logoff,classrace,level,online means a bot needs to have room in available level and classrace brackets, be online and not be slated to log off.
# The multiple lines work as an OR construction where the top lines are used first and as more bots are needed it moves down.
# Example 1 = group, 2 = bg. First it tries to login all bots in player groups, then as more bots are needed it looks for bots that might be online inside battlegrounds.
#
Expand All @@ -977,7 +977,9 @@ AiPlayerbot.PerfMonEnabled = 0
# AiPlayerbot.LoginCriteria.2 = bg
# AiPlayerbot.LoginCriteria.3 = arena
# AiPlayerbot.LoginCriteria.4 = guild
# AiPlayerbot.LoginCriteria.5 = classrace,level,logoff
# AiPlayerbot.LoginCriteria.5 = logoff,classrace,level,online
# AiPlayerbot.LoginCriteria.6 = logoff,classrace,level
# AiPlayerbot.LoginCriteria.7 = logoff,classrace

# When bots are logged in that do not fully match all criteria selected it will do so up to xxx spaces below the maximum. Bots that suddenly match all the criteria will then have room to use this to log in.
# AiPlayerbot.FreeRoomForNonSpareBots = 0
Expand Down

0 comments on commit 324bd5f

Please sign in to comment.