diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 9056aaf9..416931c4 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -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 diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index 0d86bc4f..28f43817 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -98,6 +98,7 @@ bool PlayerbotAIConfig::Initialize() iterationsPerTick = sConfigMgr->GetOption("AiPlayerbot.IterationsPerTick", 100); allowGuildBots = sConfigMgr->GetOption("AiPlayerbot.AllowGuildBots", true); + allowPlayerBots = sConfigMgr->GetOption("AiPlayerbot.AllowPlayerBots", false); randomBotMapsAsString = sConfigMgr->GetOption("AiPlayerbot.RandomBotMaps", "0,1,530,571"); LoadList>(randomBotMapsAsString, randomBotMaps); @@ -106,7 +107,7 @@ bool PlayerbotAIConfig::Initialize() LoadList>(sConfigMgr->GetOption("AiPlayerbot.RandomBotSpellIds", "54197"), randomBotSpellIds); LoadList>(sConfigMgr->GetOption("AiPlayerbot.PvpProhibitedZoneIds", "2255,656,2361,2362,2363,976,35,2268,3425,392,541,1446,3828,3712,3738,3565,3539,3623,4152,3988,4658,4284,4418,4436,4275,4323,4395"), pvpProhibitedZoneIds); LoadList>(sConfigMgr->GetOption("AiPlayerbot.PvpProhibitedAreaIds", "976,35"), pvpProhibitedAreaIds); - + LoadList>(sConfigMgr->GetOption("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761"), randomBotQuestIds); botAutologin = sConfigMgr->GetOption("AiPlayerbot.BotAutologin", false); @@ -171,7 +172,7 @@ bool PlayerbotAIConfig::Initialize() } for (uint32 spec = 0; spec < MAX_SPECNO; ++spec) { - std::ostringstream os; + std::ostringstream os; os << "AiPlayerbot.PremadeSpecName." << cls << "." << spec; premadeSpecName[cls][spec] = sConfigMgr->GetOption(os.str().c_str(), "", false); os.str(""); @@ -193,7 +194,7 @@ bool PlayerbotAIConfig::Initialize() } for (uint32 spec = 0; spec < 3; ++spec) { - std::ostringstream os; + std::ostringstream os; os << "AiPlayerbot.RandomClassSpecProb." << cls << "." << spec; randomClassSpecProb[cls][spec] = sConfigMgr->GetOption(os.str().c_str(), 33); os.str(""); @@ -298,7 +299,7 @@ bool PlayerbotAIConfig::Initialize() autoUpgradeEquip = sConfigMgr->GetOption("AiPlayerbot.AutoUpgradeEquip", false); autoLearnTrainerSpells = sConfigMgr->GetOption("AiPlayerbot.AutoLearnTrainerSpells", true); autoLearnQuestSpells = sConfigMgr->GetOption("AiPlayerbot.AutoLearnQuestSpells", false); - autoTeleportForLevel = sConfigMgr->GetOption("AiPlayerbot.AutoTeleportForLevel", false); + autoTeleportForLevel = sConfigMgr->GetOption("AiPlayerbot.AutoTeleportForLevel", false); autoDoQuests = sConfigMgr->GetOption("AiPlayerbot.AutoDoQuests", false); syncLevelWithPlayers = sConfigMgr->GetOption("AiPlayerbot.SyncLevelWithPlayers", false); freeFood = sConfigMgr->GetOption("AiPlayerbot.FreeFood", true); @@ -531,7 +532,7 @@ static std::vector split(const std::string &str, const std::string std::vector> PlayerbotAIConfig::ParseTempTalentsOrder(uint32 cls, std::string tab_link) { // check bad link - uint32 classMask = 1 << (cls - 1); + uint32 classMask = 1 << (cls - 1); std::vector> res; std::vector tab_links = split(tab_link, "-"); std::map> spells; @@ -575,4 +576,4 @@ std::vector> PlayerbotAIConfig::ParseTempTalentsOrder(uint32 res.insert(res.end(), order.begin(), order.end()); } return res; -} \ No newline at end of file +} diff --git a/src/PlayerbotAIConfig.h b/src/PlayerbotAIConfig.h index 9f4ae250..b3e5fdd7 100644 --- a/src/PlayerbotAIConfig.h +++ b/src/PlayerbotAIConfig.h @@ -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, @@ -103,11 +103,11 @@ class PlayerbotAIConfig std::string randomBotCombatStrategies, randomBotNonCombatStrategies; uint32 randomBotMinLevel, randomBotMaxLevel; float randomChangeMultiplier; - - + + // std::string premadeLevelSpec[MAX_CLASSES][10][91]; //lvl 10 - 100 // ClassSpecs classSpecs[MAX_CLASSES]; - + std::string premadeSpecName[MAX_CLASSES][MAX_SPECNO]; std::string premadeSpecGlyph[MAX_CLASSES][MAX_SPECNO]; std::vector parsedSpecGlyph[MAX_CLASSES][MAX_SPECNO]; diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index 4489a253..49dbf467 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -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"; }