7 Days to Die Wiki
Line 6: Line 6:
   
 
<!-- 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}} |<!-- Necessary? --> {{#expr: 100 *{{#dplvar:scaler}}}} |{{#expr: ({{{probability}}} / {{#dplvar:totalrarity}} * 100) *{{#dplvar:scaler}} }} }}|0}} }}
+
{{#if: {{{item|}}} {{{group|}}}| {{#vardefine:percent |{{#if:{{#dplvar:totalrarity}} |{{#if:{{#dplvar:includeall}} |<!-- Necessary? --> {{#expr: 100 *{{#dplvar:scaler}}}} |{{#expr: ({{{probability}}} / {{#dplvar:totalrarity}} * 100) *{{#dplvar:scaler}} }} }}|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 -->
Line 13: Line 13:
 
<!-- Sets the other values of the item into the table and finishes it off -->
 
<!-- Sets the other 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}} }} }}
 
{{!}} style="text-align:center" {{!}} {{#ifeq:{{#var:percent|}}|0| - |{{#ifexpr:{{#var:percent}} > {{#dplvar:common}}|Common|{{#ifexpr:{{#var:percent}} > {{#dplvar:uncommon}}|Uncommon|Rare}} }} }}
{{!}} style="text-align:right" {{!}} {{#if:{{#dplvar:includeall}}|--|{{{probability|1}}}}}
+
{{!}} 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}}
+
{{!}} {{#vardefine:nmin|{{{numbermin|1}}} }} {{#vardefine:nmax|{{{numbermax|{{#var:nmin}} }}} }}
{{!}} style="text-align:right"{{!}} {{#var:nmax}} }}
+
{{#ifeq: {{#var:nmin}}|{{#var:nmax}}|colspan=2 style="text-align:center" {{!}} {{#var:nmin}} |
{{!}} style="text-align:right"{{!}} {{#ifeq:{{#var:percent}}|0| - |{{#expr: {{#var:percent}} round 2}} % }}
+
{{!}} style="text-align:right" {{!}} {{#var:nmin}}
  +
{{!}} style="text-align:right" {{!}} {{#var:nmax}} }}
  +
{{!}} style="text-align:right" {{!}} {{#ifeq:{{#var:percent}}|0| - |{{#expr: {{#var:percent}} round 2}} % }}
   
 
<!-- {{#if: {{{default|}}}|"{{!}} <small>No value is given, <br/>a default value of one has been assumed.</small>}} -->
 
<!-- {{#if: {{{default|}}}|"{{!}} <small>No value is given, <br/>a default value of one has been assumed.</small>}} -->

Revision as of 11:26, 25 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.