Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Join the Playtest on Steam Now: SpiritVale

Module:GameInfo/Skills/doc: Difference between revisions

From SpiritVale Wiki
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 {{#invoke:GameInfo|Skills}}.
Module:GameInfo/Skills renders the compiled “Skill card” payload used by [[Module:GameInfo]].


== Contract ==
== Overview ==
This module expects a compiled JSON payload provided via <code>|data=</code>.
This module is a strict renderer for a compiled JSON payload (schema 1). It does not attempt compatibility fallbacks or schema guessing.
It is strict (no backwards-compat / no schema guessing).


== Entry point ==
== Where it is used ==
GameInfo loads this module via [[Module:GameInfo]] and calls <code>render(frame)</code>.
This module is loaded by [[Module:GameInfo]] and called through the GameInfo entry points (for example the Skills route).
Typical invocation:
<pre>{{#invoke:GameInfo|Skills|id=...|index=...|notes=...|data=...}}</pre>


== TemplateStyles ==
== Styling ==
This module sets:
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>
GameInfo will emit that TemplateStyles tag before the rendered output.


== Required arguments ==
== Inputs ==
* <code>data</code>: JSON string payload (must decode to an object with <code>schema=1</code>)
Arguments are read from <code>frame.args</code> (handled by [[Module:GameInfo]]).


== Optional arguments ==
Required:
* <code>id</code>: HTML id for the root card. If omitted, one is generated from display name + index.
* <code>data</code> — JSON string payload (must decode to an object and contain <code>schema</code> = <code>1</code>)
* <code>index</code>: Used only for generating a stable id. Default <code>1</code>.
* <code>notes</code>: Wikitext content shown in the Notes popup.
* <code>debug</code>: If <code>1</code>, error output includes a nowiki preview of the first ~480 chars of the raw JSON.


== Payload schema (schema=1) ==
Optional:
At minimum, the payload should include:
* <code>id</code> — HTML id for the root card. If omitted, one is generated from display name + index.
* <code>identity</code>: display name, description, sprite info
* <code>index</code> — Used only for generating a stable id. Default <code>1</code>.
* <code>level</code>: default/max (used for slider + value selection)
* <code>notes</code> — Wikitext content shown in the Notes popup.
* <code>meta_row</code>: 4 meta cells (icon + label lines)
* <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>requirements</code> / <code>users</code>: grouped lists (optional)
* <code>scaling_top</code>: damage/modifier/scaling lines (supports series values)
* <code>core_stats</code>: list of core stat cells (supports series values)
* <code>tabs</code>: mechanics grid, keyword pills, effects/events reference cards


Values may be plain strings/numbers, or objects like:
Example usage (shown as text only):
* <code>{"text":"..."}</code>
<pre><nowiki>{{#invoke:GameInfo|Skills|id=...|index=...|notes=...|data=...}}</nowiki></pre>
* <code>{"series":[...]}</code> (emits <code>data-series</code> for JS and selects by level)


== Images and missing icons ==
== Payload expectations (schema 1) ==
Image references are validated with a small existence cache.
The payload is expected to contain the parts needed to build the full Skill card, including:
If a file page does not exist, the renderer outputs a small “?” badge (<code>sv-miss</code>) instead of a redlink image.
* <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 emits semantic hooks used by Common.js:
The module outputs semantic hooks used by site JS:
* Popups: <code>data-sv-toggle="1"</code> with <code>sv-hidden</code>
* Popups use <code>data-sv-toggle</code> and <code>sv-hidden</code>
* Tabs: <code>data-tabs="1"</code> / <code>data-tabs-root</code>
* Tabs use <code>data-tabs</code> and <code>data-tabs-root</code>
* Slider: <code>data-sv-slider="1"</code> with ARIA slider attributes
* 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.

This 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 source

This module is loaded by Module:GameInfo and called through the GameInfo entry points (for example the Skills route).

This module declares a TemplateStyles source so the wrapper can load the correct CSS:

STYLE_SRC = "Module:GameInfo/styles.css"

Arguments are read from frame.args (handled by Module:GameInfo).

Required:

  • data — JSON string payload (must decode to an object and contain schema = 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. Default 1.
  • notes — Wikitext content shown in the Notes popup.
  • debug — If set to 1, 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 source

The 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)
  • requirements and users (optional grouped lists)
  • scaling_top, core_stats
  • tabs (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 as data-series)

Images and missing files

edit source

File 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 source

Keyword 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 source

The module outputs semantic hooks used by site JS:

  • Popups use data-sv-toggle and sv-hidden
  • Tabs use data-tabs and data-tabs-root
  • The custom level slider uses data-sv-slider and ARIA slider attributes