Difference between revisions of "Template:Required Resources"
Jump to navigation
Jump to search
(better support for nutrition; simplification) |
(Added a multiplier as a second parameter) |
||
Line 1: | Line 1: | ||
− | <includeonly>{{#if:{{#vardefineecho:r1|{{Q|{{{1|{{PAGENAME}}}}}|Resource 1}}}}|{{#ifeq:{{lc:{{#var:r1}}}}|nutrition||{{Icon Small|{{#var:r1}}}} }}{{Q|{{{1|{{PAGENAME}}}}}|Resource 1 Amount}} {{#ifeq:{{lc:{{#var:r1}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 1 Type}})|{{#if:{{{simple|}}}||[[{{#var:r1}}]]}} }}<!-- | + | <includeonly>{{#if:{{#vardefineecho:r1|{{Q|{{{1|{{PAGENAME}}}}}|Resource 1}}}}|{{#ifeq:{{lc:{{#var:r1}}}}|nutrition||{{Icon Small|{{#var:r1}}}} }}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 1 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r1}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 1 Type}})|{{#if:{{{simple|}}}||[[{{#var:r1}}]]}} }}<!-- |
-->{{#ifeq: {{lc:{{#var:r1}}}} | stuff | ([[{{#explode:{{#vardefineecho:stuffTags|{{Q|{{{1|{{PAGENAME}}}}}|Stuff Tags}}}}|,}}]]{{#if:{{#explode:{{#var:stuffTags}}|,|1}}|/[[{{#explode:{{#var:stuffTags}}|,|1}}]]}}{{#if:{{#explode:{{#var:stuffTags}}|,|2}}|/[[{{#explode:{{#var:stuffTags}}|,|2}}]]}}{{#if:{{#explode:{{#var:stuffTags}}|,|3}}|/[[{{#explode:{{#var:stuffTags}}|,|3}}]]}}{{#if:{{#explode:{{#var:stuffTags}}|,|4}}|/[[{{#explode:{{#var:stuffTags}}|,|4}}]]}})}}<!-- | -->{{#ifeq: {{lc:{{#var:r1}}}} | stuff | ([[{{#explode:{{#vardefineecho:stuffTags|{{Q|{{{1|{{PAGENAME}}}}}|Stuff Tags}}}}|,}}]]{{#if:{{#explode:{{#var:stuffTags}}|,|1}}|/[[{{#explode:{{#var:stuffTags}}|,|1}}]]}}{{#if:{{#explode:{{#var:stuffTags}}|,|2}}|/[[{{#explode:{{#var:stuffTags}}|,|2}}]]}}{{#if:{{#explode:{{#var:stuffTags}}|,|3}}|/[[{{#explode:{{#var:stuffTags}}|,|3}}]]}}{{#if:{{#explode:{{#var:stuffTags}}|,|4}}|/[[{{#explode:{{#var:stuffTags}}|,|4}}]]}})}}<!-- | ||
− | -->{{#if:{{#vardefineecho:r2|{{Q|{{{1|{{PAGENAME}}}}}|Resource 2}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r2}}}}|nutrition||{{Icon Small|{{#var:r2}}}} }}{{Q|{{{1|{{PAGENAME}}}}}|Resource 2 Amount}} {{#ifeq:{{lc:{{#var:r2}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 2 Type}})|{{#if:{{{simple|}}}||[[{{#var:r2}}]]}} }} }}<!-- | + | -->{{#if:{{#vardefineecho:r2|{{Q|{{{1|{{PAGENAME}}}}}|Resource 2}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r2}}}}|nutrition||{{Icon Small|{{#var:r2}}}} }}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 2 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r2}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 2 Type}})|{{#if:{{{simple|}}}||[[{{#var:r2}}]]}} }} }}<!-- |
− | -->{{#if:{{#vardefineecho:r3|{{Q|{{{1|{{PAGENAME}}}}}|Resource 3}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r3}}}}|nutrition||{{Icon Small|{{#var:r3}}}} }}{{Q|{{{1|{{PAGENAME}}}}}|Resource 3 Amount}} {{#ifeq:{{lc:{{#var:r3}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 3 Type}})|{{#if:{{{simple|}}}||[[{{#var:r3}}]]}} }} }}<!-- | + | -->{{#if:{{#vardefineecho:r3|{{Q|{{{1|{{PAGENAME}}}}}|Resource 3}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r3}}}}|nutrition||{{Icon Small|{{#var:r3}}}} }}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 3 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r3}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 3 Type}})|{{#if:{{{simple|}}}||[[{{#var:r3}}]]}} }} }}<!-- |
− | -->{{#if:{{#vardefineecho:r4|{{Q|{{{1|{{PAGENAME}}}}}|Resource 4}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r4}}}}|nutrition||{{Icon Small|{{#var:r4}}}} }}{{Q|{{{1|{{PAGENAME}}}}}|Resource 4 Amount}} {{#ifeq:{{lc:{{#var:r4}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 4 Type}})|{{#if:{{{simple|}}}||[[{{#var:r4}}]]}} }} }}<!-- | + | -->{{#if:{{#vardefineecho:r4|{{Q|{{{1|{{PAGENAME}}}}}|Resource 4}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r4}}}}|nutrition||{{Icon Small|{{#var:r4}}}} }}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 4 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r4}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 4 Type}})|{{#if:{{{simple|}}}||[[{{#var:r4}}]]}} }} }}<!-- |
− | -->{{#if:{{#vardefineecho:r5|{{Q|{{{1|{{PAGENAME}}}}}|Resource 5}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r5}}}}|nutrition||{{Icon Small|{{#var:r5}}}} }}{{Q|{{{1|{{PAGENAME}}}}}|Resource 5 Amount}} {{#ifeq:{{lc:{{#var:r5}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 5 Type}})|{{#if:{{{simple|}}}||[[{{#var:r5}}]]}} }} }}<!-- | + | -->{{#if:{{#vardefineecho:r5|{{Q|{{{1|{{PAGENAME}}}}}|Resource 5}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r5}}}}|nutrition||{{Icon Small|{{#var:r5}}}} }}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 5 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r5}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 5 Type}})|{{#if:{{{simple|}}}||[[{{#var:r5}}]]}} }} }}<!-- |
− | -->{{#if:{{#vardefineecho:r6|{{Q|{{{1|{{PAGENAME}}}}}|Resource 6}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r6}}}}|nutrition||{{Icon Small|{{#var:r6}}}} }}{{Q|{{{1|{{PAGENAME}}}}}|Resource 6 Amount}} {{#ifeq:{{lc:{{#var:r6}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 6 Type}})|{{#if:{{{simple|}}}||[[{{#var:r6}}]]}} }} }} }}</includeonly><noinclude> | + | -->{{#if:{{#vardefineecho:r6|{{Q|{{{1|{{PAGENAME}}}}}|Resource 6}}}}|{{{sep|,}}} {{#ifeq:{{lc:{{#var:r6}}}}|nutrition||{{Icon Small|{{#var:r6}}}} }}{{#expr:{{Q|{{{1|{{PAGENAME}}}}}|Resource 6 Amount}}*{{{2|1}}}}} {{#ifeq:{{lc:{{#var:r6}}}}|nutrition|[[Nutrition]] ({{Q|{{{1|{{PAGENAME}}}}}|Resource 6 Type}})|{{#if:{{{simple|}}}||[[{{#var:r6}}]]}} }} }} }}</includeonly><noinclude> |
{{Documentation}} | {{Documentation}} | ||
</noinclude> | </noinclude> |
Revision as of 20:36, 19 September 2022
Returns a list of the resources required to make an item.
Parameters
First parameter is the item whose required resources are to be returned (optional, default = PAGENAME).
Second parameter is a multiplier (optional, default = 1).
sep
is the seperator parameter (optional, default = ",").
simple
removes the name of the time and only leaves the icon (set to any text or value, usually "1").
Examples
{{Required Resources|Plate armor}}
{{Required Resources|Plate armor|3}}
{{Required Resources|Phoenix armor}}
150 Plasteel, 50 Uranium, 6 Advanced component, 75 Steel, 4 Component, 40 Chemfuel
{{Required Resources|Phoenix armor|sep= +}}
150 Plasteel + 50 Uranium + 6 Advanced component + 75 Steel + 4 Component + 40 Chemfuel
{{Required Resources|Phoenix armor|sep= +|simple=1}}
{{Required Resources|Phoenix armor|sep= +|simple=1|2}}
The above documentation is transcluded from Template:Required Resources/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |