mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-20 18:10:02 +01:00
Compare commits
15 Commits
df3c44419d
...
40874624a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40874624a8 | ||
|
|
f76435b4c4 | ||
|
|
b7b8c60d17 | ||
|
|
e5f1446b9f | ||
|
|
e92029dd6e | ||
|
|
b8c0a54f92 | ||
|
|
18d1821dab | ||
|
|
8a8571c54f | ||
|
|
21bcbece7a | ||
|
|
8a9a833c98 | ||
|
|
101c7f3046 | ||
|
|
d8d94f33ee | ||
|
|
66b326d79e | ||
|
|
0d8e8fbd61 | ||
|
|
64b09fd3ca |
@ -809,6 +809,14 @@ AiPlayerbot.RandomBotNonCombatStrategies = ""
|
||||
AiPlayerbot.CombatStrategies = ""
|
||||
AiPlayerbot.NonCombatStrategies = ""
|
||||
|
||||
# Remove "healer dps" strategy on specified maps.
|
||||
# Default: 0 (disabled)
|
||||
AiPlayerbot.HealerDPSMapRestriction = 0
|
||||
|
||||
# List of Map IDs where "healer dps" strategy will be removed if AiPlayerbot.HealerDPSMapRestriction is enabled
|
||||
# Default: (Dungeon and Raid maps) "33,34,36,43,47,48,70,90,109,129,209,229,230,329,349,389,429,1001,1004,1007,269,540,542,543,545,546,547,552,553,554,555,556,557,558,560,585,574,575,576,578,595,599,600,601,602,604,608,619,632,650,658,668,409,469,509,531,532,534,544,548,550,564,565,580,249,533,603,615,616,624,631,649,724"
|
||||
AiPlayerbot.RestrictedHealerDPSMaps = "33,34,36,43,47,48,70,90,109,129,209,229,230,329,349,389,429,1001,1004,1007,269,540,542,543,545,546,547,552,553,554,555,556,557,558,560,585,574,575,576,578,595,599,600,601,602,604,608,619,632,650,658,668,409,469,509,531,532,534,544,548,550,564,565,580,249,533,603,615,616,624,631,649,724"
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
@ -420,7 +420,8 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa
|
||||
{
|
||||
if (sPlayerbotAIConfig->autoSaveMana)
|
||||
engine->addStrategy("save mana", false);
|
||||
engine->addStrategy("healer dps", false);
|
||||
if (!sPlayerbotAIConfig->IsRestrictedHealerDPSMap(player->GetMapId()))
|
||||
engine->addStrategy("healer dps", false);
|
||||
}
|
||||
if (facade->IsRealPlayer() || sRandomPlayerbotMgr->IsRandomBot(player))
|
||||
{
|
||||
|
||||
@ -722,6 +722,7 @@ void PlayerbotAI::HandleTeleportAck()
|
||||
// SetNextCheckDelay(urand(2000, 5000));
|
||||
if (sPlayerbotAIConfig->applyInstanceStrategies)
|
||||
ApplyInstanceStrategies(bot->GetMapId(), true);
|
||||
EvaluateHealerDpsStrategy();
|
||||
Reset(true);
|
||||
}
|
||||
|
||||
@ -6407,3 +6408,14 @@ void PlayerbotAI::AddTimedEvent(std::function<void()> callback, uint32 delayMs)
|
||||
// Every Player already owns an EventMap called m_Events
|
||||
bot->m_Events.AddEvent(new LambdaEvent(std::move(callback)), bot->m_Events.CalculateTime(delayMs));
|
||||
}
|
||||
|
||||
void PlayerbotAI::EvaluateHealerDpsStrategy()
|
||||
{
|
||||
if (!IsHeal(bot, true))
|
||||
return;
|
||||
|
||||
if (sPlayerbotAIConfig->IsRestrictedHealerDPSMap(bot->GetMapId()))
|
||||
ChangeStrategy("-healer dps", BOT_STATE_COMBAT);
|
||||
else
|
||||
ChangeStrategy("+healer dps", BOT_STATE_COMBAT);
|
||||
}
|
||||
|
||||
@ -401,6 +401,7 @@ public:
|
||||
void ClearStrategies(BotState type);
|
||||
std::vector<std::string> GetStrategies(BotState type);
|
||||
void ApplyInstanceStrategies(uint32 mapId, bool tellMaster = false);
|
||||
void EvaluateHealerDpsStrategy();
|
||||
bool ContainsStrategy(StrategyType type);
|
||||
bool HasStrategy(std::string const name, BotState type);
|
||||
BotState GetState() { return currentState; };
|
||||
|
||||
@ -190,6 +190,15 @@ bool PlayerbotAIConfig::Initialize()
|
||||
sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBotsPriceChangeInterval", 48 * HOUR);
|
||||
randomBotJoinLfg = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotJoinLfg", true);
|
||||
|
||||
restrictHealerDPS = sConfigMgr->GetOption<bool>("AiPlayerbot.HealerDPSMapRestriction", false);
|
||||
LoadList<std::vector<uint32>>(
|
||||
sConfigMgr->GetOption<std::string>("AiPlayerbot.RestrictedHealerDPSMaps",
|
||||
"33,34,36,43,47,48,70,90,109,129,209,229,230,329,349,389,429,1001,1004,"
|
||||
"1007,269,540,542,543,545,546,547,552,553,554,555,556,557,558,560,585,574,"
|
||||
"575,576,578,595,599,600,601,602,604,608,619,632,650,658,668,409,469,509,"
|
||||
"531,532,534,544,548,550,564,565,580,249,533,603,615,616,624,631,649,724"),
|
||||
restrictedHealerDPSMaps);
|
||||
|
||||
//////////////////////////// ICC
|
||||
|
||||
EnableICCBuffs = sConfigMgr->GetOption<bool>("AiPlayerbot.EnableICCBuffs", true);
|
||||
@ -653,6 +662,12 @@ bool PlayerbotAIConfig::IsInPvpProhibitedArea(uint32 id)
|
||||
return find(pvpProhibitedAreaIds.begin(), pvpProhibitedAreaIds.end(), id) != pvpProhibitedAreaIds.end();
|
||||
}
|
||||
|
||||
bool PlayerbotAIConfig::IsRestrictedHealerDPSMap(uint32 mapId) const
|
||||
{
|
||||
return restrictHealerDPS &&
|
||||
std::find(restrictedHealerDPSMaps.begin(), restrictedHealerDPSMaps.end(), mapId) != restrictedHealerDPSMaps.end();
|
||||
}
|
||||
|
||||
std::string const PlayerbotAIConfig::GetTimestampStr()
|
||||
{
|
||||
time_t t = time(nullptr);
|
||||
|
||||
@ -402,6 +402,10 @@ public:
|
||||
|
||||
static std::vector<std::vector<uint32>> ParseTempTalentsOrder(uint32 cls, std::string temp_talents_order);
|
||||
static std::vector<std::vector<uint32>> ParseTempPetTalentsOrder(uint32 spec, std::string temp_talents_order);
|
||||
|
||||
bool restrictHealerDPS = false;
|
||||
std::vector<uint32> restrictedHealerDPSMaps;
|
||||
bool IsRestrictedHealerDPSMap(uint32 mapId) const;
|
||||
};
|
||||
|
||||
#define sPlayerbotAIConfig PlayerbotAIConfig::instance()
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "Playerbots.h"
|
||||
#include "PositionValue.h"
|
||||
#include "PvpTriggers.h"
|
||||
#include "PathGenerator.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
@ -4152,7 +4153,6 @@ bool ArenaTactics::Execute(Event event)
|
||||
if (bot->isMoving())
|
||||
return false;
|
||||
|
||||
|
||||
// startup phase
|
||||
if (bg->GetStartDelayTime() > 0)
|
||||
return false;
|
||||
@ -4163,12 +4163,29 @@ bool ArenaTactics::Execute(Event event)
|
||||
if (botAI->HasStrategy("buff", BOT_STATE_NON_COMBAT))
|
||||
botAI->ChangeStrategy("-buff", BOT_STATE_NON_COMBAT);
|
||||
|
||||
// this causes bot to reset constantly in arena
|
||||
// if (sBattlegroundMgr->IsArenaType(bg->GetBgTypeID()))
|
||||
// {
|
||||
// botAI->ResetStrategies(false);
|
||||
// botAI->SetMaster(nullptr);
|
||||
// }
|
||||
Unit* target = bot->GetVictim();
|
||||
if (target)
|
||||
{
|
||||
bool losBlocked = !bot->IsWithinLOSInMap(target) || fabs(bot->GetPositionZ() - target->GetPositionZ()) > 5.0f;
|
||||
|
||||
if (losBlocked)
|
||||
{
|
||||
PathGenerator path(bot);
|
||||
path.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), false);
|
||||
|
||||
if (path.GetPathType() != PATHFIND_NOPATH)
|
||||
{
|
||||
// If you are casting a spell and lost your target due to LoS, interrupt the cast and move
|
||||
if (bot->IsNonMeleeSpellCast(false, true, true, false, true))
|
||||
bot->InterruptNonMeleeSpells(true);
|
||||
|
||||
float x, y, z;
|
||||
target->GetPosition(x, y, z);
|
||||
botAI->TellMasterNoFacing("Repositioning to exit the LoS target!");
|
||||
return MoveTo(target->GetMapId(), x + frand(-1, +1), y + frand(-1, +1), z, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bot->IsInCombat())
|
||||
return moveToCenter(bg);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user