Jump to content

Module:InventorySlot/doc

From SankoQuest Wiki
Revision as of 17:16, 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:InventorySlot

This is the documentation page for Module:InventorySlot.

Renders a single inventory-style item slot: a span.sanko-inventory-slot containing a 28 px item sprite (via Template:ItemSprite, linked to the item's page) and, when the quantity is anything other than 1, a span.sanko-inventory-qty badge.

Functions

slot

Wikitext entry point: {{#invoke:InventorySlot|slot|item=...|qty=...}}. item and qty may also be given as the first and second positional parameters.

Parameter Meaning Default
item (or first positional) Item name; also used as the sprite's link target. Empty renders an empty slot.
qty (or second positional) Quantity badge text. Hidden when empty or exactly 1. hidden

Example:

{{#invoke:InventorySlot|slot|Iron Bar|3}}

_slot

Module-to-module entry point: p._slot(frame, item, qty). Takes the same values as plain Lua arguments and returns the rendered HTML string. This is how Module:Recipe draws its input and output slots.

Used by

  • Module:Recipe — via require('Module:InventorySlot') and inventory._slot(frame, item, qty).
  • No template currently calls #invoke:InventorySlot directly.

Notes and sharp edges

  • The sprite is produced with frame:expandTemplate{ title = 'ItemSprite', ... }, so this module breaks if Template:ItemSprite is renamed or deleted, and the item name must exist in Module:Sprite/Item or the slot shows the missing-sprite ? placeholder.
  • The quantity check is a string comparison: only the exact string 1 (or empty) is suppressed. Values like 01 or will display. The value is shown verbatim — no number formatting.
  • Sprite size is fixed at 28 px and the link always targets the item name; neither is parameterized.