Anonymous

Module:CombatAreas/AreaTables: Difference between revisions

From Melvor Idle
Fixed Combat & Slayer area tables breaking
(Some initial prepwork on setting up dungeon DR tables. Too lazy to finish it right now)
(Fixed Combat & Slayer area tables breaking)
Line 41: Line 41:
                 return a.difficulty[2] < b.difficulty[2]
                 return a.difficulty[2] < b.difficulty[2]
               else
               else
                 return a.areaName < b.areaName
                 return a.name < b.name
               end
               end
             end)
             end)
Line 47: Line 47:
   for i, area in Shared.skpairs(combatAreas) do
   for i, area in Shared.skpairs(combatAreas) do
     result = result..'\r\n|-'
     result = result..'\r\n|-'
     result = result..'\r\n|'..Icons.Icon({area.areaName, type='combat', size='50', notext=true})..'||[['..area.areaName..']]'
     result = result..'\r\n|'..Icons.Icon({area.name, type='combat', size='50', notext=true})..'||[['..area.name..']]'
     local diff1 = Constants.getDifficultyString(area.difficulty[1])
     local diff1 = Constants.getDifficultyString(area.difficulty[1])
     local diff2 = Constants.getDifficultyString(area.difficulty[2])
     local diff2 = Constants.getDifficultyString(area.difficulty[2])
Line 68: Line 68:
   local slayerAreas = Shared.clone(AreaData.slayerAreas)
   local slayerAreas = Shared.clone(AreaData.slayerAreas)
   table.sort(slayerAreas, function(a, b)  
   table.sort(slayerAreas, function(a, b)  
               if a.slayerLevel ~= b.slayerLevel then
               if a.difficulty[1] ~= b.difficulty[1] then
                return a.slayerLevel < b.slayerLevel
              elseif a.difficulty[1] ~= b.difficulty[1] then
                 return a.difficulty[1] < b.difficulty[1]
                 return a.difficulty[1] < b.difficulty[1]
               elseif a.difficulty[2] == nil then
               elseif a.difficulty[2] == nil then
Line 79: Line 77:
                 return a.difficulty[2] < b.difficulty[2]
                 return a.difficulty[2] < b.difficulty[2]
               else
               else
                 return a.areaName < b.areaName
                 return a.name < b.name
               end
               end
             end)
             end)
Line 85: Line 83:
   for i, area in Shared.skpairs(slayerAreas) do
   for i, area in Shared.skpairs(slayerAreas) do
     result = result..'\r\n|-'
     result = result..'\r\n|-'
     result = result..'\r\n|'..Icons.Icon({area.areaName, type='slayer', size='50', notext=true})..'||[['..area.areaName..']]'
     result = result..'\r\n|'..Icons.Icon({area.name, type='slayer', size='50', notext=true})..'||[['..area.name..']]'
     local diff1 = Constants.getDifficultyString(area.difficulty[1])
     local diff1 = Constants.getDifficultyString(area.difficulty[1])
     local diff2 = Constants.getDifficultyString(area.difficulty[2])
     local diff2 = Constants.getDifficultyString(area.difficulty[2])
Line 93: Line 91:
     result = result..'||'..highLvl
     result = result..'||'..highLvl


    local reqArray = {}
     result = result..'||'..CombatAreas._getAreaRequirements(area)
    if area.slayerLevel ~= nil and area.slayerLevel > 1 then
      table.insert(reqArray, Icons._SkillReq('Slayer', area.slayerLevel))
    end
    if area.slayerItem ~= nil and area.slayerItem > 0 then
      local item = Items.getItemByID(area.slayerItem)
      table.insert(reqArray, Icons.Icon({item.name, type='item'})..' Equipped')
    end
    if area.dungeonCompleted ~= nil and area.dungeonCompleted > 0 then
      local dung = CombatAreas.getAreaByID('dungeon', area.dungeonCompleted)
      table.insert(reqArray, Icons.Icon({dung.name, type='dungeon'})..' Completed')
    end
     result = result..'||data-sort-value="'..area.slayerLevel..'"| '..table.concat(reqArray, '<br/>')
     result = result..'||'
     result = result..'||'
     if area.areaEffectDescription ~= nil then
     if area.areaEffectDescription ~= nil then