16,254
edits
(getWorshipTable: Add season modifiers) |
(getBuildingInfoBox, getBuildingUpgradeTable, getTraderTable: Update for v1.1.2) |
||
Line 1: | Line 1: | ||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local Items = require('Module:Items') | |||
local Shop = require('Module:Shop') | local Shop = require('Module:Shop') | ||
local GameData = require('Module:GameData') | local GameData = require('Module:GameData') | ||
Line 19: | Line 20: | ||
else | else | ||
return GameData.getEntityByID(Township.buildings, id) | return GameData.getEntityByID(Township.buildings, id) | ||
end | |||
end | |||
-- Gets a Township building by name, e.g. Hunters Cabin | |||
function p._getBuildingByName(name) | |||
-- Check for the special statue case | |||
if name == 'Statues' then | |||
name = 'Statue of Worship' | |||
end | |||
local STATUE_OF = 'Statue of ' | |||
if string.sub(name, 1, string.len(STATUE_OF)) == STATUE_OF then | |||
local building = Shared.clone(GameData.getEntityByID(Township.buildings, 'melvorF:Statues')) | |||
building.name = name | |||
return building | |||
else | |||
return GameData.getEntityByName(Township.buildings, name) | |||
end | end | ||
end | end | ||
Line 25: | Line 42: | ||
function p._getResourceByID(id) | function p._getResourceByID(id) | ||
return GameData.getEntityByID(Township.resources, id) | return GameData.getEntityByID(Township.resources, id) | ||
end | |||
-- Given a building, find the next building upgrade | |||
function p._getBuildingUpgrade(building) | |||
local function checkFunc(entity) | |||
return entity.upgradesFrom ~= nil and entity.upgradesFrom == building.id | |||
end | |||
local upgradesTo = GameData.getEntities(Township.buildings, checkFunc) | |||
if #upgradesTo > 0 then | |||
return upgradesTo[1] | |||
end | |||
return nil | |||
end | end | ||
Line 58: | Line 87: | ||
end | end | ||
end | end | ||
end | |||
-- Given a building, groups biomes for which that building has a common cost | |||
function p._getBuildingGroupedCosts(building) | |||
local biomeGroups = {} | |||
for i, biomeID in ipairs(building.biomes) do | |||
local currentBiomeCost = p._getBuildingCostText(building, biomeID) | |||
local found = false | |||
for j, biomeGroup in ipairs(biomeGroups) do | |||
if biomeGroup.cost == currentBiomeCost then | |||
-- Another biome exists with this cost | |||
table.insert(biomeGroup.biomeIDs, biomeID) | |||
found = true | |||
break | |||
end | |||
end | |||
if not found then | |||
table.insert(biomeGroups, { biomeIDs = { biomeID }, cost = currentBiomeCost}) | |||
end | |||
end | |||
return biomeGroups | |||
end | |||
-- Given a building, returns a text string repesenting the building costs for all biomes | |||
function p._getBuildingGroupedCostText(building) | |||
local resultPart = {} | |||
local biomeGroups = p._getBuildingGroupedCosts(building) | |||
if Shared.tableCount(biomeGroups) == 1 then | |||
-- If only one entry then simply output the cost | |||
table.insert(resultPart, biomeGroups[1].cost) | |||
else | |||
-- Otherwise, split by biome group | |||
for i, biomeGroup in ipairs(biomeGroups) do | |||
local biomeText = {} | |||
for j, biomeID in ipairs(biomeGroup.biomeIDs) do | |||
local biome = GameData.getEntityByID(Township.biomes, biomeID) | |||
table.insert(biomeText, Icons.Icon({biome.name, type='biome', notext=true, nolink=true, alt=biome.name})) | |||
end | |||
table.insert(resultPart, table.concat(biomeText, ', ') .. ': ' .. biomeGroup.cost) | |||
end | |||
end | |||
return table.concat(resultPart, '<br/>') | |||
end | end | ||
-- Given a building and biome ID, returns a string displaying the building's benefits, | -- Given a building and biome ID, returns a string displaying the building's benefits, | ||
-- or nil if no benefits | -- or nil if no benefits | ||
function p. | function p._getBuildingBenefitText(building, biomeID, includeModifiers, delimiter) | ||
-- Basic validation of inputs | -- Basic validation of inputs | ||
if type(building) == 'table' and building.provides ~= nil and biomeID ~= nil then | if type(building) == 'table' and building.provides ~= nil and biomeID ~= nil then | ||
Line 81: | Line 152: | ||
end | end | ||
end | end | ||
if providesData ~= nil then | if providesData ~= nil then | ||
local resultPart = {} | local resultPart = {} | ||
Line 109: | Line 180: | ||
-- Other stats | -- Other stats | ||
for key, stat in pairs(stats) do | for key, stat in pairs(stats) do | ||
local quantity = providesData[key] | local quantity = providesData[key] | ||
if quantity ~= nil and quantity ~= 0 then | if quantity ~= nil and quantity ~= 0 then | ||
Line 121: | Line 191: | ||
end | end | ||
end | end | ||
end | |||
-- Given a building, groups biomes for which that building has a common benefit/provides | |||
function p._getBuildingGroupedBenefits(building, includeModifiers) | |||
if includeModifiers == nil then | |||
includeModifiers = true | |||
end | |||
local biomeGroups = {} | |||
for i, biomeID in ipairs(building.biomes) do | |||
local currentBiomeBenefit = p._getBuildingBenefitText(building, biomeID, includeModifiers) | |||
local found = false | |||
for j, biomeGroup in ipairs(biomeGroups) do | |||
if biomeGroup.benefit == currentBiomeBenefit then | |||
-- Another biome exists with this cost | |||
table.insert(biomeGroup.biomeIDs, biomeID) | |||
found = true | |||
break | |||
end | |||
end | |||
if not found then | |||
table.insert(biomeGroups, { biomeIDs = { biomeID }, cost = currentBiomeBenefit}) | |||
end | |||
end | |||
return biomeGroups | |||
end | |||
-- Given a building, returns a text string repesenting the building benefits for all biomes | |||
function p._getBuildingGroupedBenefitText(building, includeModifiers) | |||
if includeModifiers == nil then | |||
includeModifiers = true | |||
end | |||
local resultPart = {} | |||
local biomeGroups = p._getBuildingGroupedBenefits(building, includeModifiers) | |||
if Shared.tableCount(biomeGroups) == 1 then | |||
-- If only one entry then simply output the cost | |||
table.insert(resultPart, biomeGroups[1].cost) | |||
else | |||
-- Otherwise, split by biome group | |||
for i, biomeGroup in ipairs(biomeGroups) do | |||
local biomeText = {} | |||
for j, biomeID in ipairs(biomeGroup.biomeIDs) do | |||
local biome = GameData.getEntityByID(Township.biomes, biomeID) | |||
table.insert(biomeText, Icons.Icon({biome.name, type='biome', notext=true, nolink=true, alt=biome.name})) | |||
end | |||
table.insert(resultPart, table.concat(biomeText, ', ') .. ': ' .. biomeGroup.cost) | |||
end | |||
end | |||
return table.concat(resultPart, '<br/>') | |||
end | end | ||
Line 291: | Line 409: | ||
table.insert(resultPart, '\n| ' .. Icons.Icon({biome.name, type='biome', nolink=true})) | table.insert(resultPart, '\n| ' .. Icons.Icon({biome.name, type='biome', nolink=true})) | ||
table.insert(resultPart, '\n| ' .. p._getBuildingCostText(building, biomeID)) | table.insert(resultPart, '\n| ' .. p._getBuildingCostText(building, biomeID)) | ||
local providesText = p. | local providesText = p._getBuildingBenefitText(building, biomeID) | ||
if building.modifiers ~= nil then | if building.modifiers ~= nil then | ||
local modText = Constants.getModifiersText(building.modifiers) | local modText = Constants.getModifiersText(building.modifiers) | ||
Line 310: | Line 428: | ||
-- Builds the table of trader items | -- Builds the table of trader items | ||
function p.getTraderTable(frame) | function p.getTraderTable(frame) | ||
local resultPart = {} | |||
-- Build | -- Build table header | ||
table.insert(resultPart, '{| class="wikitable sortable stickyHeader"') | |||
table.insert(resultPart, '\n|- class="headerRow-0"') | |||
table.insert(resultPart, '\n!colspan="2"| Item\n!Description\n!style="min-width:60px"| Cost\n!Requirements') | |||
for i, tsResource in ipairs(Township.itemConversions.fromTownship) do | |||
local res = GameData.getEntityByID(Township.resources, tsResource.resourceID) | |||
for j, tradeDef in ipairs(tsResource.items) do | |||
local item = Items.getItemByID(tradeDef.itemID) | |||
local itemDesc = item.customDescription | |||
if itemDesc == nil then | |||
if item.modifiers ~= nil then | |||
itemDesc = Constants.getModifiersText(item.modifiers, false, true) | |||
if | |||
else | else | ||
itemDesc = '' | |||
end | end | ||
end | end | ||
local resQty = math.max(item.sellsFor, 2) | |||
table.insert( | local costSort = i * 10000 + resQty | ||
table.insert( | table.insert(resultPart, '\n|-\n| ' .. Icons.Icon({item.name, type='item', size=50, notext=true})) | ||
table.insert(resultPart, '\n| ' .. Icons.Icon({item.name, type='item', noicon=true})) | |||
table.insert(resultPart, '\n| ' .. itemDesc) | |||
table.insert(resultPart, '\n|data-sort-value="' .. costSort ..'" style="text-align:right"| ' .. Icons.Icon({res.name, type='resource', qty=resQty, notext=true})) | |||
table.insert(resultPart, '\n| ' .. Shop.getRequirementString(tradeDef.unlockRequirements)) | |||
end | end | ||
end | end | ||
return table.concat( | table.insert(resultPart, '\n|}') | ||
return table.concat(resultPart) | |||
end | end | ||
Line 479: | Line 542: | ||
end | end | ||
-- | -- Gets a building and prepares all the relevant stats for the building, presented as an infobox | ||
function p.getBuildingInfoBox(frame) | |||
local name = frame.args ~= nil and frame.args[1] or frame | |||
local building = p._getBuildingByName(name) | |||
function p. | if building == nil then | ||
return Shared.printError('No building named "' .. name .. '" exists in the data module') | |||
local | |||
end | end | ||
local ret = {} | local ret = {} | ||
-- Header | -- Header | ||
table.insert(ret, ' | table.insert(ret, '{| class="wikitable infobox"') | ||
-- Name | -- Name | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n! ' .. building.name) | ||
-- Icon | -- Icon | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n|style="text-align:center"| ' .. Icons.Icon({building.name, type='building', size='250', notext=true})) | ||
-- ID | -- ID | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n| <b>Building ID:</b> ' .. building.id) | ||
-- Type | -- Type | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n| <b>Type:</b> ' .. building.type) | ||
-- Tier | -- Tier | ||
local tier = p._getTierText(building.tier) | local tier = p._getTierText(building.tier) | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n| <b>Requirements:</b><br/>' .. tier) | ||
-- Upgrades From | -- Upgrades From | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n| <b>Base Cost:</b>') | ||
local upgradesFrom = p._getBuildingDowngrade(building) | local upgradesFrom = p._getBuildingDowngrade(building) | ||
if upgradesFrom ~= nil then | if upgradesFrom ~= nil then | ||
table.insert(ret, '<br>'..Icons.Icon({upgradesFrom.name, type='building'})) | table.insert(ret, '<br/>' .. Icons.Icon({upgradesFrom.name, type='building'})) | ||
end | end | ||
-- Cost | -- Cost | ||
local cost = | --table.insert(ret, '<br/>' .. p._getBuildingGroupedCostText(building)) | ||
local function getGroupedText(building, groupFunc) | |||
local biomeGroups = groupFunc(building) | |||
if Shared.tableCount(biomeGroups) == 1 then | |||
-- If only one entry then simply output the cost | |||
return biomeGroups[1].cost | |||
else | |||
-- Otherwise, split by biome group | |||
local resultPart = {} | |||
table.insert(resultPart, '{| class="wikitable" style="text-align:center; margin: 0.25em 0 0 0"') | |||
for i, biomeGroup in ipairs(biomeGroups) do | |||
local biomeText = {} | |||
for j, biomeID in ipairs(biomeGroup.biomeIDs) do | |||
local biome = GameData.getEntityByID(Township.biomes, biomeID) | |||
table.insert(biomeText, Icons.Icon({biome.name, type='biome', notext=true, nolink=true, alt=biome.name})) | |||
end | |||
table.insert(resultPart, '\n|-\n| ' .. table.concat(biomeText, '<br/>')) | |||
table.insert(resultPart, '\n| ' .. biomeGroup.cost) | |||
end | |||
table.insert(resultPart, '\n|}') | |||
return table.concat(resultPart) | |||
end | |||
end | |||
table.insert(ret, '\n' .. getGroupedText(building, p._getBuildingGroupedCosts)) | |||
-- Upgrades To | -- Upgrades To | ||
local upgradesTo = p. | local upgradesTo = p._getBuildingUpgrade(building) | ||
if upgradesTo ~= nil then | if upgradesTo ~= nil then | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n| <b>Upgrades To:</b>') | ||
table.insert(ret, '<br>'..Icons.Icon({upgradesTo.name, type='building'}) | table.insert(ret, '<br/>' .. Icons.Icon({upgradesTo.name, type='building'})) | ||
table.insert(ret, '\n' .. getGroupedText(upgradesTo, p._getBuildingGroupedCosts)) | |||
table.insert(ret, ' | |||
end | end | ||
-- | -- Benefits | ||
local benefits = p. | local benefits = p._getBuildingGroupedBenefitText(building) | ||
if benefits ~= nil | if benefits ~= nil and benefits ~= '' then | ||
table.insert(ret, '\n|-\n| <b>Provides:</b><br/>' .. benefits) | |||
end | end | ||
-- Biomes | -- Biomes | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n| <b>Biomes:</b>') | ||
for _, biomeid in ipairs(building.biomes) do | for _, biomeid in ipairs(building.biomes) do | ||
local | local biome = GameData.getEntityByID(Township.biomes, biomeid) | ||
table.insert(ret, '<br>'..Icons.Icon({ | table.insert(ret, '<br/>' .. Icons.Icon({biome.name, type='biome', nolink=true})) | ||
end | end | ||
-- End | -- End | ||
table.insert(ret, ' | table.insert(ret, '\n|}') | ||
return table.concat(ret) | return table.concat(ret) | ||
end | end | ||
-- | -- Returns an upgrade table of a building | ||
function p. | function p.getBuildingUpgradeTable(frame) | ||
local buildingname = frame.args ~= nil and frame.args[1] or frame | |||
local | local building = p._getBuildingByName(buildingname) | ||
if building == nil then | |||
if | return Shared.printError('No building named "' .. buildingname .. '" exists in the data module') | ||
return | |||
end | end | ||
-- Let's find the base building | -- Let's find the base building | ||
local baseBuilding = building | local baseBuilding = building | ||
Line 815: | Line 642: | ||
end | end | ||
end | end | ||
-- Let's make a list of all the buildings | -- Let's make a list of all the buildings | ||
-- Return empty string if there is only 1 building in the upgrade chain (i.e. no upgrades/downgrades) | -- Return empty string if there is only 1 building in the upgrade chain (i.e. no upgrades/downgrades) | ||
Line 822: | Line 649: | ||
while true do | while true do | ||
table.insert(buildingList, _curBuilding) | table.insert(buildingList, _curBuilding) | ||
_curBuilding = p. | _curBuilding = p._getBuildingUpgrade(_curBuilding) | ||
if _curBuilding == nil then | if _curBuilding == nil then | ||
break | break | ||
Line 830: | Line 657: | ||
return '' | return '' | ||
end | end | ||
local ret = {} | local ret = {} | ||
table.insert(ret, ' | table.insert(ret, '\n== Upgrade Chart ==') | ||
table.insert(ret, ' | table.insert(ret, '\n{| class="wikitable" style="text-align:center"') | ||
-- Name | -- Name | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n!colspan="2"| Name') | ||
for _, building in ipairs(buildingList) do | for _, building in ipairs(buildingList) do | ||
table.insert(ret, ' | table.insert(ret, '\n!' .. Icons.Icon({building.name, type='building'})) | ||
end | end | ||
-- Tier | -- Tier | ||
table.insert(ret, ' | table.insert(ret, '\n|-\n!colspan="2"| Requirements') | ||
for _, building in ipairs(buildingList) do | for _, building in ipairs(buildingList) do | ||
table.insert(ret, '\n|' .. p._getTierText(building.tier)) | |||
table.insert(ret, ' | |||
end | end | ||
-- Cost | -- Cost | ||
table.insert(ret, ' | local biomeCount = Shared.tableCount(baseBuilding.biomes) | ||
for _, building in ipairs(buildingList) do | table.insert(ret, '\n|-\n!rowspan="' .. biomeCount .. '"| Cost') | ||
local firstBiome = true | |||
for _, biomeID in ipairs(baseBuilding.biomes) do | |||
local biome = GameData.getEntityByID(Township.biomes, biomeID) | |||
table.insert(ret, (firstBiome and '' or '\n|-') .. '\n! ' .. Icons.Icon({biome.name, type='biome', nolink=true})) | |||
for _, building in ipairs(buildingList) do | |||
local cost = p._getBuildingCostText(building, biomeID) | |||
table.insert(ret, '\n| ' .. cost) | |||
end | |||
firstBiome = false | |||
end | end | ||
-- | -- Benefits | ||
local benefitText = {} | |||
- | table.insert(benefitText, '\n|-\n!rowspan="' .. biomeCount .. '"| Benefits') | ||
firstBiome = true | |||
local | local hasText = false | ||
local | for _, biomeID in ipairs(baseBuilding.biomes) do | ||
local biome = GameData.getEntityByID(Township.biomes, biomeID) | |||
table.insert(benefitText, (firstBiome and '' or '\n|-') .. '\n! ' .. Icons.Icon({biome.name, type='biome', nolink=true})) | |||
for _, building in ipairs(buildingList) do | for _, building in ipairs(buildingList) do | ||
local | local benefit = p._getBuildingBenefitText(building, biomeID, true) or '' | ||
if not hasText and benefit ~= '' then | |||
hasText = true | |||
end | |||
table.insert(benefitText, '\n| ' .. benefit) | |||
end | end | ||
firstBiome = false | |||
end | |||
if hasText then | |||
-- Only add benefits rows if the building has benefits to display | |||
table.insert(ret, table.concat(benefitText)) | |||
end | end | ||
-- End | -- End | ||
table.insert(ret, ' | table.insert(ret, '\n|}') | ||
return table.concat(ret) | return table.concat(ret) | ||
end | end | ||
-- Returns a row containing a task given a title and a task table | -- Returns a row containing a task given a title and a task table | ||
function p. | function p._getTaskRow(title, task) | ||
local ret = {} | local ret = {} | ||
-- If has description, we will need to rowspan the title by 2, and insert a description with colspan 2 | -- If has description, we will need to rowspan the title by 2, and insert a description with colspan 2 | ||
local hasDescription = false | local hasDescription = false | ||
Line 891: | Line 726: | ||
end | end | ||
local titlespan = hasDescription == true and 'rowspan="2"|' or '' | local titlespan = hasDescription == true and 'rowspan="2"|' or '' | ||
-- Title | -- Title | ||
table.insert(ret, ' | table.insert(ret, '\n|-') | ||
table.insert(ret, ' | table.insert(ret, '\n!'..titlespan..title) | ||
-- Description | -- Description | ||
if hasDescription then | if hasDescription then | ||
table.insert(ret, ' | table.insert(ret, '\n|colspan="2"|'..task.description) | ||
table.insert(ret, ' | table.insert(ret, '\n|-') | ||
end | end | ||
-- Requirements | -- Requirements | ||
table.insert(ret, ' | table.insert(ret, '\n|') | ||
local requirements = {} | local requirements = {} | ||
for _, item in ipairs(task.goals.items) do | for _, item in ipairs(task.goals.items) do | ||
Line 920: | Line 755: | ||
end | end | ||
-- We don't check tasks.requirements (so far it's only used to enumerate the Tutorial tasks so you only see 1 at a time) | -- We don't check tasks.requirements (so far it's only used to enumerate the Tutorial tasks so you only see 1 at a time) | ||
table.insert(ret, table.concat(requirements, '<br>')) | table.insert(ret, table.concat(requirements, '<br/>')) | ||
-- Rewards | -- Rewards | ||
table.insert(ret, ' | table.insert(ret, '\n|') | ||
local rewards = {} | local rewards = {} | ||
if task.rewards.gp ~= 0 then | if task.rewards.gp ~= 0 then | ||
Line 942: | Line 777: | ||
table.insert(rewards, Shared.formatnum(townshipResource.quantity)..' '..Icons.Icon({resourcename, type='resource'})) | table.insert(rewards, Shared.formatnum(townshipResource.quantity)..' '..Icons.Icon({resourcename, type='resource'})) | ||
end | end | ||
table.insert(ret, table.concat(rewards, '<br>')) | table.insert(ret, table.concat(rewards, '<br/>')) | ||
return table.concat(ret) | return table.concat(ret) | ||
end | end | ||
-- Returns all the tasks of a given category | -- Returns all the tasks of a given category | ||
function p. | -- TODO: Support casual tasks | ||
function p.getTaskTable(frame) | |||
local category = frame.args ~= nil and frame.args[1] or frame | local category = frame.args ~= nil and frame.args[1] or frame | ||
local categoryData = GameData.getEntityByID(Township.taskCategories, category) | local categoryData = GameData.getEntityByID(Township.taskCategories, category) | ||
Line 955: | Line 791: | ||
local categoryname = categoryData.name | local categoryname = categoryData.name | ||
local taskcount = 0 | local taskcount = 0 | ||
local ret = {} | local ret = {} | ||
table.insert(ret, ' | table.insert(ret, '{| class="wikitable lighttable" style="text-align:left"') | ||
table.insert(ret, ' | table.insert(ret, '\n!Task') | ||
table.insert(ret, ' | table.insert(ret, '\n!Requirements') | ||
table.insert(ret, ' | table.insert(ret, '\n!Rewards') | ||
for _, task in ipairs(Township.tasks) do | for _, task in ipairs(Township.tasks) do | ||
Line 967: | Line 803: | ||
taskcount = taskcount + 1 | taskcount = taskcount + 1 | ||
local title = categoryname..' '..taskcount | local title = categoryname..' '..taskcount | ||
table.insert(ret, p. | table.insert(ret, p._getTaskRow(title, task)) | ||
end | end | ||
end | end | ||
table.insert(ret, ' | table.insert(ret, '\n|}') | ||
return table.concat(ret) | return table.concat(ret) | ||
end | end | ||
-- Returns a table containing all the tasks that reference an item or monster | -- Returns a table containing all the tasks that reference an item or monster | ||
-- e.g. p. | -- e.g. p.getTaskReferenceTable({'Chicken Coop', 'dungeon'}) | ||
-- name = item or monster name | -- name = item or monster name | ||
-- type = 'item' or 'monster' or 'dungeon' | -- type = 'item' or 'monster' or 'dungeon' | ||
function p. | function p.getTaskReferenceTable(frame) | ||
-- Returns a set containing all the desired IDs | -- Returns a set containing all the desired IDs | ||
local function GetReferenceIDs(referenceName, referenceType) | local function GetReferenceIDs(referenceName, referenceType) | ||
Line 1,008: | Line 844: | ||
return referenceType == 'item' and searchItems or searchMonsters | return referenceType == 'item' and searchItems or searchMonsters | ||
end | end | ||
local args = frame.args ~= nil and frame.args or frame | local args = frame.args ~= nil and frame.args or frame | ||
local referenceName = Shared.fixPagename(args[1]) | local referenceName = Shared.fixPagename(args[1]) | ||
Line 1,035: | Line 871: | ||
return '' | return '' | ||
end | end | ||
-- Build the table | -- Build the table | ||
local ret = {} | local ret = {} | ||
table.insert(ret, '==Tasks==') | table.insert(ret, '==Tasks==') | ||
table.insert(ret, ' | table.insert(ret, '\n{| class="wikitable" style="text-align:left"') | ||
table.insert(ret, ' | table.insert(ret, '\n!Task') | ||
table.insert(ret, ' | table.insert(ret, '\n!Requirements') | ||
table.insert(ret, ' | table.insert(ret, '\n!Rewards') | ||
for _, task in ipairs(tasks) do | for _, task in ipairs(tasks) do | ||
local categoryname = GameData.getEntityByID(Township.taskCategories, task.category).name | local categoryname = GameData.getEntityByID(Township.taskCategories, task.category).name | ||
local title = '[[Township/Tasks#'..categoryname..'|'..categoryname..']]' | local title = '[[Township/Tasks#'..categoryname..'|'..categoryname..']]' | ||
table.insert(ret, p. | table.insert(ret, p._getTaskRow(title, task)) | ||
end | end | ||
table.insert(ret, ' | table.insert(ret, '\n|}') | ||
return table.concat(ret) | return table.concat(ret) | ||
end | end | ||
Line 1,057: | Line 893: | ||
function p.GetWorshipTable() | function p.GetWorshipTable() | ||
return p.getWorshipTable() | return p.getWorshipTable() | ||
end | |||
function p.GetBuildingTable(frame) | |||
return p.getBuildingInfoBox() | |||
end | |||
function p.GetBuildingUpgradeTable(frame) | |||
return p.getBuildingUpgradeTable(frame) | |||
end | |||
function p.GetTaskTable(frame) | |||
return p.getTaskTable(frame) | |||
end | |||
function p.GetTaskReferenceTable(frame) | |||
return p.getTaskReferenceTable(frame) | |||
end | end | ||
return p | return p |