benilla-re systems structs docs

Script::CloseTrade

function · ui · orchestration

Address
0x4bfdc0 · 33 bytes, up to 0x4bfde0
Signature
int __fastcall (lua_State *L)
Meaning
Signals PLAYER_TRADE_MONEY unless the trade completed, then closes the trade window
Confidence
verified, proof one
Name from
the community database (idb)
Finding
ui/trade#opening-and-closing-the-window

Finding: Opening and closing the window in ui: trade requests and status messages

0x4bf4e0(done, partner GUID) is the one place the window changes. A nonzero GUID makes the partner the interaction object, stores the GUID, clears the seven offer slots, the accept flags and the money cells, offers what the cursor holds when the trade was started by a drop, and signals TRADE_SHOW (0x13f). A zero GUID with a partner stored stores done, ends the interaction, clears the partner and signals TRADE_CLOSED (0x140). It then sends CMSG_CANCEL_TRADE (0x11c) whether or not a partner was stored. When the partner is still the interaction target the close runs twice (below). Statuses 3, 8 and 12 close, and status 8 passes done 1; 2 opens. CloseTrade() first signals PLAYER_TRADE_MONEY (0x146) when done is 0, then closes.

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 2

Calls and jumps by a bare address, from tables/calls.tsv.