Class ItemExchangeLeg
- Namespace
- FishMMO.Server.Core.World.SceneServer
- Assembly
- FishMMO.Server.dll
One character's half of a two-character exchange, as handed to TryRunExchange(IPlayerCharacter, IPlayerCharacter, Func<ItemExchangeLeg[]>, Action<bool>, string).
public sealed class ItemExchangeLeg
- Inheritance
-
ItemExchangeLeg
- Inherited Members
Remarks
Built on the main thread, inside the apply hop, while both characters' row locks are held and immediately after memory was mutated; it names which rows that mutation touched so the write can be captured there and applied on the worker as one unit with the other character's leg. Live Item references are read once, at capture, and never on the worker.
An item that moved between the two characters whole appears ONLY in the receiver's
ChangedInventoryItems: its row keeps its identity and the upsert moves it
by rewriting character_id. The giver must not also list it as removed, or the
delete would race the move. An item that merged entirely into a stack the receiver
already held ceased to exist as a row and IS listed by the giver as removed; the stack
it merged into is listed by the receiver as changed.
Fields
ChangedInventoryItems
Inventory items whose rows must be written: reduced stacks, stacks that grew by a merge, items placed in a slot — including items that arrived from the other character, which carry their existing identity and are re-owned by the write.
public List<Item> ChangedInventoryItems
Field Value
Character
The character this leg writes for.
public IPlayerCharacter Character
Field Value
CurrencyPaid
Currency this character paid to the other, for the economy ledger. Zero writes no ledger row.
public long CurrencyPaid
Field Value
LedgerReason
The ledger reason to record CurrencyPaid under.
public CurrencyMovementReason LedgerReason
Field Value
PersistAttributes
True when the character's currency moved, so the attribute sheet rides in the same transaction as the item rows. Half a trade landing — the items without the coin — is exactly the failure this exists to rule out.
public bool PersistAttributes
Field Value
Remarks
The sheet is written exactly as memory holds it, so the caller applies every payment AND
every credit before handing the legs back. A leg used to carry the credit separately, to be
folded into the written row while memory received it only after the commit — and every
other capture of the sheet in that window overwrote the credited row with one that lacked
it. The trade now holds the credit instead (TradeCurrencySettlement).
RemovedInventoryItems
Inventory rows that ceased to exist, with the versions that authorise the deletes.
public List<RemovedItemRecord> RemovedInventoryItems
Field Value
TouchedSlots
Every inventory slot the exchange read or wrote on this character. Locked from the moment memory is applied until the exchange has committed or been undone, so that an undo is exact: nothing else can move into, out of, or merge with these slots while the outcome is still open.
public List<int> TouchedSlots