Module:Skills: Difference between revisions

Added p.getFarmingPlotTable
(added p.getFarmingFoodTable)
(Added p.getFarmingPlotTable)
Line 156: Line 156:
   result = result..'\r\n|}'
   result = result..'\r\n|}'


  return result
end
function p.getFarmingPlotTable(frame)
  local areaName = frame.args ~= nil and frame.args[1] or frame
  local patches = nil
  for i, area in Shared.skpairs(SkillData.Farming.Patches) do
    if area.areaName == areaName then
      patches = area.patches
      break
    end
  end
  if patches == nil then
    return "ERROR: Invalid area name.[[Category:Pages with script errors"
  end
  local result = '{|class="wikitable"'
  result = result..'\r\n!Plot!!'..Icons.Icon({'Farming', type='skill', notext=true})..' Level!!Cost'
  for i, patch in Shared.skpairs(patches) do
    result = result..'\r\n|-\r\n|'..i
    result = result..'||style="text-align:right;" data-sort-value="0"|'..patch.level
    if patch.cost == 0 then
      result = result..'||Free'
    else
      result = result..'||style="text-align:right;" data-sort-value="'..patch.cost..'"|'..Icons.GP(patch.cost)
    end
  end
  result = result..'\r\n|}'
   return result
   return result
end
end