fix: trade COMPLETE resets state before EXTENDED can populate items/gold

SMSG_TRADE_STATUS(COMPLETE) and SMSG_TRADE_STATUS_EXTENDED arrive in the
same packet batch. COMPLETE was calling resetTradeState() which cleared
all trade slots and gold BEFORE EXTENDED could write the final data.
The trade window showed "7c" (garbage gold) because the gold field read
from the wrong offset (slot size was also wrong: 60→52 bytes).

Now COMPLETE just sets status to None without full reset, preserving
trade state for EXTENDED to populate. The TRADE_CLOSED addon event
still fires correctly.
This commit is contained in:
Kelsi 2026-03-28 15:18:33 -07:00
parent ed7cbccceb
commit ce54b196e7

View file

@ -2102,7 +2102,9 @@ void InventoryHandler::handleTradeStatus(network::Packet& packet) {
owner_.addSystemChatMessage("You are already trading.");
break;
case 7: // TRADE_STATUS_COMPLETE
resetTradeState();
// Don't reset immediately — TRADE_STATUS_EXTENDED may arrive in the same
// packet batch and needs the trade state to store final item/gold data.
tradeStatus_ = TradeStatus::None;
owner_.addSystemChatMessage("Trade complete.");
if (owner_.addonEventCallback_) {
owner_.addonEventCallback_("TRADE_CLOSED", {});