Module:Calculator/AgilityObstacle: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 89: Line 89:
local courseItemCosts = {}
local courseItemCosts = {}
for _, course in pairs(courseObstacles) do
for _, obstacle in pairs(courseObstacles) do
-- Pool together highest level requirements for the entire course.
-- Pool together highest level requirements for the entire course.
for skill, level in pairs(course.LevelRequirements) do
for skill, level in pairs(obstacle.LevelRequirements) do
Shared.addOrUpdate(courseLevelRequirements, skill,  
Shared.addOrUpdate(courseLevelRequirements, skill,  
function(x)
function(x)
Line 99: Line 99:
-- Pool together total item costs to build the entire course course.
-- Pool together total item costs to build the entire course course.
local courseCosts = course.ItemCosts
local obstacleCosts = obstacle.ItemCosts
funcPoolCosts(courseItemCosts, 'GP', courseCosts['GP'])
if obstacleCosts['GP'] then funcPoolCosts(courseItemCosts, 'GP', obstacleCosts['GP']) end
funcPoolCosts(courseItemCosts, 'SC', courseCosts['SC'])
if obstacleCosts['GP'] then funcPoolCosts(courseItemCosts, 'SC', obstacleCosts['SC']) end
for item, amount in pairs(courseCosts['Items']) do
for item, amount in pairs(obstacleCosts['Items']) do
funcPoolCosts(courseItemCosts, item, amount)
funcPoolCosts(courseItemCosts, item, amount)
end
end
2,875

edits