Plantilla:Item

De Wiki Calamity Mod Oficial
Ir a la navegación Ir a la búsqueda
Lua.svg
Esta plantilla utiliza Módulo:Item, un script escrito en el lenguaje de programación Lua. Por favor, consulta wikipedia:Lua y mw:Extension:Scribunto para obtener más información sobre Lua.
Esta plantilla está preparada para i18n, lo que significa que es fácil de localizar para diferentes idiomas. Consulta I18n & l10n para Plantillas para obtener más información.

Esta plantilla añade filas a la tabla «Imageinfo», que declara la plantilla Image. Ver tabla.

Info-bold.svg Documentación La documentación a continuación se transcluye desde Plantilla:Item/doc. (editar | historial)

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[editar código]

All parameters are optional. Despite this, some combinations are invalid and may cause errors.

See examples below for more details.

unnamed parameter 1

Default item display name, link target, and image file name.

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.

mode

Display mode. It can be:

  • image(Preferred) or imageonly or onlyimage means only image will be displayed;
  • text(Preferred) or noimage means no image will be displayed;
  • table(Preferred) or 2-cell will output 2 cells code for table. This is roughly a shortcut for {{item|mode=image|itemname}} || {{item|mode=text|itemname}}
  • htmltable(Preferred) or html-2-cell is similar to table, but will produce a result suitable for html tables instead of mediawiki tables (roughly a shortcut for {{item|mode=image|itemname}} </td><td> {{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. Diverman.png).

You can specify multiple images, just seperate filenames with slashes(eg. Diverman.png/Soul Forge (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.
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 between item name and platform icons , 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 note2= input. If set, note will be displayed in new line.

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[editar código]

Basic[editar código]

Result Code Note
Polvo de estrellaPolvo de estrella {{item|Stardust}} Basic usage.
Polvo de estrellaStar Powder {{item|Stardust|Star Powder}} Custom text.
Polvo de estrellaPolvo de estrella Demon TrophyDemon Trophy {{item|Stardust|s}} {{item|Demon Trophy|ies}} Plural.
La Mente de la ColmenaLa Mente de la Colmena {{item|The Hive Mind|size=32px}} Custom image size. (Read Extended image syntax for details).
La Mente de la ColmenaHive
Mind
{{item|The Hive Mind|size=32px|Hive<br/>Mind}} Custom text in multiple lines.
Bolsa del tesoroBolsa del tesoro {{item|Treasure Bag|s|ext=gif}} Custom image file extension.
Bolsa del tesoroBolsa del tesoro(Expert Mode) {{item|Treasure Bag|s|note=(Expert Mode)|ext=gif}} Note text.
Strange OrbOcean Spirit {{item|Strange Orb|image=Ocean Spirit.png|Ocean Spirit}} Custom image file name.
Strange OrbOcean Spirit {{item|Strange Orb|image=Ocean Spirit.png|Ocean Spirit|ext=jpg}} Will display Ocean Spirit.png, ext is ignored when image is specified.
Ocean SpiritOcean Spirit {{item|Ocean Spirit|link=Strange Orb|Ocean Spirit}} Custom link target.
Polvo de estrellaPolvo de estrella {{item|Stardust|link=}} Unlinked.
Polvo de estrellaPolvo de estrella {{item|Stardust|nolink=y}} Unlinked.
Polvo de estrellaPolvo de estrella {{item|Stardust|nolink=y|link=Astral Bar}} if link is specified, it will override unlink=y.
Polvo de estrellaPolvo de estrella
{{item|Stardust|anchor=y}} Create an anchor. Now {{PAGENAME}}#Stardust will link to here.

Multiple images[editar código]

Result Code Note
Draedon's ForgeDraedon's ForgeDraedon's Forge {{item|Draedon's Forge|image=Draedon's Forge.png/Draedon's Forge_(placed).png}} Multiple images with auto size.
Draedon's ForgeDraedon's ForgeDraedon's Forge {{item|Draedon's Forge|image=Draedon's Forge.png/Draedon's Forge_(placed).gif|size=20px}} Only one size specified, all images will use this size.
Draedon's ForgeDraedon's ForgeDraedon's Forge {{item|Draedon's Forge|image=Draedon's Forge.png/Draedon's Forge_(placed).gif|size=30px/20px}} Multiple images with multiple sizes.
Draedon's ForgeDraedon's ForgeDraedon's Forge {{item|Draedon's Forge|image=Draedon's Forge.png/Draedon's Forge_(placed).gif|size=30px/20px/300px}} Size is more than images, extra size is ignored.
Draedon's ForgeDraedon's ForgeDraedon's ForgeDraedon's Forge {{item|Draedon's Forge|image=Draedon's Forge.png/Draedon's Forge_(placed).gif/Ashen Altar.png|size=16px/50px}} Size is less than image, extra image will use auto size.

Wrap and note2[editar código]

wrap is valid only when note2 is not specified.

Result Code Note
Polvo de estrellaPolvo de estrella(some note) {{item|Stardust|wrap=y|note=(some note)}} If there is a note, note will display on next line.
Polvo de estrellaPolvo de estrella
some other notes.
{{item|Stardust|wrap=y|note2=some other notes.}} If note2 is specified, note will be displayed on the same line, even if wrap=y.

Display mode[editar código]

Result Code Note
Polvo de estrellaPolvo de estrella {{item|Stardust}} By default, it will display image and text info.
Polvo de estrella {{item|Stardust|mode=image}} mode=image: Only image will be displayed, no text, no note.
Polvo de estrella(some note) {{item|Stardust|mode=text|wrap=y|note=(some note)}} mode=text: image won't be displayed.
Polvo de estrella Polvo de estrella
Demon Trophy Demon Trophy(some note)
{| class="wikitable"
|{{item|Stardust|mode=table}}
|-
|{{item|Demon Trophy|ies|note=(some note)|mode=table}}
|}
mode=table: output as two adjacent cells for table.

Css and predefined classes[editar código]

Result Code Note
Polvo de estrellaPolvo de estrella {{item|Stardust|link=|css=color:red;border: 2px solid blue;padding: 3px; background:#ccc}} Custom css rules.
Polvo de estrellaPolvo de estrella {{item|Stardust|class=boldname}} Predefined class: boldname, item name will displayed in bold.
Polvo de estrellaPolvo de estrellanote
note2

Polvo de estrellaPolvo de estrellanote
note2

Polvo de estrellaPolvo de estrellanote
note2
{{item|Stardust|note=note|note2=note2|class=notecolor}}
{{item|Stardust|note=note|note2=note2|class=note2color}}
{{item|Stardust|note=note|note2=note2|css=color:red|class=note2color}}
Predefined class: notecolor and note2color, note or note2 will display in normal(inherited) text color, respectively .
Polvo de estrellaPolvo de estrellanote
note2

Polvo de estrellaPolvo de estrellanote
note2
{{item|Stardust|note=note|note2=note2|class=notecolor}}
{{item|Stardust|note=note|note2=note2|class=note2color}}
Predefined class: notesize and note2size, note will display in normal size, or note2 will display in reduced size, respectively.
Polvo de estrellaPolvo de estrellanote
note2

Polvo de estrellaPolvo de estrellanote
note2

Polvo de estrellaPolvo de estrellanote
note2
{{item|Stardust|note=note|note2=note2|class=left}}<br/>{{item|Stardust|note=note|note2=note2|class=center}}<br/>{{item|Stardust|note=note|note2=note2|class=right}} Predefined class: alignleft, aligncenter, and alignright, text-align = left, center, or right, respectively.
Polvo de estrellaPolvo de estrellanote
note2

Polvo de estrellaPolvo de estrellanote
note2

Polvo de estrellaPolvo de estrellanote
note2
{{item|Stardust|note=note|note2=note2|class=textleft}}<br/>{{item|Stardust|note=note|note2=note2|class=textcenter}}<br/>{{item|Stardust|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.
Polvo de estrella {{item|Stardust|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.
Polvo de estrellaPolvo de estrellanote
note2
{{item|Stardust|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.

Change default options[editar código]

You can use {{item/options}} to set/get and reset some options' default value.

Usage[editar código]

  • Set: {{item/options|nolink=y|...}} or {{item/options|set|nolink=y|...}}
  • get: {{item/options|get|nolink}}
  • reset: {{item/options|reset}} or {{item/options|resetall}}
NOTE: In order to avoid unwanted influences, it is very important to reset options as soon as possible. Especially in the template, you should reset options before the template ends.

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[editar código]

Code output
By default: 

{{item|Stardust|note=(note)}}

turn on line wrap, and set to text mode: 
{{item/options|set|wrap=y|mode=text}}
{{item|Stardust|note=(note)}}

turn on no link mode: 
{{item/options|set|nolink=y}}
{{item|Stardust|note=(note)}}

This will be overrid by '''<code>link=</code>'''

{{item|Stardust|note=(note)|link=Astral Bar}}

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|Stardust|note=(note)}}

custom css and class:
{{item/options|set|css=border:1px solid red;padding:3px}}
{{item|Stardust|note=(note)}}
{{item/options|set|class=boldname}}
{{item|Stardust|note=(note)}}

reset all:
{{item/options|resetall}}
{{item|Stardust|note=(note)}}

By default:

Polvo de estrellaPolvo de estrella(note)

turn on line wrap, and set to text mode:

Polvo de estrella(note)

turn on no link mode:

Polvo de estrella(note)

This will be overrid by link=

Polvo de estrella(note)

get current setting:

nolink = y ; wrap = y ; mode = text ;

reset all options:

Polvo de estrellaPolvo de estrella(note)

custom css and class:

Polvo de estrellaPolvo de estrella(note)

Polvo de estrellaPolvo de estrella(note)

reset all:

Polvo de estrellaPolvo de estrella(note)