Module:Items: Difference between revisions

From Melvor Idle
(Attempt to fix issue with '&' in page names)
(getEquipRequirementRow: Support requirement type 'AbyssDepthCompletion')
Line 629: Line 629:
result = '\r\n!style="text-align:right;"| '..skillIcon..pre..' Level Required'
result = '\r\n!style="text-align:right;"| '..skillIcon..pre..' Level Required'
result = result..'\r\n|style="text-align:right;"| '..req.level
result = result..'\r\n|style="text-align:right;"| '..req.level
elseif req.type == "DungeonCompletion" then
elseif (req.type == "DungeonCompletion" or req.type == "AbyssDepthCompletion") then
local dungeonName = GameData.getEntityByID("dungeons", req.dungeonID).name
local reqDefns = {
local dungeonIcon = Icons.Icon({dungeonName, type="dungeon", notext=true})
["DungeonCompletion"] = {
result = '\r\n!style="text-align:right;"| '..dungeonIcon..' Completions'
["dataKey"] = 'dungeons',
result = result..'\r\n|style="text-align:right;"| '..req.count
["IDKey"] = 'dungeonID',
["imgType"] = 'dungeon'
},
["AbyssDepthCompletion"] = {
["dataKey"] = 'abyssDepths',
["IDKey"] = 'depthID',
["imgType"] = 'abyssDepth'
}
}
local reqDefn = reqDefns[req.type]
if reqDefn ~= nil then
local area = GameData.getEntityByID(reqDefn.dataKey, req[reqDefn.IDKey])
if area == nil then
result = '\r\n!style="text-align:right;" colspan=2|' .. Shared.printError('Invalid area for requirement type "' .. req.type .. '"')
else
local areaIcon = Icons.Icon({area.name, type=reqDefn.imgType, notext=true})
result = '\r\n!style="text-align:right;"| '..areaIcon..' Completions'
result = result..'\r\n|style="text-align:right;"| '..Shared.formatnum(req.count)
end
end
elseif req.type == "Completion" then
elseif req.type == "Completion" then
local ns = GameData.getEntityByName('namespaces', req.namespace)
local ns = GameData.getEntityByName('namespaces', req.namespace)