Table of Contents

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

IReadOnlyList<(uint TemplateObjectId, int Count)>

IsAvailable

True when the session is in the world, so vendor commands can run.

bool IsAvailable { get; }

Property Value

bool

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

bool

IsOpen

True while a vendor's shop pane is open.

bool IsOpen { get; }

Property Value

bool

Items

Everything the open vendor currently has for sale; empty when no vendor is open.

IReadOnlyList<PluginVendorItem> Items { get; }

Property Value

IReadOnlyList<PluginVendorItem>

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

PluginVendorProfile

SellList

Every owned item currently staged to sell.

IReadOnlyList<uint> SellList { get; }

Property Value

IReadOnlyList<uint>

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

string

VendorObjectId

The open vendor's object id, or zero when none is open.

uint VendorObjectId { get; }

Property Value

uint

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

templateObjectId uint
count int

Returns

PluginVendorCommandResult

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

itemObjectId uint

Returns

PluginVendorCommandResult

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

PluginVendorCommandResult

ClearBuyList()

Empties the buy list without sending anything.

PluginVendorCommandResult ClearBuyList()

Returns

PluginVendorCommandResult

ClearSellList()

Empties the sell list without sending anything.

PluginVendorCommandResult ClearSellList()

Returns

PluginVendorCommandResult

RemoveFromBuyList(uint)

Un-stages a listing from the buy list.

PluginVendorCommandResult RemoveFromBuyList(uint templateObjectId)

Parameters

templateObjectId uint

Returns

PluginVendorCommandResult

RemoveFromSellList(uint)

Un-stages an item from the sell list.

PluginVendorCommandResult RemoveFromSellList(uint itemObjectId)

Parameters

itemObjectId uint

Returns

PluginVendorCommandResult

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

PluginVendorCommandResult

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

templateObjectId uint
properties PluginItemProperties

Returns

bool

Events

Closed

Raised when the open vendor's shop pane closes.

event Action Closed

Event Type

Action

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

Action<uint>

TransactionCompleted

Raised when a buy-all or sell-all transaction completes.

event Action<PluginVendorTransaction> TransactionCompleted

Event Type

Action<PluginVendorTransaction>