enable battleground

This commit is contained in:
Yunfan Li
2023-10-19 00:20:45 +08:00
parent e5e05988b2
commit 29b748803e
16 changed files with 151 additions and 36 deletions

View File

@@ -8,6 +8,7 @@
#include "BattlegroundMgr.h"
#include "Event.h"
#include "GroupMgr.h"
#include "PlayerbotAI.h"
#include "Playerbots.h"
#include "PositionValue.h"
@@ -466,7 +467,8 @@ bool BGJoinAction::JoinQueue(uint32 type)
// get battlemaster
Unit* unit = botAI->GetUnit(AI_VALUE2(CreatureData const*, "bg master", bgTypeId));
if (!unit && isArena)
{
{
botAI->GetAiObjectContext()->GetValue<uint32>("bg type")->Set(0);
LOG_DEBUG("playerbots", "Bot {} could not find Battlemaster to join", bot->GetGUID().ToString().c_str());
return false;
}
@@ -1102,3 +1104,17 @@ bool BGStatusCheckAction::isUseful()
{
return bot->InBattlegroundQueue();
}
bool BGStrategyCheckAction::Execute(Event event)
{
bool inside_bg = bot->InBattleground() && bot->GetBattleground();;
if (!inside_bg && botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT)) {
botAI->ResetStrategies();
return true;
}
if (inside_bg && !botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT)) {
botAI->ResetStrategies();
return false;
}
return false;
}