Anonymous

Module:Sandbox/GauTest/Township: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 529: Line 529:
-- Name
-- Name
table.insert(ret, '\r\n|- style="text-align:center"')
table.insert(ret, '\r\n|- style="text-align:center" \r\n! Name')
for _, building in ipairs(buildingList) do
for _, building in ipairs(buildingList) do
table.insert(ret, '\r\n!'..Icons.Icon({building.name, type='building'}))
table.insert(ret, '\r\n!'..Icons.Icon({building.name, type='building'}))
Line 535: Line 535:


-- Tier
-- Tier
table.insert(ret, '\r\n|-')
table.insert(ret, '\r\n|-\r\n! Tier')
for _, building in ipairs(buildingList) do
for _, building in ipairs(buildingList) do
local tier = p._GetTierText(building.tier)
local tier = p._GetTierText(building.tier)
Line 542: Line 542:


-- Cost
-- Cost
table.insert(ret, '\r\n|-')
table.insert(ret, '\r\n|-\r\n! Cost')
for _, building in ipairs(buildingList) do
for _, building in ipairs(buildingList) do
local cost = p._GetBuildingBaseCost(building)
local cost = p._GetBuildingBaseCost(building)
Line 549: Line 549:


-- Benefits
-- Benefits
local benefits = {}
local hasBenefits = false
table.insert(ret, '\r\n|-')
table.insert(ret, '\r\n|-')
for _, building in ipairs(buildingList) do
for _, building in ipairs(buildingList) do
local benefits = p._GetBuildingBenefits(building)
local benefit = p._GetBuildingBenefits(building)
hasBenefits = hasBenefits or benefits ~= nil
benefits = benefits ~= nil and benefits or ''
benefits = benefits ~= nil and benefits or ''
table.insert(ret, '\r\n|'..benefits)
table.insert(benefits, benefit)
end
if hasBenefits then
benefits = table.concat(benefits, '\r\n|')
table.insert(ret, '\r\n|-\r\n! Benefits|\r\n'..benefits)
end
end
572

edits