Module:Skills/Gathering: Difference between revisions

Added p.getFishingJunkTable
(Moved getSpecialFishingTable here from Skills)
(Added p.getFishingJunkTable)
Line 106: Line 106:


   local result = ''
   local result = ''
   result = result..'\r\n{|class="wikitable sortable"'
   result = result..'\r\n{|class="wikitable sortable stickyHeader"'
  result = result..'\r\n|- class="headerRow-0"'
   result = result..'\r\n!Item'
   result = result..'\r\n!Item'
   result = result..'!!Price!!colspan="2"|Chance'
   result = result..'!!Price!!colspan="2"|Chance'
Line 126: Line 127:
   result = result..'\r\n|}'
   result = result..'\r\n|}'
   result = result..'\r\nThe average value of a roll on the special fishing loot table is '..Icons.GP(Shared.round(lootValue, 2, 0))
   result = result..'\r\nThe average value of a roll on the special fishing loot table is '..Icons.GP(Shared.round(lootValue, 2, 0))
  return result
end
function p.getFishingJunkTable(frame)
  local result = '{| class="wikitable sortable stickyHeader"'
  result = result..'\r\n|- class="headerRow-0"'
  result = result..'\r\n!colspan="2"|Item!!Value'
 
  local itemArray = Items.getItems(function(item) return item.type == "Junk" end)
  table.sort(itemArray, function(a, b) return a.name < b.name end)
  for i, item in Shared.skpairs(itemArray) do
    result = result..'\r\n|-'
    result = result..'\r\n|'..Icons.Icon({item.name, type='item', notext='true', size='50'})..'||[['..item.name..']]'
    result = result..'||style="text-align:right;" data-sort-value="'..item.sellsFor..'"|'..Icons.GP(item.sellsFor)
  end
  result = result..'\r\n|}'


   return result
   return result