Difference between revisions of "Template:LootList-item"

From 7 Days to Die Wiki
Jump to: navigation, search
m
m
 
(2 intermediate revisions by the same user 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|}}}| {{#vardefine:percent |{{#if:{{#dplvar:totalprobability}} |{{#if:{{#dplvar:includeall}} | 100 |{{#expr: ({{{probability}}} / {{#dplvar:totalprobability}} * 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]] <!-- | 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}} }} }}
+
{{!}} {{#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 -->
 
<!-- 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}} }} }}
 
{{!}} 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}}|--|{{#dplvar:probability}} }}
 
<!-- {{!}} 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 -->
 
Defines min and max, chooses if both or just one is shown and shows chance percent -->
 
 
{{#vardefine:nmin|{{{numbermin|1}}} }} {{#vardefine:nmax|{{{numbermax|{{#var:nmin}} }}} }}
 
{{#vardefine:nmin|{{{numbermin|1}}} }} {{#vardefine:nmax|{{{numbermax|{{#var:nmin}} }}} }}
{{!}} {{#ifeq: {{#var:nmin}}|{{#var:nmax}}|colspan=2 style="text-align:center" {{!}} {{#var:nmin}} |
+
{{!}} {{#ifeq: {{#var:nmin}}|{{#var:nmax}}|colspan=2 style="text-align:center" {{!}} {{#var:nmin}} | style="text-align:right" {{!}} {{#var:nmin}}
style="text-align:right" {{!}} {{#var:nmin}}
 
 
{{!}} style="text-align:right" {{!}} {{#var:nmax}} }}
 
{{!}} style="text-align:right" {{!}} {{#var:nmax}} }}
 
{{!}} style="text-align:right" {{!}} {{#ifeq:{{#var:percent}}|0| - |{{#expr: {{#var:percent}} round 2}} % }} }}
 
{{!}} style="text-align:right" {{!}} {{#ifeq:{{#var:percent}}|0| - |{{#expr: {{#var:percent}} round 2}} % }} }}

Latest 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.