Module:HeroDataParser/doc
This is the documentation page for Module:HeroDataParser
HeroDataParser Module Documentation
This module provides accessors for **hero data** stored in `Data:HeroData.json`. It allows retrieving hero class, specialty, starting skills, spells, and generating wikitext lists or army icons.
Data is **cached on first access** for improved performance.
Functions
getClass(frame)
Retrieves the class of a hero.
- Usage
{{#invoke:HeroDataParser|getClass|HeroName}}
- Parameters
- frame.args[1] – string: hero name
- Returns
- string: hero's class, or empty string if not found
---
getSpecialty(frame)
Retrieves the specialty of a hero.
- Usage
{{#invoke:HeroDataParser|getSpecialty|HeroName}}
- Parameters
- frame.args[1] – string: hero name
- Returns
- string: hero's specialty, or empty string if not found
---
getSkill1(frame)
Retrieves the first starting skill of a hero.
- Usage
{{#invoke:HeroDataParser|getSkill1|HeroName}}
- Parameters
- frame.args[1] – string: hero name
- Returns
- string: name of the first starting skill, or nil if none
---
getSkill2(frame)
Retrieves the second starting skill of a hero.
- Usage
{{#invoke:HeroDataParser|getSkill2|HeroName}}
- Parameters
- frame.args[1] – string: hero name
- Returns
- string: name of the second starting skill, or nil if none
---
getSpell(frame)
Retrieves the spell of a hero.
- Usage
{{#invoke:HeroDataParser|getSpell|HeroName}}
- Parameters
- frame.args[1] – string: hero name
- Returns
- string: hero's spell, or nil if none
---
getFactionHeroes(frame)
Generates a list of heroes belonging to a faction using `|- |style="padding:0.25em 0; border-right:0;" |[[File:{{{1}}}.png|50px]] |style="border-left:0;" | [[{{{1}}}]] |[[]] | |colspan=2 | [[|Advanced ]] |`.
- Usage
{{#invoke:HeroDataParser|getFactionHeroes|FactionName}}
- Parameters
- frame.args[1] – string: faction name
- Returns
- wikitext: list of heroes in the faction
---
getClassHeroes(frame)
Generates a list of heroes of a specific class using `|- |style="padding:0.25em 0; border-right:0;" |[[File:{{{1}}}.png|50px]] |style="border-left:0;" | [[{{{1}}}]] |[[]] | |colspan=2 | [[|Advanced ]] |`.
- Usage
{{#invoke:HeroDataParser|getClassHeroes|ClassName}}
- Parameters
- frame.args[1] – string: class name
- Returns
- wikitext: list of heroes in the class
---
getStartingArmyIcons(frame)
Generates HTML displaying a hero's starting army icons with unit count.
- Usage
{{#invoke:HeroDataParser|getStartingArmyIcons|HeroName}}
- Parameters
- frame.args[1] – string: hero name
- Returns
- HTML: icons of the hero's starting army with unit names and counts
- Empty string if hero or army data is not available
---
Internal Functions
- getHeroData() – Loads and caches the hero JSON data from `Data:HeroData.json`.
- findHero(heroName) – Finds and returns the hero table by name.


