DtlTraders/patterns
Enchants
e:EID/lvl
Assigns the specified enchant to the item. A list of available effects can be found here. Separating several values with a comma allows for up to four enchantments beeing assigned.
IMPORTANT: Be extra careful when using this argument in it's current form. It is possible to assing invalid enchantments to items when supplying wrong EIDs (e.g. sharpness put on a helmet). This will cause serious errors. Additional checks will be implemented soon to ensure that enchantments are applied in the proper way.
Slot
s:
Sets the item's position in the trader window. Accepted values range from 0 (top left slot) to 50 (bottom right slot). The bottom row is reserved for navigation. Setting this value to -1 will place the item in the first unused slot.
Note: It is possible to use the same slot for multiple items. For example:
- 3 s:-1
- 3 s:0
will result in both items occupying the top left cell. This happens because the order of the entries is important. A fix for this will be included in a future version.
Price
p:
Sets the item's price. When adding items to the trader window, the plugin will try to find an item definition in the patterns file and apply any settings found. Any change in the patterns file will affect this item after reloading/restarting the plugin.
The price is set using the prices: section of the patterns file or by supplying the p: argument in the item definition. Keep in mind that any change done in the in-game trader window will separate the item from the pattern - it will be treated independently from that point onward.
To set the price use the following format:
'ItemID:DataValue': price'
When data value is not provided the price will apply to any items sharing the ID. For example:
'35:15': 2.22 - will set the price of Black Wool to 2.22.
'35': 2.22 - will set the price of any Wool block to 2.22.
Using the [sp] flag will cause the price to be applied to the whole stack.
Example pattern file
default: prices: all: 35: 1.5 '35:2': 2.0 sell: 1: 0.33 2: 0.66 3: 0.99 items: all: - 35:1 a:1,2,4 s:-1 - 35:2 a:1,2,4 s:-1 - 35:3 a:1 s:-1 - 35:4 a:2 s:-1 p:11 - 1 a:32 s:8 - 2 a:32,54 s:17 buy: - 5 p:5 s:-1 a:18 - 35:0 s:-1 a:8,4,2,1
When applied to a trader it will buy and sell Grass, Stone, and four different colors of wool (orange, magneta, light blue and yellow). Wooden planks and white wool are also added but the npc will only buy them.
The price of wool blocks is set to 1.5 in the prices section.
35: 1.5
There is an exception for magenta wool in the line below which sets a different price from the other wool blocks.
'35:2': 2.0
Although the price for Wooden planks was not specified in the prices: section it can be done right in the item definition string by using the p: argument.
5 p:5 s:-1 a:18
Slot numbers are assigned in a such a way that they do not overlap.
The price for selling dirt blocks was set but the item was not added to the trader inventory. When you add this block in game by hand the plugin will find this definition and apply the set price for you.
Saving space in the trader window
A lot of space can be saved by using the patterns file when a trader is set to buy a wide assortment of items. Let's say we want the npc to buy any kind of wool. Normally you would have to put 16 different items on the buy tab, but they can all be combined in a single slot. The items: section would look like this:
items:
buy:
- 35:0 s:0 a:1
- 35:15 s:0 a:1
- 35:14 s:0 a:1
- 35:13 s:0 a:1
- 35:12 s:0 a:1
- 35:11 s:0 a:1
- 35:10 s:0 a:1
- 35:9 s:0 a:1
- 35:8 s:0 a:1
- 35:7 s:0 a:1
- 35:6 s:0 a:1
- 35:5 s:0 a:1
- 35:4 s:0 a:1
- 35:3 s:0 a:1
- 35:2 s:0 a:1
- 35:1 s:0 a:1
The first entry will be the one shown in the trader window. But even though there are 16 different assignments packed in a single slot the plugin still treats them as separate and players will be able to sell the items as normal.
DtlTraders | |
---|---|
Usage | Managing | Trading | Patterns |
Configuration | Configuration | Commands | Permissions | Locale |
Types | Traders | Bankers |
-->