Module:HeroClassDataParser/doc

From Heroes of Might and Magic: Olden Era Official Wiki

This is the documentation page for Module:HeroClassDataParser

HeroClassDataParser Module Documentation

This module provides accessors for **hero class data** stored in `Data:HeroClassData.json`. It allows retrieving stats, skill chances, subclasses, and generating formatted stats boxes for display on the wiki.

Data is **cached on first access** for improved performance.

Functions

getStat(frame)

Retrieves the base value of a stat for a given hero class.

Usage
{{#invoke:HeroClassDataParser|getStat|Knight|attack}}
Parameters
  • frame.args[1] – string: hero class name
  • frame.args[2] – string: stat key (`attack`, `defence`, `power`, `knowledge`)
Returns
  • string: stat value, or empty string if not found

---

getPre12(frame)

Retrieves the "pre-12" roll value for a stat.

Usage
{{#invoke:HeroClassDataParser|getPre12|Knight|attack}}
Parameters
  • frame.args[1] – hero class name
  • frame.args[2] – stat key
Returns
  • string: value of statRollPre12 or empty string

---

getPost12(frame)

Retrieves the "post-12" roll value for a stat.

Usage
{{#invoke:HeroClassDataParser|getPost12|Knight|attack}}
Parameters
  • frame.args[1] – hero class name
  • frame.args[2] – stat key
Returns
  • string: value of statRollPost12 or empty string

---

getSkillChance(frame)

Retrieves the chance of learning a secondary skill for a class.

Usage
{{#invoke:HeroClassDataParser|getSkillChance|Knight|leadershipSkill}}
Parameters
  • frame.args[1] – hero class name
  • frame.args[2] – skill key
Returns
  • string: skill chance, or empty string

---

getSubclassName(frame)

Returns the name of a subclass for a class.

Usage
{{#invoke:HeroClassDataParser|getSubclassName|Necromancer|1}}
Parameters
  • frame.args[1] – hero class name
  • frame.args[2] – number/string: subclass index or name
Returns
  • string: subclass name, or empty string

---

getSubclassEffect(frame)

Returns the effect description of a subclass.

Usage
{{#invoke:HeroClassDataParser|getSubclassEffect|Necromancer|1}}
Parameters
  • frame.args[1] – hero class name
  • frame.args[2] – number/string: subclass index or name
Returns
  • string: effect description, or empty string

---

getSubclassSkill(frame)

Returns a specific skill of a subclass.

Usage
{{#invoke:HeroClassDataParser|getSubclassSkill|Necromancer|Soulweaver|2}}
Parameters
  • frame.args[1] – hero class name
  • frame.args[2] – string/number: subclass name or index
  • frame.args[3] – number: skill index (1-based)
Returns
  • string: skill name, or empty string

---

statsBox(frame)

Generates an HTML snippet displaying the class's main stats with icons.

Usage
{{#invoke:HeroClassDataParser|statsBox|Knight}}
Parameters
  • frame.args[1] – hero class name
Returns
  • string: HTML of a vertical stats box

---

Internal Functions

  • getHeroClassData() – Loads and caches the hero class JSON data from `Data:HeroClassData.json`.
  • findHeroClass(className) – Finds and returns the class table by name.