Module:GameInfo/Skills/doc: Difference between revisions
More actions
Created page with "Module:GameInfo/Skills renders the compiled “Skill card” payload used by {{#invoke:GameInfo|Skills}}. == Contract == This module expects a compiled JSON payload provided via <code>|data=</code>. It is strict (no backwards-compat / no schema guessing). == Entry point == GameInfo loads this module via Module:GameInfo and calls <code>render(frame)</code>. Typical invocation: <pre>{{#invoke:GameInfo|Skills|id=...|index=...|notes=...|data=...}}</pre> == TemplateSty..." Tags: Mobile edit Mobile web edit |
No edit summary Tags: Mobile edit Mobile web edit |
||
| Line 1: | Line 1: | ||
Module:GameInfo/Skills renders the compiled “Skill card” payload used by | Module:GameInfo/Skills renders the compiled “Skill card” payload used by [[Module:GameInfo]]. | ||
== | == Overview == | ||
This module | This module is a strict renderer for a compiled JSON payload (schema 1). It does not attempt compatibility fallbacks or schema guessing. | ||
It | |||
== | == Where it is used == | ||
This module is loaded by [[Module:GameInfo]] and called through the GameInfo entry points (for example the Skills route). | |||
== | == Styling == | ||
This module | This module declares a TemplateStyles source so the wrapper can load the correct CSS: | ||
<pre>STYLE_SRC = "Module:GameInfo/styles.css"</pre> | <pre><nowiki>STYLE_SRC = "Module:GameInfo/styles.css"</nowiki></pre> | ||
== | == Inputs == | ||
Arguments are read from <code>frame.args</code> (handled by [[Module:GameInfo]]). | |||
Required: | |||
* <code>data</code> — JSON string payload (must decode to an object and contain <code>schema</code> = <code>1</code>) | |||
* <code> | |||
Optional: | |||
* <code>id</code> — HTML id for the root card. If omitted, one is generated from display name + index. | |||
* <code> | * <code>index</code> — Used only for generating a stable id. Default <code>1</code>. | ||
* <code> | * <code>notes</code> — Wikitext content shown in the Notes popup. | ||
* <code>debug</code> — If set to <code>1</code>, error output includes a nowiki preview of the first ~480 chars of the raw JSON. | |||
* <code> | |||
* <code> | |||
Example usage (shown as text only): | |||
<pre><nowiki>{{#invoke:GameInfo|Skills|id=...|index=...|notes=...|data=...}}</nowiki></pre> | |||
== Images and missing | == Payload expectations (schema 1) == | ||
The payload is expected to contain the parts needed to build the full Skill card, including: | |||
If a file page | * <code>identity</code> (name/description/sprite) | ||
* <code>level</code> (default/max) | |||
* <code>meta_row</code> (four meta cells) | |||
* <code>requirements</code> and <code>users</code> (optional grouped lists) | |||
* <code>scaling_top</code>, <code>core_stats</code> | |||
* <code>tabs</code> (mechanics, keywords, effects, events) | |||
Values may be either: | |||
* Plain strings/numbers, or | |||
* Objects like <code>{"text":"..."}</code>, or | |||
* Series objects like <code>{"series":[...]}</code> (used for level-based selection and emitted as <code>data-series</code>) | |||
== Images and missing files == | |||
File pages are checked with a small existence cache. If a file page is missing, the renderer outputs a small “?” badge (<code>sv-miss</code>) instead of a redlink image. | |||
== Keyword pills == | == Keyword pills == | ||
Keyword pill strings in the form <code>Domain|Key</code> are expanded to: | Keyword pill strings in the form <code>Domain|Key</code> are expanded to the Definitions template: | ||
<pre>{{def|Domain|Key}}</pre> | <pre><nowiki>{{def|Domain|Key}}</nowiki></pre> | ||
Other strings are rendered as plain text. | Other strings are rendered as plain text. | ||
== Interactive UI hooks == | == Interactive UI hooks == | ||
The module | The module outputs semantic hooks used by site JS: | ||
* Popups | * Popups use <code>data-sv-toggle</code> and <code>sv-hidden</code> | ||
* Tabs | * Tabs use <code>data-tabs</code> and <code>data-tabs-root</code> | ||
* | * The custom level slider uses <code>data-sv-slider</code> and ARIA slider attributes | ||
[[Category:Lua modules]] | [[Category:Lua modules]] | ||
Latest revision as of 05:08, 25 February 2026
Module:GameInfo/Skills renders the compiled “Skill card” payload used by Module:GameInfo.
Overview
edit sourceThis module is a strict renderer for a compiled JSON payload (schema 1). It does not attempt compatibility fallbacks or schema guessing.
Where it is used
edit sourceThis module is loaded by Module:GameInfo and called through the GameInfo entry points (for example the Skills route).
Styling
edit sourceThis module declares a TemplateStyles source so the wrapper can load the correct CSS:
STYLE_SRC = "Module:GameInfo/styles.css"
Inputs
edit sourceArguments are read from frame.args (handled by Module:GameInfo).
Required:
data— JSON string payload (must decode to an object and containschema=1)
Optional:
id— HTML id for the root card. If omitted, one is generated from display name + index.index— Used only for generating a stable id. Default1.notes— Wikitext content shown in the Notes popup.debug— If set to1, error output includes a nowiki preview of the first ~480 chars of the raw JSON.
Example usage (shown as text only):
{{#invoke:GameInfo|Skills|id=...|index=...|notes=...|data=...}}
Payload expectations (schema 1)
edit sourceThe payload is expected to contain the parts needed to build the full Skill card, including:
identity(name/description/sprite)level(default/max)meta_row(four meta cells)requirementsandusers(optional grouped lists)scaling_top,core_statstabs(mechanics, keywords, effects, events)
Values may be either:
- Plain strings/numbers, or
- Objects like
{"text":"..."}, or - Series objects like
{"series":[...]}(used for level-based selection and emitted asdata-series)
Images and missing files
edit sourceFile pages are checked with a small existence cache. If a file page is missing, the renderer outputs a small “?” badge (sv-miss) instead of a redlink image.
Keyword pills
edit sourceKeyword pill strings in the form Domain|Key are expanded to the Definitions template:
{{def|Domain|Key}}
Other strings are rendered as plain text.
Interactive UI hooks
edit sourceThe module outputs semantic hooks used by site JS:
- Popups use
data-sv-toggleandsv-hidden - Tabs use
data-tabsanddata-tabs-root - The custom level slider uses
data-sv-sliderand ARIA slider attributes