mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-21 02:20:00 +01:00
Allow Randombot to teleport to grind spot on randomize
This commit is contained in:
parent
78a3d43b4a
commit
9d37ba972a
@ -904,7 +904,9 @@ bool RandomPlayerbotMgr::ProcessBot(Player* player)
|
|||||||
LOG_INFO("playerbots", "Bot #{} {}:{} {} <{}>: consumables refreshed", bot, player->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", player->getLevel(), player->GetName(), sGuildMgr->GetGuildById(player->GetGuildId())->GetName());
|
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)
|
if (sPlayerbotAIConfig->autoDoQuests)
|
||||||
|
ChangeStrategyOnce(player);
|
||||||
|
else
|
||||||
ChangeStrategy(player);
|
ChangeStrategy(player);
|
||||||
|
|
||||||
uint32 randomTime = urand(sPlayerbotAIConfig->minRandomBotRandomizeTime, sPlayerbotAIConfig->maxRandomBotRandomizeTime);
|
uint32 randomTime = urand(sPlayerbotAIConfig->minRandomBotRandomizeTime, sPlayerbotAIConfig->maxRandomBotRandomizeTime);
|
||||||
@ -1073,7 +1075,7 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
|
|||||||
bot->GetMotionMaster()->Clear();
|
bot->GetMotionMaster()->Clear();
|
||||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
||||||
if (botAI)
|
if (botAI)
|
||||||
botAI->Reset();
|
botAI->Reset(true);
|
||||||
bot->TeleportTo(loc.GetMapId(), x, y, z, 0);
|
bot->TeleportTo(loc.GetMapId(), x, y, z, 0);
|
||||||
bot->SendMovementFlagUpdate();
|
bot->SendMovementFlagUpdate();
|
||||||
|
|
||||||
@ -1312,7 +1314,7 @@ void RandomPlayerbotMgr::RandomizeFirst(Player* bot)
|
|||||||
|
|
||||||
// teleport to a random inn for bot level
|
// teleport to a random inn for bot level
|
||||||
GET_PLAYERBOT_AI(bot)->Reset(true);
|
GET_PLAYERBOT_AI(bot)->Reset(true);
|
||||||
RandomTeleportForRpg(bot);
|
// RandomTeleportForRpg(bot);
|
||||||
|
|
||||||
if (bot->GetGroup())
|
if (bot->GetGroup())
|
||||||
bot->RemoveFromGroup();
|
bot->RemoveFromGroup();
|
||||||
@ -2145,7 +2147,7 @@ void RandomPlayerbotMgr::ChangeStrategy(Player* player)
|
|||||||
|
|
||||||
if (frand(0.f, 100.f) > sPlayerbotAIConfig->randomBotRpgChance)
|
if (frand(0.f, 100.f) > sPlayerbotAIConfig->randomBotRpgChance)
|
||||||
{
|
{
|
||||||
LOG_INFO("playerbots", "Changing strategy for #{} <{}> to grinding", bot, player->GetName().c_str());
|
LOG_INFO("playerbots", "Bot #{} <{}>: sent to grind spot", bot, player->GetName().c_str());
|
||||||
ScheduleTeleport(bot, 30);
|
ScheduleTeleport(bot, 30);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2159,6 +2161,23 @@ void RandomPlayerbotMgr::ChangeStrategy(Player* player)
|
|||||||
ScheduleChangeStrategy(bot);
|
ScheduleChangeStrategy(bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RandomPlayerbotMgr::ChangeStrategyOnce(Player* player)
|
||||||
|
{
|
||||||
|
uint32 bot = player->GetGUID().GetCounter();
|
||||||
|
|
||||||
|
if (frand(0.f, 100.f) > sPlayerbotAIConfig->randomBotRpgChance) // select grind / pvp
|
||||||
|
{
|
||||||
|
LOG_INFO("playerbots", "Bot #{} <{}>: sent to grind spot", bot, player->GetName().c_str());
|
||||||
|
RandomTeleportForLevel(player);
|
||||||
|
Refresh(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_INFO("playerbots", "Bot #{} <{}>: sent to inn", bot, player->GetName().c_str());
|
||||||
|
RandomTeleportForRpg(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RandomPlayerbotMgr::RandomTeleportForRpg(Player* bot)
|
void RandomPlayerbotMgr::RandomTeleportForRpg(Player* bot)
|
||||||
{
|
{
|
||||||
uint32 race = bot->getRace();
|
uint32 race = bot->getRace();
|
||||||
|
|||||||
@ -72,7 +72,8 @@ class RandomPlayerbotMgr : public PlayerbotHolder
|
|||||||
bool ProcessBot(Player* player);
|
bool ProcessBot(Player* player);
|
||||||
void Revive(Player* player);
|
void Revive(Player* player);
|
||||||
void ChangeStrategy(Player* player);
|
void ChangeStrategy(Player* player);
|
||||||
uint32 GetValue(Player* bot, std::string const type);
|
void ChangeStrategyOnce(Player* player);
|
||||||
|
uint32 GetValue(Player* bot, std::string const type);
|
||||||
uint32 GetValue(uint32 bot, std::string const type);
|
uint32 GetValue(uint32 bot, std::string const type);
|
||||||
std::string const GetData(uint32 bot, std::string const type);
|
std::string const GetData(uint32 bot, std::string const type);
|
||||||
void SetValue(uint32 bot, std::string const type, uint32 value, std::string const data = "");
|
void SetValue(uint32 bot, std::string const type, uint32 value, std::string const data = "");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user