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
IsOpen
True while a trade window is open with a partner.
bool IsOpen { get; }
Property Value
MyAccepted
True once the local player has accepted the current contents.
bool MyAccepted { get; }
Property Value
MyItems
The items the local player has staged, empty when none are.
IReadOnlyList<uint> MyItems { get; }
Property Value
PartnerAccepted
True once the partner has accepted the current contents.
bool PartnerAccepted { get; }
Property Value
PartnerItems
The items the partner has staged, empty when none are.
IReadOnlyList<uint> PartnerItems { get; }
Property Value
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
PartnerObjectId
The trade partner's object id, or zero when no trade is open.
uint PartnerObjectId { get; }
Property Value
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
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
itemObjectIduint
Returns
Decline()
Withdraws the local side's acceptance. Unlike Accept() this carries no already-done guard and always sends.
PluginTradeCommandResult Decline()
Returns
End()
Asks the server to close the trade outright, cancelling it for both sides.
PluginTradeCommandResult End()
Returns
Reset()
Asks the server to clear everything staged on both sides, leaving the window open.
PluginTradeCommandResult Reset()
Returns
Events
Closed
Raised when the trade window closes, for any reason.
event Action Closed
Event Type
ItemAdded
Raised once per item newly staged into either side of the trade.
event Action<PluginTradeItemAdded> ItemAdded
Event Type
Opened
Raised when a trade window opens with a partner.
event Action<PluginTradeOpened> Opened
Event Type
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