Template:Item icon: Difference between revisions
(Add rarity support) |
(Overhaul examples) |
||
Line 1: | Line 1: | ||
<includeonly><onlyinclude>{{#cargo_query: | <includeonly><onlyinclude>{{#lvardef:margin|{{#expr:0.01 * {{{size|40}}} }} }}<span class="bg3wiki-itemicon-wrapper" style="margin: auto {{#lvar:margin}}rem">{{#cargo_query: | ||
tables=item_icon | tables=item_icon | ||
|fields=TRIM(icon),CONCAT('', '{{{size|40}}}'),rarity,CONCAT('', '{{{show_rarity|}}}') | |fields=TRIM(icon),CONCAT('', '{{{size|40}}}'),rarity,CONCAT('', '{{{show_rarity|}}}') | ||
Line 9: | Line 9: | ||
|format=template | |format=template | ||
|template=ItemIcon Internal | |template=ItemIcon Internal | ||
}} {{#if:{{{show_name|}}}|[[{{{name}}}]] }}</onlyinclude></includeonly><noinclude> | }} <span class="bg3wiki-itemicon-link" style="margin-left: {{#lvar:margin}}rem;">{{#if:{{{show_name|}}}|[[{{{name}}}]] }}</span></span></onlyinclude></includeonly><noinclude> | ||
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:MiscItemPage]], [[Template:EquipmentPage]], or [[Template:WeaponPage]]. | 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:MiscItemPage]], [[Template:EquipmentPage]], or [[Template:WeaponPage]]. | ||
Line 28: | Line 28: | ||
Copy-ready template (with item name): <code><nowiki>{{ItemIcon|name=|show_name=true}}</nowiki></code> | Copy-ready template (with item name): <code><nowiki>{{ItemIcon|name=|show_name=true}}</nowiki></code> | ||
== Examples == | === Examples === | ||
< | <table class="wikitable"> | ||
<tr><th>Result</th><th>Name</th><th>Size</th><th>Show name?</th><th>Rarity?</th><th>Code</th></tr> | |||
<!-- just the icon --> | |||
{{/Example|Potion of Healing|40|false|false}} | |||
{{/Example|Potion of Healing|25|false|false}} | |||
{{/Example|Potion of Supreme Healing|40|false|false}} | |||
{{/Example|Potion of Supreme Healing|25|false|false}} | |||
{{/Example|The Red Knight's Final Stratagem|40|false|false}} | |||
{{/Example|The Red Knight's Final Stratagem|25|false|false}} | |||
<!-- icon and link --> | |||
{{/Example|Potion of Healing|40|true|false}} | |||
{{/Example|Potion of Healing|25|true|false}} | |||
{{/Example|Potion of Supreme Healing|40|true|false}} | |||
{{/Example|Potion of Supreme Healing|25|true|false}} | |||
{{/Example|The Red Knight's Final Stratagem|40|true|false}} | |||
{{/Example|The Red Knight's Final Stratagem|25|true|false}} | |||
< | <!-- rarity and link --> | ||
{{/Example|Potion of Healing|40|true|true}} | |||
{{/Example|Potion of Healing|25|true|true}} | |||
{{/Example|Potion of Supreme Healing|40|true|true}} | |||
{{/Example|Potion of Supreme Healing|25|true|true}} | |||
{{/Example|The Red Knight's Final Stratagem|40|true|true}} | |||
{{/Example|The Red Knight's Final Stratagem|25|true|true}} | |||
</table> | |||
<!-- Cargo table definition --> | <!-- Cargo table definition --> |
Revision as of 09:35, 9 September 2023
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:MiscItemPage, Template:EquipmentPage, or Template:WeaponPage.
See /Family for information on the various ItemIcon templates.
Usage:{{ItemIcon |name=the name of the icon page |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. }}
Templates
Copy-ready template (no item name): {{ItemIcon|name=}}
Copy-ready template (with item name): {{ItemIcon|name=|show_name=true}}
Examples
Result | Name | Size | Show name? | Rarity? | Code |
---|---|---|---|---|---|
40 | false | false |
{{ItemIcon|name=Potion of Healing|size=40|show_name=false|show_rarity=false}} | ||
25 | false | false |
{{ItemIcon|name=Potion of Healing|size=25|show_name=false|show_rarity=false}} | ||
40 | false | false |
{{ItemIcon|name=Potion of Supreme Healing|size=40|show_name=false|show_rarity=false}} | ||
25 | false | false |
{{ItemIcon|name=Potion of Supreme Healing|size=25|show_name=false|show_rarity=false}} | ||
40 | false | false |
{{ItemIcon|name=The Red Knight's Final Stratagem|size=40|show_name=false|show_rarity=false}} | ||
25 | false | false |
{{ItemIcon|name=The Red Knight's Final Stratagem|size=25|show_name=false|show_rarity=false}} | ||
40 | true | false |
{{ItemIcon|name=Potion of Healing|size=40|show_name=true|show_rarity=false}} | ||
25 | true | false |
{{ItemIcon|name=Potion of Healing|size=25|show_name=true|show_rarity=false}} | ||
40 | true | false |
{{ItemIcon|name=Potion of Supreme Healing|size=40|show_name=true|show_rarity=false}} | ||
25 | true | false |
{{ItemIcon|name=Potion of Supreme Healing|size=25|show_name=true|show_rarity=false}} | ||
40 | true | false |
{{ItemIcon|name=The Red Knight's Final Stratagem|size=40|show_name=true|show_rarity=false}} | ||
25 | true | false |
{{ItemIcon|name=The Red Knight's Final Stratagem|size=25|show_name=true|show_rarity=false}} | ||
40 | true | true |
{{ItemIcon|name=Potion of Healing|size=40|show_name=true|show_rarity=true}} | ||
25 | true | true |
{{ItemIcon|name=Potion of Healing|size=25|show_name=true|show_rarity=true}} | ||
40 | true | true |
{{ItemIcon|name=Potion of Supreme Healing|size=40|show_name=true|show_rarity=true}} | ||
25 | true | true |
{{ItemIcon|name=Potion of Supreme Healing|size=25|show_name=true|show_rarity=true}} | ||
40 | true | true |
{{ItemIcon|name=The Red Knight's Final Stratagem|size=40|show_name=true|show_rarity=true}} | ||
25 | true | true |
{{ItemIcon|name=The Red Knight's Final Stratagem|size=25|show_name=true|show_rarity=true}} |
This template defines the table "item_icon". View table.
Template Data Section
Inserts an item's icon automatically. Can also display a link to the item.
Parameter | Description | Type | Status | |
---|---|---|---|---|
name | name | The name of the icon. Identical to the item's page name.
| Page name | required |
size | size | The height of the item icon. Optional.
| Number | optional |
show_name | show_name | Whether to link the icon as well. Optional. Providing any value at all will be interpreted as "yes". | Boolean | optional |