7 Days to Die Wiki
mNo edit summary
mNo edit summary
(35 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
<!-- Probability is one by default if no value given. -->
 
<!-- Probability is one by default if no value given. -->
 
{{#dplvar:set|probability|{{{probability|1}}} }}
 
{{#dplvar:set|probability|{{{probability|1}}} }}
āˆ’  
 
<!-- Calculates the item's chance with probabilities or sets it to 100% if the container includes all items. -->
 
<!-- Calculates the item's chance with probabilities or sets it to 100% if the container includes all items. -->
āˆ’
{{#if: {{{item|}}}{{{group|}}}| {{#dplvar:set|percent|{{#if:{{#dplvar:totalrarity}} |{{#if:{{#dplvar:includeall}} | 100 |{{#expr: ({{#dplvar:probability}} / {{#dplvar:totalrarity}} * 100) }} }}|0}} }}
+
{{#if: {{{item|}}} {{{group|}}}| {{#vardefine:percent |{{#if:{{#dplvar:totalprobability}} |{{#if:{{#dplvar:includeall}} | 100 |{{#expr: ({{{probability}}} / {{#dplvar:totalprobability}} * 100)}} }}|0}} }}
āˆ’  
 
<!-- Creates the start of the actual table and its contents for the item, mainly the icon and name -->
 
<!-- Creates the start of the actual table and its contents for the item, mainly the icon and name -->
āˆ’
{{!}} {{#if:{{{item|}}} |{{#if:{{Get-field|{{{item|}}}|image}}|style="text-align:center" {{!}} [[file:{{Get-field|{{{item|}}}|image}}|x30px]]}} {{!!}} [[{{{item}}}]] {{#if:{{{colour|}}}|{{{colour}}} }} }}{{#if:{{{group|}}}| style="text-align:center" {{!}} [[file:7DaysGroupIcon.png|x30px]] {{!!}} [[LootGroup - {{{group|}}}|{{{group|}}}]] <small>(Group)</small> {{#dplvar:set|grouplist|{{#if:{{#dplvar:grouplist}}|{{#dplvar:grouplist}},}}{{{group|}}}:{{#dplvar:percent}} }} }}
+
{{!}} {{#if:{{{item|}}} |{{#if:{{Get-field|{{{item|}}}|image}}|style="text-align:center" {{!}} [[file:{{Get-field|{{{item|}}}|image}}|x30px]] | style="text-align:center" {{!}} [[file:{{{ImagePath|}}}|x30px]] }} {{!!}} [[{{{item}}}]] {{#if:{{{colour|}}}|{{{colour}}} }} }}{{#if:{{{group|}}}| style="text-align:center" {{!}} [[file:7DaysGroupIcon.png|x30px]] {{!!}} [[LootGroup - {{{group|}}}|{{{group|}}}]] <small>(Group)</small> {{#dplvar:set|grouplist|{{#if: {{#dplvar:grouplist}}|{{#dplvar:grouplist}},}}{{{group|}}}:{{#var:percent}} }} }}
 
<!-- Sets the availability/probability values of the item into the table and finishes it off -->
āˆ’  
 
{{!}} style="text-align:center" {{!}} {{#ifeq:{{#var:percent|}}|0| - |{{#ifexpr:{{#var:percent}} > {{#dplvar:common}}|Common|{{#ifexpr:{{#var:percent}} > {{#dplvar:uncommon}}|Uncommon|Rare}} }} }}
<!-- Sets the availability/probability of the item into the table. -->
 
āˆ’
{{!}} style="text-align:center" {{!}} {{#ifeq:{{#dplvar:percent|}}|0| - |{{#ifexpr:{{#dplvar:percent}} > {{#dplvar:common}}|Common|{{#ifexpr:{{#dplvar:percent}} > {{#dplvar:uncommon}}|Uncommon|Rare}} }} }}
+
<!-- {{!}} style="text-align:right" {{!}} {{#if:{{#dplvar:includeall}}|--|{{#dplvar:probability}} }}
  +
Defines min and max, chooses if both or just one is shown and shows chance percent -->
{{!}} style="text-align:right" {{!}} {{#if:{{#dplvar:includeall}}|--|{{#dplvar:probability}} }}
 
 
{{#vardefine:nmin|{{{numbermin|1}}} }} {{#vardefine:nmax|{{{numbermax|{{#var:nmin}} }}} }}
āˆ’  
 
{{!}} {{#ifeq: {{#var:nmin}}|{{#var:nmax}}|colspan=2 style="text-align:center" {{!}} {{#var:nmin}} | style="text-align:right" {{!}} {{#var:nmin}}
āˆ’
<!-- Decides to show either min and max (if they differ from each other) or only min if they are equal after defining them + percent. -->
 
 
{{!}} style="text-align:right" {{!}} {{#var:nmax}} }}
{{#dplvar:set|nmin|{{{numbermin|1}}} }} {{#dplvar:set|nmax|{{{numbermax|{{#dplvar:nmin}} }}} }}
 
 
{{!}} style="text-align:right" {{!}} {{#ifeq:{{#var:percent}}|0| - |{{#expr: {{#var:percent}} round 2}} % }} }}
{{!}} {{#ifeq: {{#dplvar:nmin}}|{{#dplvar:nmax}} |colspan=2 style="text-align:center" {{!}} {{#dplvar:nmin}} | style="text-align:right" {{!}} {{#dplvar:nmin}}
 
{{!}} style="text-align:right" {{!}} {{#dplvar:nmax}} }}
 
{{!}} style="text-align:right" {{!}} {{#ifeq:{{#dplvar:percent}}|0| - |{{#expr: {{#dplvar:percent}} round 2}} % }} }}
 
āˆ’  
<!-- {{#dplvar:set|raritytotal|{{#expr:{{#dplvar:raritytotal}}+{{#dplvar:probability}} }} }} --> </includeonly>{{#if:{{{footer|}}}|<includeonly>{{clear}}{{Block Varieties Footer}}</includeonly> |}}
 
   
 
<!--{{#dplvar:set|raritytotal|{{#expr:{{#dplvar:raritytotal}}+{{{probability|1}}} }} }} --> </includeonly>{{#if:{{{footer|}}}|<includeonly>{{clear}}{{Block Varieties Footer}}</includeonly> |}}<noinclude>
āˆ’
<noinclude>
 
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 13:19, 28 July 2020

Template documentation (for the above template, sometimes hidden or invisible)

This template is use to create a line item in a LootList table. This template must have been proceeded with a {{LootList Header}} template and followed by a {{LootList Footer}}. There can be any number of {{LootList-item}} templates between the Header and Footer templates. e.g.:

{{LootList Header|quiet=y}}
{{LootList-item |item=Glass Jar|rarity=1}}
{{LootList-item |group=junk|rarity=1|default=y}}
     ...
{{LootList Footer|version=Alpha 15.2}}

There are a number of parameters that can be passed to it:

Parameter Type Default Description
item <String-Link> -- This parameter is a link to a page describing an item that could be found in the container. It is mutually exclusive with the group parameter.
group <String-groupname> -- This parameter is the name of a loot list group that contains more items or groups. It is mutually exclusive with the item parameter.
colour <String> -- This parameter is used to add some text after an item or group so that it is not used as a link. Normally used to specify an item colour.
probability <numeric> 1 This value specifies how rare an item is in relation to the other items that are in the group or container. It is normalized for calculations of the chance of finding that item in the group or container. Include this even if the value is 1, as they calculations need it.
numbermin <int> 1 The minimum number of this item that is returned if this item is chosen.
numbermax <int> 1 The maximum number of this item that is returned if this item is chosen.
ImagePath <String> - If the item in the lootlist doesn't have its own infobox (Such as Perk Books), the template automatically requires this parameter. It is the image's name that is shown eg. ExampleImage.png. An example of usage can be seen here.