Difference between revisions of "Template:Consumable"

From Stoneshard wiki
Jump to navigation Jump to search
old>Realpsojed
(changed the check to compare Properties1 with PropertyText. This way only when both are empty (and therefore equal), we remove space, hr and ItemType, otherwise we don't.)
old>Realpsojed
(added translation templates)
Line 1: Line 1:
<includeonly>{| width=300px;
<includeonly>{| width=300px;
|style="text-align:center;"|<span style="font-size: 20px;">{{ROOTPAGENAME}}</span>{{#ifeq:{{:{{ROOTPAGENAME}}|Properties1}}|{{:{{ROOTPAGENAME}}|PropertyText}}||<br /><span style="color:#9d9a9a;">{{:{{ROOTPAGENAME}}|ItemType}}</span><hr style="height:2px;background-color:#33323f;box-shadow: 0 2px 13121d;margin: 10px 0 10px 0;">}}
|style="text-align:center;"|<span style="font-size: 20px;">{{Translate|{{ROOTPAGENAME}}|ItemNames}}</span>{{#ifeq:{{:{{ROOTPAGENAME}}|Properties1}}|{{:{{ROOTPAGENAME}}|PropertyText}}||<br /><span style="color:#9d9a9a;">{{Translate|{{:{{ROOTPAGENAME}}|ItemType}}|Properties}}</span><hr style="height:2px;background-color:#33323f;box-shadow: 0 2px 13121d;margin: 10px 0 10px 0;">}}
|-
|-
|<div style="width:100%;color:white;"><!--
|<div style="width:100%;color:white;"><!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties1}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties1}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values1}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties1}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties1}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values1}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties2}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties2}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values2}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties2}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties2}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values2}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties3}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties3}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values3}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties3}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties3}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values3}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties4}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties4}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values4}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties4}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties4}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values4}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties5}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties5}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values5}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties5}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties5}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values5}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties6}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties6}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values6}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties6}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties6}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values6}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties7}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties7}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values7}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties7}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties7}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values7}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties8}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties8}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values8}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties8}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties8}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values8}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties9}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties9}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values9}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties9}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties9}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values9}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties10}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties10}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values10}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties10}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties10}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values10}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties11}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties11}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values11}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties11}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties11}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values11}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties12}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties12}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values12}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties12}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties12}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values12}}</div> {{Clear}}| }}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties13}} | <div style="float:left;">{{:{{ROOTPAGENAME}}|Properties13}}:</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>|}}{{:{{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}}|Durability}} | <br><div style="color:#9d9a9a;">Durability: <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> | }}
|-
|-
|style="color:#9d7969;"|<hr style="height:2px;background-color:#33323f;box-shadow: 0 2px 13121d;margin: 10px 0 10px 0;">{{:{{ROOTPAGENAME}}|Description}}{{#if:{{:{{ROOTPAGENAME}}|Price}}|<div style="float:right">[[File:Gold_Icon.png|18px|alt=Price|link=|Price]]{{W|{{:{{ROOTPAGENAME}}|Price}}}}</div>}} <br />
|style="color:#9d7969;"|<hr style="height:2px;background-color:#33323f;box-shadow: 0 2px 13121d;margin: 10px 0 10px 0;">{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip | {{:{{ROOTPAGENAME}}|Description}} | {{Translate|{{ROOTPAGENAME}} Description|ConsumableDescriptions}}}}{{#if:{{:{{ROOTPAGENAME}}|Price}}|<div style="float:right">[[File:Gold_Icon.png|18px|alt={{Translate|Price|Properties}}|link=|{{Translate|Price|Properties}}]]{{W|{{:{{ROOTPAGENAME}}|Price}}}}</div>}} <br />
|-
|-
|style="text-align:center;"|[[File:{{#if:{{:{{ROOTPAGENAME}}|Image}}|{{:{{ROOTPAGENAME}}|Image}}|{{ROOTPAGENAME}}.png}}|link={{ROOTPAGENAME}}/Tooltip|alt={{ROOTPAGENAME}}|{{ROOTPAGENAME}}]]
|style="text-align:center;"|[[File:{{#if:{{:{{ROOTPAGENAME}}|Image}}|{{:{{ROOTPAGENAME}}|Image}}|{{ROOTPAGENAME}}.png}}|link={{#ifeq:{{SUBPAGENAME}}|Tooltip|{{BASEPAGENAME}}|{{PAGENAME}}/Tooltip}}|alt={{Translate|{{ROOTPAGENAME}}|ConsumableNames}}|{{Translate|{{ROOTPAGENAME}}|ConsumableNames}}]]
|}
|}
</includeonly><noinclude>{{doc}}
</includeonly><noinclude>{{doc}}


[[Category:Tooltip templates]]</noinclude>
[[Category:Tooltip templates]]</noinclude>

Revision as of 16:28, 8 October 2020

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.