mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
BG Crash fixes
This commit is contained in:
@@ -431,7 +431,7 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Battleground switch
|
// Battleground switch
|
||||||
if (player->InBattleground())
|
if (player->InBattleground() && player->GetBattleground())
|
||||||
{
|
{
|
||||||
BattlegroundTypeId bgType = player->GetBattlegroundTypeId();
|
BattlegroundTypeId bgType = player->GetBattlegroundTypeId();
|
||||||
if (bgType == BATTLEGROUND_RB)
|
if (bgType == BATTLEGROUND_RB)
|
||||||
@@ -632,7 +632,7 @@ void AiFactory::AddDefaultNonCombatStrategies(Player* player, PlayerbotAI* const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Battleground switch
|
// Battleground switch
|
||||||
if (player->InBattleground())
|
if (player->InBattleground() && player->GetBattleground())
|
||||||
{
|
{
|
||||||
nonCombatEngine->addStrategies("nc", "chat", "default", "buff", "food", "mount", "pvp", "collision", "dps assist", "attack tagged", "emote", nullptr);
|
nonCombatEngine->addStrategies("nc", "chat", "default", "buff", "food", "mount", "pvp", "collision", "dps assist", "attack tagged", "emote", nullptr);
|
||||||
nonCombatEngine->removeStrategy("custom::say");
|
nonCombatEngine->removeStrategy("custom::say");
|
||||||
|
|||||||
@@ -897,7 +897,7 @@ void PlayerbotAI::DoNextAction(bool min)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// same BG
|
// same BG
|
||||||
if (bot->InBattleground() && bot->GetBattleground()->GetBgTypeID() == BATTLEGROUND_AV && !GET_PLAYERBOT_AI(member) && member->InBattleground() && bot->GetMapId() == member->GetMapId())
|
if (bot->InBattleground() && bot->GetBattleground() && bot->GetBattleground()->GetBgTypeID() == BATTLEGROUND_AV && !GET_PLAYERBOT_AI(member) && member->InBattleground() && bot->GetMapId() == member->GetMapId())
|
||||||
{
|
{
|
||||||
// TODO disable move to objective if have master in bg
|
// TODO disable move to objective if have master in bg
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
|
|||||||
else
|
else
|
||||||
BgPlayers[queueTypeId][bracketId][teamId]++;
|
BgPlayers[queueTypeId][bracketId][teamId]++;
|
||||||
|
|
||||||
if (!player->IsInvitedForBattlegroundInstance() && (!player->InBattleground() || player->GetBattleground()->GetBgTypeID() != BattlegroundMgr::BGTemplateId(queueTypeId)))
|
if (!player->IsInvitedForBattlegroundInstance() && (!player->InBattleground() || (player->GetBattleground() && player->GetBattleground()->GetBgTypeID() != BattlegroundMgr::BGTemplateId(queueTypeId))))
|
||||||
{
|
{
|
||||||
if (BattlegroundMgr::BGArenaType(queueTypeId))
|
if (BattlegroundMgr::BGArenaType(queueTypeId))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4880,6 +4880,11 @@ bool ArenaTactics::Execute(Event event)
|
|||||||
|
|
||||||
bool ArenaTactics::moveToCenter(Battleground* bg)
|
bool ArenaTactics::moveToCenter(Battleground* bg)
|
||||||
{
|
{
|
||||||
|
// Sanity check
|
||||||
|
if (!bg)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
uint32 Preference = context->GetValue<uint32>("bg role")->Get();
|
uint32 Preference = context->GetValue<uint32>("bg role")->Get();
|
||||||
switch (bg->GetBgTypeID())
|
switch (bg->GetBgTypeID())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user