Module:Skills: Difference between revisions

added p.getFarmingFoodTable
(Moving p.getMiningOresTable to Skills/Gathering)
(added p.getFarmingFoodTable)
Line 131: Line 131:


   return p._getFarmingTable(category)
   return p._getFarmingTable(category)
end
function p.getFarmingFoodTable(frame)
  local result = '{| class="wikitable sortable stickyHeader"'
  result = result..'\r\n|- class="headerRow-0"'
  result = result..'\r\n!colspan="2"|Crop!!'..Icons.Icon({"Farming", type="skill", notext=true})..' Level'
  result = result..'!!Healing!!Value'
 
  local itemArray = Items.getItems(function(item) return item.grownItemID ~= nil end)
  table.sort(itemArray, function(a, b) return a.farmingLevel < b.farmingLevel end)
  for i, item in Shared.skpairs(itemArray) do
    local crop = Items.getItemByID(item.grownItemID)
    if crop.healsFor ~= nil and crop.healsFor > 0 then
      result = result..'\r\n|-'
      result = result..'\r\n|'..Icons.Icon({crop.name, type='item', notext='true', size='50'})..'||[['..crop.name..']]'
      result = result..'||style="text-align:right;"|'..item.farmingLevel
      result = result..'||style="text-align:right" data-sort-value="'..crop.healsFor..'"|'..Icons.Icon({"Hitpoints", type="skill", notext=true})..' '..(crop.healsFor * 10)
      result = result..'||style="text-align:right" data-sort-value="'..crop.sellsFor..'"|'..Icons.GP(crop.sellsFor)
    end
  end
  result = result..'\r\n|}'
  return result
end
end