Difference between revisions of "Template:Consumable"

From Stoneshard wiki
Jump to navigation Jump to search
old>Realpsojed
(Add check, if freshness = 0 then "never spoils", otherwise "spoils in X days". If freshness does not exist, don't show anything (for non-food items).)
old>Realpsojed
m
Line 17: Line 17:
-->{{#if: {{:{{ROOTPAGENAME}}|Properties13}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties13}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values13}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties13}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties13}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values13}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|PropertyText}} | <div style="float:left;">{{#if:{{:{{ROOTPAGENAME}}|Properties1}}|<br>|}}{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip | {{:{{ROOTPAGENAME}}|PropertyText}} | {{Translate|{{ROOTPAGENAME}}|ConsumableDescriptions}}}} | {{:{{ROOTPAGENAME}}|PropertyText}}}}</div> {{Clear}}|}}</div><!--
-->{{#if: {{:{{ROOTPAGENAME}}|PropertyText}} | <div style="float:left;">{{#if:{{:{{ROOTPAGENAME}}|Properties1}}|<br>|}}{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip | {{:{{ROOTPAGENAME}}|PropertyText}} | {{Translate|{{ROOTPAGENAME}}|ConsumableDescriptions}}}} | {{:{{ROOTPAGENAME}}|PropertyText}}}}</div> {{Clear}}|}}</div><!--
-->{{#if: {{:{{ROOTPAGENAME}}|Freshness}} | {{#ifeq: {{:{{ROOTPAGENAME}}|Freshness}}|0|<br><div><span style="color:white;">Does not spoil over time.</span></div>|<br><div style="color:#9d9a9a;">{{Translate|Will spoil in|Properties}} <span style="color:white;">{{#iferror: {{#expr: ceil({{:{{ROOTPAGENAME}}|Freshness}}/24) }}|error}} {{#iferror: {{#ifexpr: {{:{{ROOTPAGENAME}}|Freshness}} > 24 |days|day}}|error}}.</span></div>}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Freshness}} | {{#ifeq: {{:{{ROOTPAGENAME}}|Freshness}}|0|<br><div><span style="color:white;">Does not spoil over time.</span></div>|<br><div style="color:#9d9a9a;">{{Translate|Will spoil in|Properties}} <span style="color:white;">{{#iferror: {{#expr: ceil({{:{{ROOTPAGENAME}}|Freshness}}/24) }}|error}} {{#iferror: {{#ifexpr: {{:{{ROOTPAGENAME}}|Freshness}} > 24 |days|day}}|error}}.</span></div>}}}}<!--
-->{{#if: {{#switch:{{:{{ROOTPAGENAME}}|Uses}}|0|1=|{{:{{ROOTPAGENAME}}|Uses}}}} | <br><div style="color:#9d9a9a;">{{Translate|Uses|Properties}}: <span style="color:white;">{{:{{ROOTPAGENAME}}|Uses}}/{{:{{ROOTPAGENAME}}|Uses}}</span></div> | }}<!--
-->{{#if: {{#switch:{{:{{ROOTPAGENAME}}|Uses}}|0|1=|{{:{{ROOTPAGENAME}}|Uses}}}} | <br><div style="color:#9d9a9a;">{{Translate|Uses|Properties}}: <span style="color:white;">{{:{{ROOTPAGENAME}}|Uses}}/{{:{{ROOTPAGENAME}}|Uses}}</span></div> | }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Durability}} | <br><div style="color:#9d9a9a;">{{Translate|Durability|Properties}}: <span style="color:white;">{{:{{ROOTPAGENAME}}|Durability}}/{{:{{ROOTPAGENAME}}|Durability}}</span></div> | }}
-->{{#if: {{:{{ROOTPAGENAME}}|Durability}} | <br><div style="color:#9d9a9a;">{{Translate|Durability|Properties}}: <span style="color:white;">{{:{{ROOTPAGENAME}}|Durability}}/{{:{{ROOTPAGENAME}}|Durability}}</span></div> | }}

Revision as of 21:33, 1 July 2021

Template-info.png Documentation

This is consumable template created for use together with the Template:Tooltip hover box template on a specific consumable's page or consumable's tooltip page.

Usage: The page itself must contain the consumable's data before this Template works. For example, if I wanted to create the Agrimony page, I'll add this code to the start of the page and modify the values:

<includeonly>{{#switch: {{{1}}}
|ItemType = Ingredient
|Properties1 = Energy Replenishment
|Values1 = {{c|+|+5}}
|Properties2 = Health Restoration
|Values2 = {{c|+|+0.50% (45x)}}
|Properties3 = Immunity
|Values3 = {{c|+|+1%}}
|PropertyText = 
|Description = Agrimony has been valued for its healing qualities since olden times.
|Price = 10
|#default = 
}}</includeonly>

This data is invisible on the page itself, thanks to the includeonly tags.


Next, copy this code to Agrimony or Agrimony/Tooltip or Agrimony/anything page:

{{ {{{1|Tooltip hover box}}}
|title= {{Consumable}}
}}

It will automatically load the consumable's data and fill them into this format. Go to Agrimony to see the result.