Skip to content

Vendor

This page documents hooks in the vendor category.


CanPerformVendorEdit(self, vendor)View Source

Purpose

Determines whether a player may edit a vendor through the player meta vendor-editing flow.

Category

Vendor

Realm

Server

Parameters

Player self The player attempting to edit the vendor.

Entity vendor The vendor entity being edited.

Returns

boolean|nil Return false to block vendor editing. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("CanPerformVendorEdit", "liaExampleCanPerformVendorEdit", function(self, vendor)
      if not self:isStaffOnDuty() then
          return false
      end
  end)

CanPlayerAccessVendor(client, vendor)View Source

Purpose

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

Category

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.

Example Usage

  hook.Add("CanPlayerAccessVendor", "liaExampleCanPlayerAccessVendor", function(client, vendor)
      if IsValid(client) and client:IsAdmin() then
          return true
      end
  end)

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

Purpose

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

Category

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.

Example Usage

  hook.Add("CanPlayerTradeWithVendor", "liaExampleCanPlayerTradeWithVendor", function(client, vendor, itemType, isSellingToVendor)
      if itemType == "restricted_crate" and not isSellingToVendor then
          return false, "vendorDoesNotHaveItem"
      end
  end)

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

Purpose

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

Category

Vendor

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.

Example Usage

  hook.Add("GetPriceOverride", "liaExampleGetPriceOverride", function(client, vendor, uniqueID, price, isSellingToVendor)
      return (price or 0) + 5
  end)

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

Purpose

Called after the vendor system processes a character trade attempt.

Category

Vendor

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.

Example Usage

  hook.Add("OnCharTradeVendor", "liaExampleOnCharTradeVendor", function(client, vendor, item, isSellingToVendor, character, itemType, isFailed)
      if not IsValid(client) then return end
      print(string.format("[MyModule] handled OnCharTradeVendor for %s", client:Name()))
  end)

OnOpenVendorMenu(moduleTable, vendor)View Source

Purpose

Runs after the vendor menu panel is created and assigned to the received vendor so client code can adjust the active UI.

Category

Vendor

Realm

Client

Parameters

table moduleTable The vendor module table that opened the menu and dispatched the hook.

Entity vendor The vendor entity assigned to the active vendor panel.

Example Usage

  hook.Add("OnOpenVendorMenu", "liaExampleOnOpenVendorMenu", function(moduleTable, vendor)
      if moduleTable == MODULE and IsValid(lia.gui.vendor) and IsValid(vendor) then
          lia.gui.vendor:Center()
      end
  end)

OnVendorEdited(client, vendor, key)View Source

Purpose

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

Category

Vendor

Realm

Server

Parameters

Player client The player who edited the vendor.

Entity vendor The vendor that was edited.

string key The edited property key.

Example Usage

  hook.Add("OnVendorEdited", "liaExampleOnVendorEdited", function(client, vendor, key)
      if not IsValid(client) then return end
      print(string.format("[MyModule] handled OnVendorEdited for %s", client:Name()))
  end)

PlayerAccessVendor(client, vendor)View Source

Purpose

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

Category

Vendor

Realm

Server

Parameters

Player client The player opening the vendor.

Entity vendor The vendor entity being opened.

Example Usage

  hook.Add("PlayerAccessVendor", "liaExamplePlayerAccessVendor", function(client, vendor)
      if not IsValid(client) then return end
      print(string.format("[MyModule] handled PlayerAccessVendor for %s", client:Name()))
  end)

VendorClassUpdated(vendor, id, allowed)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The updated vendor.

number id The class index that changed.

boolean allowed Whether the class is now allowed.

Example Usage

  hook.Add("VendorClassUpdated", "liaExampleVendorClassUpdated", function(vendor, id, allowed)
      print("[MyModule] handled VendorClassUpdated")
  end)

VendorEdited(vendor, key)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The edited vendor.

string key The property key that changed.

Example Usage

  hook.Add("VendorEdited", "liaExampleVendorEdited", function(vendor, key)
      print("[MyModule] handled VendorEdited")
  end)

VendorExited()View Source

Purpose

Runs on the client when the vendor session ends and the active vendor panel should be removed.

Category

Vendor

Realm

Client

Example Usage

  hook.Add("VendorExited", "liaExampleVendorExited", function()
      if IsValid(lia.gui.vendor) then
          lia.gui.vendor:Remove()
      end
  end)

VendorFactionBuyScaleUpdated(vendor, factionID, scale)View Source

Purpose

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

Category

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.

Example Usage

  hook.Add("VendorFactionBuyScaleUpdated", "liaExampleVendorFactionBuyScaleUpdated", function(vendor, factionID, scale)
      print("[MyModule] handled VendorFactionBuyScaleUpdated")
  end)

VendorFactionSellScaleUpdated(vendor, factionID, scale)View Source

Purpose

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

Category

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.

Example Usage

  hook.Add("VendorFactionSellScaleUpdated", "liaExampleVendorFactionSellScaleUpdated", function(vendor, factionID, scale)
      print("[MyModule] handled VendorFactionSellScaleUpdated")
  end)

VendorFactionUpdated(vendor, id, allowed)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The updated vendor.

number id The faction index that changed.

boolean allowed Whether the faction is now allowed.

Example Usage

  hook.Add("VendorFactionUpdated", "liaExampleVendorFactionUpdated", function(vendor, id, allowed)
      print("[MyModule] handled VendorFactionUpdated")
  end)

VendorItemBuyPriceUpdated(vendor, itemType, value)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new buy price.

Example Usage

  hook.Add("VendorItemBuyPriceUpdated", "liaExampleVendorItemBuyPriceUpdated", function(vendor, itemType, value)
      print("[MyModule] handled VendorItemBuyPriceUpdated")
  end)

VendorItemMaxStockUpdated(vendor, itemType, value)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new max stock value.

Example Usage

  hook.Add("VendorItemMaxStockUpdated", "liaExampleVendorItemMaxStockUpdated", function(vendor, itemType, value)
      print("[MyModule] handled VendorItemMaxStockUpdated")
  end)

VendorItemModeUpdated(vendor, itemType, value)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new vendor trade mode.

Example Usage

  hook.Add("VendorItemModeUpdated", "liaExampleVendorItemModeUpdated", function(vendor, itemType, value)
      print("[MyModule] handled VendorItemModeUpdated")
  end)

VendorItemSellPriceUpdated(vendor, itemType, value)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new sell price.

Example Usage

  hook.Add("VendorItemSellPriceUpdated", "liaExampleVendorItemSellPriceUpdated", function(vendor, itemType, value)
      print("[MyModule] handled VendorItemSellPriceUpdated")
  end)

VendorItemStockUpdated(vendor, itemType, value)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The updated vendor.

string itemType The affected item unique ID.

number value The new stock count.

Example Usage

  hook.Add("VendorItemStockUpdated", "liaExampleVendorItemStockUpdated", function(vendor, itemType, value)
      print("[MyModule] handled VendorItemStockUpdated")
  end)

VendorMessagesUpdated(vendor)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The updated vendor.

Example Usage

  hook.Add("VendorMessagesUpdated", "liaExampleVendorMessagesUpdated", function(vendor)
      print("[MyModule] handled VendorMessagesUpdated")
  end)

VendorOpened(vendor)View Source

Purpose

Runs on the client when vendor access succeeds and the vendor interface is about to be shown for the received vendor entity.

Category

Vendor

Realm

Client

Parameters

Entity vendor The vendor entity whose menu is being opened.

Example Usage

  hook.Add("VendorOpened", "liaExampleVendorOpened", function(vendor)
      if IsValid(vendor) then
          print("Opened vendor:", vendor:getNetVar("name", vendor:GetClass()))
      end
  end)

VendorPropertyUpdated(vendor, propertyName, propertyValue)View Source

Purpose

Called on the client after a synchronized vendor property changes.

Category

Vendor

Realm

Client

Parameters

Entity vendor The updated vendor.

string propertyName The property key that changed.

any propertyValue The synchronized property value.

Example Usage

  hook.Add("VendorPropertyUpdated", "liaExampleVendorPropertyUpdated", function(vendor, propertyName, propertyValue)
      print("[MyModule] handled VendorPropertyUpdated")
  end)

VendorSynchronized(vendor)View Source

Purpose

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

Category

Vendor

Realm

Client

Parameters

Entity vendor The vendor that was synchronized.

Example Usage

  hook.Add("VendorSynchronized", "liaExampleVendorSynchronized", function(vendor)
      print("[MyModule] handled VendorSynchronized")
  end)

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

Purpose

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

Category

Vendor

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.

Example Usage

  hook.Add("VendorTradeEvent", "liaExampleVendorTradeEvent", function(client, vendor, itemType, isSellingToVendor)
      if not IsValid(client) then return end
      print(string.format("[MyModule] handled VendorTradeEvent for %s", client:Name()))
  end)