Anonymous

Module:Sandbox/GauTest/Township: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 526: Line 526:
local ret = {}
local ret = {}
table.insert(ret, '\r\n{| class="wikitable" style="text-align:center"')
table.insert(ret, '\r\n{| class="wikitable"')
-- Name
-- Name
table.insert(ret, '\r\n|-')
table.insert(ret, '\r\n|- style="text-align:center"')
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 539: Line 539:
local tier = p._GetTierText(building.tier)
local tier = p._GetTierText(building.tier)
table.insert(ret, '\r\n|'..tier)
table.insert(ret, '\r\n|'..tier)
end
-- Cost
table.insert(ret, '\r\n|-')
for _, building in ipairs(buildingList) do
local cost = p._GetBuildingBaseCost(building)
table.insert(ret, '\r\n|'..cost)
end
-- Benefits
table.insert(ret, '\r\n|-')
for _, building in ipairs(buildingList) do
local benefits = p._GetBuildingBenefits(building)
benefits = benefits ~= nil and benefits or ''
table.insert(ret, '\r\n|'..benefits)
end
-- Production
table.insert(ret, '\r\n|-')
for _, building in ipairs(buildingList) do
local production = p._GetBuildingBaseProduction(building)
production = production ~= nil and production or ''
table.insert(ret, '\r\n|'..production)
end
-- Biomes Modifiers
table.insert(ret, '\r\n|-')
for _, building in ipairs(buildingList) do
local biomeRet = {}
table.insert(biomeRet, '<ul>')
for _, biome in ipairs(building.biomeModifiers) do
local biomename = GameData.getEntityByID(Township.biomes, biome.biomeID).name
local color = biome.value < 0 and 'red' or 'green'
local biome_value = Shared.numStrWithSign(biome.value)
table.insert(biomeRet, '<li style="color:'..color..'">'..biomename..' ('..biome_value..'%)</li>')
end
table.insert(biomeRet, '</ul>')
table.insert(ret, '\r\n|'..table.concat(biomeRet))
end
end


Line 544: Line 582:
table.insert(ret, '\r\n|}')
table.insert(ret, '\r\n|}')
mw.log(table.concat(ret))
return table.concat(ret)
return table.concat(ret)
end
end


return p
return p
572

edits