Difference between revisions of "Template:Condition"

From Stoneshard wiki
Jump to navigation Jump to search
old>Phoe nixx
m (use uniform horizontal rule)
(Add support for tooltips, hopefully)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<includeonly>{| width=300px;
<includeonly><!--
|<span style="font-size: 20px;">{{#if:{{:{{ROOTPAGENAME}}|Title}}|{{Translate|{{:{{ROOTPAGENAME}}|Title}}|ConditionNames}}|{{Translate|{{ROOTPAGENAME}}|ConditionNames}}}}</span> <br /> <span style="color:#9d9a9a;">{{c|{{:{{ROOTPAGENAME}}|ConditionType}}|{{Translate|{{:{{ROOTPAGENAME}}|ConditionType}}|Properties}}}}</span>{{Tooltip rule}}
-->{{#vardefine:Page|{{#if:{{{1|}}}|{{{1|}}}|{{ROOTPAGENAME}}}}}}<!--
|-
--><div style="width: 300px;">
|<div style="width:100%;color:white;">
<span style="font-size: 20px;">{{#if:{{:{{#var:Page}}|Title}}|{{Translate|{{:{{#var:Page}}|Title}}|ConditionNames}}|{{Translate|{{#var:Page}}|ConditionNames}}}}</span> <br /> <span style="color:#9d9a9a;">{{c|{{:{{#var:Page}}|ConditionType}}|{{Translate|{{:{{#var:Page}}|ConditionType}}|Properties}}}}</span>{{Tooltip rule}}
{{#if: {{:{{ROOTPAGENAME}}|Properties1}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties1}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values1}}</div> | }}{{Clear}}<!--
<div style="width:100%;color:white;">
-->{{#if: {{:{{ROOTPAGENAME}}|Properties2}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties2}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values2}}</div> | }}{{Clear}}<!--
{{#if: {{:{{#var:Page}}|Properties1}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties1}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values1}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties3}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties3}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values3}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties2}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties2}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values2}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties4}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties4}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values4}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties3}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties3}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values3}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties5}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties5}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values5}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties4}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties4}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values4}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties6}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties6}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values6}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties5}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties5}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values5}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties7}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties7}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values7}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties6}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties6}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values6}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties8}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties8}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values8}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties7}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties7}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values7}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties9}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties9}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values9}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties8}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties8}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values8}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties10}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties10}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values10}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties9}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties9}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values9}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties11}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties11}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values11}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties10}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties10}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values10}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties12}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties12}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values12}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties11}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties11}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values11}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Properties13}} | <div style="float:left;">{{Translate|{{:{{ROOTPAGENAME}}|Properties13}}|Properties}}</div> <div style="float: right;">{{:{{ROOTPAGENAME}}|Values13}}</div> | }}{{Clear}}<!--
-->{{#if: {{:{{#var:Page}}|Properties12}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties12}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values12}}</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}}|ConditionDescriptions}}}} | {{:{{ROOTPAGENAME}}|PropertyText}}}}</div> |}}</div>
-->{{#if: {{:{{#var:Page}}|Properties13}} | <div style="float:left;">{{Translate|{{:{{#var:Page}}|Properties13}}|Properties}}</div> <div style="float: right;">{{:{{#var:Page}}|Values13}}</div> | }}{{Clear}}<!--
|-
-->{{#if: {{:{{#var:Page}}|PropertyText}} | <div style="float:left;">{{#if: {{:{{#var:Page}}|Properties1}}|<br>| }} {{#if: {{#titleparts: {{#var:Page}} | 1 | 2}} | {{#ifeq: {{#var:Page}} | {{#var:Page}}/Tooltip | {{:{{#var:Page}}|PropertyText}} | {{Translate|{{#var:Page}}|ConditionDescriptions}}}} | {{:{{#var:Page}}|PropertyText}}}}</div> |}}</div>
|style="color:#9d7969;"|{{#if: {{:{{ROOTPAGENAME}}|Description}} | {{Tooltip rule}}{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip | {{:{{ROOTPAGENAME}}|Description}} | {{Translate|{{ROOTPAGENAME}} Description|ConditionDescriptions}}}} | {{:{{ROOTPAGENAME}} |Description}}}} <br />| }}
<div style="color:#9d7969;">{{#if: {{:{{#var:Page}}|Description}} | {{Tooltip rule}}{{#if: {{#titleparts: {{#var:Page}} | 1 | 2}} | {{#ifeq: {{#var:Page}} | {{#var:Page}}/Tooltip | {{:{{#var:Page}}|Description}} | {{Translate|{{#var:Page}} Description|ConditionDescriptions}}}} | {{:{{#var:Page}} |Description}}}} <br />| }}</div> <br><br>
|-
<div style="text-align:center;">{{#if: {{{tooltip|}}}||[[File:{{#if:{{:{{#var:Page}}|Image}}|{{:{{#var:Page}}|Image}}|{{#var:Page}}.png}}|link={{#ifeq:{{#var:Page}}|Tooltip|{{#var:Page}}|{{#var:Page}}/Tooltip}}|alt={{Translate|{{#var:Page}}|ConditionNames}}|{{Translate|{{#var:Page}}|ConditionNames}}]] <br />}}</div>
|style="text-align:center;"|[[File:{{#if:{{:{{ROOTPAGENAME}}|Image}}|{{:{{ROOTPAGENAME}}|Image}}|{{ROOTPAGENAME}}.png}}|link={{#ifeq:{{SUBPAGENAME}}|Tooltip|{{BASEPAGENAME}}|{{PAGENAME}}/Tooltip}}|alt={{Translate|{{ROOTPAGENAME}}|ConditionNames}}|{{Translate|{{ROOTPAGENAME}}|ConditionNames}}]]
</div></includeonly><noinclude>{{doc}}
|}</includeonly><noinclude>{{doc}}


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

Latest revision as of 03:10, 20 April 2023

Template-info.png Documentation

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

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

<includeonly>{{#switch: {{{1}}}
|ConditionType = Physical
|Properties1 = Deals Damage
|Values1 = {{c|+|+2}}
|Properties2 = Energy Restoration
|Values2 = {{c|-|-5%}}
|Properties3 = Healing Efficiency
|Values3 = {{c|-|-30%}}
|PropertyText = Each turn reduces the affected Body Part's condition by {{c|-|1%}}.
|Description =
|#default = 
}}</includeonly>

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

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

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

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

If you want to you can specify from which page to load the data from:

{{ {{{1|Tooltip hover box}}}
|title= {{Condition|Daze}}
}}

Condition pages also display icons for conditions that have them, but this doesn't work for tooltips. For this case, you can define a tooltip=1 parameter to not show the condition image.

{{ {{{1|Tooltip hover box}}}
|title= {{Condition|Daze|tooltip=1}}
}}

Custom Title and Image

In addition to the data structure above, the Condition template accepts two optional parameters "Title" and "Image". These can be used for conditions that share their name with a skill (like Elusiveness and Elusiveness (Condition)).
To use them, simply add them to the data structure:

|Title = Elusiveness
|Image = Elusiveness.png

Then the produced tooltip will use the Title and Image name you provided instead of automatically using the page name.