Skip to content

Commit

Permalink
NPCBots: Report assigned bot items if not found in DB
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer authored and ikkj committed Jun 10, 2024
1 parent c6bc071 commit 7e45d30
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/server/game/AI/NpcBots/bot_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15730,8 +15730,12 @@ void bot_ai::InitEquips()
//"SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, guid, itemEntry, owner_guid "
// "FROM item_instance WHERE guid IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_SYNCH

std::array<uint32, BOT_INVENTORY_SIZE> assigned_item_guids{};
for (uint8 i = 0; i != BOT_INVENTORY_SIZE; ++i)
{
stmt->SetData(i, npcBotData->equips[i]);
assigned_item_guids[i] = npcBotData->equips[i];
}

PreparedQueryResult iiresult = CharacterDatabase.Query(stmt);

Expand Down Expand Up @@ -15770,11 +15774,19 @@ void bot_ai::InitEquips()
}
}
ASSERT(found);
//ItemTemplate const* proto = item->GetTemplate();
//TC_LOG_ERROR("entities.player", "minion_ai::InitEquips(): bot %s (id: %u): found item: for slot %u: %s (id: %u, guidLow: %u)",
// me->GetName().c_str(), me->GetEntry(), i, proto->Name1.c_str(), itemId, itemGuidLow);
}
while (iiresult->NextRow());
for (uint8 i = 0; i != BOT_INVENTORY_SIZE; ++i)
{
if (assigned_item_guids[i] == itemGuidLow)
assigned_item_guids[i] = 0;
}

} while (iiresult->NextRow());
}

for (uint8 i = 0; i != BOT_INVENTORY_SIZE; ++i)
{
if (assigned_item_guids[i] != 0)
LOG_ERROR("npcbots", "InitEquips: bot {} {} has item guid {} assigned to slot {} which doesn't exist in DB!", me->GetEntry(), me->GetName(), assigned_item_guids[i], uint32(i));
}
}

Expand Down

0 comments on commit 7e45d30

Please sign in to comment.