Difference between revisions of "Template:Weapon"

From Stoneshard wiki
Jump to navigation Jump to search
old>Phoe nixx
(add category parameter)
 
(17 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<includeonly>{| width=300px;
<includeonly><!--
|style="text-align:center;"|{{#if:{{:{{ROOTPAGENAME}}|Unobtainable}}|{{Unobtainable}}<br />}}{{#if: {{:{{ROOTPAGENAME}}|Rarity}} | <span style="font-size: 20px;">{{c|{{:{{ROOTPAGENAME}}|Rarity}}|{{Translate|{{ROOTPAGENAME}}|ItemNames}}}}</span> <br /> <span style="color:#9d9a9a;">{{Translate|{{:{{ROOTPAGENAME}}|Rarity}}|Properties}} | <span style="font-size: 20px;">{{Translate|{{ROOTPAGENAME}}|ItemNames}}</span> <br /> <span style="color:#9d9a9a;">{{Translate|Common|Properties}} }} {{Translate|{{:{{ROOTPAGENAME}}|WeaponType}}|Properties}}</span><hr style="height:2px;background-color:#33323f;box-shadow: 0 2px 13121d;margin: 10px 0 10px 0;">
--- If item name is provided as parameter, use the parameter instead of root page. ---
-->{{#vardefine:Page|{{#if:{{{1|}}}|{{{1|}}}|{{ROOTPAGENAME}}}}}}<!--
--- Load complete datastring into a variable - to only load from the Armor data page once. ---
-->{{#vardefine:Datastring|{{:Weapon_data|{{#var:Page}}}}}}<!--
--- Separate values from datastring into individual variables. ---
-->{{#vardefine:Unobtainable|{{#explode: {{#var:Datastring}}|;|-2}}}}<!--
-->{{#vardefine:Rarity|{{#explode: {{#var:Datastring}}|;|2}}}}<!--
-->{{#vardefine:WeaponType|{{#explode: {{#var:Datastring}}|;|1}}}}<!--
-->{{#vardefine:Slashing Damage|{{#explode: {{#var:Datastring}}|;|13}}}}<!--
-->{{#vardefine:Piercing Damage|{{#explode: {{#var:Datastring}}|;|14}}}}<!--
-->{{#vardefine:Crushing Damage|{{#explode: {{#var:Datastring}}|;|15}}}}<!--
-->{{#vardefine:Rending Damage|{{#explode: {{#var:Datastring}}|;|16}}}}<!--
-->{{#vardefine:Fire Damage|{{#explode: {{#var:Datastring}}|;|17}}}}<!--
-->{{#vardefine:Shock Damage|{{#explode: {{#var:Datastring}}|;|18}}}}<!--
-->{{#vardefine:Poison Damage|{{#explode: {{#var:Datastring}}|;|19}}}}<!--
-->{{#vardefine:Caustic Damage|{{#explode: {{#var:Datastring}}|;|20}}}}<!--
-->{{#vardefine:Frost Damage|{{#explode: {{#var:Datastring}}|;|21}}}}<!--
-->{{#vardefine:Arcane Damage|{{#explode: {{#var:Datastring}}|;|22}}}}<!--
-->{{#vardefine:Unholy Damage|{{#explode: {{#var:Datastring}}|;|23}}}}<!--
-->{{#vardefine:Sacred Damage|{{#explode: {{#var:Datastring}}|;|24}}}}<!--
-->{{#vardefine:Psionic Damage|{{#explode: {{#var:Datastring}}|;|25}}}}<!--
-->{{#vardefine:Durability|{{#explode: {{#var:Datastring}}|;|4}}}}<!--
-->{{#vardefine:Description|{{#explode: {{#var:Datastring}}|;|-1}}}}<!--
-->{{#vardefine:Price|{{#explode: {{#var:Datastring}}|;|7}}}}<!--
--- Load translations that are used multiple times into variables. ---
-->{{#vardefine:TranslateName|{{Translate|{{#var:Page}}|ItemNames}}}}<!--
-->{{#vardefine:TranslateDamage|{{Translate|Damage|Properties}}}}<!--
-->{{#vardefine:TranslatePrice|{{Translate|Price|Properties}}}}<!--
--- Weapon Tooltip start. ---
-->{| width=300px;
|style="text-align:center;"|<!--
--- Check if item is marked as unobtainable. ---
-->{{#if:{{#var:Unobtainable}}|{{Unobtainable}}<br />}}<!--
--- Check if item is of better rarity than common ---
-->{{#if: {{#var:Rarity}} | <span style="font-size: 20px;">{{c|{{#var:Rarity}}|{{#var:TranslateName}}}}</span> <br /> <span style="color:#9d9a9a;">{{Translate|{{#var:Rarity}}|Properties}} | <span style="font-size: 20px;">{{#var:TranslateName}}</span> <br /> <span style="color:#9d9a9a;">{{Translate|Common|Properties}} }} {{Translate|{{#var:WeaponType}}|Properties}}</span>{{Tooltip rule}}
|-
|-
|style="text-align:center;"|<!--
|style="text-align:center;"|<!--
 
--- Only display Damage types that have a value. ---
-->{{c|{{:{{ROOTPAGENAME}}|DamageType1}}|{{:{{ROOTPAGENAME}}|Damage1}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru | {{#switch: {{:{{ROOTPAGENAME}}|DamageType1}}
-->{{#if:{{#var:Slashing Damage}}|{{#var:Slashing Damage}} {{Translate|Slashing|Properties}} {{#var:TranslateDamage}}<br>}}<!--
|Fire
-->{{#if:{{#var:Piercing Damage}}|{{#var:Piercing Damage}} {{Translate|Piercing|Properties}} {{#var:TranslateDamage}}<br>}}<!--
|Frost
-->{{#if:{{#var:Crushing Damage}}|{{#var:Crushing Damage}} {{Translate|Crushing|Properties}} {{#var:TranslateDamage}}<br>}}<!--
|Shock
-->{{#if:{{#var:Rending Damage}}|{{#var:Rending Damage}} {{Translate|Rending|Properties}} {{#var:TranslateDamage}}<br>}}<!--
|Poison
--- Swap the order of words for Russian wiki version on Fire, Frost, Shock, Poison and Caustic damage types, its a grammar/pronounciation thing apparently. ---
|Caustic = {{Translate|Damage|Properties}} {{Translate|{{:{{ROOTPAGENAME}}|DamageType1}}|Properties}}
-->{{#if:{{#var:Fire Damage}}|{{c|Fire|{{#var:Fire Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{#var:TranslateDamage}} {{Translate|Fire|Properties}}|{{Translate|Fire|Properties}} {{#var:TranslateDamage}}}}}}<br>}}<!--
|#default = {{Translate|{{:{{ROOTPAGENAME}}|DamageType1}}|Properties}} {{Translate|Damage|Properties}} }} | {{Translate|{{:{{ROOTPAGENAME}}|DamageType1}}|Properties}} {{Translate|Damage|Properties}}}}}}<!--
-->{{#if:{{#var:Frost Damage}}|{{c|Frost|{{#var:Frost Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{#var:TranslateDamage}} {{Translate|Frost|Properties}}|{{Translate|Frost|Properties}} {{#var:TranslateDamage}}}}}}<br>}}<!--
 
-->{{#if:{{#var:Shock Damage}}|{{c|Shock|{{#var:Shock Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{#var:TranslateDamage}} {{Translate|Shock|Properties}}|{{Translate|Shock|Properties}} {{#var:TranslateDamage}}}}}}<br>}}<!--
-->{{#if: {{:{{ROOTPAGENAME}}|Damage2}} | <br>{{c|{{:{{ROOTPAGENAME}}|DamageType2}}|{{:{{ROOTPAGENAME}}|Damage2}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru | {{#switch: {{:{{ROOTPAGENAME}}|DamageType2}}
-->{{#if:{{#var:Poison Damage}}|{{c|Poison|{{#var:Poison Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{#var:TranslateDamage}} {{Translate|Poison|Properties}}|{{Translate|Poison|Properties}} {{#var:TranslateDamage}}}}}}<br>}}<!--
|Fire
-->{{#if:{{#var:Caustic Damage}}|{{c|Caustic|{{#var:Caustic Damage}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru |{{#var:TranslateDamage}} {{Translate|Caustic|Properties}}|{{Translate|Caustic|Properties}} {{#var:TranslateDamage}}}}}}<br>}}<!--
|Frost
-->{{#if:{{#var:Arcane Damage}}|{{c|Arcane|{{#var:Arcane Damage}} {{Translate|Arcane|Properties}} {{#var:TranslateDamage}}}}<br>}}<!--
|Shock
-->{{#if:{{#var:Sacred Damage}}|{{c|Sacred|{{#var:Sacred Damage}} {{Translate|Sacred|Properties}} {{#var:TranslateDamage}}}}<br>}}<!--
|Poison
-->{{#if:{{#var:Unholy Damage}}|{{c|Unholy|{{#var:Unholy Damage}} {{Translate|Unholy|Properties}} {{#var:TranslateDamage}}}}<br>}}<!--
|Caustic = {{Translate|Damage|Properties}} {{Translate|{{:{{ROOTPAGENAME}}|DamageType2}}|Properties}}
-->{{#if:{{#var:Psionic Damage}}|{{c|Psionic|{{#var:Psionic Damage}} {{Translate|Psionic|Properties}} {{#var:TranslateDamage}}}}<br>}}<!--
|#default = {{Translate|{{:{{ROOTPAGENAME}}|DamageType2}}|Properties}} {{Translate|Damage|Properties}} }} | {{Translate|{{:{{ROOTPAGENAME}}|DamageType2}}|Properties}} {{Translate|Damage|Properties}}}}}}| }}<!--
-->{{Tooltip rule}}
 
-->{{#if: {{:{{ROOTPAGENAME}}|Damage3}} | <br>{{c|{{:{{ROOTPAGENAME}}|DamageType3}}|{{:{{ROOTPAGENAME}}|Damage3}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru | {{#switch: {{:{{ROOTPAGENAME}}|DamageType3}}
|Fire
|Frost
|Shock
|Poison
|Caustic = {{Translate|Damage|Properties}} {{Translate|{{:{{ROOTPAGENAME}}|DamageType3}}|Properties}}
|#default = {{Translate|{{:{{ROOTPAGENAME}}|DamageType3}}|Properties}} {{Translate|Damage|Properties}} }} | {{Translate|{{:{{ROOTPAGENAME}}|DamageType3}}|Properties}} {{Translate|Damage|Properties}}}}}}| }}<!--
 
-->{{#if: {{:{{ROOTPAGENAME}}|Damage4}} | <br>{{c|{{:{{ROOTPAGENAME}}|DamageType4}}|{{:{{ROOTPAGENAME}}|Damage4}} {{#ifeq: {{#titleparts: {{PAGENAME}} | 1 | 2}} | ru | {{#switch: {{:{{ROOTPAGENAME}}|DamageType4}}
|Fire
|Frost
|Shock
|Poison
|Caustic = {{Translate|Damage|Properties}} {{Translate|{{:{{ROOTPAGENAME}}|DamageType4}}|Properties}}
|#default = {{Translate|{{:{{ROOTPAGENAME}}|DamageType4}}|Properties}} {{Translate|Damage|Properties}} }} | {{Translate|{{:{{ROOTPAGENAME}}|DamageType4}}|Properties}} {{Translate|Damage|Properties}}}}}}| }}<!--
 
--><hr style="height:2px;background-color:#33323f;box-shadow: 0 2px 13121d;margin: 10px 0 10px 0;">
|-
|-
|<div style="width:100%;float: left;color:#9d9a9a;">{{Properties|{{ROOTPAGENAME}}}}</div>
|<!--
<div style="clear: both;color:#9d9a9a;">{{Translate|Durability|Properties}}: <span style="color:white;">{{:{{ROOTPAGENAME}}|Durability}}/{{:{{ROOTPAGENAME}}|Durability}}</span></div>
--- Load and sort this weapon's properties, we use another template. ---
--><div style="width:100%;color:#9d9a9a;">{{Test|{{#var:Page}}}}</div>
<div style="color:#9d9a9a;">{{Translate|Durability|Properties}}: <span style="color:white;">{{#var:Durability}}/{{#var:Durability}}</span></div>
|-
|-
|style="color:#9d7969;text-align:justify"|<hr style="height:2px;background-color:#33323f;box-shadow: 0 2px 13121d;margin: 10px 0 10px 0;">{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{ROOTPAGENAME}}/Tooltip | {{:{{ROOTPAGENAME}}|Description}} | {{Translate|{{ROOTPAGENAME}}|ItemDescriptions}}}} | {{:{{ROOTPAGENAME}}|Description}}}}<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;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}}|{{#var:Page}}/Tooltip |{{#var:Description}}|{{Translate|{{#var:Page}}|ItemDescriptions}}}}|{{#var:Description}}}}<div style="float:right;">[[File:Gold_Icon.png|18px|alt={{#var:TranslatePrice}}|link=|{{#var:TranslatePrice}}]]{{W|{{#var:Price}}}}</div><br />
|-
|-
|style="text-align:center;"|[[File:{{ROOTPAGENAME}}.png|link={{#ifeq:{{SUBPAGENAME}}|Tooltip|{{BASEPAGENAME}}|{{PAGENAME}}/Tooltip}}|alt={{Translate|{{ROOTPAGENAME}}|ItemNames}}|{{Translate|{{ROOTPAGENAME}}|ItemNames}}]]
|style="text-align:center;"|[[File:{{#var:Page}}.png|class=image2x|link=|alt={{#var:TranslateName}}|{{#var:TranslateName}}]]
|}
|}
</includeonly><noinclude>{{doc}}
{{#if: {{{category|}}} ||{{#if: {{#titleparts: {{PAGENAME}} | 1 | 2}} | {{#ifeq: {{PAGENAME}} | {{#var:Page}}/Tooltip |[[Category:{{#var:WeaponType}} Tooltips]]|{{#if: {{#titleparts: {{PAGENAME}} | 1 | 3}}|[[Category: {{uc:{{#titleparts: {{PAGENAME}} | 1 | 2}}}} {{#var:WeaponType}} Tooltips]]|[[Category: {{uc:{{#titleparts: {{PAGENAME}} | 1 | 2}}}} {{#var:WeaponType}}]]}}}}|[[Category:{{#var:WeaponType}}]]}}}}</includeonly><noinclude>{{doc}}
 
[[Category:Tooltip templates]]</noinclude>
[[Category:Tooltip templates]]</noinclude>

Latest revision as of 12:03, 26 June 2023

Template-info.png Documentation

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:

Heavy Aldorian Bow
Common Bow
31 Piercing Damage

Armor Penetration: +33%
 
Knockback Chance: +6%
Stagger Chance: +4%
Immobilization Chance: +8%
 
Accuracy: -40%
Range: 12
 
Skills Energy Cost: +50%
Spells Energy Cost: +50%
 
Durability: 225/225

It has enough power to knock a charging knight from his saddle.
Price3910

Heavy Aldorian Bow
UNOBTAINABLE
Orcish Battlesickle
Common Sword
26 Slashing Damage

 
Energy: -10
Skills Energy Cost: +50%
Spells Energy Cost: +50%
 
Durability: 50/50

Orc zealots are capable of cleaving a grown man in two with a single swing of their battlesickles.
Price650

Orcish Battlesickle