cw.salesman classclient
Part of Salesmen
Defines the client-side cw.salesman library, which holds the state of the salesman being created or edited in the
cwSalesman editor.
The Cable receivers and the editor write the fields straight into the library table; its getters expose the name, model, sells and buys lists, stock, cash, price scale, buy rate, responses and the factions, classes and flags allowed to trade.
Summary
Methods
batch size).Methods
cw.salesman:BuyInShipments()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:22Returns whether the salesman being edited sells items in whole shipments (the item's batch size).
Returns
- Boolean Whether items are sold in shipments
cw.salesman:GetBuyRate()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:52Returns the percentage of an item's cost the salesman being edited pays when buying it.
Returns
- Number The buy rate, from 1 to 100
Returns the items the salesman being edited buys.
Returns
- Map Item unique IDs mapped to a price override, or
trueto use the item's cost
Returns the cash the salesman being edited has to buy items with.
Returns
- Number The salesman's cash,
-1for unlimited
cw.salesman:GetClasses()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:58Returns the classes allowed to trade with the salesman being edited.
Returns
- Map Class names mapped to
true; empty for no restriction
cw.salesman:GetFactions()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:64Returns the factions allowed to trade with the salesman being edited.
Returns
- Map Faction names mapped to
true; empty for no restriction
cw.salesman:GetFlags()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:115Returns the flags required to trade with the salesman being edited.
Returns
- String The flags; a
-in the string refuses players without them
cw.salesman:GetItems()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:91Returns every non-base item that can be added to the salesman being edited.
Returns
- Map<Item> Item tables keyed by unique ID
cw.salesman:GetModel()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:103Returns the model of the salesman being edited.
Returns
- String The model path
cw.salesman:GetName()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:109Returns the name of the salesman being edited.
Returns
- String The salesman's name
cw.salesman:GetPanel()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:97Returns the salesman editor panel.
Returns
- Panel The
cwSalesmanpanel, ornilif it was never created
cw.salesman:GetPriceScale()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:28Returns the multiplier applied to item costs when the salesman being edited sells.
Returns
- Number The price scale,
1when unset
cw.salesman:GetSells()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:79Returns the items the salesman being edited sells.
Returns
- Map Item unique IDs mapped to a price override, or
trueto use the item's cost
cw.salesman:GetShowChatBubble()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:34Returns whether the salesman being edited shows a chat bubble above its head.
Returns
- Boolean Whether the chat bubble is shown
cw.salesman:GetStock()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:40Returns the starting stock of each item the salesman being edited sells.
Returns
- Number Stock per item,
-1for unlimited
Returns the responses of the salesman being edited.
The keys are start, noSale, noStock, needMore, cannotAfford and doneBusiness; each value
is a Map with text, sound and bHideName.
Returns
- Map The salesman's responses
cw.salesman:IsSalesmanOpen()
client gamemodes/catwork/plugins/salesmen/plugin/libraries/cl_salesman.lua:12Returns whether the salesman editor panel exists and is visible.
Returns
- Boolean
truewhen the editor is open, otherwisenil