Jump to content

Module:Sprite/Item/doc

From SankoQuest Wiki
Revision as of 17:15, 5 July 2026 by GrizzledAlchemistb40f9cb5 (talk | contribs) (module documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the documentation page for Module:Sprite/Item

This is the documentation page for Module:Sprite/Item.

A pure data module (no functions): it returns a Lua table describing the Sanko item sprite atlas. It is consumed by Module:Sprite via mw.loadData('Module:Sprite/Item') and, through that, by Template:ItemSprite and Template:Sprite.

Table layout

Key Meaning
url Atlas asset path (/w/sanko-assets/Sanko_item_atlas.svg). Not read by Module:Sprite; the image is applied by the .sanko-sprite site CSS.
image Wiki file name of the atlas (Sanko item atlas.svg).
cell Sprite cell size in pixels (32).
columns Atlas columns (4).
width, height Native atlas dimensions in pixels (128 × 1056).
items Map of exact item name → { item_id, x, y }, where x/y are the sprite's pixel offsets in the atlas at native size.

Usage

local itemData = mw.loadData('Module:Sprite/Item')
local entry = itemData.items['Bronze Axe']
-- entry = { item_id = 4, x = 96, y = 0 }

Notes and sharp edges

  • Keys are exact display names — case, spacing, and punctuation sensitive. ['Bronze Axe'] works; ['bronze axe'] renders the missing-sprite placeholder.
  • item_id values track the game item catalog and are not contiguous (gaps exist, e.g. 29 and 98–100 are unassigned here); Module:Sprite only uses x/y, not item_id.
  • NA, NA2, NA3 are placeholder atlas cells, not real items.
  • When adding an entry, its x/y must match the sprite's actual cell in the atlas image (columns advance x by 32, rows advance y by 32), and height must cover any new rows. Item IDs and catalog names are bot/API-owned fields per the style guide — keep them in sync with the catalog rather than inventing values.
  • Loaded with mw.loadData, so the table must stay static data only (no functions, no metatables).