mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-28 07:56:24 +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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuidVector members = AI_VALUE(GuidVector, "group members");
|
std::vector<Player*> players = botAI->GetPlayersInGroup();
|
||||||
for (auto& member : members)
|
for (Player* player : players)
|
||||||
{
|
{
|
||||||
Player* player = botAI->GetPlayer(member);
|
if (!player || !player->IsInWorld() || player->IsDuringRemoveFromWorld())
|
||||||
if (!player->GetSession()->IsBot()) { continue; }
|
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)
|
if (composition[i] > 0)
|
||||||
{
|
{
|
||||||
drakeAssignments[botAI->GetGroupSlotIndex(player)] = DRAKE_ITEMS[i];
|
drakeAssignments[slot] = DRAKE_ITEMS[i];
|
||||||
composition[i]--;
|
composition[i]--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,8 +89,10 @@ void PacketHandlingHelper::Handle(ExternalEventHelper& helper)
|
|||||||
{
|
{
|
||||||
while (!queue.empty())
|
while (!queue.empty())
|
||||||
{
|
{
|
||||||
helper.HandlePacket(handlers, queue.top());
|
WorldPacket packet = queue.top();
|
||||||
queue.pop();
|
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)
|
void PlayerbotAI::UpdateAIInternal([[maybe_unused]] uint32 elapsed, bool minimal)
|
||||||
{
|
{
|
||||||
if (!bot || bot->IsBeingTeleported() || !bot->IsInWorld())
|
|
||||||
|
if (!bot || !bot->GetSession())
|
||||||
return;
|
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";
|
std::string const mapString = WorldPosition(bot).isOverworld() ? std::to_string(bot->GetMapId()) : "I";
|
||||||
PerfMonitorOperation* pmo =
|
PerfMonitorOperation* pmo =
|
||||||
sPerfMonitor->start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIInternal " + mapString);
|
sPerfMonitor->start(PERF_MON_TOTAL, "PlayerbotAI::UpdateAIInternal " + mapString);
|
||||||
@@ -2238,10 +2247,15 @@ bool PlayerbotAI::IsMainTank(Player* player)
|
|||||||
|
|
||||||
bool PlayerbotAI::IsBotMainTank(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;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (IsMainTank(player))
|
if (IsMainTank(player))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user