mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
grind, teleport, move random for rndbot
This commit is contained in:
@@ -61,13 +61,13 @@ AiPlayerbot.RandomBotArenaTeamCount = 20
|
|||||||
AiPlayerbot.DeleteRandomBotArenaTeams = 0
|
AiPlayerbot.DeleteRandomBotArenaTeams = 0
|
||||||
|
|
||||||
# Change random bot has lower gear
|
# Change random bot has lower gear
|
||||||
AiPlayerbot.RandomGearLoweringChance = 0.15
|
AiPlayerbot.RandomGearLoweringChance = 0
|
||||||
|
|
||||||
# Chance random bot has max level on first randomize (default 0.15)
|
# Chance random bot has max level on first randomize (default 0.15)
|
||||||
AiPlayerbot.RandomBotMaxLevelChance = 0.15
|
AiPlayerbot.RandomBotMaxLevelChance = 0
|
||||||
|
|
||||||
# Chance bot chooses RPG (Teleport to random camp for their level) instead of grinding
|
# Chance bot chooses RPG (Teleport to random camp for their level) instead of grinding
|
||||||
AiPlayerbot.RandomBotRpgChance = 0.20
|
AiPlayerbot.RandomBotRpgChance = 0.20 #unused now
|
||||||
|
|
||||||
# Set randombots movement speed to walking anywhere
|
# Set randombots movement speed to walking anywhere
|
||||||
AiPlayerbot.RandombotsWalkingRPG = 0
|
AiPlayerbot.RandombotsWalkingRPG = 0
|
||||||
@@ -100,7 +100,7 @@ AiPlayerbot.BotActiveAlone = 100
|
|||||||
|
|
||||||
# Set minimum level of randombots where gets enchants on items (Maxlevel + 1 to disable)
|
# Set minimum level of randombots where gets enchants on items (Maxlevel + 1 to disable)
|
||||||
# Default: 60
|
# Default: 60
|
||||||
AiPlayerbot.MinEnchantingBotLevel = 60
|
AiPlayerbot.MinEnchantingBotLevel = 60 # unused now
|
||||||
|
|
||||||
# Randombots checking players gear score level and deny the group invite if it's too low
|
# Randombots checking players gear score level and deny the group invite if it's too low
|
||||||
# Default: 1 (enabled)
|
# Default: 1 (enabled)
|
||||||
@@ -138,13 +138,13 @@ AiPlayerbot.SyncLevelWithPlayers = 0
|
|||||||
|
|
||||||
# Give free food to random bots
|
# Give free food to random bots
|
||||||
# Default: 1 (enabled)
|
# Default: 1 (enabled)
|
||||||
AiPlayerbot.FreeFood = 0
|
AiPlayerbot.FreeFood = 1
|
||||||
|
|
||||||
# Bot automatically trains spells when talking to trainer (yes = train all available spells as long as the bot has the money, free = auto trains with no money cost, no = only list spells)
|
# Bot automatically trains spells when talking to trainer (yes = train all available spells as long as the bot has the money, free = auto trains with no money cost, no = only list spells)
|
||||||
AiPlayerbot.AutoTrainSpells = yes
|
AiPlayerbot.AutoTrainSpells = yes
|
||||||
|
|
||||||
# Bot automatically picks talent points based on current spec (full = pick spec based on probability if multiple are like current spec, semi = only apply points if 1 spec looks like current spec, no = no auto talent points)
|
# Bot automatically picks talent points based on current spec (full = pick spec based on probability if multiple are like current spec, semi = only apply points if 1 spec looks like current spec, no = no auto talent points)
|
||||||
AiPlayerbot.AutoPickTalents = full
|
AiPlayerbot.AutoPickTalents = no
|
||||||
|
|
||||||
# Bots automatically learn trainable spells on levelup
|
# Bots automatically learn trainable spells on levelup
|
||||||
# Default: 0 (disabled)
|
# Default: 0 (disabled)
|
||||||
@@ -156,7 +156,7 @@ AiPlayerbot.AutoLearnQuestSpells = 0
|
|||||||
|
|
||||||
# Random Bots will pick quests on their own and try to complete
|
# Random Bots will pick quests on their own and try to complete
|
||||||
# Default: 0 (disabled)
|
# Default: 0 (disabled)
|
||||||
AiPlayerbot.AutoDoQuests = 0
|
AiPlayerbot.AutoDoQuests = 1
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
# #
|
# #
|
||||||
@@ -543,7 +543,7 @@ AiPlayerbot.RandomBotMaps = 0,1,530,571
|
|||||||
AiPlayerbot.RandomBotQuestItems = "6948,5175,5176,5177,5178,16309,12382,13704,11000"
|
AiPlayerbot.RandomBotQuestItems = "6948,5175,5176,5177,5178,16309,12382,13704,11000"
|
||||||
|
|
||||||
# PvP Restricted Zones (bots don't pvp)
|
# PvP Restricted Zones (bots don't pvp)
|
||||||
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"
|
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,3703"
|
||||||
|
|
||||||
# Spells every random bot will learn on randomize (54197 - cold weather flying)
|
# Spells every random bot will learn on randomize (54197 - cold weather flying)
|
||||||
AiPlayerbot.RandomBotSpellIds = "54197"
|
AiPlayerbot.RandomBotSpellIds = "54197"
|
||||||
@@ -562,13 +562,15 @@ AiPlayerbot.MinRandomBotInWorldTime = 3600
|
|||||||
AiPlayerbot.MaxRandomBotInWorldTime = 1209600
|
AiPlayerbot.MaxRandomBotInWorldTime = 1209600
|
||||||
AiPlayerbot.MinRandomBotRandomizeTime = 302400
|
AiPlayerbot.MinRandomBotRandomizeTime = 302400
|
||||||
AiPlayerbot.MaxRandomRandomizeTime = 1209600
|
AiPlayerbot.MaxRandomRandomizeTime = 1209600
|
||||||
AiPlayerbot.RandomBotsPerInterval = 50
|
AiPlayerbot.RandomBotsPerInterval = 500
|
||||||
AiPlayerbot.MinRandomBotsPriceChangeInterval = 7200
|
AiPlayerbot.MinRandomBotsPriceChangeInterval = 7200
|
||||||
AiPlayerbot.MaxRandomBotsPriceChangeInterval = 172800
|
AiPlayerbot.MaxRandomBotsPriceChangeInterval = 172800
|
||||||
AiPlayerbot.MinRandomBotChangeStrategyTime = 180
|
AiPlayerbot.MinRandomBotChangeStrategyTime = 180
|
||||||
AiPlayerbot.MaxRandomBotChangeStrategyTime = 720
|
AiPlayerbot.MaxRandomBotChangeStrategyTime = 720
|
||||||
AiPlayerbot.MinRandomBotReviveTime = 60
|
AiPlayerbot.MinRandomBotReviveTime = 60
|
||||||
AiPlayerbot.MaxRandomBotReviveTime = 300
|
AiPlayerbot.MaxRandomBotReviveTime = 300
|
||||||
|
AiPlayerbot.MinRandomBotTeleportInterval = 3600
|
||||||
|
AiPlayerbot.MaxRandomBotTeleportInterval = 18000
|
||||||
|
|
||||||
# How far random bots are teleported after death
|
# How far random bots are teleported after death
|
||||||
AiPlayerbot.RandomBotTeleportDistance = 100
|
AiPlayerbot.RandomBotTeleportDistance = 100
|
||||||
@@ -605,6 +607,9 @@ AiPlayerbot.BotCheats = "taxi"
|
|||||||
# Enables/Disables password to bot account
|
# Enables/Disables password to bot account
|
||||||
AiPlayerbot.RandomBotRandomPassword = 0
|
AiPlayerbot.RandomBotRandomPassword = 0
|
||||||
|
|
||||||
|
# Set RandomBotMaxLevel bots to RandomBotMinLevel or not
|
||||||
|
AiPlayerbot.DowngradeMaxLevelBot = 1
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
# #
|
# #
|
||||||
# Database Stuff #
|
# Database Stuff #
|
||||||
@@ -747,3 +752,4 @@ AiPlayerbot.RandomClassSpecProbability.10.1 = 33
|
|||||||
AiPlayerbot.DefaultTalentsOrder.10.1 =
|
AiPlayerbot.DefaultTalentsOrder.10.1 =
|
||||||
AiPlayerbot.RandomClassSpecProbability.10.2 = 33
|
AiPlayerbot.RandomClassSpecProbability.10.2 = 33
|
||||||
AiPlayerbot.DefaultTalentsOrder.10.2 =
|
AiPlayerbot.DefaultTalentsOrder.10.2 =
|
||||||
|
|
||||||
|
|||||||
@@ -547,13 +547,15 @@ void AiFactory::AddDefaultNonCombatStrategies(Player* player, PlayerbotAI* const
|
|||||||
nonCombatEngine->addStrategy("pvp");
|
nonCombatEngine->addStrategy("pvp");
|
||||||
// nonCombatEngine->addStrategy("collision");
|
// nonCombatEngine->addStrategy("collision");
|
||||||
nonCombatEngine->addStrategy("grind");
|
nonCombatEngine->addStrategy("grind");
|
||||||
// nonCombatEngine->addStrategy("group");
|
nonCombatEngine->addStrategy("group");
|
||||||
// nonCombatEngine->addStrategy("guild");
|
// nonCombatEngine->addStrategy("guild");
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->autoDoQuests)
|
if (sPlayerbotAIConfig->autoDoQuests)
|
||||||
{
|
{
|
||||||
nonCombatEngine->addStrategy("travel");
|
nonCombatEngine->addStrategy("travel");
|
||||||
nonCombatEngine->addStrategy("rpg");
|
nonCombatEngine->addStrategy("rpg");
|
||||||
|
} else {
|
||||||
|
nonCombatEngine->addStrategy("move random");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->randomBotJoinBG)
|
if (sPlayerbotAIConfig->randomBotJoinBG)
|
||||||
@@ -576,13 +578,15 @@ void AiFactory::AddDefaultNonCombatStrategies(Player* player, PlayerbotAI* const
|
|||||||
nonCombatEngine->addStrategy("pvp");
|
nonCombatEngine->addStrategy("pvp");
|
||||||
// nonCombatEngine->addStrategy("collision");
|
// nonCombatEngine->addStrategy("collision");
|
||||||
nonCombatEngine->addStrategy("grind");
|
nonCombatEngine->addStrategy("grind");
|
||||||
// nonCombatEngine->addStrategy("group");
|
nonCombatEngine->addStrategy("group");
|
||||||
// nonCombatEngine->addStrategy("guild");
|
// nonCombatEngine->addStrategy("guild");
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->autoDoQuests)
|
if (sPlayerbotAIConfig->autoDoQuests)
|
||||||
{
|
{
|
||||||
nonCombatEngine->addStrategy("travel");
|
nonCombatEngine->addStrategy("travel");
|
||||||
nonCombatEngine->addStrategy("rpg");
|
nonCombatEngine->addStrategy("rpg");
|
||||||
|
} else {
|
||||||
|
nonCombatEngine->addStrategy("move random");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masterBotAI)
|
if (masterBotAI)
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
LoadList<std::vector<uint32>>(randomBotMapsAsString, randomBotMaps);
|
LoadList<std::vector<uint32>>(randomBotMapsAsString, randomBotMaps);
|
||||||
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestItems", "6948,5175,5176,5177,5178,16309,12382,13704,11000"), randomBotQuestItems);
|
LoadList<std::vector<uint32>>(sConfigMgr->GetOption<std::string>("AiPlayerbot.RandomBotQuestItems", "6948,5175,5176,5177,5178,16309,12382,13704,11000"), randomBotQuestItems);
|
||||||
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"), 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.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);
|
||||||
@@ -119,6 +119,8 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
maxRandomBotChangeStrategyTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotChangeStrategyTime", 2 * HOUR);
|
maxRandomBotChangeStrategyTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotChangeStrategyTime", 2 * HOUR);
|
||||||
minRandomBotReviveTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBotReviveTime", MINUTE);
|
minRandomBotReviveTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBotReviveTime", MINUTE);
|
||||||
maxRandomBotReviveTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotReviveTime", 5 * MINUTE);
|
maxRandomBotReviveTime = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotReviveTime", 5 * MINUTE);
|
||||||
|
minRandomBotTeleportInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBotTeleportInterval", 1 * HOUR);
|
||||||
|
maxRandomBotTeleportInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotTeleportInterval", 5 * HOUR);
|
||||||
randomBotTeleportDistance = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotTeleportDistance", 100);
|
randomBotTeleportDistance = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotTeleportDistance", 100);
|
||||||
randomBotsPerInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotsPerInterval", MINUTE);
|
randomBotsPerInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotsPerInterval", MINUTE);
|
||||||
minRandomBotsPriceChangeInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBotsPriceChangeInterval", 2 * HOUR);
|
minRandomBotsPriceChangeInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBotsPriceChangeInterval", 2 * HOUR);
|
||||||
@@ -292,6 +294,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
enableGreet = sConfigMgr->GetOption<bool>("AiPlayerbot.EnableGreet", true);
|
enableGreet = sConfigMgr->GetOption<bool>("AiPlayerbot.EnableGreet", true);
|
||||||
disableRandomLevels = sConfigMgr->GetOption<bool>("AiPlayerbot.DisableRandomLevels", false);
|
disableRandomLevels = sConfigMgr->GetOption<bool>("AiPlayerbot.DisableRandomLevels", false);
|
||||||
randomBotRandomPassword = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotRandomPassword", true);
|
randomBotRandomPassword = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotRandomPassword", true);
|
||||||
|
downgradeMaxLevelBot = sConfigMgr->GetOption<bool>("AiPlayerbot.DowngradeMaxLevelBot", true);
|
||||||
playerbotsXPrate = sConfigMgr->GetOption<int32>("AiPlayerbot.KillXPRate", 1);
|
playerbotsXPrate = sConfigMgr->GetOption<int32>("AiPlayerbot.KillXPRate", 1);
|
||||||
botActiveAlone = sConfigMgr->GetOption<int32>("AiPlayerbot.BotActiveAlone", 10);
|
botActiveAlone = sConfigMgr->GetOption<int32>("AiPlayerbot.BotActiveAlone", 10);
|
||||||
randombotsWalkingRPG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandombotsWalkingRPG", false);
|
randombotsWalkingRPG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandombotsWalkingRPG", false);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class PlayerbotAIConfig
|
|||||||
uint32 minRandomBotRandomizeTime, maxRandomBotRandomizeTime;
|
uint32 minRandomBotRandomizeTime, maxRandomBotRandomizeTime;
|
||||||
uint32 minRandomBotChangeStrategyTime, maxRandomBotChangeStrategyTime;
|
uint32 minRandomBotChangeStrategyTime, maxRandomBotChangeStrategyTime;
|
||||||
uint32 minRandomBotReviveTime, maxRandomBotReviveTime;
|
uint32 minRandomBotReviveTime, maxRandomBotReviveTime;
|
||||||
|
uint32 minRandomBotTeleportInterval, maxRandomBotTeleportInterval;
|
||||||
uint32 minRandomBotPvpTime, maxRandomBotPvpTime;
|
uint32 minRandomBotPvpTime, maxRandomBotPvpTime;
|
||||||
uint32 randomBotsPerInterval;
|
uint32 randomBotsPerInterval;
|
||||||
uint32 minRandomBotsPriceChangeInterval, maxRandomBotsPriceChangeInterval;
|
uint32 minRandomBotsPriceChangeInterval, maxRandomBotsPriceChangeInterval;
|
||||||
@@ -162,7 +163,7 @@ class PlayerbotAIConfig
|
|||||||
std::vector<uint32> randomBotArenaTeams;
|
std::vector<uint32> randomBotArenaTeams;
|
||||||
|
|
||||||
uint32 selfBotLevel;
|
uint32 selfBotLevel;
|
||||||
|
bool downgradeMaxLevelBot;
|
||||||
std::string const GetTimestampStr();
|
std::string const GetTimestampStr();
|
||||||
bool hasLog(std::string const fileName) { return std::find(allowedLogFiles.begin(), allowedLogFiles.end(), fileName) != allowedLogFiles.end(); };
|
bool hasLog(std::string const fileName) { return std::find(allowedLogFiles.begin(), allowedLogFiles.end(), fileName) != allowedLogFiles.end(); };
|
||||||
bool openLog(std::string const fileName, char const* mode = "a");
|
bool openLog(std::string const fileName, char const* mode = "a");
|
||||||
|
|||||||
@@ -80,11 +80,11 @@ void PlayerbotFactory::Prepare()
|
|||||||
{
|
{
|
||||||
if (!itemQuality)
|
if (!itemQuality)
|
||||||
{
|
{
|
||||||
if (level < 80) {
|
// if (level < 80) {
|
||||||
itemQuality = ITEM_QUALITY_RARE;
|
itemQuality = ITEM_QUALITY_RARE;
|
||||||
} else {
|
// } else {
|
||||||
itemQuality = ITEM_QUALITY_EPIC;
|
// itemQuality = ITEM_QUALITY_EPIC;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bot->isDead())
|
if (bot->isDead())
|
||||||
@@ -115,10 +115,10 @@ void PlayerbotFactory::Prepare()
|
|||||||
|
|
||||||
void PlayerbotFactory::Randomize(bool incremental)
|
void PlayerbotFactory::Randomize(bool incremental)
|
||||||
{
|
{
|
||||||
if (sPlayerbotAIConfig->disableRandomLevels)
|
// if (sPlayerbotAIConfig->disableRandomLevels)
|
||||||
{
|
// {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
LOG_INFO("playerbots", "Preparing to {} randomize...", (incremental ? "incremental" : "full"));
|
LOG_INFO("playerbots", "Preparing to {} randomize...", (incremental ? "incremental" : "full"));
|
||||||
Prepare();
|
Prepare();
|
||||||
@@ -1206,7 +1206,9 @@ void PlayerbotFactory::InitEquipment(bool incremental)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 desiredQuality = itemQuality;
|
uint32 desiredQuality = itemQuality;
|
||||||
|
if (urand(0, 100) < 100 * sPlayerbotAIConfig->randomGearLoweringChance && desiredQuality > ITEM_QUALITY_NORMAL) {
|
||||||
|
desiredQuality--;
|
||||||
|
}
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ItemTemplateContainer const* itemTemplates = sObjectMgr->GetItemTemplateStore();
|
ItemTemplateContainer const* itemTemplates = sObjectMgr->GetItemTemplateStore();
|
||||||
|
|||||||
@@ -18,11 +18,14 @@
|
|||||||
#include "LFGMgr.h"
|
#include "LFGMgr.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "PerformanceMonitor.h"
|
#include "PerformanceMonitor.h"
|
||||||
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PlayerbotCommandServer.h"
|
#include "PlayerbotCommandServer.h"
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
|
#include "Random.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "ChannelMgr.h"
|
#include "ChannelMgr.h"
|
||||||
|
#include "World.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@@ -871,80 +874,70 @@ bool RandomPlayerbotMgr::ProcessBot(Player* player)
|
|||||||
|
|
||||||
//GET_PLAYERBOT_AI(player)->GetAiObjectContext()->GetValue<bool>("random bot update")->Set(false);
|
//GET_PLAYERBOT_AI(player)->GetAiObjectContext()->GetValue<bool>("random bot update")->Set(false);
|
||||||
|
|
||||||
bool randomiser = true;
|
// bool randomiser = true;
|
||||||
if (player->GetGuildId())
|
// if (player->GetGuildId())
|
||||||
{
|
// {
|
||||||
if (Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()))
|
// if (Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()))
|
||||||
{
|
// {
|
||||||
if (guild->GetLeaderGUID() == player->GetGUID())
|
// if (guild->GetLeaderGUID() == player->GetGUID())
|
||||||
{
|
// {
|
||||||
for (std::vector<Player*>::iterator i = players.begin(); i != players.end(); ++i)
|
// for (std::vector<Player*>::iterator i = players.begin(); i != players.end(); ++i)
|
||||||
sGuildTaskMgr->Update(*i, player);
|
// sGuildTaskMgr->Update(*i, player);
|
||||||
}
|
// }
|
||||||
|
|
||||||
uint32 accountId = sCharacterCache->GetCharacterAccountIdByGuid(guild->GetLeaderGUID());
|
// uint32 accountId = sCharacterCache->GetCharacterAccountIdByGuid(guild->GetLeaderGUID());
|
||||||
if (!sPlayerbotAIConfig->IsInRandomAccountList(accountId))
|
// if (!sPlayerbotAIConfig->IsInRandomAccountList(accountId))
|
||||||
{
|
// {
|
||||||
uint8 rank = player->GetRank();
|
// uint8 rank = player->GetRank();
|
||||||
randomiser = rank < 4 ? false : true;
|
// randomiser = rank < 4 ? false : true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
uint32 randomize = GetEventValue(bot, "randomize");
|
uint32 randomize = GetEventValue(bot, "randomize");
|
||||||
if (!randomize)
|
if (!randomize)
|
||||||
{
|
{
|
||||||
if (randomiser)
|
// if (randomiser)
|
||||||
Randomize(player);
|
Randomize(player);
|
||||||
|
|
||||||
if (randomiser)
|
|
||||||
{
|
|
||||||
LOG_INFO("playerbots", "Bot #{} {}:{} <{}>: randomized", bot, player->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", player->getLevel(), player->GetName());
|
LOG_INFO("playerbots", "Bot #{} {}:{} <{}>: randomized", bot, player->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", player->getLevel(), player->GetName());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_INFO("playerbots", "Bot #{} {}:{} {} <{}>: consumables refreshed", bot, player->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", player->getLevel(), player->GetName(), sGuildMgr->GetGuildById(player->GetGuildId())->GetName());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->autoDoQuests)
|
|
||||||
ChangeStrategyOnce(player);
|
|
||||||
else
|
|
||||||
ChangeStrategy(player);
|
|
||||||
|
|
||||||
uint32 randomTime = urand(sPlayerbotAIConfig->minRandomBotRandomizeTime, sPlayerbotAIConfig->maxRandomBotRandomizeTime);
|
uint32 randomTime = urand(sPlayerbotAIConfig->minRandomBotRandomizeTime, sPlayerbotAIConfig->maxRandomBotRandomizeTime);
|
||||||
ScheduleRandomize(bot, randomTime);
|
ScheduleRandomize(bot, randomTime);
|
||||||
return true;
|
return true;
|
||||||
|
// if (randomiser)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// LOG_INFO("playerbots", "Bot #{} {}:{} {} <{}>: consumables refreshed", bot, player->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", player->getLevel(), player->GetName(), sGuildMgr->GetGuildById(player->GetGuildId())->GetName());
|
||||||
|
// }
|
||||||
|
// if (sPlayerbotAIConfig->autoDoQuests)
|
||||||
|
// ChangeStrategyOnce(player);
|
||||||
|
// else
|
||||||
|
// ChangeStrategy(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable random teleport logic if no auto traveling enabled
|
// enable random teleport logic if no auto traveling enabled
|
||||||
if (!sPlayerbotAIConfig->autoDoQuests)
|
// if (!sPlayerbotAIConfig->autoDoQuests)
|
||||||
{
|
// {
|
||||||
uint32 teleport = GetEventValue(bot, "teleport");
|
uint32 teleport = GetEventValue(bot, "teleport");
|
||||||
if (!teleport)
|
if (!teleport)
|
||||||
{
|
{
|
||||||
LOG_INFO("players", "Bot #{} <{}>: sent to grind", bot, player->GetName());
|
LOG_INFO("players", "Bot #{} <{}>: teleport for level and refresh", bot, player->GetName());
|
||||||
RandomTeleportForLevel(player);
|
RandomTeleportForLevel(player);
|
||||||
Refresh(player);
|
Refresh(player);
|
||||||
SetEventValue(bot, "teleport", 1, sPlayerbotAIConfig->maxRandomBotInWorldTime);
|
uint32 time = urand(sPlayerbotAIConfig->minRandomBotTeleportInterval, sPlayerbotAIConfig->maxRandomBotTeleportInterval);
|
||||||
|
ScheduleTeleport(bot, time);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
uint32 changeStrategy = GetEventValue(bot, "change_strategy");
|
// uint32 changeStrategy = GetEventValue(bot, "change_strategy");
|
||||||
if (!changeStrategy)
|
// if (!changeStrategy)
|
||||||
{
|
// {
|
||||||
LOG_INFO("playerbots", "Changing strategy for bot {} <{}>", bot, player->GetName());
|
// LOG_INFO("playerbots", "Changing strategy for bot #{} <{}>", bot, player->GetName().c_str());
|
||||||
ChangeStrategy(player);
|
// ChangeStrategy(player);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
uint32 changeStrategy = GetEventValue(bot, "change_strategy");
|
|
||||||
if (!changeStrategy)
|
|
||||||
{
|
|
||||||
LOG_INFO("playerbots", "Changing strategy for bot #{} <{}>", bot, player->GetName().c_str());
|
|
||||||
ChangeStrategy(player);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -980,8 +973,8 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
|
|||||||
// if (bot->getLevel() < 5)
|
// if (bot->getLevel() < 5)
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->randomBotRpgChance < 0)
|
// if (sPlayerbotAIConfig->randomBotRpgChance < 0)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (locs.empty())
|
if (locs.empty())
|
||||||
{
|
{
|
||||||
@@ -1250,9 +1243,11 @@ void RandomPlayerbotMgr::Randomize(Player* bot)
|
|||||||
RandomizeFirst(bot);
|
RandomizeFirst(bot);
|
||||||
else if (bot->getLevel() < 57 && bot->getClass() == CLASS_DEATH_KNIGHT)
|
else if (bot->getLevel() < 57 && bot->getClass() == CLASS_DEATH_KNIGHT)
|
||||||
RandomizeFirst(bot);
|
RandomizeFirst(bot);
|
||||||
else
|
else if (bot->getLevel() < sPlayerbotAIConfig->randomBotMaxLevel || !sPlayerbotAIConfig->downgradeMaxLevelBot)
|
||||||
IncreaseLevel(bot);
|
IncreaseLevel(bot);
|
||||||
|
else {
|
||||||
|
RandomizeFirst(bot);
|
||||||
|
}
|
||||||
//RandomTeleportForRpg(bot);
|
//RandomTeleportForRpg(bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1286,13 +1281,23 @@ void RandomPlayerbotMgr::RandomizeFirst(Player* bot)
|
|||||||
maxLevel = std::max(sPlayerbotAIConfig->randomBotMinLevel, std::min(playersLevel, sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)));
|
maxLevel = std::max(sPlayerbotAIConfig->randomBotMinLevel, std::min(playersLevel, sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)));
|
||||||
|
|
||||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomizeFirst");
|
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomizeFirst");
|
||||||
uint32 level = urand(sPlayerbotAIConfig->randomBotMinLevel, maxLevel);
|
|
||||||
|
|
||||||
|
uint32 level;
|
||||||
|
|
||||||
|
if (sPlayerbotAIConfig->downgradeMaxLevelBot && bot->GetLevel() == sPlayerbotAIConfig->randomBotMaxLevel) {
|
||||||
|
if (bot->getClass() == CLASS_DEATH_KNIGHT) {
|
||||||
|
level = sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
|
||||||
|
} else {
|
||||||
|
level = sPlayerbotAIConfig->randomBotMinLevel;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
level = urand(sPlayerbotAIConfig->randomBotMinLevel, maxLevel);
|
||||||
if (urand(0, 100) < 100 * sPlayerbotAIConfig->randomBotMaxLevelChance)
|
if (urand(0, 100) < 100 * sPlayerbotAIConfig->randomBotMaxLevelChance)
|
||||||
level = maxLevel;
|
level = maxLevel;
|
||||||
|
|
||||||
if (bot->getClass() == CLASS_DEATH_KNIGHT)
|
if (bot->getClass() == CLASS_DEATH_KNIGHT)
|
||||||
level = urand(sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL), std::max(sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL), maxLevel));
|
level = urand(sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL), std::max(sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL), maxLevel));
|
||||||
|
}
|
||||||
|
|
||||||
SetValue(bot, "level", level);
|
SetValue(bot, "level", level);
|
||||||
|
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ class StrategyContext : public NamedObjectContext<Strategy>
|
|||||||
creators["guild"] = &StrategyContext::guild;
|
creators["guild"] = &StrategyContext::guild;
|
||||||
creators["grind"] = &StrategyContext::grind;
|
creators["grind"] = &StrategyContext::grind;
|
||||||
creators["avoid aoe"] = &StrategyContext::avoid_aoe;
|
creators["avoid aoe"] = &StrategyContext::avoid_aoe;
|
||||||
|
creators["move random"] = &StrategyContext::move_random;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -169,6 +170,7 @@ class StrategyContext : public NamedObjectContext<Strategy>
|
|||||||
static Strategy* guild (PlayerbotAI* botAI) { return new GuildStrategy(botAI); }
|
static Strategy* guild (PlayerbotAI* botAI) { return new GuildStrategy(botAI); }
|
||||||
static Strategy* grind(PlayerbotAI* botAI) { return new GrindingStrategy(botAI); }
|
static Strategy* grind(PlayerbotAI* botAI) { return new GrindingStrategy(botAI); }
|
||||||
static Strategy* avoid_aoe(PlayerbotAI* botAI) { return new AvoidAoeStrategy(botAI); }
|
static Strategy* avoid_aoe(PlayerbotAI* botAI) { return new AvoidAoeStrategy(botAI); }
|
||||||
|
static Strategy* move_random(PlayerbotAI* ai) { return new MoveRandomStrategy(ai); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class MovementStrategyContext : public NamedObjectContext<Strategy>
|
class MovementStrategyContext : public NamedObjectContext<Strategy>
|
||||||
|
|||||||
@@ -1399,7 +1399,7 @@ bool MoveRandomAction::Execute(Event event)
|
|||||||
|
|
||||||
bool MoveRandomAction::isUseful()
|
bool MoveRandomAction::isUseful()
|
||||||
{
|
{
|
||||||
return !botAI->HasRealPlayerMaster() && botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get().size() > urand(25, 100);
|
return !botAI->HasRealPlayerMaster();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveInsideAction::Execute(Event event)
|
bool MoveInsideAction::Execute(Event event)
|
||||||
|
|||||||
@@ -15,3 +15,9 @@ void GrindingStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|||||||
triggers.push_back(new TriggerNode("no target", NextAction::array(0, new NextAction("attack anything", 5.0f), nullptr)));
|
triggers.push_back(new TriggerNode("no target", NextAction::array(0, new NextAction("attack anything", 5.0f), nullptr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MoveRandomStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
|
{
|
||||||
|
triggers.push_back(new TriggerNode(
|
||||||
|
"often",
|
||||||
|
NextAction::array(0, new NextAction("move random", 1.5f), NULL)));
|
||||||
|
}
|
||||||
@@ -20,4 +20,11 @@ class GrindingStrategy : public NonCombatStrategy
|
|||||||
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
|
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MoveRandomStrategy : public NonCombatStrategy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MoveRandomStrategy(PlayerbotAI* ai) : NonCombatStrategy(botAI) {}
|
||||||
|
std::string const getName() override { return "move random"; }
|
||||||
|
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "GridNotifiers.h"
|
#include "GridNotifiers.h"
|
||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
#include "ReputationMgr.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
GuidVector AttackersValue::Calculate()
|
GuidVector AttackersValue::Calculate()
|
||||||
@@ -141,6 +142,7 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range)
|
|||||||
|
|
||||||
// bool inCannon = botAI->IsInVehicle(false, true);
|
// bool inCannon = botAI->IsInVehicle(false, true);
|
||||||
// bool enemy = botAI->GetAiObjectContext()->GetValue<Unit*>("enemy player target")->Get();
|
// bool enemy = botAI->GetAiObjectContext()->GetValue<Unit*>("enemy player target")->Get();
|
||||||
|
|
||||||
return attacker &&
|
return attacker &&
|
||||||
attacker->IsInWorld() &&
|
attacker->IsInWorld() &&
|
||||||
attacker->GetMapId() == bot->GetMapId() &&
|
attacker->GetMapId() == bot->GetMapId() &&
|
||||||
@@ -155,7 +157,8 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range)
|
|||||||
!(attacker->GetCreatureType() == CREATURE_TYPE_CRITTER && !attacker->IsInCombat()) &&
|
!(attacker->GetCreatureType() == CREATURE_TYPE_CRITTER && !attacker->IsInCombat()) &&
|
||||||
!attacker->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) &&
|
!attacker->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) &&
|
||||||
!attacker->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) &&
|
!attacker->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) &&
|
||||||
!(sPlayerbotAIConfig->IsInPvpProhibitedZone(attacker->GetAreaId()) && bot->CanSeeOrDetect(attacker) && (attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) &&
|
bot->CanSeeOrDetect(attacker) &&
|
||||||
|
!(sPlayerbotAIConfig->IsInPvpProhibitedZone(attacker->GetZoneId()) && (attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) &&
|
||||||
(!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) ||
|
(!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) ||
|
||||||
leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || (c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) ||
|
leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || (c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) ||
|
||||||
(botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot))));
|
(botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot))));
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "GrindTargetValue.h"
|
#include "GrindTargetValue.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
#include "ReputationMgr.h"
|
||||||
|
#include "SharedDefines.h"
|
||||||
|
|
||||||
Unit* GrindTargetValue::Calculate()
|
Unit* GrindTargetValue::Calculate()
|
||||||
{
|
{
|
||||||
@@ -54,14 +56,19 @@ Unit* GrindTargetValue::FindTargetForGrinding(uint32 assistCount)
|
|||||||
if (!unit)
|
if (!unit)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if (unit->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE)) {
|
auto &rep = bot->ToPlayer()->GetReputationMgr();
|
||||||
// continue;
|
if (unit->ToCreature() && !unit->ToCreature()->GetCreatureTemplate()->lootid && bot->GetReactionTo(unit) >= REP_NEUTRAL) {
|
||||||
// }
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!bot->IsHostileTo(unit) && unit->GetNpcFlags() != UNIT_NPC_FLAG_NONE) {
|
if (!bot->IsHostileTo(unit) && unit->GetNpcFlags() != UNIT_NPC_FLAG_NONE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!bot->isHonorOrXPTarget(unit)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (abs(bot->GetPositionZ() - unit->GetPositionZ()) > sPlayerbotAIConfig->spellDistance)
|
if (abs(bot->GetPositionZ() - unit->GetPositionZ()) > sPlayerbotAIConfig->spellDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user