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
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 English defaults, mechanical fields, and 15 non-English translations of name + description + bonus_description.
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.
SpellRank carries only the '''mechanical, language-independent''' fields. All localizable text — the rank's name, 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 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 10: Line 12:
| name_sid = String
| 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
| cs_name = String
| cs_description = Wikitext
| cs_bonus_description = Wikitext
| fr_name = String
| fr_description = Wikitext
| fr_bonus_description = Wikitext
| de_name = String
| de_description = Wikitext
| de_bonus_description = Wikitext
| hu_name = String
| hu_description = Wikitext
| hu_bonus_description = Wikitext
| it_name = String
| it_description = Wikitext
| it_bonus_description = Wikitext
| ja_name = String
| ja_description = Wikitext
| ja_bonus_description = Wikitext
| ko_name = String
| ko_description = Wikitext
| ko_bonus_description = Wikitext
| pl_name = String
| pl_description = Wikitext
| pl_bonus_description = Wikitext
| ru_name = String
| ru_description = Wikitext
| ru_bonus_description = Wikitext
| es_name = String
| es_description = Wikitext
| es_bonus_description = Wikitext
| tr_name = String
| tr_description = Wikitext
| tr_bonus_description = Wikitext
| uk_name = String
| uk_description = Wikitext
| uk_bonus_description = Wikitext
| zh_cn_name = String
| zh_cn_description = Wikitext
| zh_cn_bonus_description = Wikitext
| zh_tw_name = String
| zh_tw_description = Wikitext
| zh_tw_bonus_description = Wikitext
}}
}}
<pre><nowiki>
{{SpellRankDef
| spell_id = String
| level = Integer                  <!-- 1=no skill, 2=basic, 3=advanced, 4=expert -->
| name_sid = String                <!-- same across all four ranks; per-row for clean labelled queries -->
| description_sid = String
| bonus_description_sid = String    <!-- null at level 1 -->
| mana_cost = Integer
| upgrade_cost = Integer
}}
</nowiki></pre>


== Field notes ==
== Field notes ==
* Primary key is <code>(spell_id, level)</code>.
* Primary key is <code>(spell_id, level)</code>.
* <code>name_sid</code> carries the spell's name SID — same across all four ranks; duplicated per-row for clean labelled per-rank queries.
* <code>name_sid</code> carries the spell's name SID — same across all four ranks; duplicated per-row for clean labelled per-rank queries. Traceability only; not the translation join path.
* <code>description</code> carries resolved English text. Hero-dependent placeholders (<code>{N}</code> for spell-power-scaled values) stay unsubstituted.
* <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.
* <code>bonus_description</code> is the unlock blurb at this level. Null at level 1.
* Resolved text for every language (including English) lives in [[Template:TranslationDef|Translation]]: <code>name</code>, <code>description</code>, and <code>bonus_description</code> columns, <code>WHERE type='spell_rank' AND target_id=<spell_id> AND variant=<level></code>. Hero-dependent placeholders (<code>{N}</code> for spell-power-scaled values) stay unsubstituted in the stored text.
* Per-language columns are sparse — only emitted when the corresponding SID exists.
* <code>mana_cost</code> / <code>upgrade_cost</code> are the per-rank mechanical costs.


== Related tables ==
== Related tables ==
* [[Template:SpellDef|Spell]] — joined on <code>SpellRank.spell_id = Spell.id</code> (N:1).
* [[Template:SpellDef|Spell]] — joined on <code>SpellRank.spell_id = Spell.id</code> (N:1).
* [[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).


[[Category:Cargo Definitions]]
[[Category:Cargo Definitions]]
Line 78: Line 46:
| name_sid = {{{name_sid|}}}
| name_sid = {{{name_sid|}}}
| description_sid = {{{description_sid|}}}
| description_sid = {{{description_sid|}}}
| description = {{{description|}}}
| bonus_description_sid = {{{bonus_description_sid|}}}
| bonus_description_sid = {{{bonus_description_sid|}}}
| bonus_description = {{{bonus_description|}}}
| mana_cost = {{{mana_cost|}}}
| mana_cost = {{{mana_cost|}}}
| upgrade_cost = {{{upgrade_cost|}}}
| upgrade_cost = {{{upgrade_cost|}}}
| pt_br_name = {{{pt_br_name|}}}
| pt_br_description = {{{pt_br_description|}}}
| pt_br_bonus_description = {{{pt_br_bonus_description|}}}
| cs_name = {{{cs_name|}}}
| cs_description = {{{cs_description|}}}
| cs_bonus_description = {{{cs_bonus_description|}}}
| fr_name = {{{fr_name|}}}
| fr_description = {{{fr_description|}}}
| fr_bonus_description = {{{fr_bonus_description|}}}
| de_name = {{{de_name|}}}
| de_description = {{{de_description|}}}
| de_bonus_description = {{{de_bonus_description|}}}
| hu_name = {{{hu_name|}}}
| hu_description = {{{hu_description|}}}
| hu_bonus_description = {{{hu_bonus_description|}}}
| it_name = {{{it_name|}}}
| it_description = {{{it_description|}}}
| it_bonus_description = {{{it_bonus_description|}}}
| ja_name = {{{ja_name|}}}
| ja_description = {{{ja_description|}}}
| ja_bonus_description = {{{ja_bonus_description|}}}
| ko_name = {{{ko_name|}}}
| ko_description = {{{ko_description|}}}
| ko_bonus_description = {{{ko_bonus_description|}}}
| pl_name = {{{pl_name|}}}
| pl_description = {{{pl_description|}}}
| pl_bonus_description = {{{pl_bonus_description|}}}
| ru_name = {{{ru_name|}}}
| ru_description = {{{ru_description|}}}
| ru_bonus_description = {{{ru_bonus_description|}}}
| es_name = {{{es_name|}}}
| es_description = {{{es_description|}}}
| es_bonus_description = {{{es_bonus_description|}}}
| tr_name = {{{tr_name|}}}
| tr_description = {{{tr_description|}}}
| tr_bonus_description = {{{tr_bonus_description|}}}
| uk_name = {{{uk_name|}}}
| uk_description = {{{uk_description|}}}
| uk_bonus_description = {{{uk_bonus_description|}}}
| zh_cn_name = {{{zh_cn_name|}}}
| zh_cn_description = {{{zh_cn_description|}}}
| zh_cn_bonus_description = {{{zh_cn_bonus_description|}}}
| zh_tw_name = {{{zh_tw_name|}}}
| zh_tw_description = {{{zh_tw_description|}}}
| zh_tw_bonus_description = {{{zh_tw_bonus_description|}}}
}}
}}
Created <code>SpellRank</code> entry: <code>{{{spell_id|}}} (level {{{level|}}})</code></includeonly>
Created <code>SpellRank</code> entry: <code>{{{spell_id|}}} (level {{{level|}}})</code></includeonly>

Revision as of 20:48, 14 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. All localizable text — the rank's name, 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 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 -->
| name_sid = String                <!-- same across all four ranks; per-row for clean labelled queries -->
| 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).
  • name_sid carries the spell's name SID — same across all four ranks; duplicated per-row for clean labelled per-rank queries. Traceability only; not the translation join path.
  • 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.
  • Resolved text for every language (including English) lives in Translation: name, description, and bonus_description columns, WHERE type='spell_rank' AND target_id=<spell_id> AND variant=<level>. 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).