Terraria Wiki:Cargo tables

From Terraria Wiki
Jump to navigation Jump to search

The Terraria Wiki stores some data about Terraria in databases via the MediaWiki extension Cargo. The data is usually stored in single, central locations on the wiki and can be queried on any page, facilitating quick and dynamic updates.

List of tables

All available databases (or tables) are listed at Special:CargoTables. They are described below.

Items

Items
Database Special:CargoTables/Items
Manual querying Special:Drilldown/Items

The Items Cargo table contains data about all items in the game, including attributes like damage, max stack, use time, and numerous others.

The data is entered into this table using {{item infobox}}. Virtually all articles about items use one or more {{item infobox}}es to display item information, and in the background that information is stored to the Cargo table. Many of the parameters of {{item infobox}} directly store their value in the respective column of the Cargo table.

For example, consider the following transclusion of {{item infobox}} on the page Dirt Block:

{{item infobox
| name = Dirt Block
| id = 2
| type = Block / Crafting material
| autoswing = yes
| stack = 9999
| research = 100
| rare = {{rare|0}}
| use = 15
| placeable = yes
| width = 1 | height = 1
}}

This transclusion would both:

  • display this data in the visible infobox and
  • store this data to the Cargo table in the background.

The table row (or database entry) in the Items table for the Dirt Block would then look something like this (not all columns included, for brevity):

Page itemid name type autoswing stack damage damagetype knockback research rare buy sell use placeable placedwidth placedheight
Dirt Block 2 Dirt Block block • crafting material Yes 999 100 0 15 Yes 1 1

This is the essence of the Items table:

Almost all of the Items Cargo table's columns are directly connected to the {{item infobox}} template parameters.

For instance, if you want to list all block items by querying the Items Cargo table for block in the type column, and you notice that the Dirt Block does not show up, then make sure that block is in the | type = parameter of the Dirt Block's {{item infobox}}.

There are more details about the behavior of {{item infobox}} which are explained in the following section, but the principle above still applies.

NPCs

NPCs
Database Special:CargoTables/NPCs
Manual querying Special:Drilldown/NPCs

Recipes

Recipes
Database Special:CargoTables/Recipes
Manual querying Special:Drilldown/Recipes

The Recipes Cargo table contains data about all crafting recipes in the game, including the relevant attributes for each one – crafting result, result amount, ingredients, crafting station, etc.

The data is entered into this table on recipe registration pages via {{recipes/register}}. These pages are subpages of the page Recipes; the full list can be found at Template:Recipes/register § Notes. For instance, the page Recipes/Furnace/register contains the registrations of all recipes that require a Furnace as crafting station. A typical recipe registration there looks like this:

-->{{recipes/register
| result = Luminite Brick | resultid = 3461 | amount = 5
| station = Furnace
| Stone Block | 5
| Luminite | 1
}}<!--

This transclusion stores the data for the Luminite Brick's crafting recipe to the Cargo table. The second line defines the name and item ID of the crafting result item, as well as the amount obtained from one crafting operation. The second line defines the crafting station and the lines below the ingredient items for one crafting operation (name and amount for each one). The table row (or database entry) in the Recipes table for this Luminite Brick recipe would then look something like this (not all columns included, for brevity):

Page result resultid amount station ingredients ings args
Recipes/Furnace/register Luminite Brick 3461 5 Furnace ¦Stone Block¦ • ¦Luminite¦ ¦Luminite¦1^¦Stone Block¦5 Stone Block¦5^Luminite¦1

If a crafting recipe does not show up in a query unexpectedly, or with wrong information, it likely needs to be fixed at the registration page. Locate the respective page in the list at Template:Recipes/register § Notes via the recipe's crafting station and edit/add the {{recipes/register}} transclusion there.

Drops

Drops
Database Special:CargoTables/Drops
Manual querying Special:Drilldown/Drops

Exclusive

Exclusive
Database Special:CargoTables/Exclusive
Manual querying Special:Drilldown/Exclusive

The Exclusive Cargo table contains data about the game platforms that content is available on. Older game platforms lack a lot of the content that was later added to modern platforms, and also have some exclusive content.

The data is first entered into this table on articles about Terraria patches using {{patch infobox}}, specifically the $version parameter. For example, the transclusion of the template on the page about 1.3.0.1 looks something like this:

{{patch infobox
| versions = desktop-console-mobile
<!-- other parameters omitted for brevity -->
}}

Internally, {{patch infobox}} passes these versions to {{exclusive}}, which stores them to the Cargo table (not all columns included, for brevity):

Page pagename desktop console oldgen mobile 3ds japanese
1.3.0.1 1.3.0.1 Yes Yes Yes

Articles about other entities (i.e. non-patch articles) transclude {{exclusive}} and reference the existing rows. For example, the page Moon Lord could contain {{exclusive|1.3.0.1}}, which would instruct the template to fetch the exclusivity data for "1.3.0.1" and copy it for the Moon Lord:

Page pagename desktop console oldgen mobile 3ds japanese
1.3.0.1 1.3.0.1 Yes Yes Yes
Moon Lord Moon Lord Yes Yes Yes

Many articles also reference non-patch rows, e.g. the page about the True Eye of Cthulhu could contain {{exclusive|Moon Lord}} (since it is a minion of the Moon Lord), which would similarly instruct the template to fetch the exclusivity data for "Moon Lord" and copy it for the True Eye of Cthulhu. This can be continued several times, if necessary.

Note that {{exclusive}} does not query the Cargo database directly when fetching exclusivity information. Instead, it consults a cached snapshot of it, Module:Exclusive/data, for performance reasons. This means that that module needs to be updated after every modification of the database, as explained in the module documentation.

So, taking the previous example chain of "True Eye of Cthulhu" → "Moon Lord" → "1.3.0.1" and assuming that the exclusivity information for the True Eye of Cthulhu is missing, troubleshooting would go as follows:

  1. Start at the end of the chain – ensure that the data for "1.3.0.1" is present. The {{patch infobox}} on the 1.3.0.1 page must define the versions; a null-edit might be required.
  2. Update the cached snapshot, Module:Exclusive/data, if necessary. It must contain a line starting with ["1.3.0.1"] = .
  3. Ensure that the data for "Moon Lord" is present. It might be necessary to null-edit the Moon Lord page.
  4. Update the cached snapshot again if necessary. It must contain a line starting with ["Moon Lord"] = .
  5. Finally, after null-editing the True Eye of Cthulhu page, its data should no longer be missing in the Cargo table. You should also update the cached snapshot if necessary; it should contain a line starting with ["True Eye of Cthulhu"] = .

Imageinfo

Imageinfo
Database Special:CargoTables/Imageinfo
Manual querying Special:Drilldown/Imageinfo

The Imageinfo Cargo table contains data about images uploaded to the wiki. MediaWiki also records this data in its internal databases, which can be queried using the parser functions {{#ifexist:}} and {{#imgw:}}/{{#imgh:}}. However, those parser functions are "expensive", which means that they take up a significant amount of resources and can therefore only be used a limited number of times per page. The Imageinfo Cargo table provides an alternative, as Cargo queries are not "expensive".

See also