Template:SpellRankDef: 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
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
This template defines and stores rows for the '''SpellRank''' Cargo table. Per-mastery-level data for a [[Template:SpellDef|Spell]]. Always 4 rows per spell — levels 1=no skill, 2=basic, 3=advanced, 4=expert. Each row is self-contained: it carries the English defaults, the mechanical fields, ''and'' the 15 non-English translations of every translatable field. The old <code>SpellRankTranslationDef</code> sibling table was folded back into this one — the three-translatable-field shape (name + desc + bonus_description) didn't fit [[Template:EntryDef|Entry]]'s generic name+desc-only schema, so spell ranks get their own expanded shape.
This template defines and stores rows for the '''SpellRank''' Cargo table. Per-mastery-level structural data for a [[Template:SpellDef|Spell]]. Always 4 rows per spell — levels 1=no skill, 2=basic, 3=advanced, 4=expert.


The bot emits these inline on the parent <code>Data:Spell/<id></code> page. There are no individual <code>Data:SpellRank/</code> pages.
SpellRank carries only the '''mechanical, language-independent''' fields. The rank's localizable text — its description and bonus unlock blurb, in every language including English — lives in the shared [[Template:TranslationDef|Translation]] table, keyed by <code>type=spell_rank</code>, <code>target_id=<spell_id></code>, <code>variant=<level></code>. The spell's '''name''' is '''not''' a per-rank value — it is static across all four ranks — so it is stored once, in [[Template:SpellDef|Spell]]'s <code>type=spell</code> Translation rows, and never duplicated here.
 
The bot emits these inline on the parent <code>Data:Spell/<id></code> page, each <code><nowiki>{{SpellRankDef}}</nowiki></code> row followed by its per-language <code><nowiki>{{TranslationDef}}</nowiki></code> rows.


== Schema ==
== Schema ==
Line 8: Line 10:
| spell_id = String
| spell_id = String
| level = Integer
| level = Integer
| name_sid = String
| description_sid = String
| description_sid = String
| description = Wikitext
| bonus_description_sid = String
| bonus_description_sid = String
| bonus_description = Wikitext
| mana_cost = Integer
| mana_cost = Integer
| upgrade_cost = Integer
| upgrade_cost = Integer
| pt_br_name = String
}}
| pt_br_description = Wikitext
 
| pt_br_bonus_description = Wikitext
<pre><nowiki>
| cs_name = String
{{SpellRankDef
| cs_description = Wikitext
| spell_id = String
| cs_bonus_description = Wikitext
| level = Integer                  <!-- 1=no skill, 2=basic, 3=advanced, 4=expert -->
| fr_name = String
| description_sid = String
| fr_description = Wikitext
| bonus_description_sid = String   <!-- null at level 1 -->
| fr_bonus_description = Wikitext
| mana_cost = Integer
| de_name = String
| upgrade_cost = Integer
| de_description = Wikitext
}}
| de_bonus_description = Wikitext
</nowiki></pre>
| hu_name = String
 
| hu_description = Wikitext
== Field notes ==
| hu_bonus_description = Wikitext
* Primary key is <code>(spell_id, level)</code>.
| it_name = String
* '''No <code>name_sid</code> here.''' The spell's name is static across all four ranks — it is not a per-rank value. It lives on [[Template:SpellDef|Spell]] (<code>name_sid</code>) and its resolved text in the Translation table under <code>type='spell'</code>. There is no "rank name" concept in the source data.
| it_description = Wikitext
* <code>description_sid</code> / <code>bonus_description_sid</code> point at the L10n entries the rank's text was sourced from. <code>bonus_description_sid</code> is null at level 1. Traceability only; not the translation join path.
| it_bonus_description = Wikitext
* Resolved text for every language (including English) lives in [[Template:TranslationDef|Translation]]: the <code>description</code> and <code>bonus_description</code> columns, <code>WHERE type='spell_rank' AND target_id=<spell_id> AND variant=<level></code>. The <code>name</code> column on those rows is left empty — see the note above. Hero-dependent placeholders (<code>{N}</code> for spell-power-scaled values) stay unsubstituted in the stored text.
| ja_name = String
* <code>mana_cost</code> / <code>upgrade_cost</code> are the per-rank mechanical costs.
| ja_description = Wikitext
 
| ja_bonus_description = Wikitext
== Related tables ==
| ko_name = String
* [[Template:SpellDef|Spell]] — joined on <code>SpellRank.spell_id = Spell.id</code> (N:1).
| ko_description = Wikitext
* [[Template:TranslationDef|Translation]] — joined on <code>SpellRank.spell_id = Translation.target_id AND SpellRank.level = Translation.variant</code>, <code>WHERE Translation.type='spell_rank'</code> (1:N, one row per language).
| ko_bonus_description = Wikitext
 
| pl_name = String
[[Category:Cargo Definitions]]
| pl_description = Wikitext
</noinclude><includeonly>{{#cargo_store:_table=SpellRank
| pl_bonus_description = Wikitext
| spell_id = {{{spell_id|}}}
| ru_name = String
| level = {{{level|}}}
| ru_description = Wikitext
| description_sid = {{{description_sid|}}}
| ru_bonus_description = Wikitext
| bonus_description_sid = {{{bonus_description_sid|}}}
| es_name = String
| mana_cost = {{{mana_cost|}}}
| es_description = Wikitext
| upgrade_cost = {{{upgrade_cost|}}}
| es_bonus_description = Wikitext
}}
| tr_name = String
Created <code>SpellRank</code> entry: <code>{{{spell_id|}}} (level {{{level|}}})</code></includeonly>
| tr_description = Wikitext
| tr_bonus_description = Wikitext
| uk_name = String
| uk_description = Wikitext
| uk_bonus_descri

Latest revision as of 00:34, 15 May 2026

This template defines and stores rows for the SpellRank Cargo table. Per-mastery-level structural data for a Spell. Always 4 rows per spell — levels 1=no skill, 2=basic, 3=advanced, 4=expert.

SpellRank carries only the mechanical, language-independent fields. The rank's localizable text — its description and bonus unlock blurb, in every language including English — lives in the shared Translation table, keyed by type=spell_rank, target_id=<spell_id>, variant=<level>. The spell's name is not a per-rank value — it is static across all four ranks — so it is stored once, in Spell's type=spell Translation rows, and never duplicated here.

The bot emits these inline on the parent Data:Spell/<id> page, each {{SpellRankDef}} row followed by its per-language {{TranslationDef}} rows.

Schema

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

{{SpellRankDef
| spell_id = String
| level = Integer                  <!-- 1=no skill, 2=basic, 3=advanced, 4=expert -->
| description_sid = String
| bonus_description_sid = String    <!-- null at level 1 -->
| mana_cost = Integer
| upgrade_cost = Integer
}}

Field notes

  • Primary key is (spell_id, level).
  • No name_sid here. The spell's name is static across all four ranks — it is not a per-rank value. It lives on Spell (name_sid) and its resolved text in the Translation table under type='spell'. There is no "rank name" concept in the source data.
  • description_sid / bonus_description_sid point at the L10n entries the rank's text was sourced from. bonus_description_sid is null at level 1. Traceability only; not the translation join path.
  • Resolved text for every language (including English) lives in Translation: the description and bonus_description columns, WHERE type='spell_rank' AND target_id=<spell_id> AND variant=<level>. The name column on those rows is left empty — see the note above. Hero-dependent placeholders ({N} for spell-power-scaled values) stay unsubstituted in the stored text.
  • mana_cost / upgrade_cost are the per-rank mechanical costs.

Related tables

  • Spell — joined on SpellRank.spell_id = Spell.id (N:1).
  • Translation — joined on SpellRank.spell_id = Translation.target_id AND SpellRank.level = Translation.variant, WHERE Translation.type='spell_rank' (1:N, one row per language).