Module:Calculator/AgilityObstacle: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 87: Line 87:
-- required to build this agility course.
-- required to build this agility course.
local courseLevelRequirements = {}
local courseLevelRequirements = {}
local courseItemCosts = {}
local courseItemCosts = {
['Items'] = {}
}
for _, obstacle in pairs(courseObstacles) do
for _, obstacle in pairs(courseObstacles) do
Line 104: Line 106:
for item, amount in pairs(obstacleCosts['Items']) do
for item, amount in pairs(obstacleCosts['Items']) do
funcPoolCosts(courseItemCosts, item, amount)
funcPoolCosts(courseItemCosts['Items'], item, amount)
end
end
end
end
Line 257: Line 259:
   
   
-- Order table with GP, SC first, then the other items.
-- Order table with GP, SC first, then the other items.
     if costsTable['GP'] then table.insert(res, getItemIcon('GP', costsTable['GP'])) costsTable['GP'] = nil end
     if costsTable['GP'] then table.insert(res, getItemIcon('GP', costsTable['GP'])) end
     if costsTable['SC'] then table.insert(res, getItemIcon('SC', costsTable['SC'])) costsTable['SC'] = nil end
     if costsTable['SC'] then table.insert(res, getItemIcon('SC', costsTable['SC'])) end


     local sortedCosts = Shared.sortDictionary(costsTable,  
     local sortedCosts = Shared.sortDictionary(costsTable['Items'],  
function(a, b) return a.item < b.amount end,
function(a, b) return a.item < b.amount end,
function(a, b) return {item = a, amount = b} end)
function(a, b) return {item = a, amount = b} end)
964

edits