Template:Item icon/doc: Difference between revisions

From Project Gorgon
Jump to navigation Jump to search
Extractum11 (talk | contribs)
m Various edits
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
==Description==
This accepts an item name as input and returns the in-game icon. Be aware that icons have various sizes, and you can use CSS to easily resize them. 99% of the time, you'll want 32x32. If you do NEED 64x64, remember that some icons are not inherently that big so you'll lose image quality. See the Examples section below.
This template accepts an item name as input and returns the in-game icon. This template is used by both [[Template:Item]] and [[Template:Loot]]. See the Examples section below.


==Syntax==
==Syntax==
<pre>
<pre>
{{Item icon|<name>}}
{{Item icon|<name>|<size selection>}}
</pre>
</pre>


== Parameters ==
== Parameters ==
; <name>
; <name>
: The name of the item. It must match exactly what is displayed in-game (e.g. "Red Apple", not "Apple" or "red apple")
: The name of the icon. It must match exactly what is displayed in-game (e.g. "Red Apple", not "Apple" or "red apple")
: If omitted or empty, template returns a blank icon image.
: If no match is found, template returns an error.
 
; <size selection>
: 1 or 32 for 32x32.
: 2 or 64 for 64x64.
: If omitted, empty, or anything else, image isn't resized.


== Examples ==  
== Examples ==  


=== Basic Use ===
=== Standard Use ===
<pre>{{Item icon|Glowy Yellow Crystal}} {{Item icon|Ice Core}}</pre>
<pre>
{{Item icon|Glowy Yellow Crystal}} {{Item icon|Ice Core}}
{{Item icon|Glowy Yellow Crystal}}
 
{{Item icon|Ice Core}}
 
{{Item icon}}
 
{{Item icon|FakeItemReturnsError}}
</pre>
{{Item icon|Glowy Yellow Crystal}}
 
{{Item icon|Ice Core}}
 
{{Item icon}}
 
{{Item icon|FakeItemReturnsError}}
 
 
=== Resizing ===
<pre>
{{Item icon|Glowy Yellow Crystal}} <!-- default size is 64x64 -->
 
{{Item icon|Ice Core}} <!-- default size is 32x32 -->
 
{{Item icon|Glowy Yellow Crystal|32}}
 
{{Item icon|Ice Core|64}}
</pre>
{{Item icon|Glowy Yellow Crystal}} <!-- default size is 64x64 -->
 
{{Item icon|Ice Core}} <!-- default size is 32x32 -->
 
{{Item icon|Glowy Yellow Crystal|32}}
 
{{Item icon|Ice Core|64}}
 
 
=== Alternative Resizing (old method) ===
You can also manually resize the images if you wish (using the template just wraps the image in this span automatically).
 
<pre>
<span class="extimage32px">{{Item icon|Salt}}</span>
 
<span class="extimage64px">{{Item icon|Salt}}</span>
</pre>
<span class="extimage32px">{{Item icon|Salt}}</span>


<span class="extimage64px">{{Item icon|Salt}}</span>
=== Notes ===
Sometimes items appear in-game that share the same displayed name but have different internal names. Often future patches rename one of them to prevent conflicts, but a few persist. This wiki resolves the issue by renaming the less-likely to be searched for item.


=== Forcing 32x32 size ===
One example is {{Item|Daisy}} and {{Item|Daisy (Lute)}}. Both are called just "Daisy" in-game, but the Lute has an InternalName (found in the items json) of "Daisy" and the flower has an InternalName of "Flower5".
<pre><span class="extimage32px">{{Item icon||Glowy Yellow Crystal}}</span></pre>
==== Icon Codes for Items Sharing a Name ====
<span class="extimage32px">{{Item icon|Glowy Yellow Crystal}}</span>
<pre> | Daisy = 5283
| Daisy (Lute) = 5380</pre>


==== Code Required for other templates ====
These two lines are required for [[Template:NPC training row]], [[Template:NPC training unlock row]], and [[Template:Recipe]] to work properly. They must also be placed alongside other "s" and "u" items.
<pre> | scroll = 4003
| Unlock = 109</pre>


=== Forcing 64x64 size ===
[[Category:Template_documentation]]
<pre><span class="extimage64px">{{Item icon|Ice Core}}</span></pre>
<span class="extimage64px">{{Item icon|Ice Core}}</span>

Latest revision as of 06:14, 22 February 2026

Description

This template accepts an item name as input and returns the in-game icon. This template is used by both Template:Item and Template:Loot. See the Examples section below.

Syntax

{{Item icon|<name>|<size selection>}}

Parameters

<name>
The name of the icon. It must match exactly what is displayed in-game (e.g. "Red Apple", not "Apple" or "red apple")
If omitted or empty, template returns a blank icon image.
If no match is found, template returns an error.
<size selection>
1 or 32 for 32x32.
2 or 64 for 64x64.
If omitted, empty, or anything else, image isn't resized.

Examples

Standard Use

{{Item icon|Glowy Yellow Crystal}}

{{Item icon|Ice Core}}

{{Item icon}}

{{Item icon|FakeItemReturnsError}}

{{ #replace: http://cdn.projectgorgon.com/v456/icons/icon_5702.png | http://cdn.projectgorgon.com/v456/icons/icon_.png | Error: Item not found }}

{{ #replace: http://cdn.projectgorgon.com/v456/icons/icon_5295.png | http://cdn.projectgorgon.com/v456/icons/icon_.png | Error: Item not found }}

{{ #replace: http://cdn.projectgorgon.com/v456/icons/icon_.png | http://cdn.projectgorgon.com/v456/icons/icon_.png | Error: Item not found }}


Resizing

{{Item icon|Glowy Yellow Crystal}} <!-- default size is 64x64 -->

{{Item icon|Ice Core}} <!-- default size is 32x32 -->

{{Item icon|Glowy Yellow Crystal|32}}

{{Item icon|Ice Core|64}}

{{ #replace: http://cdn.projectgorgon.com/v456/icons/icon_5702.png | http://cdn.projectgorgon.com/v456/icons/icon_.png | Error: Item not found }}

{{ #replace: http://cdn.projectgorgon.com/v456/icons/icon_5295.png | http://cdn.projectgorgon.com/v456/icons/icon_.png | Error: Item not found }}

{{ #replace: http://cdn.projectgorgon.com/v456/icons/icon_5702.png | http://cdn.projectgorgon.com/v456/icons/icon_.png | Error: Item not found }}

{{ #replace: http://cdn.projectgorgon.com/v456/icons/icon_5295.png | http://cdn.projectgorgon.com/v456/icons/icon_.png | Error: Item not found }}


Alternative Resizing (old method)

You can also manually resize the images if you wish (using the template just wraps the image in this span automatically).

<span class="extimage32px">{{Item icon|Salt}}</span>

<span class="extimage64px">{{Item icon|Salt}}</span>

{{ #replace: http://cdn.projectgorgon.com/v456/icons/icon_5013.png | http://cdn.projectgorgon.com/v456/icons/icon_.png | Error: Item not found }}

{{ #replace: http://cdn.projectgorgon.com/v456/icons/icon_5013.png | http://cdn.projectgorgon.com/v456/icons/icon_.png | Error: Item not found }}

Notes

Sometimes items appear in-game that share the same displayed name but have different internal names. Often future patches rename one of them to prevent conflicts, but a few persist. This wiki resolves the issue by renaming the less-likely to be searched for item.

One example is

 
[[Expression error: Unrecognized punctuation character "{".]]

and

 
[[Expression error: Unrecognized punctuation character "{".]]

. Both are called just "Daisy" in-game, but the Lute has an InternalName (found in the items json) of "Daisy" and the flower has an InternalName of "Flower5".

Icon Codes for Items Sharing a Name

		| Daisy = 5283
		| Daisy (Lute) = 5380

Code Required for other templates

These two lines are required for Template:NPC training row, Template:NPC training unlock row, and Template:Recipe to work properly. They must also be placed alongside other "s" and "u" items.

		| scroll = 4003
		| Unlock = 109