Skip to content

Commit

Permalink
random teleport tweak
Browse files Browse the repository at this point in the history
do not teleport to enemy capitals
do not prioritize areas with real players unless enabled in config
  • Loading branch information
celguar committed Jul 2, 2023
1 parent 2bf4da6 commit ef0b2b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions playerbot/PlayerbotAIConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions playerbot/PlayerbotAIConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class PlayerbotAIConfig
std::list<string> toggleAlwaysOnlineAccounts;
std::list<string> toggleAlwaysOnlineChars;
uint32 randomBotTeleportDistance;
bool randomBotTeleportNearPlayer;
uint32 randomGearMaxLevel;
uint32 randomGearMaxDiff;
std::list<uint32> randomGearBlacklist;
Expand Down
6 changes: 2 additions & 4 deletions playerbot/RandomPlayerbotMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector<WorldLocation> &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)
{
Expand Down Expand Up @@ -2000,7 +2000,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector<WorldLocation> &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
Expand Down Expand Up @@ -2049,8 +2049,6 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, vector<WorldLocation> &locs

if (tlocs.empty())
{
/*if (activeOnly)
return hearth ? RandomTeleportForRpg(bot, false) : RandomTeleportForLevel(bot, false);*/
if (activeOnly)
{
if (hearth)
Expand Down

0 comments on commit ef0b2b4

Please sign in to comment.