Template:Item/doc
An all-in-one template for display item name/icon/link.
By default, displays a link to the item and adds an item icon in front of it.
Usage
All parameters are optional. Despite this, some combinations are invalid and may cause errors, e.g. {{item|icons=no|mode=image}}
See examples below for more details.
- unnamed parameter 1
Default item display name, link target, and image file name. Also support # and ## syntax (see examples below).
- unnamed Parameter 2
Custom link text, which can include line breaks (<br />) and other wikitext. If an 's', 'es', 'ies' or 'ves' is passed as the custom text, it will be appended to the end of the item name. Pluralism is partially intuitive - adding 's' to Butterfly will return Butterflies.
- t
Custom link text, it will override unnamed Parameter 2, and it will be displayed as-is, without plural processing.
- mode
Display mode. It can be:
image
(Preferred) orimageonly
oronlyimage
means only image will be displayed;text
(Preferred) ornoimage
means no image will be displayed;table
(Preferred) or2-cell
will output 2 cells code for table. This is roughly a shortcut for{{item|mode=image|itemname}} || {{item|mode=text|itemname}}
Use preferred values as much as possible to get the best performance.
- image
image filename, no brackets nor "File:"(must include file extension, eg. Parrot.png).
You can specify multiple images, just seperate filenames with slashes(eg. Parrot.png/Parrot (placed).png).
- size
Custom graphic size (Read Extended image syntax for details).
You can specify multiple sizes, just seperated with slashes(eg. 32px/24x24px).
When multiple images specified:
- If only one size specified, it will apply to all images
- if size is less then image, extra images will be displayed as if they don't have size argument
- if size is more then image, extra sizes will simply be ignored.
And you can append it with *[factor]
to scale image, e.g. 24x24px*0.5
, 24px*0.5/24px*2
...
- scale
Image(s) will be scaled based on size
and scale
. e.g. |size=32x32px|scale=0.5
is equal to |size=16x16px
. This will multiply with scale factor in size paramter, |size=32x32px*0.5|scale=0.5
is equal to |size=8x8px
. scale can be set by options.
- maxsize
Image size limit. Using standard image size syntax, eg. 32px/24x24px. will be applied after scale.
- ext
image file extension, default is png. Only valid when there is no image input.
- link
Custom link target. If blank given(i.e. |link=|
), it will be no link(See example below).
- nolink = y/yes
Same as |link=|
, only valid when there is no link
input. If you use |link=somelink|nolink=y
, it will be ignored.
- anchor = y/yes
If set, will create an anchor for {{{1}}}.
- note
Extra note text. By default, it will displayed as smaller and gray text next to the item name, and without link on it.
- note2
Another note text. By default, it will displayed as gray txt in normal size, without link, and always take a single line.
- wrap = y/yes
Only valid when there is no id= or note2= input. If set, the note will be displayed in a new line.
- id
Number, will display items(or other type) ID infomation.
- type
the type of ID, case-insensitive, default is item
, only valid when id is sepcified. can be tile
, wall
, npc
, mount
, buff
, debuff
, projectile
, or armor
. All other values are treated as item
.
- showid = y/yes/n/no
Explicitly turn on/off id display. Default is on when id
is set, off when id
is not set.
- class
Custom Css class(es). There're some predefined classes for certain formatting purpose(see examples below). You can add yours if needed.
- css or style
Custom css style rules.
Examples
Basic
Result | Code | Note |
---|---|---|
Bed | {{item|Bed}} |
Basic usage. |
Format:C | {{item|Format:C}} |
":" in item name. |
Weapon Imbue: Venom | {{item|Weapon Imbue: Venom}} |
": " in item name. |
Any Bed | {{item|Bed|Any Bed}} |
Custom text. |
Psycho Knives Butterflies | {{item|Psycho Knife|s}} {{item|Butterfly|s}} |
plural. |
Wall of Flesh | {{item|Wall of Flesh|size=32px}} |
custom image size. (Read Extended image syntax for details). |
Wall of Flesh |
{{item|Wall of Flesh|size=32px|Wall of<br/>Flesh}} |
Custom text in multiple lines. |
Wall of Flesh |
{{item|Wall of Flesh|size=32px|Wall of<br/>Flesh|class=multi-line}} |
Multiple lines need "multi-line" class for middle vertical align. |
Treasure Bags | {{item|Treasure Bag|s|ext=gif}} |
Custom image file extension. |
Treasure Bags(Expert Mode) | {{item|Treasure Bag|s|note={{small|(Expert Mode)}}|ext=gif}} |
Note text. |
Parrot Pet | {{item|Pet Parrot|image=Parrot.png|Parrot Pet}} |
Custom image file name. |
Parrot Pet | {{item|Pet Parrot|image=Parrot.png|Parrot Pet|ext=jpg}} |
Will display Parrot.png, ext is ignored when image specified.
|
Beeswax | {{item|Beeswax|image=<div style="background:yellow">[[File:Guide.png]]×[[File:Nurse.png]]</div>}} |
Custom image code. The code must include at least one [[File: (case insenstive).
|
Parrot Pet | {{item|Parrot|link=Pet Parrot|Parrot Pet}} |
Custom link target. |
Beeswax | {{item|Beeswax|link=}} |
Unlinked. |
Beeswax | {{item|Beeswax|nolink=y}} |
Unlinked. |
Beeswax | {{item|Beeswax|nolink=y|link=Bee}} |
if link is specified, it will override unlink=y .
|
BeeswaxInternal Item ID: 5019 | {{item|Beeswax|id=5019}} |
With Item ID infomation |
Pet TiphiaInternal Buff ID: 204 | {{item|Pet Tiphia|id=204|type=buff}} |
Other type of ID, in this case, Buff ID. |
GuideInternal NPC ID: 22 | {{item|Guide|id=22|type=npc}} |
NPC ID. |
BeeswaxInternal Item ID: 5019 |
{{item|Beeswax|id=5019|anchor=y}} |
Create an anchor. Now {{PAGENAME}}#Beeswax will link to here. |
"#", "##", and "@" syntax
You can place "#" or "##" before main item name to auto append mod name, example:
Code | Result |
---|---|
{{modname|set|Fargo's Mod}} |
Template:Modname Since this is template document page, we need to set mod name first. See {{modname}}. |
{{item|#Tree Sword}} |
[[File:#Tree Sword.png|link=#Tree Sword|#Tree Sword]]#Tree Sword This is equivalent to {{item|Fargo's Mod/Tree Sword|Tree Sword|image=Tree Sword (Fargo's Mod).png}}
|
{{item|Fargo's Mod/Tree Sword|Tree Sword|image=Tree Sword (Fargo's Mod).png}} |
Fargo's Mod/Tree SwordTree Sword |
{{item|##Tree Sword}} |
[[File:##Tree Sword.png|link=##Tree Sword|##Tree Sword]]##Tree Sword Mod name as note. |
{{item|#Tree Sword|Sword}} |
[[File:#Tree Sword.png|link=#Tree Sword|#Tree Sword]]Sword This is equivalent to {{item|Fargo's Mod/Tree Sword|Sword|image=Tree Sword (Fargo's Mod).png}}
|
{{item|##Tree Sword|Sword}} |
[[File:##Tree Sword.png|link=##Tree Sword|##Tree Sword]]Sword Mod name as note. |
And you can use |mod=
or "@" in item name to specify mod name:
Code | Result |
---|---|
{{item|##Tree Sword|Sword|mod=Fargo's Mod}} |
[[File:##Tree Sword.png|link=##Tree Sword|##Tree Sword]]Sword |
{{item|##Tree Sword@Fargo's Mod}} |
[[File:##Tree Sword@Fargo's Mod.png|link=##Tree Sword@Fargo's Mod|##Tree Sword@Fargo's Mod]]##Tree Sword@Fargo's Mod |
Size and scale
Note: Due to the way of [[File:]]'s size option works, if you want to set a size(after scale) larger then origin image size, you need to set it in DDpx or DDxDDpx, and xDDpx will be no effect. e.g. for Beeswax, {{item|Beeswax|size=x40px}}
will be no effect.
Multiple images
Wrap, id and note2
wrap
is valid only when id
and note2
are not specified.
Display mode
Css and predefined classes
Result | Code | Note |
---|---|---|
BeeswaxInternal Item ID: 2384 | {{item|Beeswax|link=|id=2384|css=color:red;border: 2px solid blue;padding: 3px; background:#ccc}} |
Custom css rules. |
BeeswaxInternal Item ID: 2384 | {{item|Beeswax|id=2384|class=boldname}} |
Predefined class: boldname , item name will displayed in bold.
|
Beeswaxnotenote2Internal Item ID: 2384 Beeswaxnotenote2Internal Item ID: 2384 Beeswaxnotenote2Internal Item ID: 2384 |
{{item|Beeswax|id=2384|note=note|note2=note2|class=notecolor}} |
Predefined class: notecolor and note2color , note or note2 will display in normal(inherited) text color, respectively .
|
Beeswaxnotenote2Internal Item ID: 2384 Beeswaxnotenote2Internal Item ID: 2384 |
{{item|Beeswax|id=2384|note=note|note2=note2|class=notecolor}} |
Predefined class: notesize and note2size , note will display in normal size, or note2 will display in reduced size, respectively.
|
Beeswaxnotenote2Internal Item ID: 2384 Beeswaxnotenote2Internal Item ID: 2384 Beeswaxnotenote2Internal Item ID: 2384 |
{{item|Beeswax|id=2384|note=note|note2=note2|class=textleft}}<br/>{{item|Beeswax|id=2384|note=note|note2=note2|class=textcenter}}<br/>{{item|Beeswax|id=2384|note=note|note2=note2|class=textright}} |
Predefined class: textleft , textcenter , and textright , Similar to alignleft/aligncenter/alignright , but only applied to text part.alignleft/center/right can use with text/align/center/right at same time.
|
BeeswaxInternal Item ID: 2384 | {{item|Beeswax|id=2384|class=block|mode=text}} |
Predefined class: block , main item element and text element will display as block element(default is inline-block ).It is usually only practical when mode=text .
|
Beeswaxnotenote2Internal Item ID: 2384 | {{item|Beeswax|id=2384|note=note|note2=note2|class=notesize notecolor boldname|css=color:red}} |
You can specify multiple classes, seperate with space, and can specify custom css rules at the same time. |
<div style="width: 5em">{{item|Wall of Flesh|size=32px|class=break}}</div> |
Wrap item name for long text when there is no enough space. |
Transform
You can transform item image via these CSS classes.
The transformation happens at the center of the image and its effective dimensions will retain the original values of the object as if untransformed. So be careful with rotate90
and rotate270
.
Result | Code |
---|---|
guide | {{item|guide}}
|
guide | {{item|guide|class=mirror}}
|
guide | {{item|guide|class=flip}}
|
guide | {{item|guide|class=rotate90}}
|
guide | {{item|guide|class=rotate180}}
|
guide | {{item|guide|class=rotate270}}
|
Change default options
You can use {{item/options}} to set/get and reset some options' default value.
Usage
- Set:
{{item/options|nolink=y|...}}
or{{item/options|set|nolink=y|...}}
- get:
{{item/options|get|nolink}}
- reset:
{{item/options|reset}}
or{{item/options|resetall}}
All parameters:
- unnamed parameter 1
Action. get
or load
means get the current value of a option, reset
or resetall
means reset all options to default value, other values(include none. if you want, recommend to use set
for better readability) means set options' value.
- unnamed Parameter 2
The name of option which you want to get its value, only valid when action is get. Can be mode
, wrap
, nolink
, class
, css
or style
.
- mode
Only valid when action is set. Set the default value for {{item}}'s mode parameter. You can use any valid value for {{item}}'s mode parameter, and a invalid value(recommend to use default
, all
, or both
for better readability) means change the mode back to default. See {{item}}'s mode
parameter.
- wrap = y/yes/n/no
Only valid when action is set. Turn on/off line wrap. See {{item}}'s wrap
parameter.
- anchor = y/yes/n/no
Only valid when action is set. Turn on/off anchor. See {{item}}'s anchor
parameter.
- nolink = y/yes/n/no
Only valid when action is set. Turn on/off no link option. See {{item}}'s nolink
parameter.
- class
Only valid when action is set. Default value for class
. See {{item}}'s class
parameter.
- css/style
Only valid when action is set. Default value for css
. See {{item}}'s css
parameter.
See examples below for more details.
Example
Code | output |
---|---|
By default: {{item|Beeswax|note=(note)}} turn on line wrap, and set to text mode: {{item/options|set|wrap=y|mode=text}} {{item|Beeswax|note=(note)}} turn on no link mode: {{item/options|set|nolink=y}} {{item|Beeswax|note=(note)}} get current setting: nolink = {{item/options|get|nolink}} ; wrap = {{item/options|get|wrap}} ; mode = {{item/options|get|mode}} ; reset all options: {{item/options|reset}} {{item|Beeswax|note=(note)}} custom css and class: {{item/options|set|css=border:1px solid red;padding:3px}} {{item|Beeswax|note=(note)}} {{item/options|set|class=boldname}} {{item|Beeswax|note=(note)}} reset all: {{item/options|resetall}} {{item|Beeswax|note=(note)}} |
By default: turn on line wrap, and set to text mode: Beeswax(note) turn on no link mode: Beeswax(note) get current setting: nolink = y ; wrap = y ; mode = text ; reset all options: custom css and class: reset all: |