Module:SpellData/doc

From Heroes of Might and Magic: Olden Era Official Wiki

This is the documentation page for Module:SpellData

This module allows for the dynamic extraction of variables, asset icons, costs, and technical properties for battle/map spells stored within the wiki's Cargo database (specifically from the Spell 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:SpellData|get|SPELL_ID|VARIABLE|LANGUAGE_CODE}}
  • SPELL_ID : The technical identifier of the spell (e.g., day_16_magic_arinas_chosen).
  • VARIABLE : The keyword for the specific data field you want to display (see the index below).
  • LANGUAGE_CODE : (Optional) The localization code (e.g., en, fr, pt_br). Defaults to English (en).

---

Technical Reference Index

📝 Text & Translations (Language-Dependent)

These fields query the Translation table. They dynamically adapt to the requested language code.

Variable Description Example Output (en)
name The localized display name of the spell. Arina's Chosen
description The localized technical behavior text of the spell (if available). (Description text)

⚙️ Core Technical Properties

Standard database values extracted directly from the primary Spell table records.

Variable Description Example Values / Output
icon The visual icon asset filename string. Forced automatic Title Case formatting applies natively. Day_16_Magic_Arinas_Chosen
school The magic element or school category assigned to the spell. day, night, etc.
rank The Tier/Rank tier level of the spell. 5
used_on_map Boolean string indicating if the spell can be cast on the adventure map. no / yes
is_special_magic Indicator flag for specialized restricted spell mechanics. no
is_unique_magic Indicator flag for non-standard legendary or character-bound spells. no
source_path The file path location of the repository data dump JSON. DB/magics/battle_day_magics.json

💎 Resource Learning Costs

Resource costs required to memorize or master the spell path.

Variable Description Example Value
learn_cost_gemstones Amount of Gemstones required. 10
learn_cost_crystals Amount of Crystals required. 10
learn_cost_mercury Amount of Mercury required. 10

---

Practical Examples

Example 1: Printing Localized Title

To display the Portuguese translated title of a specific high-tier spell:

{{#invoke:SpellData|get|day_16_magic_arinas_chosen|name|pt_br}}

Output: Escolhido de Arina

Example 2: Material Cost Validation Layout

You can easily print resource summaries using standard table modules:

* '''Gemstones cost:''' {{#invoke:SpellData|get|day_16_magic_arinas_chosen|learn_cost_gemstones}}
* '''Crystals cost:''' {{#invoke:SpellData|get|day_16_magic_arinas_chosen|learn_cost_crystals}}