Template:SpellDef: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
obelisk-bot: uploading initial Cargo templates
obelisk-bot: Pushing translation table rework
 
Line 4: Line 4:
The bot emits each spell at <code>Data:Spell/<id></code> carrying:
The bot emits each spell at <code>Data:Spell/<id></code> carrying:


# <code><nowiki>{{SpellDef | id=… | name=… | school=… | rank=… | …}}</nowiki></code> — main row with the split learn-cost columns inline.
# <code><nowiki>{{SpellDef | id=… | school=… | rank=… | …}}</nowiki></code> — main row with the split learn-cost columns inline.
# 4 × <code><nowiki>{{SpellRankDef | spell_id=<id> | level=<1-4> | …}}</nowiki></code> paired with 4 × <code><nowiki>{{SpellRankTranslationDef | spell_id=<id> | level=<1-4> | …}}</nowiki></code> — one pair per mastery level (1=no skill, 2=basic, 3=advanced, 4=expert). Spells use the dedicated SpellRankTranslation table instead of the unified Translation (per D-030 revised) because the per-rank shape carries 3 localizable fields (name + desc + bonus_description) rather than the standard 2.
# N × <code><nowiki>{{TranslationDef | type=spell | target_id=<id> | language=| name=… }}</nowiki></code> — spell name, one row per language.
# 4 × <code><nowiki>{{SpellRankDef | spell_id=<id> | level=<1-4> | …}}</nowiki></code> — one per mastery level (1=no skill, 2=basic, 3=advanced, 4=expert).
# For each rank, N × <code><nowiki>{{TranslationDef | type=spell_rank | target_id=<id> | variant=<level> | language=… | description=… | bonus_description=… }}</nowiki></code> — the per-rank localizable text. <code>bonus_description</code> is the one column on the shared Translation table that exists specifically for spell ranks.


== Schema ==
== Schema ==
{{#cargo_declare:_table=Spell
{{#cargo_declare:_table=Spell
| id = String
| id = String
| name = String
| name_sid = String
| name_sid = String
| school = String (allowed values=day,night,primal,space,neutral)
| school = String (allowed values=day,night,primal,space,neutral)
Line 35: Line 36:
{{SpellDef
{{SpellDef
| id = String
| id = String
| name = String
| name_sid = String             <!-- display name lives in the Translation table, type='spell' -->
| name_sid = String


| school = String (allowed values=day,night,primal,space,neutral)
| school = String (allowed values=day,night,primal,space,neutral)
Line 77: Line 77:
* '''Special magics''' (<code>is_special_magic=true</code>) point back at the base spell via <code>normal_magic_sid</code>. These are upgraded variants unlocked by certain heroes' specializations.
* '''Special magics''' (<code>is_special_magic=true</code>) point back at the base spell via <code>normal_magic_sid</code>. These are upgraded variants unlocked by certain heroes' specializations.
* '''<code>excaption_in_tooltip_sid</code>''' — source field name preserves the typo (<code>excaption</code> instead of <code>exception</code>); it points at SIDs like <code>description_effect_undead_embodiment_construct_immunities</code> ("Does not affect Undead, Embodiments, or Constructs"). The bot passes the source name through unchanged.
* '''<code>excaption_in_tooltip_sid</code>''' — source field name preserves the typo (<code>excaption</code> instead of <code>exception</code>); it points at SIDs like <code>description_effect_undead_embodiment_construct_immunities</code> ("Does not affect Undead, Embodiments, or Constructs"). The bot passes the source name through unchanged.
* '''No <code>desc_sid</code> here.''' Spell descriptions vary by mastery level and live on the SpellRank rows.
* '''No <code>desc_sid</code> here.''' Spell descriptions vary by mastery level and live on the SpellRank rows; their resolved text is in the Translation table under <code>type='spell_rank'</code>.
* '''Display name''' for every language (English included) lives in the [[Template:TranslationDef|Translation]] table, <code>type='spell'</code>.


== Related tables ==
== Related tables ==
* [[Template:SpellRankDef|SpellRank]] — joined on <code>id = spell_id</code> (1:N, 4 rows per spell).
* [[Template:SpellRankDef|SpellRank]] — joined on <code>id = spell_id</code> (1:N, 4 rows per spell).
* [[SpellRankTranslationDef]] — joined on <code>id = spell_id</code> (1:N, 4 rows per spell). Carries the i18n payload for spell name + per-rank desc + per-rank bonus_description.
* [[Template:TranslationDef|Translation]] — the spell name (<code>type='spell'</code>) and per-rank description + bonus_description (<code>type='spell_rank'</code>, <code>variant=<level></code>) in every language (English included), keyed on <code>target_id=id</code>.
* <code>Hero.start_magics</code> — references spell ids via the comma-joined list column.
* <code>Hero.start_magics</code> — references spell ids via the comma-joined list column.


Line 89: Line 90:
</noinclude><includeonly>{{#cargo_store:_table=Spell
</noinclude><includeonly>{{#cargo_store:_table=Spell
| id = {{{id|}}}
| id = {{{id|}}}
| name = {{{name|}}}
| name_sid = {{{name_sid|}}}
| name_sid = {{{name_sid|}}}
| school = {{{school|}}}
| school = {{{school|}}}

Latest revision as of 20:48, 14 May 2026

One row per spell. ~137 in the 2026-05-03 corpus across 5 schools (day, night, primal, space, neutral) and 5 ranks. Includes battle spells (cast in combat), world spells (cast on the adventure map), and _special upgraded variants.

The bot emits each spell at Data:Spell/<id> carrying:

  1. {{SpellDef | id=… | school=… | rank=… | …}} — main row with the split learn-cost columns inline.
  2. N × {{TranslationDef | type=spell | target_id=<id> | language=… | name=… }} — spell name, one row per language.
  3. 4 × {{SpellRankDef | spell_id=<id> | level=<1-4> | …}} — one per mastery level (1=no skill, 2=basic, 3=advanced, 4=expert).
  4. For each rank, N × {{TranslationDef | type=spell_rank | target_id=<id> | variant=<level> | language=… | description=… | bonus_description=… }} — the per-rank localizable text. bonus_description is the one column on the shared Translation table that exists specifically for spell ranks.

Schema

This template defines the table "Spell". View table.

{{SpellDef
| id = String
| name_sid = String              <!-- display name lives in the Translation table, type='spell' -->

| school = String (allowed values=day,night,primal,space,neutral)
| rank = Integer
| used_on_map = Boolean

| icon = String

| magic_type_description = String       <!-- SID for the type label, e.g. magic_type_healing -->

<!-- Special-magic flags -->
| is_special_magic = Boolean
| is_unique_magic = Boolean
| normal_magic_sid = String             <!-- back-ref for is_special_magic spells -->

<!-- Learn-cost split per resource. Sparse: zero/missing → omitted.
     Most spells use gemstones/crystals/mercury (94 spells); a small
     set of unique magics use star_dust (6 spells). -->
| learn_cost_gemstones = Integer
| learn_cost_crystals = Integer
| learn_cost_mercury = Integer
| learn_cost_star_dust = Integer

<!-- Misc sparse fields -->
| excaption_in_tooltip_sid = String     <!-- e.g. immunity callouts (note source typo "excaption") -->
| up_effect_description_sid = String
| use_expand_tooltip = Boolean
| energy_cost = Integer
| energy_type = String

| source_path = String
}}

Field notes

  • id is the source JSON id (e.g. day_1_magic_healing_water, day_1_magic_healing_water_special).
  • school is one of 5: day, night, primal, space, neutral.
  • rank is 1-5; the spell's intrinsic difficulty/tier.
  • used_on_map distinguishes battle vs world spells. worldMagic and battleMagic sub-trees are not extracted as Cargo columns yet — they describe the in-game effect mechanics in detail; future work if a wiki need surfaces.
  • Special magics (is_special_magic=true) point back at the base spell via normal_magic_sid. These are upgraded variants unlocked by certain heroes' specializations.
  • excaption_in_tooltip_sid — source field name preserves the typo (excaption instead of exception); it points at SIDs like description_effect_undead_embodiment_construct_immunities ("Does not affect Undead, Embodiments, or Constructs"). The bot passes the source name through unchanged.
  • No desc_sid here. Spell descriptions vary by mastery level and live on the SpellRank rows; their resolved text is in the Translation table under type='spell_rank'.
  • Display name for every language (English included) lives in the Translation table, type='spell'.

Related tables

  • SpellRank — joined on id = spell_id (1:N, 4 rows per spell).
  • Translation — the spell name (type='spell') and per-rank description + bonus_description (type='spell_rank', variant=<level>) in every language (English included), keyed on target_id=id.
  • Hero.start_magics — references spell ids via the comma-joined list column.

Notes