Table of Contents

Interface ITradeAutomation

Namespace
AcDream.Plugin.Abstractions
Assembly
AcDream.Plugin.Abstractions.dll

Reads and drives the secure trade window -- the two-sided exchange where each player stages items and both must accept. Commands send exactly what the window's own buttons send; the events are raised on the host's tick thread as the tracked trade state changes.

public interface ITradeAutomation

Properties

IsAvailable

True when this surface can be used: the session is in the world and the host provides trading.

bool IsAvailable { get; }

Property Value

bool

IsOpen

True while a trade window is open with a partner.

bool IsOpen { get; }

Property Value

bool

MyAccepted

True once the local player has accepted the current contents.

bool MyAccepted { get; }

Property Value

bool

MyItems

The items the local player has staged, empty when none are.

IReadOnlyList<uint> MyItems { get; }

Property Value

IReadOnlyList<uint>

PartnerAccepted

True once the partner has accepted the current contents.

bool PartnerAccepted { get; }

Property Value

bool

PartnerItems

The items the partner has staged, empty when none are.

IReadOnlyList<uint> PartnerItems { get; }

Property Value

IReadOnlyList<uint>

PartnerName

The trade partner's character name, or an empty string when no trade is open or the client has no object for the partner.

string PartnerName { get; }

Property Value

string

PartnerObjectId

The trade partner's object id, or zero when no trade is open.

uint PartnerObjectId { get; }

Property Value

uint

Methods

Accept()

Accepts the trade as it currently stands. Returns AlreadyAccepted without touching the wire when the local side has already accepted.

PluginTradeCommandResult Accept()

Returns

PluginTradeCommandResult

Add(uint)

Asks the server to stage one owned item into the local side of the trade, the same as dragging it into the window.

PluginTradeCommandResult Add(uint itemObjectId)

Parameters

itemObjectId uint

Returns

PluginTradeCommandResult

Decline()

Withdraws the local side's acceptance. Unlike Accept() this carries no already-done guard and always sends.

PluginTradeCommandResult Decline()

Returns

PluginTradeCommandResult

End()

Asks the server to close the trade outright, cancelling it for both sides.

PluginTradeCommandResult End()

Returns

PluginTradeCommandResult

Reset()

Asks the server to clear everything staged on both sides, leaving the window open.

PluginTradeCommandResult Reset()

Returns

PluginTradeCommandResult

Events

Closed

Raised when the trade window closes, for any reason.

event Action Closed

Event Type

Action

ItemAdded

Raised once per item newly staged into either side of the trade.

event Action<PluginTradeItemAdded> ItemAdded

Event Type

Action<PluginTradeItemAdded>

Opened

Raised when a trade window opens with a partner.

event Action<PluginTradeOpened> Opened

Event Type

Action<PluginTradeOpened>

PartnerTradeAccepted

Raised when the partner accepts the trade; the argument is the partner's object id. Named PartnerTradeAccepted rather than PartnerAccepted because C# forbids a property and an event with the same name on one interface, and PartnerAccepted is already the live acceptance flag.

event Action<uint> PartnerTradeAccepted

Event Type

Action<uint>