Module:HeroData/doc: Difference between revisions
Created page with "This module allows for the dynamic extraction of all variables, stats, and translations for a specific hero stored within the wiki's Cargo database. It automatically handles localized fallback to English if a translation in the requested language is missing. == Basic Syntax == To fetch a data field, use the following syntax: <pre>{{#invoke:HeroData|get|HERO_ID|VARIABLE|LANGUAGE_CODE}}</pre> * '''<code>HERO_ID</code>''' : The technical identifier of the hero (e.g., <cod..." |
No edit summary |
||
| Line 1: | Line 1: | ||
This module allows for the dynamic extraction of | This module allows for the dynamic extraction of hero data parameters, technical properties, and translated profiles stored within the wiki's Cargo database (specifically from the <code>Hero</code> and <code>Translation</code> tables). It automatically handles localized fallback to English if a translation in the requested language is missing. | ||
== Basic Syntax == | == Basic Syntax == | ||
| Line 5: | Line 5: | ||
<pre>{{#invoke:HeroData|get|HERO_ID|VARIABLE|LANGUAGE_CODE}}</pre> | <pre>{{#invoke:HeroData|get|HERO_ID|VARIABLE|LANGUAGE_CODE}}</pre> | ||
* '''<code>HERO_ID</code>''' : The technical identifier of the hero (e.g., <code> | * '''<code>HERO_ID</code>''' : The technical identifier of the hero (e.g., <code>dungeon_hero_3</code>). | ||
* '''<code>VARIABLE</code>''' : The keyword for the specific data field you want to display (see the list below). | * '''<code>VARIABLE</code>''' : The keyword for the specific data field you want to display (see the list below). | ||
* '''<code>LANGUAGE_CODE</code>''' : ''(Optional)'' The localization code (e.g., <code>en</code>, <code>fr</code>, <code> | * '''<code>LANGUAGE_CODE</code>''' : ''(Optional)'' The localization code (e.g., <code>en</code>, <code>fr</code>, <code>pl</code>). Defaults to English (<code>en</code>). | ||
--- | --- | ||
| Line 14: | Line 14: | ||
=== 📝 Text & Translations (Language-Dependent) === | === 📝 Text & Translations (Language-Dependent) === | ||
These | These fields query the <code>Translation</code> table. They dynamically adapt to the requested language code and fallback to English seamlessly if missing. | ||
{| class="wikitable" style="width:100%;" | {| class="wikitable" style="width:100%;" | ||
! Variable !! Description !! | ! Variable !! Description !! Database Filter Relation | ||
|- | |- | ||
| <code>name</code> || The | | <code>name</code> || The localized name of the hero. || <code>type="hero"</code> | ||
|- | |- | ||
| <code>description</code> || The official lore | | <code>description</code> || The localized official biography or lore text of the hero. || <code>type="hero"</code> | ||
|- | |- | ||
| <code>motto</code> || The hero's | | <code>motto</code> || The hero's localized specific quote or motto. || <code>type="hero_motto"</code> | ||
|} | |} | ||
=== ⚔️ | === ⚔️ Split Starting Skills (Virtual Fields) === | ||
Instead of returning a comma-separated string from the database, the module automatically slices the data array into distinct outputs: | |||
{| class="wikitable" style="width:100%;" | {| class="wikitable" style="width:100%;" | ||
! Variable !! Description | ! Variable !! Description !! Fallback Behavior | ||
|- | |- | ||
| <code> | | <code>start_skill_1</code> || Returns the technical ID of the hero's primary starting skill. || Always returns the first value found. | ||
|- | |- | ||
| <code> | | <code>start_skill_2</code> || Returns the technical ID of the hero's secondary starting skill. || Returns an empty string (<code>""</code>) if the hero only has one starting skill. | ||
| | |||
| | |||
|} | |} | ||
=== | === ⚙️ Core Technical Properties === | ||
Standard database values extracted directly from the primary <code>Hero</code> table records. | |||
{| class="wikitable" style="width:100%;" | {| class="wikitable" style="width:100%;" | ||
! Variable !! Description !! Example Value | ! Variable !! Description !! Example Value | ||
|- | |- | ||
| <code>class_id</code> || Pointers linking to the hero's mechanical archetype. || <code>might_dungeon</code> | |||
| <code>class_id</code> || | |||
|- | |- | ||
| <code> | | <code>specialization_id</code> || Points to the unique skill perk assigned to this specific hero unit. || <code>dungeon_hero_3_specialization</code> | ||
|- | |- | ||
| <code> | | <code>faction</code> || The alignment group or city archetype the hero is drafted under. || <code>dungeon</code> | ||
|} | |} | ||
| Line 80: | Line 50: | ||
== Practical Examples == | == Practical Examples == | ||
Revision as of 20:08, 25 May 2026
This module allows for the dynamic extraction of hero data parameters, technical properties, and translated profiles stored within the wiki's Cargo database (specifically from the Hero and Translation tables). It automatically handles localized fallback to English if a translation in the requested language is missing.
Basic Syntax
To fetch a data field, use the following syntax:
{{#invoke:HeroData|get|HERO_ID|VARIABLE|LANGUAGE_CODE}}
HERO_ID: The technical identifier of the hero (e.g.,dungeon_hero_3).VARIABLE: The keyword for the specific data field you want to display (see the list below).LANGUAGE_CODE: (Optional) The localization code (e.g.,en,fr,pl). Defaults to English (en).
---
Available Variables
📝 Text & Translations (Language-Dependent)
These fields query the Translation table. They dynamically adapt to the requested language code and fallback to English seamlessly if missing.
| Variable | Description | Database Filter Relation |
|---|---|---|
name |
The localized name of the hero. | type="hero"
|
description |
The localized official biography or lore text of the hero. | type="hero"
|
motto |
The hero's localized specific quote or motto. | type="hero_motto"
|
⚔️ Split Starting Skills (Virtual Fields)
Instead of returning a comma-separated string from the database, the module automatically slices the data array into distinct outputs:
| Variable | Description | Fallback Behavior |
|---|---|---|
start_skill_1 |
Returns the technical ID of the hero's primary starting skill. | Always returns the first value found. |
start_skill_2 |
Returns the technical ID of the hero's secondary starting skill. | Returns an empty string ("") if the hero only has one starting skill.
|
⚙️ Core Technical Properties
Standard database values extracted directly from the primary Hero table records.
| Variable | Description | Example Value |
|---|---|---|
class_id |
Pointers linking to the hero's mechanical archetype. | might_dungeon
|
specialization_id |
Points to the unique skill perk assigned to this specific hero unit. | dungeon_hero_3_specialization
|
faction |
The alignment group or city archetype the hero is drafted under. | dungeon
|
---


