From Brotato Wiki

Revision as of 23:21, 9 November 2022 by Darkly77 (talk | contribs) (add some notes explaining use for character unlocks wi. Iconbox)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Gets the rarity for the provided name. Works with Items or Weapons (via GetType)

IMPORTANT: GetType (and therefore this helper too) relies on the #default for each entry always being "-" (in Item_Data, Weapon_Data, and Character_Data)

Examples

Items

{{GetRarity|Bat}} = 1

{{GetRarity|Acid}} = 2

{{GetRarity|Candle}} = 3

{{GetRarity|Cape}} = 4

Weapons

{{GetRarity|Chopper}} = 1

{{GetRarity|Hammer}} = 2

{{GetRarity|Minigun}} = 3

Unknown (0)

{{GetRarity|UNKNOWN}} = 0

With Iconbox

This function template is used by the auto option for Template:Iconbox.

{{Iconbox|Potato|rarity=auto}}
{{Iconbox|Hammer|rarity=auto}}

Notes

This function template is most beneficial when showing a character's unlock, if you don't already know if their unlock is a Weapon or an Item.

Ie. the auto option for Iconbox is a shortcut to writing either:

{{Iconbox|Potato|rarity={{GetRarity|Potato}}}}
{{Iconbox|Hammer|rarity={{GetRarity|Hammer}}}}

Or:

{{Iconbox|Potato|rarity={{Item_Data|Potato|rarity}}}}
{{Iconbox|Hammer|rarity={{Weapon_Data|Hammer|rarity}}}}

It's especially helpful in templates related to Character unlocks. As shown above, there are already rarity options for Item_Data and Weapon_Data, but this function saves you using a switch statement in your templates to choose whether to use Item_Data or Weapon_Data.