Template:Item icon

From dos2.wiki
Jump to navigation Jump to search

This text is transcluded from Template:Item icon/doc.

This template fetches and displays an icon for an item. The information is uploaded using the standard item descriptions. Use Template:ItemIcon Insert to add a page that doesn't use Template:ItemPage, Template:ArmorPage, or Template:WeaponPage.

Usage:
{{ItemIcon
|name=the name of the icon page
|uid=(optional) If specified, will search for this UID instead of the page name.
|size=(optional) the size of the icon
|show_name=(optional) Whether to show the name. Any value will show the name of the item as a link. Omit to hide it.
|show_rarity=(optional) Whether to add a border and background to the icon according to the item's rarity. Omit to not show it.
|no_padding=(optional) If specified, does not insert margin to the left and right of the ItemIcon. Recommended for use in tables, lists, and start of paragraphs.
|block=(optional) If specified, wraps the text next to the icon instead of underneath it.
|gap=(option) If specified and block-style is enabled, specifies the gap in px between the icon and text.
|override_icon=(optional) If specified, skips looking up the Cargo table and inserts the specified icon directly. Must also specify '''override_rarity'''.
|override_rarity=(optional) When specified with '''override_icon''', will set the rarity of the displayed item.
|alias=(optional) If specified, the link text will be this instead.
|nowrap=(optional) If specified, the text will not wrap.
|separator=(option) If specified, replaces the character to use to separate the icon and text.
}}

Templates

Copy-ready template (no item name): {{ItemIcon|name=}}

Copy-ready template (with item name): {{ItemIcon|name=|show_name=true}}

Examples

ResultSizeShow name?Rarity?Code
Icon only

40 {{ItemIcon|name=Minor Healing Potion|size=40|show_name=|show_rarity=}}

25 {{ItemIcon|name=Minor Healing Potion|size=25|show_name=|show_rarity=}}

40 {{ItemIcon|name=Medium Healing Potion|size=40|show_name=|show_rarity=}}

25 {{ItemIcon|name=Medium Healing Potion|size=25|show_name=|show_rarity=}}

File:Teleportation Gloves Icon.webp

40 {{ItemIcon|name=Teleportation Gloves|size=40|show_name=|show_rarity=}}

File:Teleportation Gloves Icon.webp

25 {{ItemIcon|name=Teleportation Gloves|size=25|show_name=|show_rarity=}}
Linked icon

Minor Healing Potion

40 true {{ItemIcon|name=Minor Healing Potion|size=40|show_name=true|show_rarity=}}

Minor Healing Potion

25 true {{ItemIcon|name=Minor Healing Potion|size=25|show_name=true|show_rarity=}}

Medium Healing Potion

40 true {{ItemIcon|name=Medium Healing Potion|size=40|show_name=true|show_rarity=}}

Medium Healing Potion

25 true {{ItemIcon|name=Medium Healing Potion|size=25|show_name=true|show_rarity=}}

File:Teleportation Gloves Icon.webpTeleportation Gloves

40 true {{ItemIcon|name=Teleportation Gloves|size=40|show_name=true|show_rarity=}}

File:Teleportation Gloves Icon.webpTeleportation Gloves

25 true {{ItemIcon|name=Teleportation Gloves|size=25|show_name=true|show_rarity=}}
Rarity icon

Minor Healing Potion

40 true true {{ItemIcon|name=Minor Healing Potion|size=40|show_name=true|show_rarity=true}}

Minor Healing Potion

25 true true {{ItemIcon|name=Minor Healing Potion|size=25|show_name=true|show_rarity=true}}

Medium Healing Potion

40 true true {{ItemIcon|name=Medium Healing Potion|size=40|show_name=true|show_rarity=true}}

Medium Healing Potion

25 true true {{ItemIcon|name=Medium Healing Potion|size=25|show_name=true|show_rarity=true}}

Gloves of Teleportation

40 true true {{ItemIcon|name=Gloves of Teleportation|size=40|show_name=true|show_rarity=true}}

Gloves of Teleportation

25 true true {{ItemIcon|name=Gloves of Teleportation|size=25|show_name=true|show_rarity=true}}
Other

File:Missing Item Or Item Icon Icon.webpMissing Item Or Item Icon

40 true true {{ItemIcon|name=Missing Item Or Item Icon|size=40|show_name=true|show_rarity=true}}

File:Missing Item Or Item Icon Icon.webpMissing Item Or Item Icon

25 true true {{ItemIcon|name=Missing Item Or Item Icon|size=25|show_name=true|show_rarity=true}}
Fang of the Winter Dragon{{ItemIcon|override_icon=Item_GRN_Love_Icon.webp|name=Fang of the Winter Dragon|override_rarity=unique|show_name=true|show_rarity=true}}

File:Template:ItemIcon/Item Missing Images Icon.webpTemplate:ItemIcon/Item Missing Images

40 true true {{ItemIcon|name=Template:ItemIcon/Item Missing Images|size=40|show_name=true|show_rarity=true}}
An alias{{ItemIcon|name=Fang of the Winter Dragon|alias=An alias|show_name=true|show_rarity=true}}

In-text

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin tristique ligula vitae turpis varius ullamcorper. Ut sagittis Giant Healing Potion eu dolor accumsan venenatis. Maecenas sit amet ante at ligula efficitur fermentum. Suspendisse ac neque pretium nisi finibus euismod. Suspendisse varius ipsum lorem, vitae consectetur metus mattis sit amet. Proin ornare orci turpis, non blandit lorem scelerisque a. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Shadow's Eye in luctus arcu. Proin aliquet lorem quis lacus lacinia molestie. Suspendisse iaculis venenatis nibh, et dapibus augue varius a.

Wrap override

Fireball Skillbook Fireball Skillbook Fireball Skillbook Fireball Skillbook Fireball Skillbook Fireball Skillbook Fireball Skillbook

Block-style

Block style prevents text from wrapping underneath the icon. Use gap to control the spacing between icon and text.

Example Markup Renders as
Block-style
{{ItemIcon|name=Teleportation Gloves|size=40|show_name=true|show_rarity=true|block=yes}}
File:Teleportation Gloves Icon.webpTeleportation Gloves
With gap
{{ItemIcon|name=Teleportation Gloves|size=40|show_name=true|show_rarity=true|block=yes|gap=8}}
File:Teleportation Gloves Icon.webpTeleportation Gloves

Common endings may be appended right after the template, just like regular links.

Markup Renders as
{{ItemIcon|name=Giant Healing Potion|show_name=true|show_rarity=true}}s
Giant Healing Potions
{{ItemIcon|name=Ring of Intelligence|show_name=true|show_rarity=true}}s
Ring of Intelligences

Specifying the uid parameter allows for picking a specific item among a number of different items with the same name. Note that you must provide the name of the item for it to display properly.

* {{ItemIcon|name=Leather Armour|show_name=true}}
* {{ItemIcon|name=Leather Armour|uid=ARM_Leather_Body|show_name=true}}
* {{ItemIcon|name=Leather Armour|uid=ARM_Unique_Braccus|show_name=true}}

Transcluded from Template:ItemIcon/Family.

The base ItemIcon with all functionality.

A version of ItemIcon that always has a image height of 20px and links the item.

Giant Healing Potion

A version of ItemIcon that always has a image height of 30px and links the item.

Giant Healing Potion

A version of ItemIcon that always has an image height of 40px and links the item.

Giant Healing Potion


A utility template that inserts information into the "Items" table, which is where all information used to provide ItemIcon functionality is stored. This template should only need to be manually called for pages that are not items, but might want to have an icon associated with them, for example Backpack.

A version of ItemIcon that displays the rarity colors and links the item. Defaults to 25px but can be adjusted.

Fang of the Winter Dragon

A version of RarityItem that defaults to 20px instead of 25. For use in running texts.

Fang of the Winter Dragon

A version of RarityItem that defaults to 30px instead of 25. For use on Template:SkillPage, which specifically needs to be passed a template name.

Fang of the Winter Dragon

A version of RarityItem that defaults to 40px instead of 25. For use on various list pages.

 Fang of the Winter Dragon

Troubleshooting

Icon does not show up

  • Check that the name is provided correctly.
Refer to the template you are using. Template:ItemIcon requires the name to be provided as the name= parameter, while other templates might use anonymous parameters.
  • Check that the page exists
The page must exist and use Template:ItemPage, Template:ArmorPage, Template:WeaponPage, or Template:ItemIcon Insert. Technically, you could also insert directly into the Items Cargo table, but please don't do that without good reason.
Also make sure that the item is spelled correctly. ItemIcon is unaware of redirects, which can cause a missing icon link when the page link works fine.
  • Check that the parameters are passed to the page-generating templates
ItemIcon pulls from the page-generating template parameters, particularly rarity, image, and icon. Either image or icon needs to be set for an icon to show.
  • Try doing a null edit on the page.
The ItemIcon template was introduced after the page-generating templates. This means that information won't be inserted into the Cargo table until the pages that use the page-generating templates are edited. You can do a null edit to forcibly insert information into the table. This is an edit where you change nothing. It will not show up in the page's edit history or your contribution page, but it will refresh the page and, if applicable, insert the info needed into the table.
  • Ask on Discord
If none of the above steps work, ask on the Discord and someone might be able to help solve the problem.

Template Data Section

Inserts an item's icon automatically. Can also display a link to the item.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
namename

The name of the icon. Identical to the item's page name.

Example
Healing Potion
Page namerequired
uiduid

If specified, will instead search by UID.

Stringoptional
sizesize

The height of the item icon.

Suggested values
40 30 25 20
Default
25
Numberoptional
show_nameshow_name

If non-empty, will link the icon as well.

Booleanoptional
show_rarityshow_rarity

If non-empty, will display an icon border corresponding to the rarity.

Booleanoptional
Blockblock

Whether to wrap the icon and text in a containing HTML element and use 'inline-flex' to align the icon and text.

Stringoptional
Gapgap

If 'block' is set, the exact gap to use between the icon and text.

Numberoptional
Nowrapnowrap

Whether to use 'white-space: nowrap' to prevent line breaks; not needed if 'block' is set.

Stringoptional
override_iconoverride_icon

If provided, will override the icon with the provided one.

Stringoptional
override_rarityoverride_rarity

If provided, will replace the fetched rarity.

Stringoptional
aliasalias

An alias for the item.

Stringoptional
Separatorseparator

What to put between the icon and text. Default is an narrow non-breaking space.

Contentoptional