TradeContext

Immutable data object representing a pending trade between an Agent and a Player. Bundles the trading agent, the item being traded, and the item's coin value.

Definition

Namespace: Paragon.Townskeep.ShopSystem Assembly: Townskeep.dll

public class TradeContext

Remarks

TradeContext is a simple data container created by TradingArea.StartTradeContext() when an agent initiates a trade. It holds readonly references to:

  • The agent performing the trade

  • The item being traded

  • The coin value of the item (derived from Item.Value)

The context lives for the duration of a pending trade and is nullified when TradingArea.CompleteTrade() finalizes the exchange. It is not serialized or networked — it exists only as transient runtime state.

Quick Lookup

Goal
How

Get the trading agent

tradeContext.TradeAgent

Get the traded item

tradeContext.TradeItem

Get the trade value

tradeContext.TradeValue

Properties

TradeAgent

The Agent initiating the trade.

TradeItem

The Item being traded.

TradeValue

The coin value of the traded item. Derived from TradeItem.Value.

Constructor

Parameter
Type
Description

tradeAgent

Agent

The agent performing the trade

tradeItem

Item

The item being offered for trade

Usage Example

See Also

  • TradingArea — creates and manages TradeContext instances

  • Agent — the trading entity

  • DisplayArea — display surface where items are picked up from

Last updated