572
edits
No edit summary |
(moved _GetResourceIcon into Icons.Icon) |
||
Line 6: | Line 6: | ||
local resource_data = { | local resource_data = { | ||
['melvorF:GP'] = { | ['melvorF:GP'] = {skill = nil}, | ||
['melvorF:Food'] = { | ['melvorF:Food'] = {skill = 'melvorD:Cooking'}, | ||
['melvorF:Wood'] = { | ['melvorF:Wood'] = {skill = 'melvorD:Woodcutting'}, | ||
['melvorF:Stone'] = { | ['melvorF:Stone'] = {skill = 'melvorD:Mining'}, | ||
['melvorF:Ore'] = { | ['melvorF:Ore'] = {skill = 'melvorD:Mining'}, | ||
['melvorF:Coal'] = { | ['melvorF:Coal'] = {skill = 'melvorD:Mining'}, | ||
['melvorF:Bar'] = { | ['melvorF:Bar'] = {skill = 'melvorD:Smithing'}, | ||
['melvorF:Herbs'] = { | ['melvorF:Herbs'] = {skill = 'melvorD:Farming'}, | ||
['melvorF:Rune_Essence'] = { | ['melvorF:Rune_Essence'] = {skill = 'melvorD:Mining'}, | ||
['melvorF:Leather'] = { | ['melvorF:Leather'] = {skill = nil}, | ||
['melvorF:Potions'] = { | ['melvorF:Potions'] = {skill = 'melvorD:Herblore'}, | ||
['melvorF:Planks'] = { | ['melvorF:Planks'] = {skill = 'melvorD:Woodcutting'}, | ||
['melvorF:Clothing'] = { | ['melvorF:Clothing'] = {skill = 'melvorD:Crafting'} | ||
} | } | ||
Line 275: | Line 275: | ||
table.insert(ret_resource, '\r\n|style="text-align:center" data-sort-value="' .. item.toTownship .. '"|'..Icons.Icon({item.name, type='item', notext=true})..' '..Shared.formatnum(item.toTownship)) | table.insert(ret_resource, '\r\n|style="text-align:center" data-sort-value="' .. item.toTownship .. '"|'..Icons.Icon({item.name, type='item', notext=true})..' '..Shared.formatnum(item.toTownship)) | ||
-- Take From | -- Take From | ||
table.insert(ret_resource, '\r\n|style="text-align:center" data-sort-value="' .. item.fromTownship .. '"|'..Icons.Icon( | table.insert(ret_resource, '\r\n|style="text-align:center" data-sort-value="' .. item.fromTownship .. '"|'..Icons.Icon({resource.name, type='resource', notext=true})..' '..Shared.formatnum(item.fromTownship)) | ||
-- Value | -- Value | ||
table.insert(ret_resource, '\r\n|style="text-align:center" data-sort-value="' .. item.sellsFor .. '"|'..Icons.GP(item.sellsFor)) | table.insert(ret_resource, '\r\n|style="text-align:center" data-sort-value="' .. item.sellsFor .. '"|'..Icons.GP(item.sellsFor)) | ||
Line 294: | Line 294: | ||
end | end | ||
return table.concat(ret) | return table.concat(ret) | ||
end | end | ||
Line 357: | Line 347: | ||
local cost = {} | local cost = {} | ||
for _, resource in ipairs(building.cost) do | for _, resource in ipairs(building.cost) do | ||
table.insert(cost, Icons.Icon( | table.insert(cost, Icons.Icon({resource.name, type='resource', notext=true})..' '..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 361: | ||
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( | table.insert(upgrade_cost, Icons.Icon({resource.name, type='resource', notext=true})..' '..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 406: | Line 396: | ||
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( | table.insert(retProduction, '<span style="color:green">'..Icons.Icon({resource.name, type='resource', notext=true})..' +'..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( | table.insert(retProduction, '<span style="color:red">'..Icons.Icon({required_resource.name, type='resource', notext=true})..' -'..demand..'</span>') | ||
end | end | ||
end | end |
edits