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
CurrencyCredit
Currency this character RECEIVES, which is NOT yet in memory when the leg is captured.
public long CurrencyCredit
Field Value
Remarks
Deductions are applied to memory before the write (an escrow: a concurrent spend can only spend what is left), but credits are applied only after the commit. A credit applied before it could be spent during the write, and a refused write could then not take it back exactly. So the attribute row for CurrencyTemplateID is written as memory plus this amount, and the caller credits memory on success.
CurrencyPaid
Currency this character paid to the other, for the economy ledger. Zero writes no ledger row.
public long CurrencyPaid
Field Value
CurrencyTemplateID
The attribute template CurrencyCredit is added to. Zero when no credit.
public int CurrencyTemplateID
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
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