Moduł:Iteminfo/data/doc

Z Terraria Wiki
Przejdź do nawigacji Przejdź do wyszukiwania

Lua.svgTo jest strona dokumentacji dla Moduł:Iteminfo/data.


Internal sub-module of Module:Iteminfo, which heavily relies on this module.

Provides a database with all statistics of every item in Terraria, taken from the source code. The database code was generated by Module:Iteminfo/datagen.

This database needs to be re-generated when the data generator (Module:Iteminfo/datagen) is updated, which is usually only the case after a Terraria patch. Re-generate it as follows:

  1. First invoke the genMeta function of the data generator. To do this, put the following wikicode on a sandbox page and save/preview it: <div style="white-space:pre">{{#invoke:Iteminfo/datagen|genMeta}}</div>. Copy the output and replace the respective lines here below the "DATA START" line with it.
  2. Then invoke the gen function, which generates the actual data for a set of items. This function expects an item ID to start at and one to end at.
    • If you only want to re-generate the database entry of one item (e.g. the item with an ID of 42), put the following wikicode on a sandbox page and save/preview it: <div style="white-space:pre">{{#invoke:Iteminfo/datagen|gen|42|42}}</div>. Copy the output and replace the respective lines here with it.
    • If you want to re-generate the database entries of several items (e.g. starting with the item with an ID of 142 and ending with the item with an ID of 163), put the following wikicode on a sandbox page and save/preview it: <div style="white-space:pre">{{#invoke:Iteminfo/datagen|gen|142|163}}</div>. Copy the output and replace the respective lines here with it.
    • If you want to re-generate the entire database (i.e. all items), then you will need to do so in chunks, as the data generator cannot handle all items at once. Put the following wikicode on a sandbox page and save/preview it: <div style="white-space:pre">{{#invoke:Iteminfo/datagen|gen|0|99}}</div>. Copy the output and replace the respective lines here with it. Repeat with |100|199, then |200|299, and so on, until you reach the greatest item ID (5455). Also feel free to try a larger interval.
Generally, the entire database should always be re-generated instead of only parts of it, to ensure it stays up-to-date (unless you know for sure that only a part has changed).