Module:Calculator/AgilityObstacle: Difference between revisions

Add expansion icon to obstacle
No edit summary
(Add expansion icon to obstacle)
 
(3 intermediate revisions by the same user not shown)
Line 18: Line 18:
return Icons.Icon({itemName, type='item', qty = amount, notext=true})
return Icons.Icon({itemName, type='item', qty = amount, notext=true})
end
local function getObstacleIcon(obstacle)
local obs = obstacle.Obstacle
return Icons.getExpansionIcon(obs.id) .. Icons.Icon({obs.name, type='agility'})
end
end


Line 25: Line 30:
local obstacle = Agility.getObstacle(name) or Agility.getPillar(name)
local obstacle = Agility.getObstacle(name) or Agility.getPillar(name)
if obstacle == nil then
if obstacle == nil then
error("Unknown Agility obstacle or pillar name: " .. name)
error("Unknown Agility obstacle or pillar name: " .. (name or '<name is nil>'))
end
end


Line 174: Line 179:
:wikitext(v.Slot)
:wikitext(v.Slot)
:tag('td')
:tag('td')
:wikitext(Icons.Icon({v.Name, type='agility'}))
:wikitext(getObstacleIcon(v))
end
end
Line 288: Line 293:
--== Parse optional parameters==--
--== Parse optional parameters==--
local showTotals = yesno(args['showtotals'], false)
local showTotals = yesno(args['showtotals'], false)
local showbonus = yesno(args['obstacleMastery'], true)
local showbonus = yesno(args['showbonus'], true)
local showrequirements = yesno(args['obstacleMastery'], true)
local showrequirements = yesno(args['showrequirements'], true)
local showcosts = yesno(args['obstacleMastery'], true)
local showcosts = yesno(args['showcosts'], true)
local obstacleMastery = yesno(args['obstacleMastery'], false)
local obstacleMastery = yesno(args['obstacleMastery'], false)


Line 325: Line 330:
:css('text-align', 'right')
:css('text-align', 'right')
:wikitext(obstacle.Slot)
:wikitext(obstacle.Slot)
:tag('td'):wikitext(Icons.Icon({obstacle.Name, type='agility'}))
:tag('td'):wikitext(getObstacleIcon(obstacle))
if showbonus then
if showbonus then
Line 344: Line 349:
:wikitext('Totals')
:wikitext('Totals')
if showbonus then
if showbonus then
tr:wikitext(getTotalBonuses(courseRequirements.Obstacles))
tr :tag('td')
:wikitext(getTotalBonuses(courseRequirements.Obstacles))
end
end
if showrequirements then
if showrequirements then
tr:wikitext(getRequirements(courseRequirements.CourseLevelRequirements))
tr :tag('td')
:wikitext(getRequirements(courseRequirements.CourseLevelRequirements))
end
end
if showcosts then
if showcosts then
tr:wikitext(getCosts(courseRequirements.CourseItemCosts))
tr :tag('td')
:wikitext(getCosts(courseRequirements.CourseItemCosts))
end
end
end
end
Line 358: Line 366:


function p.test()
function p.test()
local obstacles = {"Rope Climb","Monkey Bars"," Balance Seesaw","Elite Pillar of Conflict"}
--local obstacles = {"Rope Climb","Monkey Bars"," Balance Seesaw","Elite Pillar of Conflict"}
local obs = p.calculateCourse(obstacles)
--local obs = p.calculateCourse(obstacles)
mw.logObject(getObstacle('rope trap'))
end
end
return p
return p
918

edits