Skip to content

Vendor

This page documents the hooks defined by the vendor module.


CanPlayerAccessVendor(client, vendor)View Source

Purpose

Determines whether a player may open or continue using a vendor.

Realm

Server

Parameters

Player client The player attempting to access the vendor.

Entity vendor The vendor entity being accessed.

Returns

boolean|nil Return false to block vendor access.


CanPlayerTradeWithVendor(client, vendor, itemType, isSellingToVendor)View Source

Purpose

Determines whether a player may buy or sell a specific item through a vendor.

Realm

Server

Parameters

Player client The player attempting the trade.

Entity vendor The vendor handling the trade.

string itemType The item unique ID being traded.

boolean isSellingToVendor Whether the player is selling the item to the vendor instead of buying it.

Returns

boolean|nil, string|nil, any Return false to block the trade. Additional return values may supply a localized reason and optional format parameter.


GetPriceOverride(client, vendor, uniqueID, price, isSellingToVendor)View Source

Purpose

Allows code to override a vendor trade price for a player.

Realm

Shared

Parameters

Player client The player receiving the quoted price.

Entity vendor The vendor entity pricing the trade.

string uniqueID The item unique ID being priced.

number price The default calculated price.

boolean isSellingToVendor Whether the player is selling to the vendor.

Returns

number|nil Return a replacement price.


OnCharTradeVendor(client, vendor, item, isSellingToVendor, character, itemType, isFailed)View Source

Purpose

Called after the vendor system processes a character trade attempt.

Realm

Server

Parameters

Player client The player trading with the vendor.

Entity vendor The vendor entity used for the trade.

table item optional The traded item instance when available.

boolean isSellingToVendor Whether the player sold to the vendor.

Character character The trading character.

string itemType optional The item unique ID involved in the trade when no item instance was created.

boolean isFailed optional Whether the trade attempt failed after validation.


OnOpenVendorMenu(panelOwner, vendor)View Source

Purpose

Called on the client after the vendor UI is created.

Realm

Client

Parameters

table panelOwner The vendor module instance opening the UI.

Entity vendor The vendor entity being shown.


OnVendorEdited(client, vendor, key)View Source

Purpose

Called after a player edits a vendor setting on the server.

Realm

Server

Parameters

Player client The player who edited the vendor.

Entity vendor The vendor that was edited.

string key The edited property key.


PlayerAccessVendor(client, vendor)View Source

Purpose

Called after a player is granted access to a vendor and the open packets are sent.

Realm

Server

Parameters

Player client The player opening the vendor.

Entity vendor The vendor entity being opened.


VendorClassUpdated(vendor, id, allowed)View Source

Purpose

Called on the client after a vendor class whitelist entry changes.

Realm

Client

Parameters

Entity vendor The updated vendor.

number id The class index that changed.

boolean allowed Whether the class is now allowed.


VendorEdited(vendor, key)View Source

Purpose

Called on the client after a vendor edit synchronization updates a field.

Realm

Client

Parameters

Entity vendor The edited vendor.

string key The property key that changed.


VendorExited()View Source

Purpose

Called on the client after the vendor UI is closed by a networked exit event.

Realm

Client


VendorFactionBuyScaleUpdated(vendor, factionID, scale)View Source

Purpose

Called on the client after a faction buy scale changes for a vendor.

Realm

Client

Parameters

Entity vendor The updated vendor.

number factionID The faction index whose buy scale changed.

number scale The new buy scale value.


VendorFactionSellScaleUpdated(vendor, factionID, scale)View Source

Purpose

Called on the client after a faction sell scale changes for a vendor.

Realm

Client

Parameters

Entity vendor The updated vendor.

number factionID The faction index whose sell scale changed.

number scale The new sell scale value.


VendorFactionUpdated(vendor, id, allowed)View Source

Purpose

Called on the client after a vendor faction whitelist entry changes.

Realm

Client

Parameters

Entity vendor The updated vendor.

number id The faction index that changed.

boolean allowed Whether the faction is now allowed.


VendorItemBuyPriceUpdated(vendor, itemType, value)View Source

Purpose

Called on the client after a vendor item buy price changes.

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new buy price.


VendorItemMaxStockUpdated(vendor, itemType, value)View Source

Purpose

Called on the client after a vendor item max stock value changes.

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new max stock value.


VendorItemModeUpdated(vendor, itemType, value)View Source

Purpose

Called on the client after a vendor item trade mode changes.

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new vendor trade mode.


VendorItemSellPriceUpdated(vendor, itemType, value)View Source

Purpose

Called on the client after a vendor item sell price changes.

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new sell price.


VendorItemStockUpdated(vendor, itemType, value)View Source

Purpose

Called on the client after a vendor item stock count changes.

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new stock count.


VendorMessagesUpdated(vendor)View Source

Purpose

Called on the client after a vendor's message table is synchronized.

Realm

Client

Parameters

Entity vendor The updated vendor.


VendorOpened(vendor)View Source

Purpose

Called on the client after vendor access opens the vendor UI.

Realm

Client

Parameters

Entity vendor The vendor entity that was opened.


VendorPropertyUpdated(vendor, propertyName, propertyValue)View Source

Purpose

Called on the client after a synchronized vendor property changes.

Realm

Client

Parameters

Entity vendor The updated vendor.

string propertyName The property key that changed.

any propertyValue The synchronized property value.


VendorSynchronized(vendor)View Source

Purpose

Called on the client after a full vendor sync packet is applied.

Realm

Client

Parameters

Entity vendor The vendor that was synchronized.


VendorTradeEvent(client, vendor, itemType, isSellingToVendor)View Source

Purpose

Called when the vendor system begins processing a buy or sell transaction.

Realm

Server

Parameters

Player client The player trading with the vendor.

Entity vendor The vendor handling the trade.

string itemType The item unique ID being traded.

boolean isSellingToVendor Whether the player is selling to the vendor.