2,875
edits
No edit summary |
(Put SC and GP costs separate from item costs) |
||
Line 73: | Line 73: | ||
function p.getObstacleCosts(obstacle) | function p.getObstacleCosts(obstacle) | ||
local costs = {} | local costs = {} | ||
local items = {} | |||
if obstacle.gpCost > 0 then | if obstacle.gpCost > 0 then | ||
Line 80: | Line 81: | ||
costs['SC'] = obstacle.scCost | costs['SC'] = obstacle.scCost | ||
end | end | ||
for j, itemCost in ipairs(obstacle.itemCosts) do | for j, itemCost in ipairs(obstacle.itemCosts) do | ||
local item = Items.getItemByID(itemCost.id) | local item = Items.getItemByID(itemCost.id) | ||
items[item.name] = itemCost.quantity | |||
end | end | ||
costs['Items'] = items | |||
return costs | return costs | ||
end | end | ||
Line 103: | Line 105: | ||
local costs = {} | local costs = {} | ||
local obstacleCosts = p.getObstacleCosts(obstacle) | local obstacleCosts = p.getObstacleCosts(obstacle) | ||
-- Make sure SC and GP appear at the top. | -- Make sure SC and GP appear at the top. | ||
if obstacleCosts['GP'] then table.insert(costs, Icons.GP(obstacleCosts['GP'])) end | if obstacleCosts['GP'] then table.insert(costs, Icons.GP(obstacleCosts['GP'])) end | ||
if obstacleCosts['SC'] then table.insert(costs, Icons.SC(obstacleCosts['SC'])) end | if obstacleCosts['SC'] then table.insert(costs, Icons.SC(obstacleCosts['SC'])) end | ||
for item, amount in pairs(obstacleCosts) do | for item, amount in pairs(obstacleCosts['Items']) do | ||
table.insert(costs, Icons.Icon({item, type='item', qty = amount, notext=true})) | |||
end | end | ||
edits