Template:GetItemInfo

来自Terraria Wiki
(重定向自Template:Iteminfo
跳转到导航 跳转到搜索
This template is i18n-ready, which means it is easy to localize for different languages. Please see I18n & l10n for templates to learn more.
See Template:GetItemInfo/l10n for the localization of this template.
此模板使用了 Lua。
此模板使用了用 Lua 编程语言编写的 模块:Iteminfo。要了解 Lua 的更多信息,参见 en:Terraria Wiki:Lua
Important.svg
CAUTION: Terraria Wiki code is complex!!!
If you want to use this code on another wiki, wiki.gg staff are not able to assist you.
Please consider picking a different wiki to adapt code from, or making your own templates!
Remember that content on a wiki is more important than fancy formatting.
Template-info.svg 文档 以下文档来自Template:GetItemInfo/doc。(编辑 | 历史

This template is used to dynamically and reliably display a stat of an item's stat. It is based on Module:Iteminfo, which takes its data directly from the source code of Terraria, facilitating display of stats without having to change them in case of updates. The database is synchronized with the 电脑版 电脑版 1.4.4.9 of Terraria.

{{iteminfo}} can be used as a shortcut for this template.

Usage

{{ iteminfo | <ID or name of the item> | <specific stat> | format = y/yes (optional) | raw = y/yes (optional) }}

or

{{ iteminfo | id = <item ID> | field = <specific stat> | format = y/yes (optional) | raw = y/yes (optional) }}

First unnamed parameter / id

Name or ID of the item. If it is the ID, use the parameter $id instead, because it is faster. If it is the name, it must be valid per Template:ItemIdFromName.

Second unnamed parameter / field

Specific stat to be displayed. See Stats below for a list of all available stats, and All stats below for how to output all stats.

format

Use this parameter to wrap the output in the magic word {{formatnum:}}.

raw

Use this parameter to output the value exactly as it exists in the source code, for instance for further calculations with the {{#expr:}} parser function. See Module:Iteminfo § Stats for information about how to interpret the "raw" values, and beware that the buff name, buy, and sell stats are not available as "raw" values.[1] This parameter can be used together with $format.

Stats

All available stats are listed below. All of them are case-sensitive. Some stats have aliases, like id or itemid – any of those can be used.

Stat
(case-sensitive)
Example value Notes
accessory
acc
true If set, then the item is an accessory.
alpha 30
ammo 40 Ammo ID (used in the field useAmmo). (not only, e.g. 353, 154)
autoswing
auto
autoreuse
autoReuse
true If set, then the item is capable of autoswing.
axe
axe power
axepower
70% Axe power, formatted with {{percent}}.
backSlot 24 Back slot ID.
bait
bait power
baitpower
20% Bait power, formatted with {{percent}}.
balloonSlot 9 Balloon slot ID.
beardSlot 2 Beard slot ID.
body slot
bodyslot
bodySlot
68 Body (waist) slot ID.
buff duration
buffduration
bufftime
buffTime
10 分钟 Time that the buff granted by the item will be in effect, formatted with {{duration}}.
buff id
buffid
bufftype
buffType
104 Buff ID of the buff granted by the item.
buff name
buffname
buff
buffName
Obsidian Skin English name of the buff granted by the item.
This stat does not work with |raw=yes.
buy
price
buyValue
50 GC Purchase price in coins or Defender Medals, formatted with {{coin}} or {{dm}}. Note that this stat may be set even if the item cannot be purchased.
This stat does not work with |raw=yes. Use {{buy expr|raw=yes}} instead.
carttrack
cartTrack
true If set, then the item is a Minecart Track (including Pressure Plate Track and Booster Track).
channel true If set, then the item can/needs to be used continuously ("channeling cast"); this is different from autoswing, though! Is set for flails and yoyos, chainsaws and drills, Magic Missile and its upgrades, Dirt Rod, Piranha Gun, Chlorophyte Jackhammer, Laser Machinegun, Charged Blaster Cannon, Flying Knife, Medusa Head, Arkhalis, Portal Gun, Vortex Beater, Phantasm, The Grand Design, Last Prism, Sleepy Octopod, Ghastly Glaive, Phantom Phoenix, Sky Dragon's Fury. Is also set for certain pet/light pet/mount-summoning items, since they will continuously be in effect.
consumable true If set, then the item is consumable, which means that it can (but not necessarily must) be used in a manner that causes it to leave the player's inventory. One item is removed from the stack each time the item is used. Crucially, this stat is distinct from the tooltip label "Consumable" that is displayed in-game.
craftable true If set, then the item can be crafted.
You can also use {{recipes/exist|result=<item name>}} to retrieve this info.
crit
critical
14% Critical strike chance, formatted with {{percent}}. The default value is 0% for items whose damage stat is -1, and 4% for all other items.
damage
dmg
53 Damage.
dd2summon
DD2Summon
true If set, then the item is one of the Tavernkeep's sentry-summoning weapons.
defense 13 Defense.
dye 1 If non-zero, then the item is a dye.
expert true If set, then the item's rarity is displayed as 彩虹(稀有度级别:Expert) in-game.
faceSlot 13 Face slot ID.
fishing power
fishingpower
fishing
fishingpole
fishingPole
35% Fishing Power, formatted with {{percent}}.
flame true Is set for each kind of Torch and for Water, Peace, Platinum, Shadow, and regular Candles. Interestingly, it is also set for the Brand of the Inferno and Nightglow.
frontSlot 3 Front slot ID.
glowMask 238
hair dye
hairdye
hairDye
1 Is set to 0 for the Hair Dye Remover and 1 for other Hair Dyes.
hammer
hammer power
hammerpower
45% Hammer power, formatted with {{percent}}.
handOffSlot 7 Hand-off slot ID.
handOnSlot 12 Hand-on slot ID.
hasVanityEffects true Is set for Music Boxes, strings, Golf Balls, Critter Shampoo, Rainbow Cursor, Moon Charm and Neptune's Shell as well as their upgrades, Yoraiz0r's Scowl, Leinfors' Luxury Shampoo, Angel Halo, Fake Unicorn Horn, Hellfire Treads, Royal Scepter, Terraspark Boots, Inner Tube, Bundle of Horseshoe Balloons, and Radio Thing.
head slot
headslot
headSlot
219 Head slot ID.
heallife
healLife
100 Number of health points restored by the item when used.
healmana
healMana
50 Number of mana points restored by the item when used.
height 40 Height of the item sprite, in pixels.
holdstyle
holdStyle
2 How the item is held by the player when used or selected in the inventory. See Use Style IDs.
id
item id
itemid
type
42 Item ID.
You can also use {{itemIdFromName|<item name>}} to retrieve this info.
internal name
internalname
internalName
AntlionClaw Internal item name.
You can also use {{itemInternalNameFromId|<item ID>}} to retrieve this info.
knockback
kb
knockBack
3.5 Knockback.
Use {{knockback|{{iteminfo|...}}}} to obtain the in-game textual description of the knockback value.
leg slot
legslot
legSlot
205 Leg slot ID.
liferegen
lifeRegen
2 Is set for the Band of Regeneration and Charm of Myths.
magic true If set, then the item deals magic damage.
makenpc
makeNPC
616 If non-zero, then this value is the NPC ID of the NPC spawned by the item when used. For example, a value of 46 means that the item will spawn a Bunny NPC when used.
mana 5 Number of mana points consumed by the item upon use.
material true If set, then the item is a crafting material.
You can also use {{recipes/exist|ingredient=<item name>}} to retrieve this info.
mech true If set, then the item is a mechanism, which means that it shows wire and Actuators when held.
melee true If set, then the item deals melee damage.
mount id
mountid
mount
mounttype
mountType
6 Mount ID of the mount summoned by the item when used.
name Terra Blade English item name.
You can also use {{itemNameFromId|<item ID>}} to retrieve this info.
neckSlot 8 Neck slot ID.
netID
nomelee
noMelee
true If set, then the item is not allowed to deal damage with its sprite. Typically set for ranged weapons, which rely on their projectiles to deal damage, instead.
notammo
notAmmo
true Is only set for coins, Sand Blocks, and Ale. Aside from Ale, these share the trait of not being able to be placed in the ammo slots of the inventory, even though they are used as ammunition. Ale can be placed in those slots, though.
nousegraphic
noUseGraphic
true If set, then the item's sprite is drawn while it is in use. Is set for thrown weapons like Dynamite, because they are immediately tossed to the ground to create the illusion of being used.
nowet
noWet
true If set, then the item cannot be held/placed underwater: Unicorn on a Stick, every kind of Candle, and every kind of Torch (without Cursed and Ichor Torch). However, is also set for timers which can be placed underwater.
paint 7 If non-zero, then this value is the item's paint ID.
paintCoating 2 If non-zero, then this value is the item's coating ID.
pickaxe power
pickaxepower
pickaxe
pick power
pickpower
pick
65% Pickaxe power, formatted with {{percent}}.
potion true If set, then no other items with this attribute may be used until the cooldown elapses. Is set for healing items.
projectileid
projectile id
shoot
377 If non-zero, then this value is the projectile ID of the projectile fired by the item.
questitem
questItem
true Is set for quest fish.
range bonus
rangebonus
tileboost
tileBoost
-1 范围 Tile range bonus.
ranged true If set, then the item deals ranged damage.
rare
rarity
Orange(稀有度级别:3) Rarity of the item, formatted with {{rare|cate=no}}. You can pass |cat=y (or |cate=y or |category=y) to {{iteminfo}} to enable {{rare}}'s categorization. For items with the expert stat, this value is merely their "internal" rarity; in-game they are displayed as having the 彩虹(稀有度级别:Expert) rarity.
research
sacrifices
100 Required number to research the item.
scale 0.85
sell
value
10 GC Sell value, formatted with {{coin}}.
The sell stat does not work with |raw=yes. Use {{sell expr|raw=yes}} instead. (The value stat works normally with |raw=yes, but it does not represent the item's sell value. Check Module:Iteminfo#stat_value.)
sentry true If set, then the item is a sentry-summoning weapon.
shieldSlot 4 Shield slot ID.
shoeSlot 16 Shoe slot ID.
shopCustomPrice 60 Purchase price, in Defender Medals. Is only set for items which are purchased with Defender Medals.
The buy stat contains this value, automatically formatted with {{dm}}.
shootsEveryUse true Is set for certain projectile melee weapons.
sound
sounduse
use sound
usesound
UseSound
Sound effect that is played when the item is used, formatted with {{sound}}. Note that the listed sound is only the base sound; it might be played with modified pitch and volume in-game. A few items have multiple possible sound effects; in that case all of them are listed.
stack
maxstack
maxStack
9999 Maximum stack limit.
stringcolor
stringColor
13 String ID.
summon true If set, then the item deals summon damage.
tile id
tileid
tile
createtile
createTile
90 Tile ID and sub-ID of the tile that the item produces when placed.
tile sub id
tile subid
tilesubid
placestyle
placeStyle
24
tile wand
tilewand
tileWand
1124 Item ID of the block placed by the item, for block-placing wands.
tool speed
toolspeed
useTime
15 Tool speed for tools, (internal) use time for others. How long it takes to use the item, in ticks[2]. While the item is in use, the player cannot take any other actions.
Note the distinction between useTime and usetime!
tooltip
ToolTip
This value is currently always empty. It is reserved for the future.
Use {{itemTooltip}} to retrieve tooltips.
uniquestack
uniqueStack
true Is set for quest fish. See Fishing § Fishing quests for details regarding the special quality of these items.
use delay
usedelay
reusedelay
reuseDelay
5 Use delay, i.e. time in ticks[2] before the item may be used again. Is set for Clockwork Assault Rifle, Medusa Head, Last Prism, Sky Fracture, Betsy's Wrath, and various summon weapons.
use style
usestyle
useStyle
Hold out How the item is held by the player when used or selected in the inventory. See Use Style IDs.
use time
usetime
use
useanimation
useAnimation
12 How long it takes the animation to play for the item, in ticks[2]. An interesting quirk is that if the useTime is lower than the useAnimation, it will be activated one or more times per use (e.g. Golden Shower). If the item is an auto-swinging sword, then the use time of the item (that is displayed in the game and on the wiki) is useAnimation - 1.
Note the distinction between usetime and useTime!
Use {{use time|{{iteminfo|...}}}} to obtain the in-game textual description of the use time value.
useammo
useAmmo
Bullets Type of ammunition the item uses. For common groups of ammo items, the translated name according to the localization (e.g. "Arrows" in English, "Pfeile" in German) is returned by the template. For other, singular ammo items, the untranslated English name (e.g. "Candy Corn" in English, "Candy Corn" in German) is returned.
useturn
useTurn
true If set, then the player will turn to face the direction they are moving in when the item is used. If this stat is not set, then the player cannot switch directions while the item is in use. For example, the player can switch directions while using a sword (useTurn set), but not while using a spear (useTurn not set).
vanity true If set, then the item is a vanity item.
velocity
shootspeed
shootSpeed
14 Velocity of the projectile fired by the item, in pixels per tick[2]. For example, a value of 6 means that the projectile initially moves at 31 mph (22.5 格/秒). Note that this is merely the initial velocity of the projectile upon spawning; it may change afterwards depending on the projectile's behavior (such as the Demon Scythe, which speeds up).
Use {{mph|{{iteminfo|...}} pixels}} to obtain the velocity as it would be displayed in-game by the Stopwatch and its upgrades.
waistSlot 16 Waist slot ID.
wall id
wallid
wall
createwall
createWall
313 Wall ID of the wall that the item produces when placed.
width 40 Width of the item sprite, in pixels.
wingSlot 39 Wing slot ID.

Examples

Specific stats

Code Result
The Regeneration Potion grants the [[{{iteminfo|Regeneration Potion|buff}}]] buff for {{iteminfo|id=289|field=buff duration}} and can be sold for {{iteminfo|Regeneration Potion|sell}}. The Regeneration Potion grants the Regeneration buff for 8 分钟 and can be sold for 2 SC.
{{iteminfo|Ballista Cane|buy}} 150000*15 护卫奖章
{{iteminfo|Ballista Cane|sell}} 5 GC

Maximum ID

Use {{iteminfo/maxId}} to display the greatest valid item ID: 5455. This is also possible via {{iteminfo||count}}, but note that this method is deprecated.

All stats

Use {{item stats table}} to display all available stats of an item.

  • {{item stats table|Terra Blade|collapsible=yes|style=min-width:270px}} results in:
Terra Blade (ID: 757)
Stat Value
accessory
active 1
alpha 0
ammo 0
autoReuse 1
axe 0
backSlot -1
bait 0
balloonSlot -1
beardSlot -1
bodySlot -1
buffTime 0
buffType 0
buy
cartTrack
channel
consumable
craftable 1
createTile -1
createWall -1
crit 0
damage 85
DD2Summon
defense 0
dye 0
expert
faceSlot -1
fishingPole 0
flame
frontSlot -1
glowMask -1
hairDye -1
hammer 0
handOffSlot -1
handOnSlot -1
hasVanityEffects
headSlot -1
healLife 0
healMana 0
height 30
holdStyle 0
instanced
internalName TerraBlade
isAShopItem
knockBack 6.5
lavaWet
legSlot -1
lifeRegen 0
magic
makeNPC 0
mana 0
manaIncrease 0
material 1
maxStack 1
mech
melee 1
mountType -1
name Terra Blade
neckSlot -1
netID 757
noMelee 1
notAmmo
noUseGraphic
noWet
paint 0
paintCoating 0
pick 0
placeStyle 0
potion
prefix 0
questItem
ranged
rare 8
rarity 0
reuseDelay 0
sacrifices 1
scale 1
sentry
shieldSlot -1
shoeSlot -1
shoot 985
shootsEveryUse 1
shootSpeed 12
shopCustomPrice
shopSpecialCurrency -1
stringColor
summon
tileBoost 0
tileWand -1
tooltipContext -1
type 757
uniqueStack
useAmmo 0
useAnimation 18
UseSound Item_1
useStyle 1
useTime 18
useTurn
value 1000000
vanity
waistSlot -1
wet
wetCount 0
width 30
wingSlot -1

See also

Footnotes

  1. See Template talk:GetItemInfo#Issue about raw price info display for an explanation of this issue.
  2. 2.0 2.1 2.2 2.3 嘀嗒是可由软件计数的时间单位。《泰拉瑞亚》的大多数更新逻辑都会每嘀嗒发生一次。一个嘀嗒的长度为 1/60 秒,因此一秒钟内有 60 嘀嗒,一分钟内有 3600 嘀嗒。