Anonymous

Module:Sandbox/AuronTest/ComparisonTables: Difference between revisions

From Melvor Idle
m
no edit summary
mNo edit summary
mNo edit summary
Line 37: Line 37:
     local ndx = 1
     local ndx = 1
     while Shared.tableCount(ignoreColumns) >= ndx do
     while Shared.tableCount(ignoreColumns) >= ndx do
       if 1 ~= 0 then
       if Items._getItemStat(item, ignoreColumns[ndx], true) ~= 0 then
         table.remove(ignoreColumns, ndx)
         table.remove(ignoreColumns, ndx)
       else
       else
Line 178: Line 178:
       table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0 0 0;"|'..Icons.Icon({item.name, type='item', size=50, notext=true}))
       table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0 0 0;"|'..Icons.Icon({item.name, type='item', size=50, notext=true}))
       table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0.5em 0 0.5em;"|[['..item.name..']]')
       table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0.5em 0 0.5em;"|[['..item.name..']]')
       table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0;" |'..Shared.formatnum(1))
       table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0;" |'..Shared.formatnum(Items._getItemStat(item, 'attackSpeed', true)))
       --That's the first list out of the way, now for 2-Handed
       --That's the first list out of the way, now for 2-Handed
       table.insert(resultPart, '\r\n| style ="text-align: right;"|')
       table.insert(resultPart, '\r\n| style ="text-align: right;"|')
       table.insert(resultPart, false and 'Yes' or 'No')
       table.insert(resultPart, Items._getItemStat(item, 'isTwoHanded') and 'Yes' or 'No')
       for j, statName in pairs(statColumns) do
       for j, statName in pairs(statColumns) do
         local statValue = 1
         local statValue = Items._getItemStat(item, statName, true)
         table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0;')
         table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0;')
         if string.find(statName, '^(.+)LevelRequired$') == nil then
         if string.find(statName, '^(.+)LevelRequired$') == nil then
Line 207: Line 207:
       --Finally, the Sources
       --Finally, the Sources
       table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0.5em;" |')
       table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0.5em;" |')
       table.insert(resultPart, ' x') --ItemSourceTables._getItemSources(item))
       table.insert(resultPart, ItemSourceTables._getItemSources(item))
     else
     else
       --Building rows for armour
       --Building rows for armour
Line 214: Line 214:
       table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0.5em 0 0.5em;"|[['..item.name..']]')
       table.insert(resultPart, '\r\n|style ="text-align: left;padding: 0 0.5em 0 0.5em;"|[['..item.name..']]')
       for j, statName in pairs(statColumns) do
       for j, statName in pairs(statColumns) do
         local statValue = 1
         local statValue = Items._getItemStat(item, statName, true)
         table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0;')
         table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0;')
         if statValue > 0 then
         if statValue > 0 then
Line 236: Line 236:
       --Finally, the Sources
       --Finally, the Sources
       table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0.5em;" |')
       table.insert(resultPart, '\r\n| style ="text-align: right;padding: 0 0.5em 0 0.5em;" |')
       table.insert(resultPart, ' x') --ItemSourceTables._getItemSources(item))
       table.insert(resultPart, ItemSourceTables._getItemSources(item))
     end
     end
   end
   end
Line 552: Line 552:
   table.insert(resultPart, '\r\n|}')
   table.insert(resultPart, '\r\n|}')
   return table.concat(resultPart)
   return table.concat(resultPart)
end
function p.EquipTest()
  local funcCalls = {
    {'Melee', 'Helmet'},
    {'Ranged', 'Helmet'},
    {'Magic', 'Helmet'},
    {'None', 'Helmet', includeDescription = 'true'},
    {'Melee', 'Platebody'},
    {'Ranged', 'Platebody'},
    {'Magic', 'Platebody'},
    {'None', 'Platebody', includeDescription = 'true'},
    {'Melee', 'Platelegs'},
    {'Ranged', 'Platelegs'},
    {'Magic', 'Platelegs'},
    {'None', 'Platelegs', includeDescription = 'true'},
    {'Melee', 'Boots'},
    {'Ranged', 'Boots'},
    {'Magic', 'Boots'},
    {'None', 'Boots', includeDescription = 'true'},
    {'Melee', 'Gloves'},
    {'Ranged', 'Gloves'},
    {'Magic', 'Gloves'},
    {'None', 'Gloves', includeDescription = 'true'},
    {'All', 'Cape', includeDescription = 'true'},
    {'All', 'Quiver', 'Arrows'},
    {'All', 'Quiver', 'Bolts'},
    {'All', 'Ring', includeModifiers = 'true'},
    {'All', 'Amulet', includeDescription = 'true'},
    {'Melee', 'Shield'},
    {'Ranged', 'Shield'},
    {'Magic', 'Shield'},
    {'None', 'Shield', includeDescription = 'true'},
    {'Melee', 'Weapon'},
    {'Ranged', 'Weapon', 'Arrows'},
    {'Ranged', 'Weapon', 'Bolts'},
    {'Ranged', 'Weapon', 'Javelins'},
    {'Ranged', 'Weapon', 'Knives'},
    {'Magic', 'Weapon'}
  }
  local funcResult = {}
  for i, args in ipairs(funcCalls) do
    mw.log('Calling with args: ' .. mw.dumpObject(args))
    local res = p.getCategoryTable({args=args})
    mw.log('Result has len ' .. Shared.formatnum(string.len(res)))
    table.insert(funcResult, res)
  end
  return 'Done, ' .. #funcResult .. ' calls'
end
end


return p
return p