Template:BuildingDef
One row per (faction, building, level) — 206 rows in the 2026-05-05 corpus across 6 factions and 18 building categories. The source's parametersPerLevel array is flattened on extract: a 3-level building like Build_Main produces 3 separate Building rows (<faction>_Build_Main_L1, _L2, _L3).
A building's per-level passive bonuses (bonusesPerLevel), optional effects (optionalEffectsPerLevel), magic-guild spell roll chances (rollChances), and most other category-specific extras are deliberately not extracted in this pass — they'd need their own decision/table and the value-to-effort ratio is currently low. Creature-dwelling unit data (unitsHire) IS pulled in, simplified to a single base-unit SID + weekly increment.
Page layout
Data:Building/<id> carries:
{{BuildingDef | id=<faction>_<sid>_L<level> | faction=… | sid=… | level=… | …}}- N ×
{{TranslationDef | type=building | target_id=<id> | language=… | name=… | description=… }}— name+description, one row per language - N ×
{{TranslationDef | type=building_narrative | target_id=<id> | language=… | description=… }}— narrative text (in thedescriptioncolumn), one row per language, when anarrative_desc_sidexists
No side rows — all per-level data flattens onto the Building row itself; multi-resource costs spread across fixed <resource>_cost columns; prerequisite list goes into a List column queryable via Cargo's HOLDS operator.
Schema
This template defines the table "Building". View table.
{{BuildingDef
| id = String <!-- synthesized: <faction>_<sid>_L<level> -->
| faction = String <!-- human, demon, dungeon, nature, undead, unfrozen -->
| category = String <!-- mains, walls, hires, magicGuilds, banks, taverns, markets, graals, etc. -->
| sid = String <!-- source-side sid, e.g. Build_Main, Build_Wall, Build_Tier_1 -->
| level = Integer <!-- 1-based; 1..max_level for this building -->
<!-- Localization references — display text lives in the Translation table:
type='building' carries name+description, type='building_narrative' carries narrative_desc -->
| name_sid = String
| desc_sid = String
| narrative_desc_sid = String
| icon = String
| background_image = String
<!-- Construction state (sparse — only meaningful at level 1; repeated per level for query convenience) -->
| is_constructed_on_start = Boolean
| level_on_start = Integer
| scene_slot = String
<!-- City-screen grid position for this level -->
| node_pos_x = Integer
| node_pos_y = Integer
<!-- Prereqs: List of <sid>_L<level> strings — query with HOLDS -->
| prereqs = List (,) of String
<!-- Costs: one fixed column per source resource, NULL when not required at this level -->
| gold_cost = Integer
| wood_cost = Integer
| ore_cost = Integer
| crystals_cost = Integer
| gemstones_cost = Integer
| mercury_cost = Integer
| dust_cost = Integer
| graal_cost = Integer
<!-- Creature-dwelling fields (only populated when category='hires') -->
| units_hire_sid = String <!-- base unit SID; the upg / upg_alt variants live on Unit/UnitUpgrade joins -->
| units_weekly = Integer <!-- weekly increment at this level -->
| source_path = String
}}
Field notes
- Primary key is
id, synthesized as<faction>_<sid>_L<level>(e.g.human_Build_Main_L1). Building SIDs are unique within a faction but reused across factions (every faction hasBuild_Main), so the faction prefix is needed for global uniqueness. categoryis the source group key the building came from (one of:mains,walls,magicGuilds,taverns,markets,graals,banks,hires,artifactMarkets,heroBonusBanks,intelligences,manaFountains,myceliumRoots,portalSummonings,rebirthShrines,trainingRanges,unitsConverters,artifactChangers). The single-instance specials (intelligences, manaFountains, etc.) are faction-unique buildings —categorylets the wiki style/group them.levelis 1-based; queryWHERE sid=<x> AND level=<n>to pull a specific tier of a building, orWHERE sid=<x>for all tiers in numeric order.- Display name / description / narrative text for every language (English included) live in the Translation table —
type='building'rows carry name + description,type='building_narrative'rows carry the narrative text. prereqsis a CargoListof<sid>_L<level>strings (e.g.Build_Main_L1,Build_Tier_2_L1). Empty list when no prereq. Query "what unlocks at Build_Main level 2" viaWHERE prereqs HOLDS 'Build_Main_L2'.<resource>_costcolumns are sparse — each is NULL unless the source'scostsarray includes that resource for this level. Eight columns total (gold/wood/ore/crystals/gemstones/mercury/dust/graal). One pre-set column per resource keeps queries scalar-clean ("WHERE gold_cost > 5000").units_hire_sidis the base unit SID fromunitsHire.units[0].sids[0]. The upg / upg_alt variants are reachable viaUnit.upgrade_of/ equivalent join on the Unit table — no need to denormalize them onto Building.units_weeklyisunitsHire.units[0].weeklyIncrement. The dwellings in 2026-05-05 only ever ship a single units-group entry per building, so we collapse it.
Deliberately not extracted
bonusesPerLevel— per-level passive bonuses on the building (e.g. mains'+500 gold daily). The data exists in source but isn't currently emitted; would extend the unifiedBonusDeftable withparent_type='building_level'if added later. Out of scope for this pass.optionalEffectsPerLevel— the choose-one effects you pick when upgrading certain buildings (e.g. mains level 2 offers gold/law/astrology). Same story — would need its own side table.rollChanceson magic guilds — the per-spell offering weights. ~60 entries per guild, would explode into aBuildingGuildSpell(building_id, spell_sid, chance)side table; deferred.- Wall
bonuses, marketextraChargePurchase/extraChargeSell/numberPurchases/resArr, trainingtrainingStats, unitsConverterconversionPairs, artifactMarketartifacts/itemsCountPerRarity/levelStep/numberPurchases, graalgraalType— category-specific data the player rarely queries from a wiki perspective. All deferred. buildOrders— 60 build-order presets used by AI / random map generation, not player-facing buildings. Not extracted (per project decision; noted for hypothetical future work asBuildingPreset).
Related tables
- Faction — joined on
faction = Faction.id. - Translation — display text in every language (English included), joined on
id = Translation.target_idwithTranslation.type IN ('building', 'building_narrative')and the desiredlanguagefilter. - Unit — for
category='hires'rows,units_hire_sidjoins toUnit.id(the base unit; upgrade variants chain via Unit's own self-joins). - Building (self) —
prereqs HOLDS '<sid>_L<level>'finds buildings unlocked by a given prereq tier.


