The vendor editor (fl_vendor_editor): a frame with four pages for the settings of a vendor. The first has its name, description, model, animation, currency, money pool and buy-back rate; the second lists every item, where a click on a row chooses whether the vendor sells or buys the item, at what price and with how much stock; the third picks the factions that may trade; the fourth holds the phrases of the vendor. The server opens the editor for staff with the 'manage_vendors' permission who use the Vendor Tool on a vendor, and gets the settings back when the save button is pressed.

Summary

Methods

Adds a checkbox to a page.
Adds a labeled control to a page.
Adds a line of explanation to a page.
Adds a page to the editor along with the button that shows it.
Builds the page with a checkbox for every faction.
Builds the page with the name, description, model, animation, currency, money pool and buy-back rate of the vendor.
Builds the page with the list of items and its search field.
Builds the page with an entry for every phrase of the vendor.
Returns the vendor that is being edited.
Init()client
Creates the frame, its save and remove buttons, the bar of page buttons and the body that holds the pages.
Opens the menu of an item of the list: whether the vendor sells it and buys it, and the price and stock to set.
Fills the list of items again: every item whose name or ID matches the search, with what the vendor sells it for, how many it has and what it buys it for.
Asks for a number and stores it in a field of an item entry.
save()client
Sends the settings to the server and closes the editor.
Sets the vendor to edit and builds the pages out of its settings.
Shows one page of the editor and hides the others.

Methods

PANEL:add_check_box(page, title, checked, callback)

client plugins/vendors/plugin/views/cl_vendor_editor.lua:216

Adds a checkbox to a page.

Parameters

  • page Panel the panel of the page
  • title String translated label
  • checked Boolean whether the checkbox starts out checked
  • callback Function called with the new state (Boolean) when it changes

Returns

  • Panel the checkbox

PANEL:add_field(page, title, class)

client plugins/vendors/plugin/views/cl_vendor_editor.lua:173

Adds a labeled control to a page.

Parameters

  • page Panel the panel of the page
  • title String translated label
  • class String class of the control, such as 'DTextEntry' or 'DComboBox'

Returns

  • Panel the control

PANEL:add_help(page, text)

client plugins/vendors/plugin/views/cl_vendor_editor.lua:197

Adds a line of explanation to a page.

Parameters

  • page Panel the panel of the page
  • text String translated text

Returns

  • Panel the label

PANEL:add_page(id, title, class)

client plugins/vendors/plugin/views/cl_vendor_editor.lua:135

Adds a page to the editor along with the button that shows it.

Parameters

  • id String ID of the page
  • title String translated title of the page
  • class String optional, defaults to 'DScrollPanel' class of the panel that holds the page

Returns

  • Panel the panel of the page

Builds the page with a checkbox for every faction. A faction that the vendor is limited to but that is not registered anymore gets a checkbox labeled with its ID, so that it can be unchecked.

Builds the page with the name, description, model, animation, currency, money pool and buy-back rate of the vendor.

Builds the page with the list of items and its search field.

Builds the page with an entry for every phrase of the vendor. The default phrase is shown in an entry that is left empty.

Returns the vendor that is being edited.

Returns

  • Entity

Creates the frame, its save and remove buttons, the bar of page buttons and the body that holds the pages.

PANEL:open_item_menu(item_id)

client plugins/vendors/plugin/views/cl_vendor_editor.lua:404

Opens the menu of an item of the list: whether the vendor sells it and buys it, and the price and stock to set.

Parameters

  • item_id String

Fills the list of items again: every item whose name or ID matches the search, with what the vendor sells it for, how many it has and what it buys it for.

PANEL:request_amount(entry, field, message)

client plugins/vendors/plugin/views/cl_vendor_editor.lua:380

Asks for a number and stores it in a field of an item entry. An empty answer stores false, which stands for the default price or for unlimited stock.

Parameters

  • entry Map the entry of the item in the sells or the buys list
  • field String 'price' or 'stock'
  • message String translated text of the request

Sends the settings to the server and closes the editor.

PANEL:set_vendor(vendor, data)

client plugins/vendors/plugin/views/cl_vendor_editor.lua:108

Sets the vendor to edit and builds the pages out of its settings.

Parameters

  • vendor Entity
  • data Map vendor settings sent by the server

Shows one page of the editor and hides the others.

Parameters

  • id String ID of the page

Defined in