Modèle:Item infobox : Différence entre versions

De Terraria Wiki
Aller à : navigation, rechercher
Ligne 165 : Ligne 165 :
 
-->{{#vardefine:ii:ammo|{{#dplvar:ii:info:ammo}}}}<!--
 
-->{{#vardefine:ii:ammo|{{#dplvar:ii:info:ammo}}}}<!--
 
-->{{#ifexpr:{{#var:ii:ammo}}|<!-- Ammo type/cate
 
-->{{#ifexpr:{{#var:ii:ammo}}|<!-- Ammo type/cate
// add "Ammunition" and "Weapon" to type.
+
// add "Ammunition" to type.
-->{{#vardefine:ii:types|{{#lstapp:{{#var:ii:types}}|/|ammunition/weapon}}}}<!--
+
-->{{#vardefine:ii:types|{{#lstapp:{{#var:ii:types}}|/|ammunition}}}}<!--
 
// add ammo type to listcat: (by AmmoID)
 
// add ammo type to listcat: (by AmmoID)
 
-->{{#vardefine:ii:listcats|{{#lstapp:{{#var:ii:listcats}}|/|{{#switch:{{#var:ii:ammo}}<!--
 
-->{{#vardefine:ii:listcats|{{#lstapp:{{#var:ii:listcats}}|/|{{#switch:{{#var:ii:ammo}}<!--

Version du 25 octobre 2020 à 07:43

Ce modèle définit le tableau « Items ». Voir le tableau.

Ce modèle est considéré comme prêt pour i18n, signifiant qu'il est facile à régionaliser pour les différentes langues. Veuillez regarder i18n & l10n pour les modèles (en) pour en apprendre plus.
Voir Modèle:Item infobox/l10n pour la localisation de ce modèle.
Ce modèle utilise Lua.
Ce modèle utilise Module:Iteminfo, un script écrit dans le language de programmation Lua. Pour en apprendre plus à propos Lua, visiter Terraria Wiki:Lua (en).
Template-info.svg Documentation La documentation ci-dessous est transcluse de Modèle:Item infobox/doc. (modifier | historique)

This template is used for displaying the infobox for an item. It is one of the most important and most powerful infobox templates.

Usage

While the template is extremely versatile, its main functionality is to display the standard infobox.

The data which is to be displayed can be manually entered when calling the template, but thanks to {{iteminfo}}, the vast majority of data is generated automatically. To enable automatic data, use the parameter auto and set it to the ID of the item (alternatively: auto=yes and either id=<item ID>, name=<item name>, or nothing else – the latter two methods will cause the template to automatically generate the ID using {{itemNameFromId}}, with the last method using the page title for name reference). This way, all relevant item parameters are set automatically. See the table below for affected parameters. However, they can still be overridden and manually entered parameters always take precedence over the automatic ones.

Basic parameters

Notes:
  • The dollar sign ($) is used to signify that the word after it is the name of a template parameter.
  • All parameters which have a default value listed can usually be omitted. Note that this does not mean that parameters which do not have a default value listed should always be filled in.
Parameter Description Auto Example Default value
(if omitted)
Note
{{item infobox

Box-related parameters

Box-related parameters
| boxwidth Width of the infobox 27em 21em Number with unit. Default is 21em or stretching to image width
| float Position of the infobox left right
| css
 or
| style
CSS style affecting the entire infobox Any width or float properties defined here will override the template's $boxwidth and $float parameters, respectively.
| auto Enables automatic data 465 Can also be yes (see text above).
| id ID of the item 465 The automatic data gathering for $tooltip is based on this.
| name Name of the item Wood Page name Will be displayed as heading of the infobox.
| lname Localized name of the item Legno
(Italian for "Wood")
{{tr|$name}} Will be displayed as heading of the infobox; only to be used if $name is not existent in the {{tr}} database of the specific language.
| showenglishname Display of English name of this item yes
no
Defaults to no for languages that have an in-game translation (en, de (allemand), es (espagnol), fr (français), it (italien), pl (polonais), pt (portugais), ru (russe), zh (chinois)), and to yes for all other languages.
| namesub Name sub-heading Additional information directly underneath the title of the infobox; rarely useful for item infoboxes.

Image-related parameters

Image-related parameters
| imagealt Complete custom control over the entire image display [[File:Wood.png]] Overrides all image parameters in this parameter category (except for $imagebreak).

If intending to manually reproduce the gray border that the infobox places automatically between $image, $imageold. etc., a simple <hr/> should not be used. Instead, enclose the different images that should be separated in <li> tags (except for the first image). The $imagebreak parameter will also still work as expected in this case and create vertical breaks at the separators. See Sensors for a simple example and Fish Bowls for a more elaborate, fully customized example.

| ext File extension of $image gif png
| image Main image of the inventory icon or equipped item/set Wood.png $name.$ext
| imageold Variant image of the older versions Compass (old).png $name (old) Default value: First checks for the .gif and then for the .png. Due to the way the automatic image detection is handled internally, it will likely fail on items whose name contains a dot (e.g. S.D.M.G.). It is necessary to explicitly specify the image in that case. (This applies to all image-related parameters.)
| imageplaced Image of the placed item Wood (placed).png $name (placed)
| imageequipped Image of the equipped item/set Shackle (equipped).png $name (equipped)
| imagefemale Image of the female equipped item/set Robe (equipped) female.png $name female.$ext
| imageoldalt Complete custom control over the "old" image display [[File:Compass (old).png]]
| imageplacedalt Complete custom control over the "placed" image display [[File:Wood (placed).png]]
| imageequippedalt Complete custom control over the "equipped" image display [[File:Shackle (equipped).png]]
| imagebreak Arranges multiple images in rows rather than in columns yes Causes the main/"old", "placed", "equipped", and "female" images to all take up a separate row, with small horizontal bars in between (example: Book). Note that the main and "old" images will always be displayed in the same row. Also note that this effect is enabled regardless of what $imagebreak is set to (i.e, setting it to no will also enable it – so refrain from doing that).
| imagemode Controls image selection placed/equipped full If set to full (which will only be the default for the infobox $view), the template will attempt to display all different types of images mentioned above. If not set to full, it will only attempt to display the main image (which will be the case for other $views by default, e.g. table), for performance reasons. It is possible, however, to enable (attempted) display of certain image types even if the mode is not full: Set the parameter to old, placed, equipped, or any combination of these three to cause the template to fetch these images as well.
| imageinfo Prevents the internal usage of {{image}} no Setting it to no will cause the template to use the standard [[File:]] syntax instead of {{image}}. {{image}} will increase the expensive function count, so if there are many item infoboxes on one page, the expensive function count limit may be exceeded. Using imageinfo=no can reduce the count to avoid exceeding it. In the vast majority of cases, this is not necessary.

Statistics-related parameters

Statistics-related parameters
| autoswing Auto-use capability yes Displays Autoswing, Autofire, or Auto-use in the top-right corner of the infobox. Hover text is determined by $damagetype ("Autoswing" for melee, "Autofire" for ranged and magic, and "Auto-use" for anything else).
| stack Maximum possible stack size [1] 99 1 Maximum quantity of this item that can be stacked in a single inventory slot.
| pick Pickaxe power [1] 100 Without percentage sign (%), unless more complex wikitext is used. If any of the three parameters is used, all three symbols will always be displayed: Pickaxe icon.png Hammer icon.png Axe icon.png
| hammer Hammer power [1] 75
| axe Axe power [1] 50
| pickreq Required pickaxe power for destroying × 150 Without percentage sign (%)!
| hammerreq Required hammer power for destroying × 80 Without percentage sign (%)! Prints the following behind it: "(seulement en Hardmode)"
| type
 (deprecated:
| type2)
Classification and categorization Weapon/Tool Broad classifications like "Weapon", "Tool", "Furniture", etc. Separate multiple values with a slash (/). Many types, such as "Crafting material", will be added automatically.
| fishing Fishing power [1] Without percentage sign (%)!
| bait Bait power Without percentage sign (%)!
| damage Damage [1]
| damagetype Damage type [1] Possible values: melee, ranged, magic, summon, and throwing. The infobox will automatically categorize the page in the appropriate weapon type category, but only for the automatically generated damage type. For any additional, manually added damage type, a |listcat=<damage type> weapons will be necessary.
| knockback Knockback [1] @@@@ / {{kb|5}} If more than one value is needed, wrap the individual values with {{kb}} in order to ensure correct styling. The @@@@ string does not need {{kb}}.
| defense Defense [1]
| tileboost Tile range boost
| bonus Miscellaneous bonuses ×
| setbonus Set bonus [1] For armor sets, where $type contains Set. Note that because this parameter is only sensible for set item infoboxes – which don't use $auto since it doesn't work with sets – its data will always be generated automatically (instead of only when $auto is set). Set this parameter to an empty value to hide the automatically generated set bonus.
| placeable Placeable yes no
| width Width when placed × In tiles. Defaults to 1 for blocks.
| height Height when placed ×
| consumable Consumable True if the item leaves the player's inventory with Utiliser / Attaquer; includes placeable items. It is found in the game's source code.
| mana Mana cost [1]
| mheal Mana restoration [1]
| hheal Health restoration [1]
| critical Critical strike chance [1] 11 Without percentage sign (%), unless more complex wikitext is used. If no value is entered and the main $type is Weapon, a default value of 4 will be used.
| body slot Body slot
| use Use time [1] @@@@ / {{ut|30}} If more than one value is needed, wrap the individual values with {{ut}} in order to ensure correct styling. The @@@@ string does not need {{ut}}.
| velocity
 (deprecated:
| sspeed)
Velocity [1]
| toolspeed Tool speed [1]
| tooltip Tooltip [1]
| rare Rarity [1] @@@@ / {{rare|0}} Use the {{rare}} template.
| research Research required 5
| buy Buy value [1] Enter the value using the coin template ({{coin}}). If using $auto, use buy=y/yes/true/show to enable display of automatic buy price (disabled by default, since many items that can be sold cannot be bought). Alternatively, add buy, buyable, or vendor to $tags.
| sell Sell value [1] Also enter the value using the coin template.
| value Value Mostly used internally. Will not be displayed directly, but serves as the base for $buy and $sell. It can be used to suppress buy and sell value display entirely by setting it to a blank value (|value=).

Buff- & debuff-related parameters

Buff- & debuff-related parameters
| buff Buff provided Name of the buff. As a shortcut for $buffduration and $buffchance, they can be appended to this value, separated with a slash: | buff = <name> / <duration> / <chance>. Chance may also be omitted.
| idbuff Buff ID
| bufflink Buff link target
| bufftip Buff tooltip
| buffchance Buff chance
| buffduration Buff duration [1] Enter the value using the {{duration}} template.
| buff<n> Additional buff provided × Can be continued nearly infinitely, e.g. buff2, buff3, etc.
| idbuff<n> Buff ID ×
| bufflink<n> Buff link target ×
| bufftip<n> Buff tooltip ×
| buffchance<n> Buff chance ×
| buffduration<n> Buff duration ×
| debuff Debuff inflicted Name of the debuff. As a shortcut for $debuffduration and $debuffchance, they can be appended to this value, separated with a slash: | debuff = <name> / <duration> / <chance>. Chance may also be omitted.
| iddebuff Debuff ID
| debufflink Debuff link target
| debufftip Debuff tooltip
| debuffchance Debuff chance
| debuffduration Debuff duration [1] Enter the value using the {{duration}} template.
| debuff<n> Additional debuff provided × Can be continued nearly infinitely, e.g. debuff2, debuff3, etc.
| iddebuff<n> Debuff ID ×
| debufflink<n> Debuff link target ×
| debufftip<n> Debuff tooltip ×
| debuffchance<n> Debuff chance ×
| debuffduration<n> Debuff duration ×

Sound-related parameters

Sound-related parameters
| sounduse Use sound effect Item_1.wav Can be a comma-separated list for multiple sounds. Caption is "Utilisation".
| sound1 Custom additional sound effect Can be a comma-separated list for multiple sounds.
| soundcaption1 Caption for the sound effect
| sound2 Custom additional sound effect Can be a comma-separated list for multiple sounds.
| soundcaption2 Caption for the sound effect
| sound<n> Custom additional sound effect Can be continued nearly infinitely. Sounds will only be displayed if there is a sound<n> parameter with a corresponding soundcaption<n> parameter.
| soundcaption<n> Caption for the sound effect

Mount-related parameter

Mount-related parameter
| idmount Mount ID

Projectile-related parameters

Projectile-related parameters
| idprojectile
 (deprecated:
| shoot)
Projectile ID Can be a comma-separated list for multiple IDs.
| projectilename Projectile name
| projectileimage Projectile image
| projectileblock Projectile images arrangement × Operates similarly to $imagebreak.

ID-related parameters

ID-related parameters
| showids Display of ID section × no ID section is not hidden by default.
| idshow Vanity item ID ×
| idtile Tile ID
| idtileshow Vanity tile ID ×
| idtilesub Tile sub-ID Internally known as placeStyle in Terraria.
| idwall Wall ID
| idarmor Armor ID
| idbuffshow Vanity buff ID × 170–172 The values of these parameters require to be escaped, i.e., wikitext like templates or parser functions will need to be wrapped with <esc> and </esc>.
| idbuffshow<n> Vanity buff ID × 1007 <esc>{{3DS}}</esc>
| iddebuffshow Vanity debuff ID ×
| iddebuffshow<n> Vanity debuff ID ×

Back-end-related parameters

Back-end-related parameters
| cate Toggles categorization × no Set to yes to force categorization when it is disabled by default (on non-mainspace pages). Set to no to disable categorization.
| listexclude Toggles categorization × yes no Set to yes to disable categorization. Overrides cate=yes, but not cate=no.
| cargo Toggles cargo data storage × no Set to force to force cargo data storage when it is disabled by default (on non-mainspace pages). Set to no to disable cargo data storage. Note that setting it to anything else (e.g. yes) also disables cargo data storage, so please stick to the unambiguous no.
| listcat Categorization Supplemental category names to include the current item in a DPL list, e.g. arrows causes the item to display at the Arrows page. Separate multiple categories with a slash character (/). The following categories will be added automatically:
| tag
 or
| tags
Categorization Supplemental category names to appropriately categorize the item. Can contain any of the following (separate multiple with a slash character (/):
  • buy/buyable/vendor (implies buy=yes)
    • vendor:<NPC name>
  • hardmodeonly/hardmode (implies hardmode=yes)
  • allversions (implies allversions=yes)
  • dd2 (means that this item is to be purchased with Médaille de défenseur.)
  • drop (implies listcat=drop items)
  • loot (implies listcat=loot items)
  • plunder (implies listcat=plunder items)
    • plunder:<location>
  • fished (implies listcat=fished items)
  • unobtainable (implies listcat=unobtainable items)
  • developer (implies listcat=developer items).
  • storage (implies listcat=storage items).
  • informational (implies listcat=informational items).
  • quest rewards (implies listcat=quest rewards).
  • light source (implies listcat=light source items).
  • novelty (implies listcat=novelty items).
  • mechanism (implies listcat=mechanism items).
  • potion ingredients (implies listcat=potion ingredients).
  • bag loot/bagloot (implies listcat=bag loot items).
  • treasure bag loot (implies listcat=Treasure Bag loot items).
  • minion (implies type=weapon and listcat=minion summon items).
  • sentry (implies type=weapon and listcat=sentry summon items).

All other values will have no effect. All tags will be stored to cargo for querying.

| allversions Platform version availability Set to yes to assert that the item is available on all platforms of Terraria. This is only to be used if no {{exclusive}} banner is on the page. If omitted and if $tags does not contain allversions, it will be detected automatically based on the result of {{eversions|<item name>}} (even though $auto might not be set!). Categorizes the page in all five version content categories (with the exception of Category:Japanese console content), if yes is determined.
| hardmode Hardmode-exclusivity yes Set to yes to assert that the item is not available in pre-Hardmode, but only becomes available in Hardmode. Categorizes the page in Category:Objets obtenables uniquement en Hardmode.

View-related parameters

By default, an item infobox is displayed in the standard infobox style, a boxed, table-like listing of stats on the right of the article text. It is possible to change the display format (called "view"), however – there are four other views available: custom, item, table, and void (additionally test). They can be selected via the $view (aliases: $mode, $output) parameter. Each view has an own subpage which contains the code for the respective output.

View Description Subpage
custom Completely custom output. /customView
infobox
(default)
Standard infobox-style output. /infoboxView
item Displays the item as formatted by {{item}}. /itemView
table Displays an entire table row (including the row separator, |-). /tableView
void Does not display anything. This is useful when it is necessary to store item information to the Cargo database, but an own infobox for the item is unwanted (e.g. on group pages, where there is a main infobox for all items of the group). /voidView

Some views enable additional, view-exclusive parameters:

Parameter Description Example Default value
(if omitted)
Note
{{item infobox

Custom view

Custom view
| template Name of the formatting template This parameter is required when using the custom view. It is to be set to the name of the template that contains the custom code for the output. (For instance, |view=custom|template=item infobox/infoboxView could also be used for a standard infobox style, because {{item infobox/infoboxView}} contains the code for the infobox output.)
| extargs Additional custom parameters Enable additional, custom parameters for the {{item infobox}} call that are handled by the formatting template. Separate multiple parameter names with a slash character (/). This parameter should only be used if the parameters specified in it are used in the {{item infobox}} call.

Item view

Item view
(all {{item}} parameters) The following additional {{item}} parameters will be processed as if the template itself was called:
  • mode
  • nolink
  • link
  • wrap
  • icons
  • note
  • note2
  • showid
  • class
  • css
  • t

See {{item}} for documentation.

Table view

Table view
| cols Columns to display item2cells/sell This parameter defines which columns/cells are to be displayed in the resulting table row. The content and formatting of those cells is handled by the respective subpage of Template:Item infobox/tableView, by default. The following values are predefined:

However, it is also possible to include another page name, e.g. Moss/Placed on bricks (via |cols=:Moss/Placed on bricks) for a custom formatting for that cell.

In addition, it is possible to include columns for which the content is set in the same {{item infobox}} call. These column names begin with col: (e.g. |cols=col:notes) and the content can be set in the parameter of the same name (i.e. |col:notes=This is the note).

| colsep Separator for $cols \ / Specify the character that separates the column names in $cols. This is useful when using column names that include slashes, since the default separator is a slash and would thus treat that column name as two different columns.
| extargs Additional custom parameters Enable additional, custom parameters for the {{item infobox}} call that are handled by the column formatting page. Separate multiple parameter names with a slash character (/). For instance, the item2cells column formatting page is able to process three exclusive parameters, $anchor, $nolink, and $rowspan. These parameters can be specified in the {{item infobox}} call to influence the formatting carried out by item2cells, but they will have no effect unless explicitly specified via |extargs=anchor/nolink/rowspan. This parameter should only be used if the parameters specified in it are used in the {{item infobox}} call.
  1. 1,00 1,01 1,02 1,03 1,04 1,05 1,06 1,07 1,08 1,09 1,10 1,11 1,12 1,13 1,14 1,15 1,16 1,17 1,18 1,19 1,20 1,21 et 1,22 Any occurrence of the string @@@@ in the parameter value will be replaced by the automatically generated data. This can be used to mix automatic and manual data.

Options

This template supports options through {{options}} template. All valid options are listed below, see {{options}} for usage and other infomation.

See Template:item infobox/initOptions for the initial options setting of this template.

NameAliasInitial ValueValue Mapping[1]Note
viewoutput
mode
infobox
cols(empty)
colsep(empty)
extargs(empty)
imagemode(empty)
imageinfo(empty)y(empty)
yes(empty)
on(empty)
non
offn
autoimageold(empty)y(empty)
yes(empty)
on(empty)
non
offn
autoimageplaced(empty)y(empty)
yes(empty)
on(empty)
non
offn
autoimageequipped(empty)y(empty)
yes(empty)
on(empty)
non
offn
extold(empty)
extplaced(empty)
extequipped(empty)
item2cell:anchor(empty)yesy
ony
n(empty)
no(empty)
off(empty)
item2cell:nolink(empty)yesy
ony
n(empty)
no(empty)
off(empty)
  1. Values with mapping will be stored and loaded as mapped value. Other values without mapping will be stored and loaded as-is.

Subpages

There are numerous supplemental subpages which are mainly used for formatting certain data:

See also