mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
improved check to avoid unresponsive BG/arena bot, and removed possibility of battleground strat crashing server when in wrong BG
This commit is contained in:
@@ -977,8 +977,10 @@ bool BGStatusAction::Execute(Event event)
|
||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||
|
||||
botAI->ResetStrategies(false);
|
||||
// if this is first bot into BG they can lose bg strat
|
||||
botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT);
|
||||
if (!bot->GetBattleground()) {
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly, set bg for "bg strategy check" to fix that
|
||||
botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT);
|
||||
}
|
||||
context->GetValue<uint32>("bg role")->Set(urand(0, 9));
|
||||
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()["bg objective"];
|
||||
@@ -1085,8 +1087,10 @@ bool BGStatusAction::Execute(Event event)
|
||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||
|
||||
botAI->ResetStrategies(false);
|
||||
// if this is first bot into BG they can lose bg strat
|
||||
botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT);
|
||||
if (!bot->GetBattleground()) {
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly, set bg for "bg strategy check" to fix that
|
||||
botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT);
|
||||
}
|
||||
context->GetValue<uint32>("bg role")->Set(urand(0, 9));
|
||||
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()["bg objective"];
|
||||
|
||||
@@ -2609,7 +2609,7 @@ bool BGTactics::Execute(Event event)
|
||||
|
||||
if (bg->isArena())
|
||||
{
|
||||
// can't use this in arena - it will crash server wehen vPaths/vFlagIds are used uninitialized
|
||||
// can't use this in arena - no vPaths/vFlagIds (will crash server)
|
||||
botAI->ResetStrategies();
|
||||
return false;
|
||||
}
|
||||
@@ -2656,6 +2656,9 @@ bool BGTactics::Execute(Event event)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// can't use this in this BG - no vPaths/vFlagIds (will crash server)
|
||||
botAI->ResetStrategies();
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user