Difference between revisions of "Template:Health"

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!

m (Removed all decimal examples from the first section)
(Added possibility to change health's icon to its hardcore variant by setting the hardcore parameter to true, and also added possibility to set a custom icon size by adding a second unnamed parameter specifying its size in number an units (ex: 16x16px))
Line 1: Line 1:
 
<includeonly>{{#switch: {{{1}}}
 
<includeonly>{{#switch: {{{1}}}
| 0 = 0 ([[File:ui-health-empty.png|12x12px|class=item-icon pixel|alt=♥|link=|0 hearts]])
+
| 0 = 0 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}-empty.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|0 hearts]])
| 1 = 1 ([[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|0.5 hearts]])
+
| 1 = 1 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|0.5 hearts]])
| 2 = 2 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1 heart]])
+
| 2 = 2 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|1 heart]])
| 3 = 3 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|1.5 hearts]])
+
| 3 = 3 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|1.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|1.5 hearts]])
| 4 = 4 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2 hearts]])
+
| 4 = 4 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|2 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|2 hearts]])
| 5 = 5 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|2.5 hearts]])
+
| 5 = 5 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|2.5 hearts]])
| 6 = 6 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3 hearts]])
+
| 6 = 6 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|3 hearts]])
| 7 = 7 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]])
+
| 7 = 7 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|3.5 hearts]])
| 8 = 8 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]])
+
| 8 = 8 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|4 hears]])
| 9 = 9 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]])
+
| 9 = 9 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}-half.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|4.5 hearts]])
| 10 = 10 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]])
+
| 10 = 10 ([[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|5 hearts]])
| #default = {{{1}}} ({{#expr: {{{1}}} / 2}} × [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1 heart]])
+
| #default = {{{1}}} ({{#expr: {{{1}}} / 2}} × [[File:ui-health{{#ifeq: {{{hardcode}}} | true | hardcore}}.png|{{{2|12x12px}}}|class=item-icon pixel|alt=♥|link=|1 heart]])
 
}}</includeonly><noinclude>
 
}}</includeonly><noinclude>
 
== About ==
 
== About ==
Line 31: Line 31:
 
* <code><nowiki>{{Health|9}}</nowiki></code> → {{Health|9}}
 
* <code><nowiki>{{Health|9}}</nowiki></code> → {{Health|9}}
 
* <code><nowiki>{{Health|10}}</nowiki></code> → {{Health|10}}
 
* <code><nowiki>{{Health|10}}</nowiki></code> → {{Health|10}}
 +
 +
* <code><nowiki>{{Health|0}}</nowiki></code> → {{Health|0|hardcore=true}}
 +
* <code><nowiki>{{Health|1}}</nowiki></code> → {{Health|1|hardcore=true}}
 +
* <code><nowiki>{{Health|2}}</nowiki></code> → {{Health|2|hardcore=true}}
 +
* <code><nowiki>{{Health|3}}</nowiki></code> → {{Health|3|hardcore=true}}
 +
* <code><nowiki>{{Health|4}}</nowiki></code> → {{Health|4|hardcore=true}}
 +
* <code><nowiki>{{Health|5}}</nowiki></code> → {{Health|5|hardcore=true}}
 +
* <code><nowiki>{{Health|6}}</nowiki></code> → {{Health|6|hardcore=true}}
 +
* <code><nowiki>{{Health|7}}</nowiki></code> → {{Health|7|hardcore=true}}
 +
* <code><nowiki>{{Health|8}}</nowiki></code> → {{Health|8|hardcore=true}}
 +
* <code><nowiki>{{Health|9}}</nowiki></code> → {{Health|9|hardcore=true}}
 +
* <code><nowiki>{{Health|10}}</nowiki></code> → {{Health|10|hardcore=true}}
 +
* <code><nowiki>{{Health|100}}</nowiki></code> → {{Health|100|hardcore=true}}
 +
* <code><nowiki>{{Health|4.5}}</nowiki></code> → {{Health|4.5|hardcore=true}}
  
 
Rounding examples:
 
Rounding examples:

Revision as of 17:54, 10 October 2022

About

This template serves to display health points in a page.

Usage

The syntax of this template is {{Health|<number>}}. If the value given is 0 or lower, it will display an empty heart icon, and if the value is higher than 10, it will display n × <health> where n is the number you specified. It can also round to the nearest integer.

Examples

  • {{Health|0}} → 0 (♥)
  • {{Health|1}} → 1 (♥)
  • {{Health|2}} → 2 (♥)
  • {{Health|3}} → 3 (♥♥)
  • {{Health|4}} → 4 (♥♥)
  • {{Health|5}} → 5 (♥♥♥)
  • {{Health|6}} → 6 (♥♥♥)
  • {{Health|7}} → 7 (♥♥♥♥)
  • {{Health|8}} → 8 (♥♥♥♥)
  • {{Health|9}} → 9 (♥♥♥♥♥)
  • {{Health|10}} → 10 (♥♥♥♥♥)
  • {{Health|0}} → 0 (♥)
  • {{Health|1}} → 1 (♥)
  • {{Health|2}} → 2 (♥)
  • {{Health|3}} → 3 (♥♥)
  • {{Health|4}} → 4 (♥♥)
  • {{Health|5}} → 5 (♥♥♥)
  • {{Health|6}} → 6 (♥♥♥)
  • {{Health|7}} → 7 (♥♥♥♥)
  • {{Health|8}} → 8 (♥♥♥♥)
  • {{Health|9}} → 9 (♥♥♥♥♥)
  • {{Health|10}} → 10 (♥♥♥♥♥)
  • {{Health|100}} → 100 (50 × ♥)
  • {{Health|4.5}} → 4.5 (2.25 × ♥)

Rounding examples:

  • {{Health|1.25}} → 1.25 (0.625 × ♥)
  • {{Health|1.5}} → 1.5 (0.75 × ♥)
  • {{Health|1.75}} → 1.75 (0.875 × ♥)

More than 20 health points:

  • {{Health|20.5}} → 20.5 (10.25 × ♥)
  • {{Health|30} → 30 (15 × ♥)
  • {{Health|600}} → 600 (300 × ♥)