Interface IVendorAutomation
- Namespace
- AcDream.Plugin.Abstractions
- Assembly
- AcDream.Plugin.Abstractions.dll
Reads the open vendor's stock and shops with it. Buying and selling is two-step: items are staged into a local buy or sell list, which costs nothing and touches no wire, and then BuyAll() or SellAll() commits the whole list at once and empties it.
public interface IVendorAutomation
Properties
BuyList
Every item currently staged to buy, with its requested count.
IReadOnlyList<(uint TemplateObjectId, int Count)> BuyList { get; }
Property Value
IsAvailable
True when the session is in the world, so vendor commands can run.
bool IsAvailable { get; }
Property Value
IsBusy
True while a buy or sell this surface committed is still awaiting the server's answer. This is vendor-local; it is not the client-wide inventory-request gate, which vendor transactions never take.
bool IsBusy { get; }
Property Value
IsOpen
True while a vendor's shop pane is open.
bool IsOpen { get; }
Property Value
Items
Everything the open vendor currently has for sale; empty when no vendor is open.
IReadOnlyList<PluginVendorItem> Items { get; }
Property Value
Profile
The open vendor's shop terms: the rate it pays for goods, the categories it deals in, its value limits and the currency it takes. When no vendor is open, or this host does not provide the surface, this is Unset -- which says so in its own fields rather than looking like a vendor that refuses everything -- but IsOpen is still the thing to check before planning against it.
PluginVendorProfile Profile { get; }
Property Value
SellList
Every owned item currently staged to sell.
IReadOnlyList<uint> SellList { get; }
Property Value
VendorName
The open vendor's name, or an empty string when no vendor is open or the client has no object for it.
string VendorName { get; }
Property Value
VendorObjectId
The open vendor's object id, or zero when none is open.
uint VendorObjectId { get; }
Property Value
Methods
AddToBuyList(uint, int)
Stages one of the vendor's listings to buy, adding to the count already staged for it. Nothing is sent until BuyAll().
PluginVendorCommandResult AddToBuyList(uint templateObjectId, int count)
Parameters
Returns
AddToSellList(uint)
Stages one owned item to sell. The item must be owned by the player, not currently equipped, and not itself a vendor listing. Nothing is sent until SellAll().
PluginVendorCommandResult AddToSellList(uint itemObjectId)
Parameters
itemObjectIduint
Returns
BuyAll()
Asks the server to buy everything staged in the buy list, then empties the list. Reports InvalidItem when nothing is staged and Busy when an earlier buy or sell is still outstanding. The server's answer arrives on TransactionCompleted.
PluginVendorCommandResult BuyAll()
Returns
ClearBuyList()
Empties the buy list without sending anything.
PluginVendorCommandResult ClearBuyList()
Returns
ClearSellList()
Empties the sell list without sending anything.
PluginVendorCommandResult ClearSellList()
Returns
RemoveFromBuyList(uint)
Un-stages a listing from the buy list.
PluginVendorCommandResult RemoveFromBuyList(uint templateObjectId)
Parameters
templateObjectIduint
Returns
RemoveFromSellList(uint)
Un-stages an item from the sell list.
PluginVendorCommandResult RemoveFromSellList(uint itemObjectId)
Parameters
itemObjectIduint
Returns
SellAll()
Asks the server to sell everything staged in the sell list, each item in its full stack, then empties the list. Gated exactly like BuyAll(), and answered on TransactionCompleted.
PluginVendorCommandResult SellAll()
Returns
TryCaptureProperties(uint, out PluginItemProperties)
Reads the property tables the vendor's listing already carried for one of its items, including the weapon and armor profiles when it has them. This is the data that arrived with the shop listing, not a fresh appraisal. Returns false when the client has no object for that listing id.
bool TryCaptureProperties(uint templateObjectId, out PluginItemProperties properties)
Parameters
templateObjectIduintpropertiesPluginItemProperties
Returns
Events
Closed
Raised when the open vendor's shop pane closes.
event Action Closed
Event Type
Opened
Raised when a vendor's shop pane becomes the open one, and again each time the player uses the vendor whose visit is still open (the pane refreshes in place). A refresh that follows a buy or a sell does not raise it.
event Action<uint> Opened
Event Type
TransactionCompleted
Raised when a buy-all or sell-all transaction completes.
event Action<PluginVendorTransaction> TransactionCompleted