mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-23 13:36:23 +00:00
[CRASH FIX] Crash logs fixes (#2052)
https://github.com/mod-playerbots/mod-playerbots/issues/2046 https://github.com/mod-playerbots/mod-playerbots/issues/2030
This commit is contained in:
@@ -62,17 +62,25 @@ bool MountDrakeAction::Execute(Event event)
|
||||
break;
|
||||
}
|
||||
|
||||
GuidVector members = AI_VALUE(GuidVector, "group members");
|
||||
for (auto& member : members)
|
||||
std::vector<Player*> players = botAI->GetPlayersInGroup();
|
||||
for (Player* player : players)
|
||||
{
|
||||
Player* player = botAI->GetPlayer(member);
|
||||
if (!player->GetSession()->IsBot()) { continue; }
|
||||
if (!player || !player->IsInWorld() || player->IsDuringRemoveFromWorld())
|
||||
continue;
|
||||
|
||||
for (int i = 0; i < composition.size(); i++)
|
||||
WorldSession* session = player->GetSession();
|
||||
if (!session || !session->IsBot())
|
||||
continue;
|
||||
|
||||
int slot = botAI->GetGroupSlotIndex(player);
|
||||
if (slot < 0)
|
||||
continue;
|
||||
|
||||
for (uint8 i = 0; i < composition.size(); ++i)
|
||||
{
|
||||
if (composition[i] > 0)
|
||||
{
|
||||
drakeAssignments[botAI->GetGroupSlotIndex(player)] = DRAKE_ITEMS[i];
|
||||
drakeAssignments[slot] = DRAKE_ITEMS[i];
|
||||
composition[i]--;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -89,8 +89,10 @@ void PacketHandlingHelper::Handle(ExternalEventHelper& helper)
|
||||
{
|
||||
while (!queue.empty())
|
||||
{
|
||||
helper.HandlePacket(handlers, queue.top());
|
||||
queue.pop();
|
||||
WorldPacket packet = queue.top();
|
||||
queue.pop(); // remove first so handling can't modify the queue while we're using it
|
||||
|
||||
helper.HandlePacket(handlers, packet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,9 +439,16 @@ void PlayerbotAI::UpdateAIGroupMaster()
|
||||
|
||||
void PlayerbotAI::UpdateAIInternal([[maybe_unused]] uint32 elapsed, bool minimal)
|
||||
{
|
||||
if (!bot || bot->IsBeingTeleported() || !bot->IsInWorld())
|
||||
|
||||
if (!bot || !bot->GetSession())
|
||||
return;
|
||||
|
||||
if (!bot->IsInWorld() || bot->IsBeingTeleported() || bot->IsDuringRemoveFromWorld())
|
||||
return;
|
||||
|
||||
if (!bot->GetMap())
|
||||
return; // instances are created and destroyed on demand
|
||||
|
||||
std::string const mapString = WorldPosition(bot).isOverworld() ? std::to_string(bot->GetMapId()) : "I";
|
||||
PerfMonitorOperation* pmo =
|
||||
sPerfMonitor->start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIInternal " + mapString);
|
||||
@@ -2238,10 +2247,15 @@ bool PlayerbotAI::IsMainTank(Player* player)
|
||||
|
||||
bool PlayerbotAI::IsBotMainTank(Player* player)
|
||||
{
|
||||
if (!player->GetSession()->IsBot() || !IsTank(player))
|
||||
{
|
||||
if (!player || !player->IsInWorld() || player->IsDuringRemoveFromWorld())
|
||||
return false;
|
||||
|
||||
WorldSession* session = player->GetSession();
|
||||
if (!session || !session->IsBot())
|
||||
return false;
|
||||
|
||||
if (!IsTank(player))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsMainTank(player))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user