Template:UnitDef: 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 9: Line 9:
| tier = Integer
| tier = Integer
| source_path = String
| source_path = String
| name = String
| description = Wikitext
| name_sid = String
| name_sid = String
| desc_sid = String
| desc_sid = String
Line 61: Line 59:
| source_path = String
| source_path = String


<!-- Localization references -->
<!-- Localization references — display text lives in the Translation table, type='unit' -->
| name = String
| description = Wikitext
| name_sid = String
| name_sid = String
| desc_sid = String
| desc_sid = String
Line 121: Line 117:
* '''Resource cost columns are sparse.''' Most units have only <code>gold_cost</code>; tier-7s cost gold + a special resource. The <code>dust_cost</code> column reflects Olden Era's "dust" resource (analogous to mercury in HoMM3).
* '''Resource cost columns are sparse.''' Most units have only <code>gold_cost</code>; tier-7s cost gold + a special resource. The <code>dust_cost</code> column reflects Olden Era's "dust" resource (analogous to mercury in HoMM3).
* '''<code>creature_type</code> is derived''' from data-immunities tagged <code><class>_immunities</code> — <code>living_immunities</code> → <code>living</code>, etc. The unit's actual immunity tags live in <code>immunities</code>.
* '''<code>creature_type</code> is derived''' from data-immunities tagged <code><class>_immunities</code> — <code>living_immunities</code> → <code>living</code>, etc. The unit's actual immunity tags live in <code>immunities</code>.
* '''<code>name_sid</code> / <code>desc_sid</code>''' are the join keys to <code>UnitTranslation</code>.
* '''<code>name_sid</code> / <code>desc_sid</code>''' are the source L10n SIDs, surfaced for traceability only. They are not the translation lookup path — display text is joined from the [[Template:TranslationDef|Translation]] table on <code>id</code>.


== Related tables ==
== Related tables ==
* [[UnitTranslation]] — joined on <code>name_sid</code> (1:1).
* [[Template:TranslationDef|Translation]] — display text in every language (English included), joined on <code>id = Translation.target_id WHERE Translation.type='unit' AND Translation.language='{{{lang|en}}}'</code> (1:N, one row per language).
* [[Template:UnitAbilityDef|UnitAbility]] and its splinters — joined on <code>unit_id = id</code> (1:N).
* [[Template:UnitAbilityDef|UnitAbility]] and its splinters — joined on <code>unit_id = id</code> (1:N).


Line 134: Line 130:
| tier = {{{tier|}}}
| tier = {{{tier|}}}
| source_path = {{{source_path|}}}
| source_path = {{{source_path|}}}
| name = {{{name|}}}
| description = {{{description|}}}
| name_sid = {{{name_sid|}}}
| name_sid = {{{name_sid|}}}
| desc_sid = {{{desc_sid|}}}
| desc_sid = {{{desc_sid|}}}

Latest revision as of 20:48, 14 May 2026

One row per extracted creature. Combat stats, resource costs, faction metadata, and classification flags. The bot emits one {{UnitDef | …}} template invocation per unit at the top of Data:Unit/<id>. The template's job on the wiki side is to call #cargo_store with these parameters.

Schema

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

{{UnitDef
| id = String
| unused = Boolean
| faction = String (allowed values=human,undead,dungeon,nature,demon,unfrozen,neutral)
| tier = Integer
| source_path = String

<!-- Localization references — display text lives in the Translation table, type='unit' -->
| name_sid = String
| desc_sid = String
| base_sid = String                          <!-- this unit's base form, if it's an upgrade -->
| upgrade_sid = String                        <!-- the unit's upgrade target, if it has one -->

<!-- Stats block (mirrors UnitStats) -->
| hp = Integer
| offence = Integer
| defence = Integer
| damage_min = Integer
| damage_max = Integer
| initiative = Integer
| speed = Integer
| luck = Integer
| morale = Integer
| energy_per_cast = Integer
| energy_per_round = Integer
| energy_per_take_damage = Integer
| action_points = Integer
| num_counters = Integer
| morale_min = Integer
| morale_max = Integer
| luck_min = Integer
| luck_max = Integer
| move_type = String (allowed values=ground,fly,teleport,jump)

<!-- Classification -->
| creature_type = String (allowed values=living,undead,demon,magic_creature,embodiment,dragon,construct)
| immunities = List (,) of String
| disablers = List (,) of String
| shared_abilities = List (,) of String      <!-- name SIDs of base_*/<faction>_* passives -->
| native_biome = String
| ai_archetype = String
| tags = List (,) of String
| leave_corpse = Boolean

<!-- Resource costs (sparse — only the resources this unit needs are populated) -->
| gold_cost = Integer
| wood_cost = Integer
| ore_cost = Integer
| mercury_cost = Integer
| dust_cost = Integer
| crystal_cost = Integer
| gemstone_cost = Integer

<!-- Misc -->
| squad_value = Integer                       <!-- AI-side squad-power scoring -->
| exp_bonus = Integer
}}

Field notes

  • unused is sparse-emitted: only present (as yes) for the small set of deprecated units (units whose name_sid has no English entry). Filter most queries with WHERE unused != "yes".
  • base_sid / upgrade_sid form the variant chain: crossbowmancrossbowman_upgcrossbowman_upg_alt. Each tier gets its own row.
  • shared_abilities lists name SIDs of the base/faction passives this unit has (e.g. base_passive_melee_attack_name). The actual passive text lives in shared tables (Phase 2). The bot ships these as references so the wiki display layer can render them by lookup instead of duplicating text on every unit page.
  • Resource cost columns are sparse. Most units have only gold_cost; tier-7s cost gold + a special resource. The dust_cost column reflects Olden Era's "dust" resource (analogous to mercury in HoMM3).
  • creature_type is derived from data-immunities tagged <class>_immunitiesliving_immunitiesliving, etc. The unit's actual immunity tags live in immunities.
  • name_sid / desc_sid are the source L10n SIDs, surfaced for traceability only. They are not the translation lookup path — display text is joined from the Translation table on id.

Related tables

  • Translation — display text in every language (English included), joined on id = Translation.target_id WHERE Translation.type='unit' AND Translation.language='en' (1:N, one row per language).
  • UnitAbility and its splinters — joined on unit_id = id (1:N).