Template:HeroSpecializationDef: 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
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:


The specialization carries identity (name, desc, icon) plus a list of structured <code>bonuses[]</code> effects that compose the spec's mechanical impact. Bonuses are emitted as inline
The specialization carries identity (name, desc, icon) plus a list of structured <code>bonuses[]</code> effects that compose the spec's mechanical impact. Bonuses are emitted as inline
<code>{{HeroSpecializationBonus}}</code> rows on the same wiki page.
<code><nowiki>{{HeroSpecializationBonus}}</nowiki></code> rows on the same wiki page.


== Page layout ==
== Page layout ==
<code>Data:HeroSpecialization/<id></code> carries:
<code>Data:HeroSpecialization/<id></code> carries:


# <code>{{HeroSpecializationDef | id=… | name=… | desc=… | icon=… | …}}</code>
# <code><nowiki>{{HeroSpecializationDef | id=… | icon=… | name_sid=… | desc_sid=… | …}}</nowiki></code>
# <code>{{TranslationDef | type=hero_specialization | target_id=<id> | …}}</code>
# N × <code><nowiki>{{TranslationDef | type=hero_specialization | target_id=<id> | language=… | …}}</nowiki></code> — one row per language
# N × <code>{{HeroSpecializationBonus | spec_id=<id> | ordinal=N | …}}</code> (1367 total bonus rows across all 126 specs)
# N × <code><nowiki>{{HeroSpecializationBonus | spec_id=<id> | ordinal=N | …}}</nowiki></code> (1367 total bonus rows across all 126 specs)


== Schema ==
== Schema ==
{{#cargo_declare:_table=HeroSpecialization
{{#cargo_declare:_table=HeroSpecialization
| id = String
| id = String
| name = String
| desc = Wikitext
| name_sid = String
| name_sid = String
| desc_sid = String
| desc_sid = String
Line 26: Line 24:
{{HeroSpecializationDef
{{HeroSpecializationDef
| id = String
| id = String
| name = String
| icon = String
| desc = Wikitext
<!-- Localization references — display text lives in the Translation table, type='hero_specialization' -->
| name_sid = String
| name_sid = String
| desc_sid = String
| desc_sid = String
| icon = String
| source_path = String
| source_path = String
}}
}}
Line 37: Line 34:
== Field notes ==
== Field notes ==
* '''<code>id</code>''' is the source JSON id (e.g. <code>human_hero_1_specialization</code>, <code>campaign_hero_4_specialization</code>). The <code>_specialization</code> suffix is preserved.
* '''<code>id</code>''' is the source JSON id (e.g. <code>human_hero_1_specialization</code>, <code>campaign_hero_4_specialization</code>). The <code>_specialization</code> suffix is preserved.
* '''<code>name_sid</code> / <code>desc_sid</code>''' point at the L10n entries (e.g. <code>human_hero_1_spec_name</code> / <code>human_hero_1_spec_description</code>). Description text is heavy with <code>{0}</code>/<code>{1}</code> placeholders for stat values; the resolver substitutes via the standard pipeline before storing.
* '''<code>name_sid</code> / <code>desc_sid</code>''' point at the L10n entries (e.g. <code>human_hero_1_spec_name</code> / <code>human_hero_1_spec_description</code>), surfaced for traceability. Description text is heavy with <code>{0}</code>/<code>{1}</code> placeholders for stat values; the resolver substitutes via the standard pipeline before storing the translation.
* '''<code>name</code> / <code>desc</code>''' carry the resolved English text inline. Translations live on the <code>{{TranslationDef | type=hero_specialization}}</code> row.
* '''Display name / description''' for every language (English included) live in the [[Template:TranslationDef|Translation]] table, <code>type='hero_specialization'</code>.
* '''No <code>hero_id</code> back-reference.''' The Hero → HeroSpecialization direction is sufficient (forward join via <code>Hero.specialization_id = HeroSpecialization.id</code>). Reverse queries — "which hero has this spec" — work via the same join. Per D-028.
* '''No <code>hero_id</code> back-reference.''' The Hero → HeroSpecialization direction is sufficient (forward join via <code>Hero.specialization_id = HeroSpecialization.id</code>). Reverse queries — "which hero has this spec" — work via the same join.


== Related tables ==
== Related tables ==
* [[Template:HeroDef|Hero]] — joined on <code>id = Hero.specialization_id</code> (1:1 in practice; the schema permits N:1 in case a future patch shares specs across heroes).
* [[Template:HeroDef|Hero]] — joined on <code>id = Hero.specialization_id</code> (1:1 in practice; the schema permits N:1 in case a future patch shares specs across heroes).
* [[HeroSpecializationBonus]] — joined on <code>id = spec_id</code> (1:N).
* [[HeroSpecializationBonus]] — joined on <code>id = spec_id</code> (1:N).
* [[Template:TranslationDef|<code>TranslationDef</code>]] — one row per spec with <code>type=hero_specialization</code>, <code>target_id=id</code>.
* [[Template:TranslationDef|Translation]] — display text in every language (English included), joined on <code>id = Translation.target_id WHERE Translation.type='hero_specialization' AND Translation.language='{{{lang|en}}}'</code> (1:N, one row per language).


== Notes ==
== Notes ==
Line 51: Line 48:
</noinclude><includeonly>{{#cargo_store:_table=HeroSpecialization
</noinclude><includeonly>{{#cargo_store:_table=HeroSpecialization
| id = {{{id|}}}
| id = {{{id|}}}
| name = {{{name|}}}
| desc = {{{desc|}}}
| name_sid = {{{name_sid|}}}
| name_sid = {{{name_sid|}}}
| desc_sid = {{{desc_sid|}}}
| desc_sid = {{{desc_sid|}}}
| icon = {{{icon|}}}
| icon = {{{icon|}}}
| source_path = {{{source_path|}}}
| source_path = {{{source_path|}}}
}}</includeonly>
}}
Created <code>HeroSpecialization</code> entry: <code>{{{id|}}}</code></includeonly>

Latest revision as of 20:48, 14 May 2026

One row per hero specialization (126 in the 2026-05-03 corpus: 108 faction + 9 campaign + 5 tutorial + 4 test). Each spec is the unique passive that distinguishes one hero mechanically — every Hero record carries specialization_id pointing at one of these.

The specialization carries identity (name, desc, icon) plus a list of structured bonuses[] effects that compose the spec's mechanical impact. Bonuses are emitted as inline {{HeroSpecializationBonus}} rows on the same wiki page.

Page layout

Data:HeroSpecialization/<id> carries:

  1. {{HeroSpecializationDef | id=… | icon=… | name_sid=… | desc_sid=… | …}}
  2. N × {{TranslationDef | type=hero_specialization | target_id=<id> | language=… | …}} — one row per language
  3. N × {{HeroSpecializationBonus | spec_id=<id> | ordinal=N | …}} (1367 total bonus rows across all 126 specs)

Schema

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

{{HeroSpecializationDef
| id = String
| icon = String
<!-- Localization references — display text lives in the Translation table, type='hero_specialization' -->
| name_sid = String
| desc_sid = String
| source_path = String
}}

Field notes

  • id is the source JSON id (e.g. human_hero_1_specialization, campaign_hero_4_specialization). The _specialization suffix is preserved.
  • name_sid / desc_sid point at the L10n entries (e.g. human_hero_1_spec_name / human_hero_1_spec_description), surfaced for traceability. Description text is heavy with {0}/{1} placeholders for stat values; the resolver substitutes via the standard pipeline before storing the translation.
  • Display name / description for every language (English included) live in the Translation table, type='hero_specialization'.
  • No hero_id back-reference. The Hero → HeroSpecialization direction is sufficient (forward join via Hero.specialization_id = HeroSpecialization.id). Reverse queries — "which hero has this spec" — work via the same join.

Related tables

  • Hero — joined on id = Hero.specialization_id (1:1 in practice; the schema permits N:1 in case a future patch shares specs across heroes).
  • HeroSpecializationBonus — joined on id = spec_id (1:N).
  • Translation — display text in every language (English included), joined on id = Translation.target_id WHERE Translation.type='hero_specialization' AND Translation.language='en' (1:N, one row per language).

Notes