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
Methods
PANEL:add_check_box(page, title, checked, callback)
client plugins/vendors/plugin/views/cl_vendor_editor.lua:216Adds 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
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
Adds a line of explanation to a page.
Parameters
- page Panel the panel of the page
- text String translated text
Returns
- Panel the label
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.
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:380Asks 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.
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