Template:FactionDef: 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
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
One row per faction (6 rows total: <code>human</code>, <code>undead</code>, <code>dungeon</code>,
One row per faction (6 rows total: <code>human</code>, <code>undead</code>, <code>dungeon</code>,
<code>nature</code>, <code>demon</code>, <code>unfrozen</code>). Carries the structural data the
<code>nature</code>, <code>demon</code>, <code>unfrozen</code>). Carries the structural data the
in-game faction record holds — display name, description, biome, signature resource, asset references — plus the SIDs the
in-game faction record holds — biome, signature resource, asset references — plus the source SIDs. Display name and description (every language, English included) live in the shared [[Template:TranslationDef|Translation]] table.
<code>FactionTranslation</code> sibling joins on.


The bot emits one <code><nowiki>{{FactionDef | …}}</nowiki></code> template invocation at the top of each <code>Data:Faction/<id></code> page, immediately followed by the
The bot emits one <code><nowiki>{{FactionDef | …}}</nowiki></code> template invocation at the top of each <code>Data:Faction/<id></code> page, immediately followed by one <code><nowiki>{{TranslationDef | …}}</nowiki></code> row per language.
<code><nowiki>{{FactionTranslation | …}}</nowiki></code> row for the 15 non-English locales.
City-name pool entries are ''not'' on this page — they emit separately as <code>EntryDef</code> rows of <code>type=FactionCityName</code> (one row per city, see [[Template:EntryDef|<code>EntryDef</code>]]).
City-name pool entries are ''not'' on this page — they emit separately as <code>EntryDef</code> rows of <code>type=FactionCityName</code> (one row per city, see [[Template:EntryDef|<code>shared/Entry.md</code>]] and D-025).


Faction laws (the <code>fractionLawsLines</code> skill-tree structure in source JSON) are deferred — that ships when the dedicated FactionLaw work lands. Until then the law tree shape is not surfaced on the wiki.
Faction laws (the <code>fractionLawsLines</code> skill-tree structure in source JSON) are deferred — that ships when the dedicated FactionLaw work lands. Until then the law tree shape is not surfaced on the wiki.
Line 14: Line 12:
{{#cargo_declare:_table=Faction
{{#cargo_declare:_table=Faction
| id = String (allowed values=human,undead,dungeon,nature,demon,unfrozen)
| id = String (allowed values=human,undead,dungeon,nature,demon,unfrozen)
| name = String
| description = Wikitext
| icon = String
| icon = String
| icon_faction_laws = String
| icon_faction_laws = String
Line 28: Line 24:
{{FactionDef
{{FactionDef
| id = String (allowed values=human,undead,dungeon,nature,demon,unfrozen)
| id = String (allowed values=human,undead,dungeon,nature,demon,unfrozen)
| name = String
| description = Wikitext


| icon = String
| icon = String
Line 37: Line 31:
| resource = String
| resource = String


<!-- Localization references — display text lives in the Translation table, type='faction' -->
| name_sid = String
| name_sid = String
| desc_sid = String
| desc_sid = String
Line 46: Line 41:
== Field notes ==
== Field notes ==
* '''<code>id</code>''' is the primary key. Six fixed values; <code>neutral</code> is ''not'' a faction here even though <code>FactionDef</code> enum includes it for unit classification — there's no <code>7_neutral.json</code> source file.
* '''<code>id</code>''' is the primary key. Six fixed values; <code>neutral</code> is ''not'' a faction here even though <code>FactionDef</code> enum includes it for unit classification — there's no <code>7_neutral.json</code> source file.
* '''<code>name</code> / <code>desc</code>''' carry the resolved English defaults inline. Translations live on <code>FactionTranslation</code> keyed by <code>name_sid</code> / <code>desc_sid</code>. Per HoMM tradition the faction's display name is the town-style name: "Temple", "Necropolis", "Dungeon", "Grove", "Hive", "Schism".
* '''Display name / description''' for every language (English included) live in the [[Template:TranslationDef|Translation]] table, <code>type='faction'</code>. Per HoMM tradition the faction's display name is the town-style name: "Temple", "Necropolis", "Dungeon", "Grove", "Hive", "Schism".
* '''<code>icon</code>''' is the asset filename for the standard faction crest (e.g. <code>fraction_human</code>); the source JSON's misspelling is preserved here since it's an asset path, not a normalized concept.
* '''<code>icon</code>''' is the asset filename for the standard faction crest (e.g. <code>fraction_human</code>); the source JSON's misspelling is preserved here since it's an asset path, not a normalized concept.
* '''<code>icon_faction_laws</code>''' is a separate icon used on the faction-laws panel (e.g. <code>Scroll_Faction_Human</code>). Renamed from JSON's <code>iconFractionLaws</code>.
* '''<code>icon_faction_laws</code>''' is a separate icon used on the faction-laws panel (e.g. <code>Scroll_Faction_Human</code>). Renamed from JSON's <code>iconFractionLaws</code>.
Line 59: Line 54:


== Related tables ==
== Related tables ==
* [[FactionTranslation]] — joined on <code>id = faction_id</code> (1:1) for the 15 non-English locales.
* [[Template:TranslationDef|Translation]] — display text in every language (English included), joined on <code>id = Translation.target_id WHERE Translation.type='faction' AND Translation.language='{{{lang|en}}}'</code> (1:N, one row per language).
* [[Template:EntryDef|<code>EntryDef</code>]] where <code>type='FactionCityName'</code> — joined via <code>subtype LIKE '<faction>_%'</code> to surface this faction's randomization-pool city names.
* [[Template:EntryDef|<code>EntryDef</code>]] where <code>type='FactionCityName'</code> — joined via <code>subtype LIKE '<faction>_%'</code> to surface this faction's randomization-pool city names.
* [[Template:UnitDef|Unit]] — joined via <code>Unit.faction = Faction.id</code> (1:N).
* [[Template:UnitDef|Unit]] — joined via <code>Unit.faction = Faction.id</code> (1:N).
Line 68: Line 63:
</noinclude><includeonly>{{#cargo_store:_table=Faction
</noinclude><includeonly>{{#cargo_store:_table=Faction
| id = {{{id|}}}
| id = {{{id|}}}
| name = {{{name|}}}
| description = {{{description|}}}
| icon = {{{icon|}}}
| icon = {{{icon|}}}
| icon_faction_laws = {{{icon_faction_laws|}}}
| icon_faction_laws = {{{icon_faction_laws|}}}
Line 77: Line 70:
| desc_sid = {{{desc_sid|}}}
| desc_sid = {{{desc_sid|}}}
| source_path = {{{source_path|}}}
| source_path = {{{source_path|}}}
}}</includeonly>
}}
Created <code>Faction</code> entry: <code>{{{id|}}}</code></includeonly>

Latest revision as of 20:48, 14 May 2026

One row per faction (6 rows total: human, undead, dungeon, nature, demon, unfrozen). Carries the structural data the in-game faction record holds — biome, signature resource, asset references — plus the source SIDs. Display name and description (every language, English included) live in the shared Translation table.

The bot emits one {{FactionDef | …}} template invocation at the top of each Data:Faction/<id> page, immediately followed by one {{TranslationDef | …}} row per language. City-name pool entries are not on this page — they emit separately as EntryDef rows of type=FactionCityName (one row per city, see EntryDef).

Faction laws (the fractionLawsLines skill-tree structure in source JSON) are deferred — that ships when the dedicated FactionLaw work lands. Until then the law tree shape is not surfaced on the wiki.

Schema

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

{{FactionDef
| id = String (allowed values=human,undead,dungeon,nature,demon,unfrozen)

| icon = String
| icon_faction_laws = String

| biome = String
| resource = String

<!-- Localization references — display text lives in the Translation table, type='faction' -->
| name_sid = String
| desc_sid = String

| source_path = String
}}

Field notes

  • id is the primary key. Six fixed values; neutral is not a faction here even though FactionDef enum includes it for unit classification — there's no 7_neutral.json source file.
  • Display name / description for every language (English included) live in the Translation table, type='faction'. Per HoMM tradition the faction's display name is the town-style name: "Temple", "Necropolis", "Dungeon", "Grove", "Hive", "Schism".
  • icon is the asset filename for the standard faction crest (e.g. fraction_human); the source JSON's misspelling is preserved here since it's an asset path, not a normalized concept.
  • icon_faction_laws is a separate icon used on the faction-laws panel (e.g. Scroll_Faction_Human). Renamed from JSON's iconFractionLaws.
  • biome is the faction's signature terrain (Grass, Deathland, Dirt, Autumn, Lava, Snow). One per faction, all distinct in the 2026-05-03 corpus.
  • resource is the faction's signature resource (gemstones, mercury, crystals). Renamed from JSON's resourceName. Distribution: gemstones (human, dungeon), mercury (undead, unfrozen), crystals (nature, demon).
  • source_path is the JSON path relative to Core/, useful for audit / diff traceability.

Dropped from source

The source JSON's narrativeDesc field references SIDs of the form <id>_narrative_desc that exist in no language file in the 2026-05-03 corpus. Dead pointer; we drop the field entirely. If a future patch populates the SIDs, we'll add the column back.

Related tables

  • Translation — display text in every language (English included), joined on id = Translation.target_id WHERE Translation.type='faction' AND Translation.language='en' (1:N, one row per language).
  • EntryDef where type='FactionCityName' — joined via subtype LIKE '<faction>_%' to surface this faction's randomization-pool city names.
  • Unit — joined via Unit.faction = Faction.id (1:N).

Notes