Difference between revisions of "Template:Weapon"
Jump to navigation
Jump to search
(updated to load item data from Data page) |
(load data from Weapon_data page, for performance reasons) |
||
Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
--- Define variables for properties used more than once in the template - goal is to only load each property from the Data page once. --- | --- 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|{{: | -->{{#vardefine:Rarity|{{:Weapon_data|{{ROOTPAGENAME}}|Rarity}}}}<!-- | ||
-->{{#vardefine:Weapon Type|{{: | -->{{#vardefine:Weapon Type|{{:Weapon_data|{{ROOTPAGENAME}}|WeaponType}}}}<!-- | ||
-->{{#vardefine:Slashing Damage|{{: | -->{{#vardefine:Slashing Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Slashing Damage}}}}<!-- | ||
-->{{#vardefine:Piercing Damage|{{: | -->{{#vardefine:Piercing Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Piercing Damage}}}}<!-- | ||
-->{{#vardefine:Crushing Damage|{{: | -->{{#vardefine:Crushing Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Crushing Damage}}}}<!-- | ||
-->{{#vardefine:Rending Damage|{{: | -->{{#vardefine:Rending Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Rending Damage}}}}<!-- | ||
-->{{#vardefine:Fire Damage|{{: | -->{{#vardefine:Fire Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Fire Damage}}}}<!-- | ||
-->{{#vardefine:Frost Damage|{{: | -->{{#vardefine:Frost Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Frost Damage}}}}<!-- | ||
-->{{#vardefine:Shock Damage|{{: | -->{{#vardefine:Shock Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Shock Damage}}}}<!-- | ||
-->{{#vardefine:Poison Damage|{{: | -->{{#vardefine:Poison Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Poison Damage}}}}<!-- | ||
-->{{#vardefine:Caustic Damage|{{: | -->{{#vardefine:Caustic Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Caustic Damage}}}}<!-- | ||
-->{{#vardefine:Arcane Damage|{{: | -->{{#vardefine:Arcane Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Arcane Damage}}}}<!-- | ||
-->{{#vardefine:Sacred Damage|{{: | -->{{#vardefine:Sacred Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Sacred Damage}}}}<!-- | ||
-->{{#vardefine:Unholy Damage|{{: | -->{{#vardefine:Unholy Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Unholy Damage}}}}<!-- | ||
-->{{#vardefine:Psionic Damage|{{: | -->{{#vardefine:Psionic Damage|{{:Weapon_data|{{ROOTPAGENAME}}|Psionic Damage}}}}<!-- | ||
-->{{#vardefine:Durability|{{: | -->{{#vardefine:Durability|{{:Weapon_data|{{ROOTPAGENAME}}|Durability}}}}<!-- | ||
-->{{#vardefine:Description|{{: | -->{{#vardefine:Description|{{:Weapon_data|{{ROOTPAGENAME}}|Description}}}}<!-- | ||
--- Weapon Tooltip start. --- | --- Weapon Tooltip start. --- | ||
-->{| width=300px; | -->{| width=300px; | ||
|style="text-align:center;"|<!-- | |style="text-align:center;"|<!-- | ||
--- Check if item is marked as unobtainable. --- | --- Check if item is marked as unobtainable. --- | ||
-->{{#if:{{: | -->{{#if:{{:Weapon_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. --- | --- 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}} | -->{{#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}} | ||
Line 51: | Line 51: | ||
|style="color:#9d7969;text-align:justify"|<!-- | |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. --- | --- 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|{{: | -->{{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|{{:Weapon_data|{{ROOTPAGENAME}}|Price}}}}</div><br /> | ||
|- | |- | ||
|style="text-align:center;"|[[File:{{#if:{{: | |style="text-align:center;"|[[File:{{#if:{{:Weapon_data|{{ROOTPAGENAME}}|Image}}|{{:Weapon_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:{{#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}} | {{#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 14:40, 29 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:
UNOBTAINABLE Weapon Data does not exist. Data does not exist. |
Data does not exist. Slashing Damage Data does not exist. Piercing Damage Data does not exist. Crushing Damage Data does not exist. Rending Damage Data does not exist. Fire Damage Data does not exist. Frost Damage Data does not exist. Shock Damage Data does not exist. Poison Damage Data does not exist. Caustic Damage Data does not exist. Arcane Damage Data does not exist. Sacred Damage Data does not exist. Unholy Damage Data does not exist. Psionic Damage |
Durability: Data does not exist./Data does not exist.
|
Data does not exist. Data does not exist. |
Weapon |
UNOBTAINABLE Weapon Data does not exist. Data does not exist. |
Data does not exist. Slashing Damage Data does not exist. Piercing Damage Data does not exist. Crushing Damage Data does not exist. Rending Damage Data does not exist. Fire Damage Data does not exist. Frost Damage Data does not exist. Shock Damage Data does not exist. Poison Damage Data does not exist. Caustic Damage Data does not exist. Arcane Damage Data does not exist. Sacred Damage Data does not exist. Unholy Damage Data does not exist. Psionic Damage |
Durability: Data does not exist./Data does not exist.
|
Data does not exist. Data does not exist. |
Weapon |