Jump to content

Module:ModuleView/doc

From The Perfect Tower II

This is the documentation page for Module:ModuleView

Shows the game's modules from the game's own data, for {{Module}} and {{Module row}}. Used on Modules and the region pages.

The data comes live from the game's browser build on the game's CDN. The server reads it, and Lua gets it through the library mw.ext.gameData: getVersion(), getModule(key) (by id or by name), getModules(category) and getCategories(). It updates with each game build, without edits on the wiki. Text from the game is escaped. The styles are in Template:Module/styles.css (TemplateStyles).

Entry points

  • main(frame), for {{Module}}: id or name. text replaces the shown name. Names link to the module database on perfecttower2.com, or with link to a wiki page. view is one of:
    • icon (default): the name in the text, with a category swatch and a tooltip (category, type, max tier);
    • compact: a card with the short description;
    • full: a panel with the description, max tier, levels per tier, prices, target, tags and game version (numbers through Module:FormatNumber).
  • row(frame), for {{Module row}}: one table row. layout picks the columns: standard (default; with location, condition, formula), infinity (adds maxtier, gridlocation, gridcoordinates, unlockcost) or region (type, name and condition). note adds the wiki's note under the description.
  • _view(m, args) and _row(m, args, key, available): the same from a module table, for tests.

Values the game fills in at runtime show in brackets, such as [chance]; a parameter with that name (chance=20%) puts the wiki's value in its place. The templates' own parameter names (id, view, formula and so on) don't work for this.

An id or name the game doesn't have shows "Unknown module" and adds Category:Pages with unknown modules, except in the Template and Module namespaces. When the game data can't be read, the id or name shows as plain text.