Module:Township: Difference between revisions

getBuildingBiomeTable: Add biome requirements to header rows
(getBuildingInfoBox: Add maximum building count)
(getBuildingBiomeTable: Add biome requirements to header rows)
Line 314: Line 314:
table.insert(resultPart, '\n|- class="headerRow-1"')
table.insert(resultPart, '\n|- class="headerRow-1"')
table.insert(resultPart, '\n! ' .. Icons.Icon({'Township', 'Level', type='skill', nolink=true}))
table.insert(resultPart, '\n! ' .. Icons.Icon({'Township', 'Level', type='skill', nolink=true}))
table.insert(resultPart, '\n! ' .. Icons.Icon({'Township%23Population', 'Population', img='Population', type='township'}))
table.insert(resultPart, '\n! ' .. Icons.Icon({'Township', 'Population', img='Population', type='township', section='Population' }))


for i, biome in ipairs(Township.biomes) do
for i, biome in ipairs(Township.biomes) do
Line 334: Line 334:
local ret = {}
local ret = {}
table.insert(ret, '{| class="wikitable sortable stickyHeader" style="text-align:center"')
table.insert(ret, '{| class="wikitable sortable stickyHeader" style="text-align:center"')
table.insert(ret, '\n|- class="headerRow-0"')
table.insert(ret, '\n! Building')


-- Generate the table header, one column per biome
-- Generate the table header, one column per biome
local biomeRows = {
['head'] = { '\n|- class="headerRow-0"\n! Building' },
['level'] = { '\n|- class="sorttop"\n! ' .. Icons.Icon({'Township', 'Level', type='skill', nolink=true}) },
['pop'] = { '\n|- class="sorttop"\n! ' .. Icons.Icon({'Township', 'Population', img='Population', type='township', section='Population' }) }
}
for _, biome in ipairs(Township.biomes) do
for _, biome in ipairs(Township.biomes) do
table.insert(ret, '\n! ' .. Icons.Icon({biome.name, type='biome', notext=true, nolink=true}) .. '<br/>' .. biome.name)
local reqs = p._getTierRequirements(biome.tier)
table.insert(biomeRows.head, '\n! ' .. Icons.Icon({biome.name, type='biome', notext=true, nolink=true}) .. '<br/>' .. biome.name)
table.insert(biomeRows.level, '\n| ' .. Shared.formatnum(reqs.level))
table.insert(biomeRows.pop, '\n| ' .. Shared.formatnum(reqs.population))
end
end
table.insert(ret, table.concat(biomeRows.head))
table.insert(ret, table.concat(biomeRows.level))
table.insert(ret, table.concat(biomeRows.pop))
biomeRows = nil


for _, _building in ipairs(p._sortedBuildings(false)) do
for _, _building in ipairs(p._sortedBuildings(false)) do