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:GameSkills/doc: Difference between revisions

From SpiritVale Wiki
No edit summary
 
Line 8: Line 8:


* Loads data via [[Module:GameData]] → <code>GameData.loadSkills()</code>.
* Loads data via [[Module:GameData]] → <code>GameData.loadSkills()</code>.
* Looks up skills by their <code>"Internal Name"</code> (fast) or by display <code>"Name"</code> (fallback).
* Looks up skills primarily by display <code>"Name"</code> (what editors use), with <code>"Internal Name"</code> as a fallback.
* Builds a table with only the fields that actually exist for that skill.
* Builds a table with only the fields that actually exist for that skill.


Line 30: Line 30:
  }
  }


Each record is a single skill. The important key for lookups is:
Each record is a single skill. Important keys:


* <code>"Internal Name"</code> – the stable ID used in templates (e.g. <code>Bash</code>, <code>Dispell</code>).
* <code>"Name"</code> – the display name (what players and editors will usually see and use).
* <code>"Name"</code> – the name that most players will be familiar with).
* <code>"Internal Name"</code> – the stable ID used internally and available as an optional parameter for power users and tooling.


----
----
Line 39: Line 39:
== Output ==
== Output ==


For a given skill, the module renders a table with the CSS class <code>sv-skill-infobox</code>.
For a given skill, the module renders a table with the CSS class <code>spiritvale-skill-infobox</code>.


Depending on what exists in the JSON record, the table may include:
Depending on what exists in the JSON record, the table may include:


* Header row with skill name.
* Header row with skill name (and icon, if present).
* Icon (from <code>"Icon"</code>, as a file name like <code>skill-example.webp</code>).
* Icon (from <code>"Icon"</code>, as a file name like <code>skill-example.webp</code>).
* Description.
* Description.
* Type line (combined from <code>Damage Type</code>, <code>Element Type</code>, <code>Target Type</code>, <code>Cast Type</code>).
* Type information:
** Damage Type
** Element Type
** Target Type
** Cast Type
* Max Level.
* Max Level.
* Users (Classes, Summons, Monsters).
* Users:
** Classes
** Summons
** Monsters
** Events
* Requirements:
** Required Skills (with required level)
** Required Weapons
** Required Stances
* Mechanics:
* Mechanics:
** Range
** Range
** Area (size / effective distance)
** Cast Time / Cooldown / Duration
** Cast Time / Cooldown / Duration
** Resource Cost (Mana / HP)
** Mana Cost
* Statuses applied.
* Damage and scaling:
* Statuses removed.
** Main Damage (base and per-level, where present)
** Scaling (stat-based contributions)
* Status interactions:
** Status Applications (status name, scope, basic duration/chance info)


Rows are only shown if the underlying field exists in the JSON for that skill.
Rows are only shown if the underlying field exists in the JSON for that skill.
Line 71: Line 85:
It accepts the following parameters (either passed directly or via a wrapper template):
It accepts the following parameters (either passed directly or via a wrapper template):


* <code>id</code> – <code>"Internal Name"</code> of the skill (preferred).
* <code>1</code> – unnamed parameter; treated as the skill <code>"Name"</code>.
* <code>name</code> – display <code>"Name"</code> of the skill (fallback, slower lookup).
* <code>name</code> – explicit display <code>"Name"</code> of the skill (equivalent to <code>1</code>).
* <code>id</code> – <code>"Internal Name"</code> of the skill (optional fallback / power use).


Lookup order:
Lookup order:


# If <code>id</code> is provided and matches an <code>"Internal Name"</code>, that record is used.
# If <code>name</code> or the first unnamed parameter is provided and matches a record’s <code>"Name"</code>, that record is used.
# Otherwise, if <code>name</code> is provided, the module scans all records for a matching <code>"Name"</code>.
# Otherwise, if <code>id</code> is provided and matches an <code>"Internal Name"</code>, that record is used.
# If nothing is found, a small error message is returned.
# If nothing is found, a small error message is returned and the page is categorized for tracking.


Example direct usage (not recommended; normally use a template):
Example direct usage (not recommended; normally use a template):


  {{#invoke:GameSkills|infobox|id=Bash}}
{{#invoke:GameSkills|infobox|name=Bash}}
 
or:
 
  {{#invoke:GameSkills|infobox|id=Bash_InternalId}}


----
----
Line 92: Line 111:
  Template:Skill
  Template:Skill


   {{#invoke:GameSkills|infobox|id={{{id|}}}|name={{{name|}}}}}
   {{#invoke:GameSkills|infobox
  | 1={{{1|}}}
  | name={{{name|}}}
  | id={{{id|}}}
  }}
 
Typical usage on any page:
 
{{Skill|Bash}}


Usage on any page:
or, explicitly:


  {{Skill|id=Dispell}}
  {{Skill|name=Bash}}


or, using the display name (slower):
Internal IDs can still be used when needed:


  {{Skill|name=Absolution}}
  {{Skill|id=Bash_InternalId}}


This keeps page wikitext simple while centralizing all JSON loading and formatting logic inside Lua.
This keeps page wikitext simple while centralizing all JSON loading and formatting logic inside Lua.