Difference between revisions of "Template:Armor"

From Mine Blocks Wiki
Jump to navigation Jump to search
If you find a typo, inconsistency, or error, please sign up and help out the wiki! We can't do it without your help! :D Thank you!

(Alt text + hover text + removed links)
(Re-wrote template just like {{Health}} it now can have custom icon sizes too with an unnamed parameter)
Line 1: Line 1:
βˆ’
{{{1}}} ({{#ifexpr: {{{1}}} > 0 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]] | {{#ifexpr: {{{1}}} = 0 or {{{1}}} < 0 | [[File:ui-armor-empty.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}}}}{{#ifexpr: {{{1}}} > 1.49 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}}{{#ifexpr: {{{1}}} > 2.49 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}}{{#ifexpr: {{{1}}} > 3.49 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}}{{#ifexpr: {{{1}}} > 4.49 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}}{{#ifexpr: {{{1}}} > 5.49 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}}{{#ifexpr: {{{1}}} > 6.49 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}}{{#ifexpr: {{{1}}} > 7.49 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}}{{#ifexpr: {{{1}}} > 8.49 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}}{{#ifexpr: {{{1}}} > 9.49 | [[File:ui-armor.png|12x12px|class=item-icon pixel|alt=πŸ›‘|link=|{{{1}}} armor point{{#ifexpr: {{{1}}} = 1||s}}]]}})<noinclude>
+
<includeonly>{{#switch: {{{1}}}
Β +
| 0 = 0 ([[File:ui-armor-empty.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|0 armor points]])
Β +
| 1 = 1 ([[File:ui-armor-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|0.5 armor points]])
Β +
| 2 = 2 ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|1 armor point]])
Β +
| 3 = 3 ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|1.5 armor points]][[File:ui-armor-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|1.5 armor points]])
Β +
| 4 = 4 ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|2 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|2 armor points]])
Β +
| 5 = 5 ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|2.5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|2.5 armor points]][[File:ui-armor-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|2.5 armor points]])
Β +
| 6 = 6 ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|3 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|3 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|3 armor points]])
Β +
| 7 = 7 ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|3.5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|3.5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|3.5 armor points]][[File:ui-armor-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|3.5 armor points]])
Β +
| 8 = 8 ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|4 hears]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|4 hears]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|4 hears]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|4 hears]])
Β +
| 9 = 9 ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|4.5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|4.5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|4.5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|4.5 armor points]][[File:ui-armor-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|4.5 armor points]])
Β +
| 10 = 10 ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|5 armor points]][[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|5 armor points]])
Β +
| #default = {{{1}}} ([[File:ui-armor.png|{{{2|12x12px}}}|class=item-icon pixel|alt=πŸ›‘|link=|1 armor point]] Γ— {{#expr: {{{1}}} / 2}})
Β +
}}</includeonly><noinclude>
Β 
== About ==
Β 
== About ==
Β 
This template serves to display armor points in a page.
Β 
This template serves to display armor points in a page.
Β Β 
Β 
== Usage ==
Β 
== Usage ==
βˆ’
The syntax of this template is <code><nowiki>{{Armor|<number>}}</nowiki></code>. If the value given is <code>0</code> or lower, it will display an empty armor icon, and if the value is higher than <code>10</code>, it will display 10 armor icons. It can also round to the nearest integer.
+
The syntax of this template is <code><nowiki>{{Armor|<number>|<size>}}</nowiki></code>. If the value is higher than <code>10</code>, it will display <code><nowiki>n Γ— <armor></nowiki></code> where <code>n</code> is the number you specified.
Β Β 
Β 
== Examples ==
Β 
== Examples ==
Line 23: Line 36:
Β 
* <code><nowiki>{{Armor|1.5}}</nowiki></code> β†’ {{Armor|1.5}}
Β 
* <code><nowiki>{{Armor|1.5}}</nowiki></code> β†’ {{Armor|1.5}}
Β 
* <code><nowiki>{{Armor|1.75}}</nowiki></code> β†’ {{Armor|1.75}}
Β 
* <code><nowiki>{{Armor|1.75}}</nowiki></code> β†’ {{Armor|1.75}}
Β +
Β +
More than 20 armor points:
Β +
* <code><nowiki>{{Armor|20.5}}</nowiki></code> β†’ {{Armor|20.5}}
Β +
* <code><nowiki>{{Armor|30}</nowiki></code> β†’ {{Armor|30}}
Β +
* <code><nowiki>{{Armor|600}}</nowiki></code> β†’ {{Armor|600}}
Β +
Β +
Custom icon size:
Β +
* <code><nowiki>{{Armor|6|16x16px}}</nowiki></code> β†’ {{Armor|6|16x16px}}
Β 
</noinclude>
Β 
</noinclude>

Revision as of 19:04, 10 October 2022

About

This template serves to display armor points in a page.

Usage

The syntax of this template is {{Armor|<number>|<size>}}. If the value is higher than 10, it will display n Γ— <armor> where n is the number you specified.

Examples

Rounding examples:

  • {{Armor|1.25}} β†’ 1.25 (πŸ›‘ Γ— 0.625)
  • {{Armor|1.5}} β†’ 1.5 (πŸ›‘ Γ— 0.75)
  • {{Armor|1.75}} β†’ 1.75 (πŸ›‘ Γ— 0.875)

More than 20 armor points:

  • {{Armor|20.5}} β†’ 20.5 (πŸ›‘ Γ— 10.25)
  • {{Armor|30} β†’ 30 (πŸ›‘ Γ— 15)
  • {{Armor|600}} β†’ 600 (πŸ›‘ Γ— 300)

Custom icon size:

  • {{Armor|6|16x16px}} β†’ 6 (πŸ›‘πŸ›‘πŸ›‘)