Template:Icon: Difference between revisions

3,946 bytes removed ,  21 June 2023
Support 'section' parameter
m (Add ZoneIcon to list of suggested templates)
(Support 'section' parameter)
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
A generic version of the template used in things like [[Template:ItemIcon]] or [[Template:UpgradeIcon]].
<includeonly>{{#invoke:Icons|Icon|{{{1|}}}|{{{2|}}}|type={{{type|}}}|ext={{{ext|}}}|size={{#if:{{{size|}}}|{{{size}}}|{{#if:{{{menu|}}}|25|23}}}}|qty={{{qty|}}}|img={{{img|}}}|notext={{{notext|}}}|nolink={{{nolink|}}}|noicon={{{noicon|}}}|menu={{{menu|}}}|section={{{section|}}}}}</includeonly><noinclude>
 
{{/doc}}
You probably want to use one of the following instead for most things:
</noinclude>
 
* [[Template:ItemIcon]] for items
* [[Template:MonsterIcon]] for monsters
* [[Template:Skill]] for skill
* [[Template:UpgradeIcon]] for upgrades (like the {{UpgradeIcon|Dragon Pickaxe}})
* [[Template:PetIcon]] for pets
* [[Template:PrayerIcon]] for prayers
* [[Template:ZoneIcon]] for combat zones
 
Format is like so: <nowiki>{{Icon|type=combatArea|Castle of Kings|Knight Time}}</nowiki> becomes {{Icon|type=combatArea|Castle of Kings|Knight Time}}.
 
You can also just do <nowiki>{{Icon|Combat}}</nowiki> {{Icon|Combat}} if you need an icon for an image that doesn't belong to a given category.
 
 
Some special overrides exist:
{| class="wikitable sortable"
! Input !! Output
|-
|<nowiki>{{Icon|Melee}}</nowiki> || {{Icon|Melee}}
|-
|<nowiki>{{Icon|Superheat}}</nowiki> || {{Icon|Superheat}}
|-
|<nowiki>{{Icon|type=monster|Golbin}}</nowiki>||{{Icon|type=monster|Golbin}}
|-
|<nowiki>{{Icon|type=monster|Spider (lv. 51)}}</nowiki>||{{MonsterIcon|Spider (lv. 51)}}
|-
|<nowiki>{{Icon|type=monster|Spider2}}</nowiki>||{{MonsterIcon|Spider2}}
|-
|<nowiki>{{Icon|type=skill|Alt. Magic}}</nowiki>||{{Icon|type=skill|Alt. Magic}}
|}
 
Other options:
 
The 'notext' option sends only the image (with link), so <nowiki>{{Icon|Mastery|notext=true}}</nowiki> becomes {{Icon|Mastery|notext=true}}
 
The 'menu' option formats the icon in a handy table (useful for menuboxes) so <nowiki>{{Icon|Combat|menu=true}}</nowiki> becomes {{Icon|Combat|menu=true}}
 
The 'qty' option allows you to specify a number of items to go between the icon and the text, so <nowiki>{{Icon|type=item|Elder Dragonhide|qty=5000}}</nowiki> becomes {{Icon|type=item|Elder Dragonhide|qty=5000}}
 
The 'size' option allows you to specify larger icons, so {{T|Icon|Combat|size=50|notext=true}} becomes {{Icon|Combat|size=50|notext=true}}
 
<includeonly><onlyinclude><!--
Defining some variables to make things easier later
-->{{#vardefine:image|{{{1|}}}}}<!--
-->{{#vardefine:type|{{{type|}}}}}<!--
-->{{#vardefine:link|{{{1|}}}}}<!--
-->{{#vardefine:text|{{#if:{{{2|}}}|{{{2|}}}|{{#var:link}}}}}}<!--
-->{{#vardefine:ext|{{#if:{{{ext|}}}|{{{ext|}}}|svg}}}}<!--
-->{{#vardefine:size|{{#if:{{{size|}}}|{{{size}}}|{{#if:{{{menu|}}}|25|23}}}}}}<!--
    Allowing for manual exception overrides for weird cases:
        Melee uses the Combat icon
        Done to allow for easily fitting into combat triangle related tables
-->{{#ifeq:{{#var:link}}|Melee|{{#vardefine:image|Combat}}}}<!--
        Superheat goes to a generic Superheat page but pulls the icon for Superheat IV
-->{{#ifeq:{{#var:link}}|Superheat|{{#vardefine:image|Superheat IV}}{{#vardefine:type|spell}}}}<!--
        Golbin + monster icon type links directly to Golbin (monster) to skip disambiguation page
-->{{#ifeq:{{#var:link}}|Golbin|{{#ifeq:{{#var:type}}|monster|{{#vardefine:link|Golbin (monster)}}}}}}<!--
        Handling for Spiders (since they come in two flavors)
-->{{#ifeq:{{#var:link}}|Spider (lv. 51)|{{#vardefine:image|Spider}}}}{{#ifeq:{{#var:link}}|Spider (lv. 52)|{{#vardefine:image|Spider2}}}}{{#ifeq:{{#var:link}}|Spider2|{{#vardefine:link|Spider (lv. 52)}}{{#ifeq:{{#var:image}}|{{#var:text}}|{{#vardefine:text|Spider (lv. 52)}}}}}}<!--
        Forcing the correct extension for Rhaelyx items
-->{{#switch:{{#var:image}}|Crown of Rhaelyx|Circlet of Rhaelyx|Jewel of Rhaelyx|Charge Stone of Rhaelyx|Mysterious Stone={{#vardefine:ext|png}}}}<!--
        Allowing for Alt. Magic to use the Magic image
-->{{#ifeq:{{#var:type}}|skill|{{#switch:{{#var:link}}|Alt. Magic|Alt Magic|Alternative Magic={{#vardefine:image|Magic}}{{#vardefine:link|Alternative Magic}}}}}}<!--
Handling for 'menu' option
-->{{#if:{{{menu|}}}|{{{!}} class="articletable" style="display:inline; vertical-align:middle;"
{{!}}-
{{!}}| }}<!--
--><span style="display:inline-block">{{#if:{{{qty|}}}|{{formatnum:{{{qty|}}}}}&nbsp;|}}[[File:{{#var:image}}{{#if:{{#var:type}}|_({{#var:type}})|}}.{{#var:ext}}|{{#var:size}}x{{#var:size}}px|link={{#var:link}}]]{{#if:{{{notext|}}}||&nbsp;[[{{#var:link}}|{{#var:text}}]]}}</span><!--
-->{{#if:{{{menu|}}}|<br/>
{{!}}}|}}</onlyinclude></includonly>