diff --git a/playerbot/PlayerbotAIConfig.cpp b/playerbot/PlayerbotAIConfig.cpp index 7b2533eb7..042a40444 100644 --- a/playerbot/PlayerbotAIConfig.cpp +++ b/playerbot/PlayerbotAIConfig.cpp @@ -177,6 +177,7 @@ bool PlayerbotAIConfig::Initialize() minRandomBotReviveTime = config.GetIntDefault("AiPlayerbot.MinRandomBotReviveTime", 60); maxRandomBotReviveTime = config.GetIntDefault("AiPlayerbot.MaxRandomReviveTime", 300); randomBotTeleportDistance = config.GetIntDefault("AiPlayerbot.RandomBotTeleportDistance", 1000); + randomBotTeleportNearPlayer = config.GetBoolDefault("AiPlayerbot.RandomBotTeleportNearPlayer", false); randomBotsPerInterval = config.GetIntDefault("AiPlayerbot.RandomBotsPerInterval", 60); randomBotsMaxLoginsPerInterval = config.GetIntDefault("AiPlayerbot.RandomBotsMaxLoginsPerInterval", randomBotsPerInterval); minRandomBotsPriceChangeInterval = config.GetIntDefault("AiPlayerbot.MinRandomBotsPriceChangeInterval", 2 * 3600); diff --git a/playerbot/PlayerbotAIConfig.h b/playerbot/PlayerbotAIConfig.h index f2c2149c7..cff7ed41b 100644 --- a/playerbot/PlayerbotAIConfig.h +++ b/playerbot/PlayerbotAIConfig.h @@ -80,6 +80,7 @@ class PlayerbotAIConfig std::list toggleAlwaysOnlineAccounts; std::list toggleAlwaysOnlineChars; uint32 randomBotTeleportDistance; + bool randomBotTeleportNearPlayer; uint32 randomGearMaxLevel; uint32 randomGearMaxDiff; std::list randomGearBlacklist; diff --git a/playerbot/RandomPlayerbotMgr.cpp b/playerbot/RandomPlayerbotMgr.cpp index 3636fef90..35f1ae1f4 100644 --- a/playerbot/RandomPlayerbotMgr.cpp +++ b/playerbot/RandomPlayerbotMgr.cpp @@ -1930,7 +1930,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector &locs //tlocs.erase(std::remove_if(tlocs.begin(), tlocs.end(), [bot](WorldLocation const& l) {return l.mapid == bot->GetMapId() && sServerFacade.GetDistance2d(bot, l.coord_x, l.coord_y) > urand(0, 5000) + bot->GetLevel() * 15 * urand(5, 10); }), tlocs.end()); // teleport to active areas only - if (activeOnly) + if (sPlayerbotAIConfig.randomBotTeleportNearPlayer && activeOnly) { tlocs.erase(std::remove_if(tlocs.begin(), tlocs.end(), [bot](WorldPosition l) { @@ -2000,7 +2000,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector &locs isEnemyZone = false; break; } - if (isEnemyZone && bot->GetLevel() < 21) + if (isEnemyZone && (bot->GetLevel() < 21 || (zone->flags & AREA_FLAG_CAPITAL))) return true; // filter other races zones @@ -2049,8 +2049,6 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector &locs if (tlocs.empty()) { - /*if (activeOnly) - return hearth ? RandomTeleportForRpg(bot, false) : RandomTeleportForLevel(bot, false);*/ if (activeOnly) { if (hearth)