Difference between revisions of "Template:Weapon"
Jump to navigation
Jump to search
m (108 revisions imported) |
(updated to load item data from Data page) |
||
Line 1: | Line 1: | ||
<includeonly>{| width=300px; | <includeonly><!-- | ||
|style="text-align:center;"|{{#if:{{:{{ROOTPAGENAME}}|Unobtainable}}|{{Unobtainable}}<br />}}{{#if: {{: | --- Define variables for properties used more than once in the template - goal is to only load each property from the Data page once. --- | ||
-->{{#vardefine:Rarity|{{:Data|{{ROOTPAGENAME}}|Rarity}}}}<!-- | |||
-->{{#vardefine:Weapon Type|{{:Data|{{ROOTPAGENAME}}|WeaponType}}}}<!-- | |||
-->{{#vardefine:Slashing Damage|{{:Data|{{ROOTPAGENAME}}|Slashing Damage}}}}<!-- | |||
-->{{#vardefine:Piercing Damage|{{:Data|{{ROOTPAGENAME}}|Piercing Damage}}}}<!-- | |||
-->{{#vardefine:Crushing Damage|{{:Data|{{ROOTPAGENAME}}|Crushing Damage}}}}<!-- | |||
-->{{#vardefine:Rending Damage|{{:Data|{{ROOTPAGENAME}}|Rending Damage}}}}<!-- | |||
-->{{#vardefine:Fire Damage|{{:Data|{{ROOTPAGENAME}}|Fire Damage}}}}<!-- | |||
-->{{#vardefine:Frost Damage|{{:Data|{{ROOTPAGENAME}}|Frost Damage}}}}<!-- | |||
-->{{#vardefine:Shock Damage|{{:Data|{{ROOTPAGENAME}}|Shock Damage}}}}<!-- | |||
-->{{#vardefine:Poison Damage|{{:Data|{{ROOTPAGENAME}}|Poison Damage}}}}<!-- | |||
-->{{#vardefine:Caustic Damage|{{:Data|{{ROOTPAGENAME}}|Caustic Damage}}}}<!-- | |||
-->{{#vardefine:Arcane Damage|{{:Data|{{ROOTPAGENAME}}|Arcane Damage}}}}<!-- | |||
-->{{#vardefine:Sacred Damage|{{:Data|{{ROOTPAGENAME}}|Sacred Damage}}}}<!-- | |||
-->{{#vardefine:Unholy Damage|{{:Data|{{ROOTPAGENAME}}|Unholy Damage}}}}<!-- | |||
-->{{#vardefine:Psionic Damage|{{:Data|{{ROOTPAGENAME}}|Psionic Damage}}}}<!-- | |||
-->{{#vardefine:Durability|{{:Data|{{ROOTPAGENAME}}|Durability}}}}<!-- | |||
-->{{#vardefine:Description|{{:Data|{{ROOTPAGENAME}}|Description}}}}<!-- | |||
--- Weapon Tooltip start. --- | |||
-->{| width=300px; | |||
|style="text-align:center;"|<!-- | |||
--- Check if item is marked as unobtainable. --- | |||
-->{{#if:{{:Data|{{ROOTPAGENAME}}|Unobtainable}}|{{Unobtainable}}<br />}}<!-- | |||
--- Check if item has Rarity, then format the text, color the item name with Rarity's color and display the weapon type. Default to Common Rarity if the item has no Rarity. --- | |||
-->{{#if: {{#var:Rarity}} | <span style="font-size: 20px;">{{c|{{#var:Rarity}}|{{Translate|{{ROOTPAGENAME}}|ItemNames}}}}</span> <br /> <span style="color:#9d9a9a;">{{Translate|{{#var:Rarity}}|Properties}} | <span style="font-size: 20px;">{{Translate|{{ROOTPAGENAME}}|ItemNames}}</span> <br /> <span style="color:#9d9a9a;">{{Translate|Common|Properties}} }} {{Translate|{{#var:Weapon Type}}|Properties}}</span>{{Tooltip rule}} | |||
|- | |- | ||
|style="text-align:center;"|<!-- | |style="text-align:center;"|<!-- | ||
--- 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>}}<!-- | |||
--- Swap the order of words for Russian wiki version on Fire, Frost, Shock, Poison and Caustic damage types, its a grammar/pronounciation thing apparently. --- | |||
-->{{#if:{{#var:Fire Damage}}|{{c|Fire|{{#var:Fire Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{Translate|Damage|Properties}} {{Translate|Fire|Properties}}|{{Translate|Fire|Properties}} {{Translate|Damage|Properties}}}}}}<br>}}<!-- | |||
-->{{#if:{{#var:Frost Damage}}|{{c|Frost|{{#var:Frost Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{Translate|Damage|Properties}} {{Translate|Frost|Properties}}|{{Translate|Frost|Properties}} {{Translate|Damage|Properties}}}}}}<br>}}<!-- | |||
-->{{#if:{{#var:Shock Damage}}|{{c|Shock|{{#var:Shock Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{Translate|Damage|Properties}} {{Translate|Shock|Properties}}|{{Translate|Shock|Properties}} {{Translate|Damage|Properties}}}}}}<br>}}<!-- | |||
-->{{#if: {{: | -->{{#if:{{#var:Poison Damage}}|{{c|Poison|{{#var:Poison Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{Translate|Damage|Properties}} {{Translate|Poison|Properties}}|{{Translate|Poison|Properties}} {{Translate|Damage|Properties}}}}}}<br>}}<!-- | ||
|Fire | -->{{#if:{{#var:Caustic Damage}}|{{c|Caustic|{{#var:Caustic Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{Translate|Damage|Properties}} {{Translate|Caustic|Properties}}|{{Translate|Caustic|Properties}} {{Translate|Damage|Properties}}}}}}<br>}}<!-- | ||
| | -->{{#if:{{#var:Arcane Damage}}|{{c|Arcane|{{#var:Arcane Damage}} {{Translate|Arcane|Properties}} {{Translate|Damage|Properties}}}}<br>}}<!-- | ||
-->{{#if:{{#var:Sacred Damage}}|{{c|Sacred|{{#var:Sacred Damage}} {{Translate|Sacred|Properties}} {{Translate|Damage|Properties}}}}<br>}}<!-- | |||
-->{{#if:{{#var:Unholy Damage}}|{{c|Unholy|{{#var:Unholy Damage}} {{Translate|Unholy|Properties}} {{Translate|Damage|Properties}}}}<br>}}<!-- | |||
| | -->{{#if:{{#var:Psionic Damage}}|{{c|Psionic|{{#var:Psionic Damage}} {{Translate|Psionic|Properties}} {{Translate|Damage|Properties}}}}<br>}}<!-- | ||
-->{{#if: {{: | |||
|Shock | |||
| | |||
| | |||
-->{{#if: {{: | |||
| | |||
| | |||
| | |||
-->{{Tooltip rule}} | -->{{Tooltip rule}} | ||
|- | |- | ||
|<div style="width:100%;float: left;color:#9d9a9a;">{{ | |<!-- | ||
<div style="clear: both;color:#9d9a9a;">{{Translate|Durability|Properties}}: <span style="color:white;">{{: | --- Load and sort this weapon's properties, we use another template. --- | ||
--><div style="width:100%;float: left;color:#9d9a9a;">{{Test|{{ROOTPAGENAME}}}}</div> | |||
<div style="clear: both;color:#9d9a9a;">{{Translate|Durability|Properties}}: <span style="color:white;">{{#var:Durability}}/{{#var:Durability}}</span></div> | |||
|- | |- | ||
|style="color:#9d7969;text-align:justify"|{{Tooltip rule}}{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip | {{: | |style="color:#9d7969;text-align:justify"|<!-- | ||
--- Depending on which page we are currently on, description is loaded either from Data page, or from description translation template. --- | |||
-->{{Tooltip rule}}{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}}|{{#ifeq: {{PAGENAME}}|{{ROOTPAGENAME}}/Tooltip |{{#var:Description}}|{{Translate|{{ROOTPAGENAME}}|ItemDescriptions}}}}|{{#var:Description}}}}<div style="float:right;">[[File:Gold_Icon.png|18px|alt={{Translate|Price|Properties}}|link=|{{Translate|Price|Properties}}]]{{W|{{:Data|{{ROOTPAGENAME}}|Price}}}}</div><br /> | |||
|- | |- | ||
|style="text-align:center;"|[[File:{{ROOTPAGENAME}}.png|class=image2x|link={{#ifeq:{{SUBPAGENAME}}|Tooltip|{{BASEPAGENAME}}|{{PAGENAME}}/Tooltip}}|alt={{Translate|{{ROOTPAGENAME}}|ItemNames}}|{{Translate|{{ROOTPAGENAME}}|ItemNames}}]] | |style="text-align:center;"|[[File:{{#if:{{:Data|{{ROOTPAGENAME}}|Image}}|{{:Data|{{ROOTPAGENAME}}|Image}}|{{ROOTPAGENAME}}.png}}|class=image2x|link={{#ifeq:{{SUBPAGENAME}}|Tooltip|{{BASEPAGENAME}}|{{PAGENAME}}/Tooltip}}|alt={{Translate|{{ROOTPAGENAME}}|ItemNames}}|{{Translate|{{ROOTPAGENAME}}|ItemNames}}]] | ||
|} | |} | ||
{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip |[[Category:{{: | {{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip |[[Category:{{#var:Weapon Type}} Tooltips]]|{{#if: {{#titleparts: {{PAGENAME}} | 1 | 3}}|[[Category: {{uc:{{#titleparts: {{PAGENAME}} | 1 | 2}}}} {{#var:Weapon Type}} Tooltips]]|[[Category: {{uc:{{#titleparts: {{PAGENAME}} | 1 | 2}}}} {{#var:Weapon Type}}]]}}}}|[[Category:{{#var:Weapon Type}}]]}}</includeonly><noinclude>{{doc}} | ||
[[Category:Tooltip templates]]</noinclude> | [[Category:Tooltip templates]]</noinclude> |
Revision as of 22:36, 28 May 2022
Documentation
[purge]
This is weapon template created for use together with the Template:Tooltip hover box template to display tooltip with item attributes for weapons.
Usage: Copy this code to any page where you want to display the item tooltip:
{{{{{1|Tooltip hover box}}}|title={{Weapon}}}}
You can provide the item name as first parameter, otherwise the pagename is used.
By default, the page is also labelled with a category corresponding to the item type (ie. Heavy Aldorian Bow will receive the Category: Bow
).
If you don't want to add this category to a page, add the category
parameter:
{{{{{1|Tooltip hover box}}}|title={{Weapon|Heavy Aldorian Bow|category=no}}}}
Examples:
Weapon Common |
Durability: /
|
Weapon |
[[Category:]]
Weapon Common |
Durability: /
|
Weapon |
[[Category:]]