Merge pull request #171 from oiuv/player_bots

add config for another player's character as bot
This commit is contained in:
Yunfan Li
2024-04-02 10:07:51 +08:00
committed by GitHub
4 changed files with 18 additions and 10 deletions

View File

@@ -17,6 +17,10 @@ AiPlayerbot.DeleteRandomBotAccounts = 0
# auto-login all player alts as bots on player login
AiPlayerbot.BotAutologin = 0
# Allow login other players' characters as bots
# Default: 0 (disabled)
AiPlayerbot.AllowPlayerBots = 0
# Guild Task system
AiPlayerbot.EnableGuildTasks = 0

View File

@@ -98,6 +98,7 @@ bool PlayerbotAIConfig::Initialize()
iterationsPerTick = sConfigMgr->GetOption<int32>("AiPlayerbot.IterationsPerTick", 100);
allowGuildBots = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowGuildBots", true);
allowPlayerBots = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowPlayerBots", false);
randomBotMapsAsString = sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotMaps", "0,1,530,571");
LoadList<std::vector<uint32>>(randomBotMapsAsString, randomBotMaps);

View File

@@ -53,7 +53,7 @@ class PlayerbotAIConfig
bool IsInPvpProhibitedArea(uint32 id);
bool enabled;
bool allowGuildBots;
bool allowGuildBots, allowPlayerBots;
uint32 globalCoolDown, reactDelay, maxWaitForMove, expireActionTime, dispelAuraDuration, passiveDelay, repeatDelay,
errorDelay, rpgDelay, sitDelay, returnDelay, lootDelay;
float sightDistance, spellDistance, reactDistance, grindDistance, lootDistance, shootDistance,

View File

@@ -527,6 +527,9 @@ std::string const PlayerbotHolder::ProcessBotCommand(std::string const cmd, Obje
if (ObjectAccessor::FindPlayer(guid))
return "player already logged in";
if (!sPlayerbotAIConfig->allowPlayerBots && !isRandomAccount && !isMasterAccount)
return "You cannot login another player's character as bot.";
AddPlayerBot(guid, masterAccountId);
return "ok";
}