572
edits
No edit summary |
(Migrate GetTownshipStatIcon to Icons.Icon) |
||
Line 1: | Line 1: | ||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:GauTest/Icons') | ||
local GameData = require('Module:GameData') | local GameData = require('Module:GameData') | ||
local Constants = require('Module:Constants') | local Constants = require('Module:Constants') | ||
Line 346: | Line 346: | ||
-- Tier | -- 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>'.. | table.insert(ret, '\r\n|-\r\n| <b>Tier '..building.tier..'</b><ul><li>'..Icons._SkillReq('Township', tier.level, false)..'</li><li>'..Icons.Icon({'Population', type='township'})..' '..tier.population..'</li></ul>') | ||
-- Upgrades From | -- Upgrades From | ||
Line 357: | Line 357: | ||
local cost = {} | local cost = {} | ||
for _, resource in ipairs(building.cost) do | for _, resource in ipairs(building.cost) do | ||
table.insert(cost, Icons.Icon(p._GetResourceIcon(resource.id))..' '..resource.quantity) | table.insert(cost, Icons.Icon(p._GetResourceIcon(resource.id))..' '..resource.quantity) | ||
end | end | ||
table.insert(ret, '<b>Base Cost:</b> '..table.concat(cost, ', ')) | table.insert(ret, '<b>Base Cost:</b> '..table.concat(cost, ', ')) | ||
Line 371: | Line 371: | ||
local upgrade_cost = {} | local upgrade_cost = {} | ||
for _, resource in ipairs(upgradesTo[1].cost) do | for _, resource in ipairs(upgradesTo[1].cost) do | ||
table.insert(upgrade_cost, Icons.Icon(p._GetResourceIcon(resource.id))..' '..resource.quantity) | table.insert(upgrade_cost, Icons.Icon(p._GetResourceIcon(resource.id))..' '..resource.quantity) | ||
end | end | ||
table.insert(ret, '<br><b>Upgrade Base Cost:</b> '..table.concat(upgrade_cost, ', ')) | table.insert(ret, '<br><b>Upgrade Base Cost:</b> '..table.concat(upgrade_cost, ', ')) | ||
Line 385: | Line 385: | ||
deadStorage = 'Dead Storage' | deadStorage = 'Dead Storage' | ||
} | } | ||
for key, | for key, stat in pairs(stats) do | ||
if building.provides[key] ~= nil and building.provides[key] ~= 0 then | if building.provides[key] ~= nil and building.provides[key] ~= 0 then | ||
table.insert(benefits, | table.insert(benefits, Icons.Icon({stat, type='township'})..' '..building.provides[key]) | ||
end | end | ||
end | end | ||
Line 406: | Line 406: | ||
local production = resource.quantity*100*(Township.tickLength/10) | local production = resource.quantity*100*(Township.tickLength/10) | ||
local resource_data = GameData.getEntityByID(resources, resource.id) | local resource_data = GameData.getEntityByID(resources, resource.id) | ||
table.insert(retProduction, '<span style="color:green">'..Icons.Icon(p._GetResourceIcon(resource.id))..' +'..production..'</span>') | table.insert(retProduction, '<span style="color:green">'..Icons.Icon(p._GetResourceIcon(resource.id))..' +'..production..'</span>') | ||
if resource_data.requires ~= nil and #resource_data.requires > 0 then | if resource_data.requires ~= nil and #resource_data.requires > 0 then | ||
for _, required_resource in ipairs(resource_data.requires) do | for _, required_resource in ipairs(resource_data.requires) do | ||
local demand = production*required_resource.quantity*100 | local demand = production*required_resource.quantity*100 | ||
table.insert(retProduction, '<span style="color:red">'..Icons.Icon(p._GetResourceIcon(required_resource.id))..' -'..demand..'</span>') | table.insert(retProduction, '<span style="color:red">'..Icons.Icon(p._GetResourceIcon(required_resource.id))..' -'..demand..'</span>') | ||
end | end | ||
end | end | ||
retProduction = table.concat(retProduction, ', ')..'/t ('.. | retProduction = table.concat(retProduction, ', ')..'/t ('..Icons.Icon({'Workers', type='township'})..' '..workers..')' | ||
table.insert(retResources, retProduction) | table.insert(retResources, retProduction) | ||
end | end | ||
Line 446: | Line 446: | ||
return table.concat(ret) | return table.concat(ret) | ||
end | end | ||
-- Given a resource id, return the job id | -- Given a resource id, return the job id |
edits