mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #171 from oiuv/player_bots
add config for another player's character as bot
This commit is contained in:
@@ -17,6 +17,10 @@ AiPlayerbot.DeleteRandomBotAccounts = 0
|
|||||||
# auto-login all player alts as bots on player login
|
# auto-login all player alts as bots on player login
|
||||||
AiPlayerbot.BotAutologin = 0
|
AiPlayerbot.BotAutologin = 0
|
||||||
|
|
||||||
|
# Allow login other players' characters as bots
|
||||||
|
# Default: 0 (disabled)
|
||||||
|
AiPlayerbot.AllowPlayerBots = 0
|
||||||
|
|
||||||
# Guild Task system
|
# Guild Task system
|
||||||
AiPlayerbot.EnableGuildTasks = 0
|
AiPlayerbot.EnableGuildTasks = 0
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
iterationsPerTick = sConfigMgr->GetOption<int32>("AiPlayerbot.IterationsPerTick", 100);
|
iterationsPerTick = sConfigMgr->GetOption<int32>("AiPlayerbot.IterationsPerTick", 100);
|
||||||
|
|
||||||
allowGuildBots = sConfigMgr->GetOption<bool>("AiPlayerbot.AllowGuildBots", true);
|
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");
|
randomBotMapsAsString = sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotMaps", "0,1,530,571");
|
||||||
LoadList<std::vector<uint32>>(randomBotMapsAsString, randomBotMaps);
|
LoadList<std::vector<uint32>>(randomBotMapsAsString, randomBotMaps);
|
||||||
@@ -106,7 +107,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotSpellIds", "54197"), randomBotSpellIds);
|
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotSpellIds", "54197"), randomBotSpellIds);
|
||||||
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("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<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("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<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.PvpProhibitedAreaIds", "976,35"), pvpProhibitedAreaIds);
|
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.PvpProhibitedAreaIds", "976,35"), pvpProhibitedAreaIds);
|
||||||
|
|
||||||
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761"), randomBotQuestIds);
|
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestIds", "7848,3802,5505,6502,7761"), randomBotQuestIds);
|
||||||
|
|
||||||
botAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.BotAutologin", false);
|
botAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.BotAutologin", false);
|
||||||
@@ -171,7 +172,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
}
|
}
|
||||||
for (uint32 spec = 0; spec < MAX_SPECNO; ++spec)
|
for (uint32 spec = 0; spec < MAX_SPECNO; ++spec)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "AiPlayerbot.PremadeSpecName." << cls << "." << spec;
|
os << "AiPlayerbot.PremadeSpecName." << cls << "." << spec;
|
||||||
premadeSpecName[cls][spec] = sConfigMgr->GetOption<std::string>(os.str().c_str(), "", false);
|
premadeSpecName[cls][spec] = sConfigMgr->GetOption<std::string>(os.str().c_str(), "", false);
|
||||||
os.str("");
|
os.str("");
|
||||||
@@ -193,7 +194,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
}
|
}
|
||||||
for (uint32 spec = 0; spec < 3; ++spec)
|
for (uint32 spec = 0; spec < 3; ++spec)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "AiPlayerbot.RandomClassSpecProb." << cls << "." << spec;
|
os << "AiPlayerbot.RandomClassSpecProb." << cls << "." << spec;
|
||||||
randomClassSpecProb[cls][spec] = sConfigMgr->GetOption<uint32>(os.str().c_str(), 33);
|
randomClassSpecProb[cls][spec] = sConfigMgr->GetOption<uint32>(os.str().c_str(), 33);
|
||||||
os.str("");
|
os.str("");
|
||||||
@@ -298,7 +299,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
autoUpgradeEquip = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoUpgradeEquip", false);
|
autoUpgradeEquip = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoUpgradeEquip", false);
|
||||||
autoLearnTrainerSpells = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoLearnTrainerSpells", true);
|
autoLearnTrainerSpells = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoLearnTrainerSpells", true);
|
||||||
autoLearnQuestSpells = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoLearnQuestSpells", false);
|
autoLearnQuestSpells = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoLearnQuestSpells", false);
|
||||||
autoTeleportForLevel = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoTeleportForLevel", false);
|
autoTeleportForLevel = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoTeleportForLevel", false);
|
||||||
autoDoQuests = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoDoQuests", false);
|
autoDoQuests = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoDoQuests", false);
|
||||||
syncLevelWithPlayers = sConfigMgr->GetOption<bool>("AiPlayerbot.SyncLevelWithPlayers", false);
|
syncLevelWithPlayers = sConfigMgr->GetOption<bool>("AiPlayerbot.SyncLevelWithPlayers", false);
|
||||||
freeFood = sConfigMgr->GetOption<bool>("AiPlayerbot.FreeFood", true);
|
freeFood = sConfigMgr->GetOption<bool>("AiPlayerbot.FreeFood", true);
|
||||||
@@ -531,7 +532,7 @@ static std::vector<std::string> split(const std::string &str, const std::string
|
|||||||
|
|
||||||
std::vector<std::vector<uint32>> PlayerbotAIConfig::ParseTempTalentsOrder(uint32 cls, std::string tab_link) {
|
std::vector<std::vector<uint32>> PlayerbotAIConfig::ParseTempTalentsOrder(uint32 cls, std::string tab_link) {
|
||||||
// check bad link
|
// check bad link
|
||||||
uint32 classMask = 1 << (cls - 1);
|
uint32 classMask = 1 << (cls - 1);
|
||||||
std::vector<std::vector<uint32>> res;
|
std::vector<std::vector<uint32>> res;
|
||||||
std::vector<std::string> tab_links = split(tab_link, "-");
|
std::vector<std::string> tab_links = split(tab_link, "-");
|
||||||
std::map<uint32, std::vector<TalentEntry const*>> spells;
|
std::map<uint32, std::vector<TalentEntry const*>> spells;
|
||||||
@@ -575,4 +576,4 @@ std::vector<std::vector<uint32>> PlayerbotAIConfig::ParseTempTalentsOrder(uint32
|
|||||||
res.insert(res.end(), order.begin(), order.end());
|
res.insert(res.end(), order.begin(), order.end());
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class PlayerbotAIConfig
|
|||||||
bool IsInPvpProhibitedArea(uint32 id);
|
bool IsInPvpProhibitedArea(uint32 id);
|
||||||
|
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool allowGuildBots;
|
bool allowGuildBots, allowPlayerBots;
|
||||||
uint32 globalCoolDown, reactDelay, maxWaitForMove, expireActionTime, dispelAuraDuration, passiveDelay, repeatDelay,
|
uint32 globalCoolDown, reactDelay, maxWaitForMove, expireActionTime, dispelAuraDuration, passiveDelay, repeatDelay,
|
||||||
errorDelay, rpgDelay, sitDelay, returnDelay, lootDelay;
|
errorDelay, rpgDelay, sitDelay, returnDelay, lootDelay;
|
||||||
float sightDistance, spellDistance, reactDistance, grindDistance, lootDistance, shootDistance,
|
float sightDistance, spellDistance, reactDistance, grindDistance, lootDistance, shootDistance,
|
||||||
@@ -103,11 +103,11 @@ class PlayerbotAIConfig
|
|||||||
std::string randomBotCombatStrategies, randomBotNonCombatStrategies;
|
std::string randomBotCombatStrategies, randomBotNonCombatStrategies;
|
||||||
uint32 randomBotMinLevel, randomBotMaxLevel;
|
uint32 randomBotMinLevel, randomBotMaxLevel;
|
||||||
float randomChangeMultiplier;
|
float randomChangeMultiplier;
|
||||||
|
|
||||||
|
|
||||||
// std::string premadeLevelSpec[MAX_CLASSES][10][91]; //lvl 10 - 100
|
// std::string premadeLevelSpec[MAX_CLASSES][10][91]; //lvl 10 - 100
|
||||||
// ClassSpecs classSpecs[MAX_CLASSES];
|
// ClassSpecs classSpecs[MAX_CLASSES];
|
||||||
|
|
||||||
std::string premadeSpecName[MAX_CLASSES][MAX_SPECNO];
|
std::string premadeSpecName[MAX_CLASSES][MAX_SPECNO];
|
||||||
std::string premadeSpecGlyph[MAX_CLASSES][MAX_SPECNO];
|
std::string premadeSpecGlyph[MAX_CLASSES][MAX_SPECNO];
|
||||||
std::vector<uint32> parsedSpecGlyph[MAX_CLASSES][MAX_SPECNO];
|
std::vector<uint32> parsedSpecGlyph[MAX_CLASSES][MAX_SPECNO];
|
||||||
|
|||||||
@@ -527,6 +527,9 @@ std::string const PlayerbotHolder::ProcessBotCommand(std::string const cmd, Obje
|
|||||||
if (ObjectAccessor::FindPlayer(guid))
|
if (ObjectAccessor::FindPlayer(guid))
|
||||||
return "player already logged in";
|
return "player already logged in";
|
||||||
|
|
||||||
|
if (!sPlayerbotAIConfig->allowPlayerBots && !isRandomAccount && !isMasterAccount)
|
||||||
|
return "You cannot login another player's character as bot.";
|
||||||
|
|
||||||
AddPlayerBot(guid, masterAccountId);
|
AddPlayerBot(guid, masterAccountId);
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user