fix: defer loot item notification until item name is known from server query

When SMSG_ITEM_PUSH_RESULT arrives for an item not yet in the cache, store
a PendingItemPushNotif and fire the 'Received: [item]' chat message only
after SMSG_ITEM_QUERY_SINGLE_RESPONSE resolves the name and quality, so the
notification always shows a proper item link instead of 'item #12345'.

Notifications that are already cached emit immediately as before; multiple
pending notifs for the same item are all flushed on the single response.
This commit is contained in:
Kelsi 2026-03-18 04:25:37 -07:00
parent 09b0bea981
commit c1765b6b39
2 changed files with 42 additions and 15 deletions

View file

@ -2644,6 +2644,14 @@ private:
std::unordered_map<uint64_t, OnlineItemInfo> onlineItems_;
std::unordered_map<uint32_t, ItemQueryResponseData> itemInfoCache_;
std::unordered_set<uint32_t> pendingItemQueries_;
// Deferred SMSG_ITEM_PUSH_RESULT notifications for items whose info wasn't
// cached at arrival time; emitted once the query response arrives.
struct PendingItemPushNotif {
uint32_t itemId = 0;
uint32_t count = 1;
};
std::vector<PendingItemPushNotif> pendingItemPushNotifs_;
std::array<uint64_t, 23> equipSlotGuids_{};
std::array<uint64_t, 16> backpackSlotGuids_{};
std::array<uint64_t, 32> keyringSlotGuids_{};