DtlTraders/patterns: Difference between revisions

From Citizens Wiki
No edit summary
 
(34 intermediate revisions by one other user not shown)
Line 1: Line 1:
What are those patterns, I bet many of you are just confused abut it how does it work, what does it add and how you can use it. You could hear some things when I talked about it, here I'm going to explain what does it add.
== '''NOTICE''' ==
Patterns have not been implemented into vr. 3.0 yet!


== Overview ==
== Overview ==


All patterns basically should be saved in the ''patterns.yml'', in the main plugin folder. (plugins/DtlCitizensTrader)<br /> You may change the directory in the ''config.yml''.
Every pattern is saved in the ''patterns.yml'' file located in the plugin's main folder. (plugins/DtlCitizensTrader)<br /> You can change the directory in the configuration file.




There are 3 types of patterns, even when each type is just a simple part of a whole pattern. We got ''Pricing patterns'', where you just set item prices and pricing tiers. Another pattern type is ''Items pattern'' so this pattern will add items to the traders stock, but here you can also set 2 items under the same slot which can be used in different ways, going to show one here. Third type is a special pattern construction used by ''Market traders'', so you need to set them properly.
There are 2 types of patterns:


- ''Pricing patterns''<br>
Sets item prices and pricing tiers.


== Basics ==
- ''Item patterns''<br>
Will add certain items to the trader's stock, also has item tiers.


Here you got a example basic ''pricing pattern'':
<div style="border: solid 1px black;padding:10px;padding-top:0px"><span style="white-space: pre;color:darkgreen;">
default:
<span>  prices: </span>
<span>    all: </span>
<span>      multiplier: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">1.0</tt></span>
<span>      35: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">1.5</tt></span>
<span>      '35:2': <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">2.0</tt></span>
<span>    sell: </span>
<span>      1: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.33</tt></span>
<span>      2: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.66</tt></span>
<span>      3: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.99</tt></span>
<span>    buy: </span>
<span>      multiplier: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.9</tt></span>
<span>      1: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.33</tt></span>
<span>      2: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.66</tt></span>
<span>      3: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.99</tt></span>
</span></div>


This shows how to set a ''pricing pattern'', it isn't really hard to understand, the '''all''' section will set prices for both tabs, where '''sell''' sets prices for sell tab and '''buy''' for buy tab, the multiplier is used to fast change prices, like all prices on server where to high, so lets lesser them by 10% = 0.9, if no multiplier is set it's just 1.0 so you could remove that multiplier in the all section if set any multiplier in ''sell'' or ''buy'' overrides the ''all'' multiplier, so in this example 0.9 overrides 1.0 so sell got not 1.0 and buy got prices of 0.9 basic price.
Incoming a third pattern type with 2.6 (long way to it):


Also if you got items with additional data like ''wool'', you can set the price for each wool by just using the id 35: <price>, but if you add '35:0': it will only apply to ''white wool'', if both are set the more specific version will override the general price for that id so 35: <price> will be overridden by '35:0': <another price> just for while wool, all other wool colors will have <price>.
- ''random patterns''  
Those will allow to set maximum items a trader can have showd in stock (like 10 of 20), also set timeouts, "spawn chance", amount and price chances that will be used on each item when it's timeout passed.




But how does tiering works?
All patterns are based on one syntax that is used to build item scripts. Those scripts are used by each pattern type, just each pattern type uses it in another way.


A tier is like a pattern within a pattern, so tiers override the patterns prices, except multipliers, because those are calculated from the highest tier down to the general pattern.
== Item syntax ==


so settings two tiers ''tier1'' with multipliers 0.9 and ''tier2'' with multiplier 0.8, will cause each Player with tier1 to have prices multiplied by 0.9*1.0 default multiplier for general pattern, but each player with both tiers will cause to have the price multiplied by 0.8*0.9*1.0, this allows to easily change prices for groups of VIPS, lets say we got VIP and VIP+ but we want both groups to lesser prices, so we just need to lesser them in ''tier1'' if VIP2 got both tiers.
This sound horrible, I know, but it's best way to explain it in two words :D


where do we put tiers? A tiered pricing pattern looks like this
Every item within a pattern is build up by some keywords and flags you may use, many options you can't achieve with a basic trader setup are here allowed, but you need to be careful.
<div style="border: solid 1px black;padding:10px;padding-top:0px"><span style="white-space: pre;color:darkgreen;">
default:
<span>  prices: </span>
<span>    all: </span>
<span>      multiplier: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">1.0</tt></span>
<span>      35: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">1.5</tt></span>
<span>      '35:2': <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">2.0</tt></span>
<span>    sell: </span>
<span>      1: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.33</tt></span>
<span>      2: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.66</tt></span>
<span>      3: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.99</tt></span>
<span>    buy: </span>
<span>      multiplier: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.9</tt></span>
<span>      1: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.33</tt></span>
<span>      2: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.66</tt></span>
<span>      3: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.99</tt></span>
<span>    tier1: </span>
<span>      all: </span>
<span>        multiplier: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.9</tt></span>
<span>      sell: </span>
<span>        2: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.11</tt></span>
<span>      buy: </span>
<span>        multiplier: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">1.1</tt></span>
</span></div>


so with that pattern grass would be cost 0.11*0.9*1.0 for a player with the tier1 permission 
=== Keywords ===


<!--This page shows how to use the price patterns. Below is a sample pattern along with an explanation of how it works and what changes when using it together with manager mode.
<div style="width:100%;vertical-align:top">
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;border-right:solid 1px black"><p style="margin:0px;padding:2px 10px;"><b>Item setting</b></p>
</div>
<div style="display:table-cell;width:110px;border-right:solid 1px"><p style="margin:0px;padding:2px 10px;"><b>Keyword</b></p>
</div>
<div style="display:table-cell;width:220px;border-right:solid 1px"><p style="margin:0px;padding:2px 10px;"><b>Price pattern</b></p>
</div>
<div style="display:table-cell;width:280px;border-right:solid 1px black"><p style="margin:0px;padding:2px 10px;"><b>Item pattern</b></p>
</div>
<div style="display:table-cell;width:120px;"><p style="margin:0px;padding:2px 10px;"><b>Example</b></p>
</div>
</div>


== Preparation ==
<!-- base -->
A pattern has to be defined before it can be used. Pattern definitions are saved by default in the patterns.yml file. The name of the file can be changed in the plugin configuration.
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:solid 1px"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">ID and data</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:solid 1px"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">id[:data]</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:solid 1px"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block;">Looks for items with the given id and/or data, <b>priority: 130</b></code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:solid 1px"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block;">Sets the item id, and when set also the data <b>default: required!</b></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:solid 1px"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">wool:14</code></p>
</div>
</div>


== Defining a pattern ==
<!-- name -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Name</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">n</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">matches the item by the given name, <strong>priority: 300</strong></code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets the item name, <b>default: nothing</b></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">n:A Item</code></p>
</div>
</div>


The format of adding an item to the pattern is as follows:<br />
<!-- amount -->
<br />
<div style="display:table;width:100%">
<tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">id[:data] [d:durability] [a:amount,...] [e:eid/lvl,...] [s:slot] [p:price] [sp]</tt><br />
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<br />
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">Item amount</code></p>
Each of the arguments is explained below in detail.
</div>
=== Item ID and data value ===
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
'''id:data'''<br />
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">a</code></p>
The item ID is the only mandatory value that has to be provided. Every other argument will fall back to a default value if omitted. Data value is optional and can be specified by adding it in the following format '''ID''':''data'' - 35:11 would result in a  Blue Wool block beeing added.
</div>
=== Durability ===
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
'''d:'''<br />
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block;">Looks for items with the given amount, <b>priority: 5</b></code></p>
<br />
</div>
Simply how damaged the offered item should be. You can find a durability table [http://www.minecraftwiki.net/wiki/Item_Durability here] with values for different tools and armors .
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
=== Amounts ===
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block;">Sets one or more amounts for an item, <b>default: 1</b></code></p>
'''a:'''<br />
</div>
<br />
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
Using a value higher than 1 will result in several items of the same type sold together as a stack. Providing more than one value will create the amount selection menu.
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">a:1,2,4</code></p>
=== Enchants ===
</div>
'''e:EID/lvl'''<br />
</div>
<br />
Assigns the specified enchant to the item. A list of available effects can be found [http://www.minecraftwiki.net/wiki/Enchant#Enchantments here]. Separating several values with a comma allows for up to four enchantments beeing assigned.<br />
<br />
'''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:'''<br />
<br />
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. <br />
<br />
'''Note:''' It is possible to use the same slot for multiple items. For example:<br />
<tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">- 3 s:-1</tt><br />
<tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">- 3 s:0</tt><br />
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:'''<br />
<br />
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.<br />
<br />
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.<br />
<br />
To set the price use the following format:<br />
<br />
<tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">'ItemID:DataValue': price'</tt><br />
<br />
When data value is not provided the price will apply to any items sharing the ID. For example:<br />
<tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">'35:15': 2.22</tt> - will set the price of Black Wool to 2.22.<br />
<tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">'35': 2.22</tt> - will set the price of any Wool block to 2.22.<br />
<br />
Using the '''[sp]''' flag will cause the price to be applied to the whole stack.<br />
== Example pattern file ==
<div style="border: solid 1px black;padding:10px;padding-top:0px"><span style="white-space: pre;color:darkgreen;">
default:
<span> prices: </span>
<span>    all: </span>
<span>      35: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">1.5</tt></span>
<span>      '35:2': <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">2.0</tt></span>
<span>    sell: </span>
<span>      1: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.33</tt></span>
<span>      2: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.66</tt></span>
<span>      3: <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">0.99</tt></span>
<span>  items: </span>
<span>    all: </span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:1 a:1,2,4 s:-1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:2 a:1,2,4 s:-1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:3 a:1 s:-1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:4 a:2 s:-1 p:11</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">1 a:32 s:8</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">2 a:32,54 s:17</tt></span>
<span>    buy: </span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">5 p:5 s:-1 a:18</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:0 s:-1 a:8,4,2,1</tt></span>
</span></div>


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.<br />
<!-- durability -->
<br />
<div style="display:table;width:100%">
The price of wool blocks is set to '''1.5''' in the ''prices'' section. <br />
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35: 1.5</tt><br />
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Durability</code></p>
There is an exception for magenta wool in the line below which sets a different price from the other wool blocks.<br />
</div>
<tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">'35:2': 2.0</tt><br />
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<br />
<p style="margin:0px"><code style="padding: 5px 10px;display:block">d</code></p>
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.<br />
</div>
<tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">5 <b>p:5</b> s:-1 a:18</tt><br />
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<br />
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Looks for items with the given or higher durability, <b>priority: 45</b></code></p>
Slot numbers are assigned in a such a way that they do not overlap.<br />
</div>
<br />
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
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.
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets the items durability, <b>default: 0</b></code></p>
== Saving space in the trader window ==
</div>
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:<br />
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<span style="white-space: pre;color:darkgreen;">
<p style="margin:0px"><code style="padding: 5px 10px;display:block">d:22</code></p>
<span> items:</span>
</div>
<span>    buy:</span>
</div>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:0 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:15 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:14 s:0 a:1</tt></span>
<span>   - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:13 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:12 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:11 s:0 a:1</tt></span>
<span>   - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:10 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:9 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:8 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:7 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:6 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:5 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:4 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:3 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:2 s:0 a:1</tt></span>
<span>    - <tt style="color:black;background-color: #F8F8E0;border: solid 1px black;padding:0px 1px">35:1 s:0 a:1</tt></span>
</span>
<br />
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.


-->
<!-- tier -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Tier</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">t</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Matches items only in the given <strong>item</strong> tier, <b>priority: 25</b></code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">not used</code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">t:vip_tier</code></p>
</div>
</div>
 
<!-- color -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Color</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">c</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">matches by the given color, <strong>priority: 5</strong>, <strong>leather armor only</strong></code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets the color for a leather armor item. Uses RGB values separated by <strong>^</strong>, <strong>leather armor only</strong></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">c:255^210^24</code></p>
</div>
</div>
 
<!-- enchantment -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Enchants</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">e</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Checks if the item has the same enchants, <strong>priority: 5</strong></code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets enchantments for an item, <b>default: none</b></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">e:smite/3</code></p>
</div>
</div>
 
<!-- Stored enchants -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Stored enchants</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">se</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Checks if the item has the same stored enchants, <strong>priority: 5</strong></code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets enchantments for a enchanted book item, <b>default: none</b>, <strong>enchanted book only</strong></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">se:smite/7</code></p>
</div>
</div>
 
<!-- price -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Price</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">p</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets the price for each matching item, overriding lower priority matches</code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets the price for the given item, <b>default: pattern price</b></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">p:12.22</code></p>
</div>
</div>
 
<!-- multiplier -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Multiplier</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">m</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets the multiplier for each matching item, overriding lower priority matches</code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets the multiplier for the given item, <b>default: pattern multiplier</b></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">m:0.9</code></p>
</div>
</div>
 
<!-- fireworks -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Firework</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">f</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">not used</code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets firework data for a firework item, <strong>firework only</strong></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">---</code></p>
</div>
</div>
 
<!-- global limit -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Global limit</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">gl</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">not used</code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets a limit for this item, <strong>default: none</strong></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">gl:limit/timeout</code></p>
</div>
</div>
 
<!-- player limit -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Player limit</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">pl</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">not used</code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets a limit for each player for this item, <strong>default: none</strong></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">pl:limit/timeout</code></p>
</div>
</div>
 
<!-- Slot -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Slot</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">s</code></p>
</div>
<div style="display:table-cell;width:220px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Not used</code></p>
</div>
<div style="display:table-cell;width:280px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">Sets the slot for the item, <b>default: first empty</b></code></p>
</div>
<div style="display:table-cell;width:120px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px"><code style="padding: 5px 10px;display:block">s:22</code></p>
</div>
</div>
 
</div>
 
----
 
 
 
=== Flags ===
 
<div style="width:100%;vertical-align:top">
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;border-right:solid 1px black"><p style="margin:0px;padding:2px 10px;"><b>Item flag</b></p>
</div>
<div style="display:table-cell;width:110px;border-right:solid 1px"><p style="margin:0px;padding:2px 10px;"><b>flag</b></p>
</div>
<div style="display:table-cell;width:620px;border-right:solid 1px black"><p style="margin:0px;padding:2px 10px;"><b>Item pattern</b></p>
</div>
</div>
 
<!-- lore -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:solid 1px"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">Item Lore</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:solid 1px"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">lore</code></p>
</div>
<div style="display:table-cell;width:620px;background-color: #F9F9F9;border-top:solid 1px"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block;">This flag allows you to add lores to your item. It needs always to be set on the end of a item definition and needs to end with <strong>:</strong>. If used always supply a lore. How it should look like will be shown later.</code></p>
</div>
</div>
 
<!-- stack price -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">Stack price</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">sp</code></p>
</div>
<div style="display:table-cell;width:620px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block;">The price calculated for this item, is always applied to the whole stack, not to each item. <strong>example: </strong> price = 3$ | amount = 2 | without sp: 2*3$ = 6$ | with sp: 3$, so 1.5$ for each </code></p>
</div>
</div>
 
<!-- Pattern multiplier -->
<div style="display:table;width:100%">
<div style="display:table-cell;width:160px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block">Pattern multiplier</code></p>
</div>
<div style="display:table-cell;width:110px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block"><strong>pm</strong> or <strong>!pm</strong></code></p>
</div>
<div style="display:table-cell;width:620px;background-color: #F9F9F9;border-top:dashed 1px red"><!-- Cell -->
<p style="margin:0px;padding:2px 10px"><code style="margin:0px;display:block;">Forces to use or to ignore pattern multiplier matches</code></p>
</div>
</div>
 
</div>
 
----
 
 
 
=== Basic syntax ===
 
----
 
==== All patterns ====
 
Each patterns starts with a name, that you will use in-game to assign them to your traders. That name may be as long as you wish, just you should only use letters, numbers and use this character `'''_'''` instead of a whitespace.
 
Also each pattern from up now needs to have a type specified, so the pattern loader knows how to read it.
So far there are only 2 types, '''price''', and '''item'''. I think it's obvious.
 
Beside the type node all patterns got 3 additional nodes: "all", "sell", "buy". These nodes applies entries either to both sell and buy stocks, or just to one of them.
 
 
Empty pattern example:
 
<code>
  pattern_name:
    type: pattern_type
    all:
    - ...
    sell:
    - ...
    buy:
    - ...
</code>
 
<hr />
 
Each entry in a pattern has the same syntax that looks like this and it should be always done like this:
 
<code>id[:data] [keywords...] [flags...] [n:...]  [lore:]</code>
 
As in the example best way is to set after the ID all keywords then flags.
 
 
There are two exceptions in this rule.
 
The '''name''' keyword is best used on the end because you don't need to worry about that it will interpret any other keyword or flag as a item name part. But if you want you don't need to set it on the end just '''remember to always add two spaces''' after the item name. ''(the example shows that with the '''lore''' flag)''
 
The '''lore''' flag needs always to be on the end, it's a '''YAML''' syntax requirement, that will allow us to add lores easily to the item.
 
 
It's really simple to add items to a pattern, just need type their name or ID, and data if needed, all other values got their default values or behavior, so you don't need to be afraid that you may forget to set something for an item and it will break the pattern. 
 
<strong>Examples:</strong>
 
<code>wool:14</code> - will add to the traders stock a red wool block.
 
<code>wool s:3 n:My white wool</code> - will add to the traders stock a wool block, at slot 3 named '''My white wool'''.
 
<code>276 d:80% e:smite/2 p:1000</code> - will add to the traders stock a diamond sword, with smite level 2, price 1000 and durability 80%.
 
 
 
==== Price patterns ====
 
Generally a price pattern allows you to set prices and multipliers for items a trader has in stock. Each item entry in a price pattern is considered as a matching pattern, this is going to be used to match items the trader has in stock and set their prices and multipliers.
 
Each match may have another priority, with the rule: the greater priority wins.
 
Easies and most common used are these patterns as a global price file. So you setup all prices for each item in-game, and just add this pattern to each Trader. Now the only thing you need to do is to add items to his stock and thats it. No more price setting :P Prices are going to be set automatically for each player.
 
Because there is also the possibility to create '''tiers''' in these patterns, you may create vip groups that have lower prices (easily done by setting just the multiplier for a tier). To apply prices from a tier, the player needs to have a permission to '''"use"''' that tier.
 
 
Lets say we go a price pattern for all items in-game (going to name this "global-prices" from up now), and we want to set the multiplier to '''0.9''' for all of them except logs:
 
<code>
  - ...
  // because we just set the multiplier, it will be set for all items in this pattern, priority match is equal to 0
  - m:0.9
  // here we add additional information to match items with id 17 (logs), and because this match is higher (equals 130), it will override the 0.9 global multiplier for logs
  - 17 m:1.0
</code>
 
 
 
Another price pattern example:
 
<code>
  price_pattern:
    type: price
    all:
    - m:1.0
    - dirt p:0.55
    - wool p:4.42
    sell:
    - m:1.0
    - log p:3.33
    - wool m:1.1
    buy:
    - wool m:0.9
</code>
 
This pattern will set buy and sell prices for dirt and wool blocks, and just sell price for logs. We also told the pattern to use for all items a multiplier of '''1.0''', except for wool, that got a multiplier while selling (to a player) '''1.1''', and selling to a trader is like '''0.9''' of the base price.
 
Only this allows you for much more possibilities than the old system :P
 
 
===== Tiers =====
 
 
 
===== Tier tags (whats the difference?) =====
 
 
 
===== Advanced matching =====
 
 
 
===== Matching informations =====
 
What tags and item information can be matched can be found in the table on the beginning, there is also information provided, how does the priority grows when a specific keyword is used.
 
As because this is not the release version there are going to be many changes to the matching system. Any ideas are always welcome :)
 
==== Item patterns ====
 
 
Soon.
 
 
===== Lores =====
 
Soon :)


== Navigation ==
== Navigation ==
Line 195: Line 511:
| Configuration || | <!--[http://wiki.citizensnpcs.com/DtlTraders/config Configuration] |--> [http://wiki.citizensnpcs.com/DtlTraders/Commands Commands] | [http://wiki.citizensnpcs.com/DtlTraders/permissions Permissions] <!--| [http://wiki.citizensnpcs.com/DtlTraders/locale Locale] -->
| Configuration || | <!--[http://wiki.citizensnpcs.com/DtlTraders/config Configuration] |--> [http://wiki.citizensnpcs.com/DtlTraders/Commands Commands] | [http://wiki.citizensnpcs.com/DtlTraders/permissions Permissions] <!--| [http://wiki.citizensnpcs.com/DtlTraders/locale Locale] -->
|-
|-
| Usage || | <!--[http://wiki.citizensnpcs.com/DtlTraders/managing Managing] | [http://wiki.citizensnpcs.com/DtlTraders/trading Trading] | [http://wiki.citizensnpcs.com/DtlTraders/banking Banking] | [http://wiki.citizensnpcs.com/DtlTraders/patterns Patterns-->
| Usage || | <!--[http://wiki.citizensnpcs.com/DtlTraders/managing Managing] | [http://wiki.citizensnpcs.com/DtlTraders/trading Trading] | [http://wiki.citizensnpcs.com/DtlTraders/banking Banking] | -->[http://wiki.citizensnpcs.com/DtlTraders/patterns Patterns]
|-
|-
| Types || | <!--[http://wiki.citizensnpcs.com/DtlTraders/traders Traders] | [http://wiki.citizensnpcs.com/DtlTraders/bankers Bankers] | [http://wiki.citizensnpcs.com/DtlTraders/auctionhouse Auction House] | [http://wiki.citizensnpcs.com/DtlTraders/wallets Wallets]-->
| Types || | <!--[http://wiki.citizensnpcs.com/DtlTraders/traders Traders] | [http://wiki.citizensnpcs.com/DtlTraders/bankers Bankers] | [http://wiki.citizensnpcs.com/DtlTraders/auctionhouse Auction House] | [http://wiki.citizensnpcs.com/DtlTraders/wallets Wallets]-->
|}
|}

Latest revision as of 16:45, 3 June 2013

NOTICE

Patterns have not been implemented into vr. 3.0 yet!

Overview

Every pattern is saved in the patterns.yml file located in the plugin's main folder. (plugins/DtlCitizensTrader)
You can change the directory in the configuration file.


There are 2 types of patterns:

- Pricing patterns
Sets item prices and pricing tiers.

- Item patterns
Will add certain items to the trader's stock, also has item tiers.


Incoming a third pattern type with 2.6 (long way to it):

- random patterns Those will allow to set maximum items a trader can have showd in stock (like 10 of 20), also set timeouts, "spawn chance", amount and price chances that will be used on each item when it's timeout passed.


All patterns are based on one syntax that is used to build item scripts. Those scripts are used by each pattern type, just each pattern type uses it in another way.

Item syntax

This sound horrible, I know, but it's best way to explain it in two words :D

Every item within a pattern is build up by some keywords and flags you may use, many options you can't achieve with a basic trader setup are here allowed, but you need to be careful.

Keywords

Item setting

Keyword

Price pattern

Item pattern

Example

ID and data

id[:data]

Looks for items with the given id and/or data, priority: 130

Sets the item id, and when set also the data default: required!

wool:14

Name

n

matches the item by the given name, priority: 300

Sets the item name, default: nothing

n:A Item

Item amount

a

Looks for items with the given amount, priority: 5

Sets one or more amounts for an item, default: 1

a:1,2,4

Durability

d

Looks for items with the given or higher durability, priority: 45

Sets the items durability, default: 0

d:22

Tier

t

Matches items only in the given item tier, priority: 25

not used

t:vip_tier

Color

c

matches by the given color, priority: 5, leather armor only

Sets the color for a leather armor item. Uses RGB values separated by ^, leather armor only

c:255^210^24

Enchants

e

Checks if the item has the same enchants, priority: 5

Sets enchantments for an item, default: none

e:smite/3

Stored enchants

se

Checks if the item has the same stored enchants, priority: 5

Sets enchantments for a enchanted book item, default: none, enchanted book only

se:smite/7

Price

p

Sets the price for each matching item, overriding lower priority matches

Sets the price for the given item, default: pattern price

p:12.22

Multiplier

m

Sets the multiplier for each matching item, overriding lower priority matches

Sets the multiplier for the given item, default: pattern multiplier

m:0.9

Firework

f

not used

Sets firework data for a firework item, firework only

---

Global limit

gl

not used

Sets a limit for this item, default: none

gl:limit/timeout

Player limit

pl

not used

Sets a limit for each player for this item, default: none

pl:limit/timeout

Slot

s

Not used

Sets the slot for the item, default: first empty

s:22



Flags

Item flag

flag

Item pattern

Item Lore

lore

This flag allows you to add lores to your item. It needs always to be set on the end of a item definition and needs to end with :. If used always supply a lore. How it should look like will be shown later.

Stack price

sp

The price calculated for this item, is always applied to the whole stack, not to each item. example: price = 3$ | amount = 2 | without sp: 2*3$ = 6$ | with sp: 3$, so 1.5$ for each

Pattern multiplier

pm or !pm

Forces to use or to ignore pattern multiplier matches



Basic syntax


All patterns

Each patterns starts with a name, that you will use in-game to assign them to your traders. That name may be as long as you wish, just you should only use letters, numbers and use this character `_` instead of a whitespace.

Also each pattern from up now needs to have a type specified, so the pattern loader knows how to read it. So far there are only 2 types, price, and item. I think it's obvious.

Beside the type node all patterns got 3 additional nodes: "all", "sell", "buy". These nodes applies entries either to both sell and buy stocks, or just to one of them.


Empty pattern example:

 pattern_name:
   type: pattern_type
   all:
   - ...
   sell:
   - ...
   buy:
   - ...


Each entry in a pattern has the same syntax that looks like this and it should be always done like this:

id[:data] [keywords...] [flags...] [n:...] [lore:]

As in the example best way is to set after the ID all keywords then flags.


There are two exceptions in this rule.

The name keyword is best used on the end because you don't need to worry about that it will interpret any other keyword or flag as a item name part. But if you want you don't need to set it on the end just remember to always add two spaces after the item name. (the example shows that with the lore flag)

The lore flag needs always to be on the end, it's a YAML syntax requirement, that will allow us to add lores easily to the item.


It's really simple to add items to a pattern, just need type their name or ID, and data if needed, all other values got their default values or behavior, so you don't need to be afraid that you may forget to set something for an item and it will break the pattern.

Examples:

wool:14 - will add to the traders stock a red wool block.

wool s:3 n:My white wool - will add to the traders stock a wool block, at slot 3 named My white wool.

276 d:80% e:smite/2 p:1000 - will add to the traders stock a diamond sword, with smite level 2, price 1000 and durability 80%.


Price patterns

Generally a price pattern allows you to set prices and multipliers for items a trader has in stock. Each item entry in a price pattern is considered as a matching pattern, this is going to be used to match items the trader has in stock and set their prices and multipliers.

Each match may have another priority, with the rule: the greater priority wins.

Easies and most common used are these patterns as a global price file. So you setup all prices for each item in-game, and just add this pattern to each Trader. Now the only thing you need to do is to add items to his stock and thats it. No more price setting :P Prices are going to be set automatically for each player.

Because there is also the possibility to create tiers in these patterns, you may create vip groups that have lower prices (easily done by setting just the multiplier for a tier). To apply prices from a tier, the player needs to have a permission to "use" that tier.


Lets say we go a price pattern for all items in-game (going to name this "global-prices" from up now), and we want to set the multiplier to 0.9 for all of them except logs:

 - ...
 // because we just set the multiplier, it will be set for all items in this pattern, priority match is equal to 0
 - m:0.9
 // here we add additional information to match items with id 17 (logs), and because this match is higher (equals 130), it will override the 0.9 global multiplier for logs
 - 17 m:1.0


Another price pattern example:

 price_pattern:
   type: price
   all:
   - m:1.0
   - dirt p:0.55
   - wool p:4.42 
   sell:
   - m:1.0
   - log p:3.33
   - wool m:1.1
   buy:
   - wool m:0.9

This pattern will set buy and sell prices for dirt and wool blocks, and just sell price for logs. We also told the pattern to use for all items a multiplier of 1.0, except for wool, that got a multiplier while selling (to a player) 1.1, and selling to a trader is like 0.9 of the base price.

Only this allows you for much more possibilities than the old system :P


Tiers
Tier tags (whats the difference?)
Advanced matching
Matching informations

What tags and item information can be matched can be found in the table on the beginning, there is also information provided, how does the priority grows when a specific keyword is used.

As because this is not the release version there are going to be many changes to the matching system. Any ideas are always welcome :)

Item patterns

Soon.


Lores

Soon :)

Navigation

DtlTraders
Configuration Commands | Permissions
Usage Patterns
Types