Template:LawLevelDef: 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 2: | Line 2: | ||
One row per (law, level) pair. The 198 production laws contribute roughly 415 LawLevel rows (most laws have 2 levels; some have 1 or 3). Test laws add another ~80 rows. | One row per (law, level) pair. The 198 production laws contribute roughly 415 LawLevel rows (most laws have 2 levels; some have 1 or 3). Test laws add another ~80 rows. | ||
Each level carries the law-points cost to enact (separate from the tier-unlock threshold) | Each level carries the law-points cost to enact (separate from the tier-unlock threshold). The resolved description for ''that level's'' parameter substitutions lives in the [[Template:TranslationDef|Translation]] table. Bonuses awarded at this level are emitted as <code><nowiki>{{BonusDef | parent_type=law_level | parent_id=<law_id>_L<level> | …}}</nowiki></code> rows. | ||
== Schema == | == Schema == | ||
| Line 9: | Line 9: | ||
| level = Integer | | level = Integer | ||
| cost = Integer | | cost = Integer | ||
}} | }} | ||
| Line 17: | Line 16: | ||
| level = Integer <!-- 1-based; 1..max_level --> | | level = Integer <!-- 1-based; 1..max_level --> | ||
| cost = Integer <!-- law points to enact this level --> | | cost = Integer <!-- law points to enact this level --> | ||
}} | }} | ||
</nowiki></pre> | </nowiki></pre> | ||
| Line 24: | Line 22: | ||
* '''Primary key is <code>(law_id, level)</code>'''. | * '''Primary key is <code>(law_id, level)</code>'''. | ||
* '''<code>cost</code>''' is the per-level law-points spend, drawn from <code>parametersPerLevel[level-1].cost</code>. Each level's cost stands alone — leveling a law from L1 → L2 spends both costs in sequence. | * '''<code>cost</code>''' is the per-level law-points spend, drawn from <code>parametersPerLevel[level-1].cost</code>. Each level's cost stands alone — leveling a law from L1 → L2 spends both costs in sequence. | ||
* '''<code> | * '''Per-level description''' for every language (English included) lives in the [[Template:TranslationDef|Translation]] table as <code>type='law_level'</code> rows keyed by <code>target_id=<law_id></code> + <code>variant=<level></code>. The text is the parent law's <code>desc_sid</code> resolved with this level's bonus parameters (via the <code>CurrentFractionLawConfig</code> interpreter op, mirroring <code>CurrentMagicBattle</code> / <code>CurrentItem</code>). | ||
* '''No | * '''No name''' — the law's name is shared across all levels and lives in Translation as <code>type='law'</code>. | ||
== Related tables == | == Related tables == | ||
* [[Template:LawDef|Law]] — joined on <code>law_id = Law.id</code> (N:1). | * [[Template:LawDef|Law]] — joined on <code>law_id = Law.id</code> (N:1). | ||
* [[Template:BonusDef|<code>BonusDef</code>]] — joined on <code>parent_type='law_level' AND parent_id = law_id || '_L' || level</code>. | * [[Template:BonusDef|<code>BonusDef</code>]] — joined on <code>parent_type='law_level' AND parent_id = law_id || '_L' || level</code>. | ||
* [[ | * [[Template:TranslationDef|Translation]] — per-level descriptions in every language (English included), joined on <code>law_id = Translation.target_id AND level = Translation.variant WHERE Translation.type='law_level'</code> (1:N, one row per language). | ||
[[Category:Cargo Definitions]] | [[Category:Cargo Definitions]] | ||
| Line 37: | Line 35: | ||
| level = {{{level|}}} | | level = {{{level|}}} | ||
| cost = {{{cost|}}} | | cost = {{{cost|}}} | ||
}} | }} | ||
Created <code>LawLevel</code> entry: <code>{{{law_id|}}} (level {{{level|}}})</code></includeonly> | Created <code>LawLevel</code> entry: <code>{{{law_id|}}} (level {{{level|}}})</code></includeonly> | ||
Latest revision as of 20:48, 14 May 2026
One row per (law, level) pair. The 198 production laws contribute roughly 415 LawLevel rows (most laws have 2 levels; some have 1 or 3). Test laws add another ~80 rows.
Each level carries the law-points cost to enact (separate from the tier-unlock threshold). The resolved description for that level's parameter substitutions lives in the Translation table. Bonuses awarded at this level are emitted as {{BonusDef | parent_type=law_level | parent_id=<law_id>_L<level> | …}} rows.
Schema
This template defines the table "LawLevel". View table.
{{LawLevelDef
| law_id = String
| level = Integer <!-- 1-based; 1..max_level -->
| cost = Integer <!-- law points to enact this level -->
}}
Field notes
- Primary key is
(law_id, level). costis the per-level law-points spend, drawn fromparametersPerLevel[level-1].cost. Each level's cost stands alone — leveling a law from L1 → L2 spends both costs in sequence.- Per-level description for every language (English included) lives in the Translation table as
type='law_level'rows keyed bytarget_id=<law_id>+variant=<level>. The text is the parent law'sdesc_sidresolved with this level's bonus parameters (via theCurrentFractionLawConfiginterpreter op, mirroringCurrentMagicBattle/CurrentItem). - No name — the law's name is shared across all levels and lives in Translation as
type='law'.
Related tables
- Law — joined on
law_id = Law.id(N:1). BonusDef— joined onparent_type='law_level' AND parent_id = law_id || '_L' || level.- Translation — per-level descriptions in every language (English included), joined on
law_id = Translation.target_id AND level = Translation.variant WHERE Translation.type='law_level'(1:N, one row per language).


