Module:Items/ComparisonTables: Difference between revisions

Created getDoubleLootTable
(Now trimming whitespaces for getTableForList)
(Created getDoubleLootTable)
Line 285: Line 285:
     return p._getEquipmentTable(itemList)
     return p._getEquipmentTable(itemList)
   end
   end
end
function p.getDoubleLootTable(frame)
  local itemList = Items.getItems(function(item) return item.chanceToDoubleLoot ~= nil and item.chanceToDoubleLoot > 0 end)
  table.sort(itemList, function(a, b) return a.name < b.name end)
  local result = '{| class="wikitable sortable stickyHeader"\r\n|-class="headerRow-0"'
  result = result..'\r\n!colspan="2"|Name!!Bonus!!Description!!Sources'
  for i, item in Shared.skpairs(itemList) do
    result = result..'\r\n|-'
    result = result..'\r\n|data-sort-value="'..item.name..'"|'..Icons.Icon({item.name, type='item', size=50, notext=true})
    result = result..'||'..item.name
    result = result..'||style ="text-align: right;" data-sort-value="'..item.chanceToDoubleLoot..'"|'..item.chanceToDoubleLoot..'%'
    result = result..'||'..item.description
    result = result..'\r\n| style ="text-align: right;white-space: nowrap;padding: 0 0.5em 0 0.5em;" |'
    result = result..ItemSourceTables._getItemSources(item)
  end
  result = result..'\r\n|}'
  return result
end
end


return p
return p