Template:ItemIdSet
This template is used to access the database of item ID sets at Module:Iteminfo/idSets/data. The database reflects the Terraria source code (Terraria.ID.ItemID.Sets plus a few other sets). For instance, the set IsLavaImmuneRegardlessOfRarity consists of a list of items that are never destroyed when dropped in lava.
Either the entire contents of a set can be retrieved (often useful for lists/boolsets like IsLavaImmuneRegardlessOfRarity) or the value of a specific item in a set (often useful for value sets like BonusMeleeSpeedMultiplier).
Usage
Value of a specific item
{{ itemIdSet | <set name> | item = <item ID> }}
Note that this mode only supports simple sets of scalar values (Booleans, integers, floats). Nested sets like flowerPacketInfo cannot be queried with this mode; use the second mode with a combination of array functions for that.
Boolean values are returned as true/false. Use {{bool}} on the result, e.g. {{#if: {{bool|{{itemIdSet|...}}}} | setValue is true | setValue is false }}.
- First unnamed parameter
Name of the set to query.
- item
ID of the item to query.
Entire content of a set
{{ itemIdSet | <set name> | list = y/yes | sort = id/name (optional) }}
This mode returns the set as an array from Extension:ArrayFunctions. There are a variety of parser functions to further process the returned array. The simplest is {{#af_print:}}, which displays the array in a human-readable format. {{#af_foreach:}} is almost always useful to iterate over the set.
Beware that the values in value sets are usually represented as their respective data types from Extension:ArrayFunctions. Wrapping scalar values in {{#af_show:}} ensures that they are displayed as expected. (This does not concern the keys of value sets, which are technically integers but are always forcibly treated as strings.)
- First unnamed parameter
Name of the set to query.
- list
Ignores the values of the set and only returns the keys, i.e. the item IDs. This is useful for boolsets like IsLavaImmuneRegardlessOfRarity, where the value (which is always true) is unimportant.
- sort
Order of the set, either item ID (id) or item name (name) in the local wiki language. |sort=id is the default if this parameter is not specified. A blank (|sort=) or unrecognized (e.g. |sort=foobar) parameter value will result in the contents being ordered randomly.
Examples
Value of a specific item
| Code | Result |
|---|---|
{{itemIdSet|ShimmerTransformToItem|item=3460}} |
947 |
{{itemIdSet|Workbenches|item=36}} |
true |
{{itemIdSet|Workbenches|item=1}} |
false |
{{bool|{{itemIdSet|Workbenches|item=36}}}} |
y |
{{bool|{{itemIdSet|Workbenches|item=1}}}} |
|
{{itemIdSet|KillsToBanner|item=2971}} |
150 |
{{itemIdSet|BannerStrength|item=3838}} |
0.2 |
Entire content of a set
| Code | Result |
|---|---|
{{#af_print:{{itemIdSet|GrassSeeds}}}}
|
|
{{#af_print:{{itemIdSet|GrassSeeds|list=y}}}}
|
|
{{#af_join:{{itemIdSet|GrassSeeds|list=y}}|,\s}}
|
59, 62, 194, 195, 369, 2171, 5214 |
{{#af_foreach:{{itemIdSet|GrassSeeds|list=y}}||id|{{itemNameFromId|{{{id}}}}}|delimiter=<br/>}}
|
Corrupt Seeds Grass Seeds Mushroom Grass Seeds Jungle Grass Seeds Hallowed Seeds Crimson Seeds Ash Grass Seeds |
{{#af_foreach:{{itemIdSet|GrassSeeds|list=y|sort=name}}||id|{{itemNameFromId|{{{id}}}}}|delimiter=<br/>}}
|
Ash Grass Seeds Corrupt Seeds Crimson Seeds Grass Seeds Hallowed Seeds Jungle Grass Seeds Mushroom Grass Seeds |
{{#af_foreach:{{itemIdSet|BonusMeleeSpeedMultiplier}}|id|value|{{{id}}} = {{{value}}}|delimiter=<br/>}}Caution with scalar values in value sets! They are represented in their internal format.
|
757 = float__^__0.75 1827 = float__^__0.5 3013 = float__^__0.25 3106 = float__^__0.33 |
{{#af_foreach:{{itemIdSet|BonusMeleeSpeedMultiplier}}|id|value|{{{id}}} = {{#af_show:{{{value}}}}}|delimiter=<br/>}}Properly handling scalar values in value sets.
|
757 = 0.75 1827 = 0.5 3013 = 0.25 3106 = 0.33 |
<ul>{{#af_foreach:{{itemIdSet|ShimmerCountsAsItem}}|id|value|<li>{{itemNameFromId|{{{id}}}}} → {{itemNameFromId|{{#af_show:{{{value}}}}}}}</li>}}</ul>
|
|