Difference between revisions of "Template:Consumable"

From Stoneshard wiki
Jump to navigation Jump to search
old>Phoe nixx
(hide one rule if no properties)
old>Phoe nixx
(add alternative image option)
Line 22: Line 22:
|style="color:#9d7969;"|{{Tooltip rule}}{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip | {{:{{ROOTPAGENAME}}|Description}} | {{Translate|{{ROOTPAGENAME}} Description|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="color:#9d7969;"|{{Tooltip rule}}{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip | {{:{{ROOTPAGENAME}}|Description}} | {{Translate|{{ROOTPAGENAME}} Description|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}}|link={{#ifeq:{{SUBPAGENAME}}|Tooltip|{{BASEPAGENAME}}|{{PAGENAME}}/Tooltip}}|alt={{Translate|{{ROOTPAGENAME}}|ConsumableNames}}|{{Translate|{{ROOTPAGENAME}}|ConsumableNames}}]]
|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}}]]{{#if:{{:{{ROOTPAGENAME}}|Image2}}|[[File:{{:{{ROOTPAGENAME}}|Image2}}|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 19:33, 1 March 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.