Difference between revisions of "Template:Consumable"
Jump to navigation
Jump to search
old>Realpsojed (Consumables don't use rarity (for now at least), removed centering of properties, changed to use Properties template, added PropertyText for texts above description but below properties that some consumables carry) |
|||
(62 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{| width=300px; | <includeonly><!-- | ||
|style="text-align:center;"|<span style="font-size: 20px;">{{ROOTPAGENAME}}</span> <br /> <span style="color:#9d9a9a;">{{:{{ROOTPAGENAME}}|ItemType}}</span> | --- Define variables for properties used more than once in the template - goal is to only load each property from the Data page once. !! TEMPchanged to load from the itempage !! --- | ||
-->{{#vardefine:Slashing Damage|{{:{{ROOTPAGENAME}}|Slashing Damage}}}}<!-- | |||
-->{{#vardefine:Piercing Damage|{{:{{ROOTPAGENAME}}|Piercing Damage}}}}<!-- | |||
-->{{#vardefine:Crushing Damage|{{:{{ROOTPAGENAME}}|Crushing Damage}}}}<!-- | |||
-->{{#vardefine:Rending Damage|{{:{{ROOTPAGENAME}}|Rending Damage}}}}<!-- | |||
-->{| width=300px; | |||
|style="text-align:center;"|{{#if:{{:{{ROOTPAGENAME}}|Unobtainable}}|{{Unobtainable}}<br />|}}<span style="font-size: 20px;">{{Translate|{{#if:{{:{{ROOTPAGENAME}}|Name}}|{{:{{ROOTPAGENAME}}|Name}}|{{ROOTPAGENAME}}}}|ConsumableNames}}</span><br /><span style="color:#9d9a9a;">{{Translate|{{:{{ROOTPAGENAME}}|ItemType}}|Properties}}</span>{{#ifeq:{{:{{ROOTPAGENAME}}|Properties1}}|{{:{{ROOTPAGENAME}}|PropertyText}}||{{Tooltip rule}}}} | |||
|- | |- | ||
| | |style="text-align:center;"|{{#if:{{#var:Slashing Damage}}{{#var:Piercing Damage}}{{#var:Crushing Damage}}{{#var:Rending Damage}}|<!-- | ||
--- Only display Damage types that have a value. --- | |||
-->{{#if:{{#var:Slashing Damage}}|{{#var:Slashing Damage}} {{Translate|Slashing|Properties}} {{Translate|Damage|Properties}}<br>}}<!-- | |||
-->{{#if:{{#var:Piercing Damage}}|{{#var:Piercing Damage}} {{Translate|Piercing|Properties}} {{Translate|Damage|Properties}}<br>}}<!-- | |||
-->{{#if:{{#var:Crushing Damage}}|{{#var:Crushing Damage}} {{Translate|Crushing|Properties}} {{Translate|Damage|Properties}}<br>}}<!-- | |||
-->{{#if:{{#var:Rending Damage}}|{{#var:Rending Damage}} {{Translate|Rending|Properties}} {{Translate|Damage|Properties}}<br>}}<!-- | |||
-->{{Tooltip rule}}}} | |||
|- | |- | ||
|style="color:# | |<div style="width:100%;color:white;"><!-- | ||
-->{{#if: {{:{{ROOTPAGENAME}}|Properties1}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties1}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values1}}</div> {{Clear}}| }}<!-- | |||
-->{{#ifeq: {{ROOTPAGENAME}} | Leeches | <div style="float:left;"><br>{{Translate|{{:{{ROOTPAGENAME}}|LeechesDesc}}|Properties}}:<br><br></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;">{{Translate|{{:{{ROOTPAGENAME}}|Properties3}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values3}}</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;">{{Translate|{{:{{ROOTPAGENAME}}|Properties5}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values5}}</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;">{{Translate|{{:{{ROOTPAGENAME}}|Properties7}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values7}}</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;">{{Translate|{{:{{ROOTPAGENAME}}|Properties9}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values9}}</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;">{{Translate|{{:{{ROOTPAGENAME}}|Properties11}}|Properties}}:</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values11}}</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;">{{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}}|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: {{:{{ROOTPAGENAME}}|Durability}} | <br><div style="color:#9d9a9a;">{{Translate|Durability|Properties}}: <span style="color:white;">{{:{{ROOTPAGENAME}}|Durability}}/{{:{{ROOTPAGENAME}}|Durability}}</span></div> | }} | |||
|- | |- | ||
|style=" | |style="color:#9d7969;"|{{Tooltip rule}}{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip | {{:{{ROOTPAGENAME}}|Description}} | {{Translate|{{ROOTPAGENAME}}|ConsumableDescriptions}}}} | {{:{{ROOTPAGENAME}} |Description}}}}{{#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}}|class=image2x|link={{#ifeq:{{SUBPAGENAME}}|Tooltip|{{BASEPAGENAME}}|{{PAGENAME}}/Tooltip}}|alt={{Translate|{{ROOTPAGENAME}}|ConsumableNames}}|{{Translate|{{ROOTPAGENAME}}|ConsumableNames}}]]{{#if:{{:{{ROOTPAGENAME}}|Image2}}|[[File:{{:{{ROOTPAGENAME}}|Image2}}|class=image2x|link={{#ifeq:{{SUBPAGENAME}}|Tooltip|{{BASEPAGENAME}}|{{PAGENAME}}/Tooltip}}|alt={{Translate|{{ROOTPAGENAME}}|ConsumableNames}}|{{Translate|{{ROOTPAGENAME}}|ConsumableNames}}]]}} | |||
|} | |} | ||
<noinclude>{{doc}} | </includeonly><noinclude>{{doc}} | ||
[[Category: | [[Category:Tooltip templates]]</noinclude> |
Latest revision as of 21:08, 21 February 2023
Documentation
[purge]
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.