17,105
edits
(Fix function) |
(getSeasonTable: Initial implementation) |
||
Line 9: | Line 9: | ||
p.Township = Township | p.Township = Township | ||
function p.getSeasonTable(frame) | |||
-- Manual data specifying the worship requirement for those | |||
-- rare seasons | |||
local seasonReqs = { | |||
["Nightfall"] = Icons.Icon({'Township%23Worship', 'Bane Worship', img='Statue of Bane', type='building'}), | |||
["SolarEclipse"] = Icons.Icon({'Township%23Worship', 'The Herald Worship', img='Statue of The Herald', type='building'}) | |||
} | |||
local seasons = Shared.shallowClone(Township.seasons) | |||
table.sort(seasons, function(a, b) return a.order < b.order end) | |||
local resultPart = {} | |||
table.insert(resultPart, '{| class="wikitable sortable stickyHeaders"') | |||
table.insert(resultPart, '\n|- class="headerRow-0"') | |||
table.insert(resultPart, '\n!colspan="2" | Season\n!Type\n!Modifiers') | |||
for i, season in ipairs(seasons) do | |||
local ns, localSeasonID = Shared.getLocalID(season.id) | |||
local reqs = seasonReqs[localSeasonID] | |||
table.insert(resultPart, '\n|-') | |||
table.insert(resultPart, '\n|class="table-img"| ' .. Icons.Icon({season.name, type='township', size=50, nolink=true, notext=true})) | |||
table.insert(resultPart, '\n| ' .. Icons.Icon({season.name, type='township', nolink=true, noicon=true})) | |||
table.insert(resultPart, '\n| ' .. (season.order <= 3 and 'Regular' or 'Rare')) | |||
if reqs ~= nil then | |||
table.insert(resultPart, '<br/>Requires ' .. reqs) | |||
end | |||
table.insert(resultPart, '\n| ' .. Constants.getModifiersText(season.modifiers)) | |||
end | |||
table.insert(resultPart, '\n|}') | |||
return table.concat(resultPart) | |||
end | |||
-- Returns the recipe for the item of a desired skill. | -- Returns the recipe for the item of a desired skill. | ||
Line 383: | Line 415: | ||
table.insert(ret, '\r\n|-\r\n| <b>Modifiers:</b>\r\n'..Constants.getModifiersText(building.modifiers, true)) | table.insert(ret, '\r\n|-\r\n| <b>Modifiers:</b>\r\n'..Constants.getModifiersText(building.modifiers, true)) | ||
end | end | ||
-- Biomes | -- Biomes | ||
table.insert(ret, '\r\n|-\r\n| <b>Biomes:</b>') | table.insert(ret, '\r\n|-\r\n| <b>Biomes:</b>') | ||
Line 390: | Line 422: | ||
table.insert(ret, '<br>'..Icons.Icon({biomename, type='biome', notext=true, nolink=true})..' <span>'..biomename..'</span>') | table.insert(ret, '<br>'..Icons.Icon({biomename, type='biome', notext=true, nolink=true})..' <span>'..biomename..'</span>') | ||
end | end | ||
-- End | -- End | ||
table.insert(ret, '\r\n|}') | table.insert(ret, '\r\n|}') |