aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


docs/research-notes/player-trade-research/native/remote-template-delivery.md (7689B)


Remote template delivery through existing native messages

Read-only follow-up using exported evidence and lifted source. No REA tools or runtime sessions were opened; parent retains ownership of its KKR session. The artifact identity is the original 14.9.1 KKR hash in README.md.

Answer

Yes: AddTemplate can create a counted template row on a remote SimpleChar. Trade4 can then move that complete row into the remote actor's TradeInv, which the local trade UI displays through page208. This avoids the count1 construction in peer action7. These are observed native operations; the composed sequence is a reconstruction and still requires a two-client runtime test.

The persistent server instance ID must remain unchanged in the atomic ownership transaction. AddTemplate itself creates a client proxy with identity(0,0); it does not transmit or change that persistent ID. Thus this preserves authoritative server IDs and row quantity, but not a distinct native dynel identity for the temporary proxy. Normal AddTemplate grants already use this representation.

Exact retained evidence

All three records are in local/reports/stack-resync-1491-evidence.json and were copied into remote-template-0x*.c.txt here without reopening the binary.

Entry Evidence ID Observation
1007cfe0 ev_51546b34f37c502e64f97b7f8d254e9cb41cf83c71b676217ffd69bc1ff2761a Reader consumes lowTemplate, highTemplate, QL, count; high0 becomes low; QL low16
1007d090 ev_b43a133a4bc5a3a18f15a321bada7ed50f61702ad9a9e5e0a2ca5b3f6ff7926a Resolves outer subject as SimpleChar; no local-player guard; invokes subject inventory helper
1005ef90 ev_7b4afe19deabc80973ba1b2ac210a5f9b66e9ac793f6521ed89d7b5eec615066 First-free ordinary slot from48, explicit packet count into1002d580; inventory notification and mass addition

The handler's receiver is unambiguous in lifted source: client/game/kkr.dll/lifted-0036.c:8085, sub_3607D090, instruction3607d0bc loads ecx = actor+0x150 before calling3605ef90. It does not use GetClientChar. Apply source is client/game/kkr.dll/lifted-0029.c:578, sub_3605EF90.

Row constructor1002d580 creates flags0x21, count low16, identity(0,0), preserves QL/low/high. Prior row evidence: ev_7068398cd05aadd58835c11d5c29bbf6ca622ac2a23614a299144bd8b9348cdb in local/shop-purchase-research/native/delivery-evidence.json.

Trade4/5/Complete/Abort are in this directory's retained KKR evidence and reused core-handler batch: ev_3b068fe016d29c9c6d60176e86341dcd106df72df90b32492a9c956186bf61c7. 100601b0 moves the complete source row into first-free TradeInv through1002d3c0; the template branch is tested before the actual-object branch.

Concrete sequence on observer B

Let playerA offer a count25 kit and let native ordinary slot48 currently be free on the remote A object in B's client. A and B must already be initialized in trade.

  1. AddTemplate key0x052e2f0c, outer(50000,A), body {low,high,QL,25}. This creates a template row in A ordinary slot48 on B's client.
  2. TradeIIR key0x36284f6e, outer(50000,A), body {1,4,50000,A,104,48}. It moves that same row into A first-free TradeInv. B's page208 list now points to the complete counted row.
  3. For removal, TradeIIR outer(50000,A), body {1,5,50000,A,108,tradeSlot}. Use108 even though the GUI reference was208: subject A owns this TradeInv. This restores the row to A ordinary first-free.
  4. For success after durable commit, send Complete3 for A and B to each client. CompleteA moves A's count25 row into B ordinary first-free. CompleteB moves B's offers into A ordinary first-free. Both preserve full row quantities.

Own A's client already has the real owned source row and must receive its normal Trade4 source reference, without a duplicate AddTemplate. The observer's seed slot is a client presentation slot and need not equal A's actual source slot.

Trade4's validator requires first identity=subject owner, subject in trade, valid source ownership, general admission and first-free TradeInv capacity. The template proxy satisfies the ownership branch through row flag1; it need not have a live dynel or persistent native instance identity.

Removal and close implications

Remove8 is for actual dynel identities. Its first identity is the partner and its second identity is the actual item identity. It cannot select an arbitrary AddTemplate row by server ID because that row has native identity(0,0). Using (0,0) would delete the first matching proxy and cannot identify a later one. Use the remote subject's Trade5 for counted template rows.

Trade5 does not discard the observer's proxy: it returns it to remote ordinary inventory. Abort similarly restores every remote TradeInv row first-free before closing. Complete also fills the remote actor's ordinary inventory with the observer's outgoing rows. Therefore remote ordinary inventory is not necessarily empty on the next offer or next session. Assuming every seed uses48 will fail.

This matters beyond cosmetic leftovers: Complete searches the remote recipient's ordinary capacity even when transferring the local owner's outgoing rows. If a remote shadow fills up, Complete can stop early and leave local TradeInv rows behind after clearing its trade flag. Ensure remote shadow capacity is known and cleared/reconciled before composing another transaction.

A bounded remote cleanup or explicit tracking can keep scratch slots predictable. Trade5 followed by deletion of the restored remote ordinary proxy balances the native template mass add/subtract path. Direct deletion from TradeInv would subtract mass again after Trade4 already removed that mass; this is an additional reason to prefer normal Trade5 restoration for the basic protocol sequence.

CharacterAction112 is a possible cleanup primitive, but selecting its affected remote rows must be deliberate. Retained stack evidence proves dispatcher 1006fa30 case0x70 calls1005f270 without a local-only guard: ev_a72f5fcc86874822b1b63307e5a87629672d3ba8de1270fbeb43fe2e0bf7cd44. Delete helper1005f270 selects the page through10061800, handles template flags, subtracts template mass and deletes the row; evidence ev_adf2bdce609e25d955a4c232cc1035041d4692c16e8af2b37e85653298399b7d. The dispatcher is in local/reports/stack-protocol-1491-evidence.json; the deletion helper is in local/reports/stack-resync-1491-evidence.json. Template deletion can dispatch authored deletion effects when present, so a broad cleanup is not automatically neutral for every item. This follow-up has not runtime-tested remote cleanup or actual-dynel deletion side effects.

Ordering, identity, and test boundaries

Complete must be sent for both actors, even when one basket is empty, because each direction also handles that actor's offered cash and active trade flag. Either direction order preserves the other actor's independent TradeInv. This does not mean arbitrary packet reordering is safe: AddTemplate must precede its Trade4, and all offer deliveries must precede Complete.

These findings do not establish the historical server's chosen packet sequence. They establish that existing native operations can convey a remote template row's full quantity without altering the client or replaying FullCharacter. Before production claims, verify B's page208 row count25 before acceptance, received ordinary count25 after both Complete messages, removal of non-first offers, cancellation and another trade, persistent IDs after reconnect, and mixed actual-backpack/template offers. Real bags still need actual Chest objects and contents; converting those into null-ID template proxies would lose their separate native identity contract.