Module:Calculator/AgilityObstacle: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 148: Line 148:
function p._getCourseList(args)
function p._getCourseList(args)
-- Parse optional parameters
-- Parse optional parameters
local includeItems = yesno(args['includeitems'], true)
 
local includeSkills = yesno(args['includeskills'], true)
local includeObstacles  = yesno(args['includeObstacles'], true)
local costReduction = {
local costReduction = {
['GP']  = args['gpCostReduction'] or 0,
['GP']  = args['gpCostReduction'] or 0,
Line 164: Line 161:
     local div = html:tag('div')
     local div = html:tag('div')
      
      
     if includeObstacles then
     if yesno(args['includeObstacles'], true) then
div:tag('b'):wikitext('Obstacles')
div:tag('b'):wikitext('Obstacles')
local tbl = mw.html.create("table")
local tbl = mw.html.create("table")
Line 186: Line 183:
     end
     end


     if includeItems then
     if yesno(args['includeitems'], true) then
     div:tag('b'):wikitext('Items Required')
     div:tag('b'):wikitext('Items Required')
     local ul = div:tag('ul')
     local ul = div:tag('ul')
Line 196: Line 193:
     if courseItems['SC'] then ul:tag('li'):wikitext(getItemIcon('SC', courseItems['SC'])) end
     if courseItems['SC'] then ul:tag('li'):wikitext(getItemIcon('SC', courseItems['SC'])) end


courseItems['GP'] = nil
     local itemList = Shared.sortDictionary(courseItems['Items'],  
courseItems['SC'] = nil
     local itemList = Shared.sortDictionary(courseItems,  
     function(a, b) return a.item < b.item end,
     function(a, b) return a.item < b.item end,
     function(a, b) return {item = a, amount = b} end)
     function(a, b) return {item = a, amount = b} end)
Line 209: Line 203:
     end
     end
if includeSkills then
if yesno(args['includeskills'], true) then
div:tag('b'):wikitext('Skills Required')
div:tag('b'):wikitext('Skills Required')
     local ul2 = div:tag('ul')
     local ul2 = div:tag('ul')
2,875

edits