如中文 wiki 信息过时,可以参考英文 wiki 对应页面。
见 Terraria Wiki:项目/1.4.5 获取 wiki 状态与更新指南
Template:Iteminfo query
This template is used for querying the iteminfo database. This is useful for obtaining information that is not available in the Items cargo table.
Usage
{{ iteminfo query | stat = <statistic> | value = <stat value> | valuenot = <stat value> | get = count/name/id | sort = name/id }}
- stat, value, valuenot
Parameters for the query. The template fetches all items whose $stat value is equal to $value. For instance, with |stat=noMelee|value=true it finds all items that have a noMelee value of true. Alternatively, $valuenot allows searching for items whose $stat value is not equal to the specified value. Only one out of $value and $valuenot can be used, not both. See Module:Iteminfo for a list of all available stats and possible values.
- get
Format of the output of the items that match the condition: either the number of items (|get=count), a list of English item names (|get=name; this is the default), or a list of item IDs (|get=id). Lists are returned as arrays from Extension:ArrayFunctions, which can be further processed with the extension's parser functions, such as {{#af_foreach:}}.
- sort
Order of the item list. Items are sorted either by name (|sort=name) or by item ID (|sort=id; this is the default). This parameter has no effect if |get=count is used. On language wikis, item names are sorted in the local language, even though the output (with |get=name) is in English. This facilitates passing the item names to {{item}}, which expects English names as input and translates them itself.
Examples
| Code | Result |
|---|---|
{{iteminfo query|stat=noMelee|value=true|get=count}}
|
675 |
{{iteminfo query|stat=sacrifices|valuenot=0|get=count}}
|
6087 |
{{#af_print:{{iteminfo query|stat=stringColor|valuenot=false}}}}
|
|
{{#af_print:{{iteminfo query|stat=useAmmo|value=283}}}}
|
|
{{#af_join:{{iteminfo query|stat=useAmmo|value=283|get=id}}}}
|
281, 986, 3007, 3008 |
{{options/set|itemlist|width=12em}}
{{#af_template:itemlist| {{#af_map: {{iteminfo query|stat=useAmmo|value=283|get=id|sort=name}} |id| {{item|id={{#af_show:{{{id}}}}}}} }}}} {{options/reset|itemlist}} |