Skip to content

Commit

Permalink
Login: Experimental asynchronous login system.
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlikely4r committed Dec 4, 2024
1 parent 1606ae9 commit 39fe8d7
Show file tree
Hide file tree
Showing 9 changed files with 924 additions and 8 deletions.
16 changes: 16 additions & 0 deletions playerbot/PlayerbotAIConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <iomanip>
#include <boost/algorithm/string.hpp>
#include <regex>
#include "PlayerbotLoginMgr.h"

std::vector<std::string> ConfigAccess::GetValues(const std::string& name) const
{
Expand Down Expand Up @@ -262,6 +263,15 @@ bool PlayerbotAIConfig::Initialize()
bExplicitDbStoreSave = config.GetBoolDefault("AiPlayerbot.ExplicitDbStoreSave", false);

randomBotLoginWithPlayer = config.GetBoolDefault("AiPlayerbot.RandomBotLoginWithPlayer", false);
asyncBotLogin = config.GetBoolDefault("AiPlayerbot.AsyncBotLogin", false);
freeRoomForNonSpareBots = config.GetIntDefault("AiPlayerbot.FreeRoomForNonSpareBots", 1);

loginBotsNearPlayerRange = config.GetIntDefault("AiPlayerbot.LoginBotsNearPlayerRange", 0);

for (uint32 level = 1; level < DEFAULT_MAX_LEVEL; ++level)
{
levelProbability[level] = config.GetIntDefault("AiPlayerbot.LevelProbability." + std::to_string(level), 100);
}

sLog.outString("Loading Race/Class probabilities");

Expand Down Expand Up @@ -753,6 +763,12 @@ bool PlayerbotAIConfig::Initialize()
if (sPlayerbotAIConfig.randomBotJoinBG)
sRandomPlayerbotMgr.LoadBattleMastersCache();

if (sPlayerbotAIConfig.asyncBotLogin)
{
std::thread t([] {sPlayerBotLoginMgr.LoadBotsFromDb(); });
t.detach();
}

sLog.outString("---------------------------------------");
sLog.outString(" AI Playerbot initialized ");
sLog.outString("---------------------------------------");
Expand Down
4 changes: 4 additions & 0 deletions playerbot/PlayerbotAIConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class PlayerbotAIConfig
std::string premadeLevelSpec[MAX_CLASSES][10][91]; //lvl 10 - 100
uint32 classRaceProbabilityTotal;
uint32 classRaceProbability[MAX_CLASSES][MAX_RACES];
uint32 levelProbability[DEFAULT_MAX_LEVEL];
ClassSpecs classSpecs[MAX_CLASSES];
bool gearProgressionSystemEnabled;
uint32 gearProgressionSystemItemLevels[MAX_GEAR_PROGRESSION_LEVEL][2];
Expand Down Expand Up @@ -295,6 +296,9 @@ class PlayerbotAIConfig
bool respawnModForPlayerBots, respawnModForInstances;

bool randomBotLoginWithPlayer;
bool asyncBotLogin;
uint32 freeRoomForNonSpareBots;
uint32 loginBotsNearPlayerRange;

bool jumpInBg;
bool jumpWithPlayer;
Expand Down
Loading

0 comments on commit 39fe8d7

Please sign in to comment.