Anonymous

Module:Sandbox/GauTest/Township: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 295: Line 295:
end
end


-- TODO integrate into Icons.imgOverrides
-- Gets the icon of a resource
-- Gets the icon of a resource
-- e.g. Icons.Icon(_GetResourceIcon('melvorF:Bar'))
-- e.g. Icons.Icon(_GetResourceIcon('melvorF:Bar'))
Line 331: Line 332:
local resources = p._ResourcesData()
local resources = p._ResourcesData()
local ret = {}
local ret = {}
-- Header
table.insert(ret, '\r\n{| class="wikitable infobox"')
table.insert(ret, '\r\n{| class="wikitable infobox"')
-- Name
table.insert(ret, '\r\n|-\r\n!'..building.name)
table.insert(ret, '\r\n|-\r\n!'..building.name)
-- Icon
table.insert(ret, '\r\n|-\r\n|style="text-align:center"|'..Icons.Icon({building.name, type='building', size='250', notext=true}))
table.insert(ret, '\r\n|-\r\n|style="text-align:center"|'..Icons.Icon({building.name, type='building', size='250', notext=true}))
-- Description
table.insert(ret, '\r\n|-\r\n|style="text-align:center"|'..building.description)
-- ID
table.insert(ret, '\r\n|-\r\n| <b>Building ID:</b> '..building.id)
table.insert(ret, '\r\n|-\r\n| <b>Building ID:</b> '..building.id)
-- Type
table.insert(ret, '\r\n|-\r\n| <b>Type:</b> '..building.type)
-- Cost
local cost = {}
for _, resource in ipairs(building.cost) do
table.insert(cost, Icons.Icon(p._GetResourceIcon(resource.id))..' '..resource.quantity)
end
table.insert(ret, '\r\n|-\r\n| <b>Base Cost:</b> '..table.concat(cost, ', '))
-- Tier
local tier = p._GetTierRequirements(building.tier)
local tier = p._GetTierRequirements(building.tier)
table.insert(ret, '\r\n|-\r\n| <b>Tier '..building.tier..'</b><ul><li>'..Icons._SkillReq('Township', tier.level, false)..'</li><li>'..tier.population..p.GetTownshipStatIcon('Population')..'</li></ul>')
table.insert(ret, '\r\n|-\r\n| <b>Tier '..building.tier..'</b><ul><li>'..Icons._SkillReq('Township', tier.level, false)..'</li><li>'..p.GetTownshipStatIcon('Population')..tier.population..'</li></ul>')
table.insert(ret, '\r\n|}')
table.insert(ret, '\r\n|}')
return table.concat(ret)
return table.concat(ret)
Line 360: Line 377:
p.GameData = GameData
p.GameData = GameData
p.Icons = Icons
p.Icons = Icons
p.Township = Township


p.Township = Township
return p
return p
572

edits