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.
OnVendorEdited(client, vendor, key)View Source
PlayerAccessVendor(client, vendor)View Source
VendorClassUpdated(vendor, id, allowed)View Source
VendorEdited(vendor, key)View Source
VendorExited()View Source
VendorFactionBuyScaleUpdated(vendor, factionID, scale)View Source
VendorFactionSellScaleUpdated(vendor, factionID, scale)View Source
VendorFactionUpdated(vendor, id, allowed)View Source
VendorItemBuyPriceUpdated(vendor, itemType, value)View Source
VendorItemMaxStockUpdated(vendor, itemType, value)View Source
VendorItemModeUpdated(vendor, itemType, value)View Source
VendorItemSellPriceUpdated(vendor, itemType, value)View Source
VendorItemStockUpdated(vendor, itemType, value)View Source
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
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.