From 9cd52c4dd7b7494a3df6f64123423243be625aa8 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sat, 14 Mar 2026 07:31:15 -0700 Subject: [PATCH] fix(loot): gate auto-loot sends per loot session --- include/game/game_handler.hpp | 1 + src/game/game_handler.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/game/game_handler.hpp b/include/game/game_handler.hpp index 2513083f..04e959db 100644 --- a/include/game/game_handler.hpp +++ b/include/game/game_handler.hpp @@ -2829,6 +2829,7 @@ private: struct LocalLootState { LootResponseData data; bool moneyTaken = false; + bool itemAutoLootSent = false; }; std::unordered_map localLootState_; struct PendingLootRetry { diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index ae28aad7..0d933601 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -19582,7 +19582,8 @@ void GameHandler::handleLootResponse(network::Packet& packet) { std::remove_if(pendingGameObjectLootOpens_.begin(), pendingGameObjectLootOpens_.end(), [&](const PendingLootOpen& p) { return p.guid == currentLoot.lootGuid; }), pendingGameObjectLootOpens_.end()); - localLootState_[currentLoot.lootGuid] = LocalLootState{currentLoot, false}; + auto& localLoot = localLootState_[currentLoot.lootGuid]; + localLoot.data = currentLoot; // Query item info so loot window can show names instead of IDs for (const auto& item : currentLoot.items) { @@ -19607,11 +19608,12 @@ void GameHandler::handleLootResponse(network::Packet& packet) { } // Auto-loot items when enabled - if (autoLoot_ && state == WorldState::IN_WORLD && socket) { + if (autoLoot_ && state == WorldState::IN_WORLD && socket && !localLoot.itemAutoLootSent) { for (const auto& item : currentLoot.items) { auto pkt = AutostoreLootItemPacket::build(item.slotIndex); socket->send(pkt); } + localLoot.itemAutoLootSent = true; } }