Module:Skills/Gathering: Difference between revisions

getFishTable
(Enforce min-width on icon columns to ensure visibility on mobile devices)
(getFishTable)
Line 227: Line 227:
     result = result..Shared.timeString(oreData.respawnInterval / 1000, true)
     result = result..Shared.timeString(oreData.respawnInterval / 1000, true)
     result = result..'||data-sort-value="'..ore.sellsFor..'"|'..Icons.GP(ore.sellsFor)
     result = result..'||data-sort-value="'..ore.sellsFor..'"|'..Icons.GP(ore.sellsFor)
  end
  result = result..'\r\n|}'
  return result
end
function p.getFishTable(frame)
  local data = Items.getItems(function(item) return item.fishingID ~= nil end)
  table.sort(data, function(a, b) return a.fishingID < b.fishingID end)
  local result = '{| class="wikitable sortable stickyHeader"'
  result = result..'\r\n|- class="headerRow-0"'
  result = result..'\r\n!Fish\r\n!Name\r\n!{{Skill|Fishing|notext=true}} Level\r\n!Catch Time'
  result = result..'\r\n!Experience\r\n!Fish Price\r\n!{{Skill|Cooking|notext=true}} Level'
  for i, fish in Shared.skpairs(data) do
    result = result..'\r\n|-'
    result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({fish.name, type='item', size='50', notext=true})
    result = result..'\r\n| style ="text-align: left;" |[['..fish.name..']]'
    result = result..'\r\n| style="text-align:right"|'..fish.fishingLevel
    local timeSortVal = (fish.minFishingInterval + fish.maxFishingInterval) / 2
    local timeStr = string.format("%.1fs-%.1fs", (fish.minFishingInterval/1000), (fish.maxFishingInterval/1000))
    result = result..'\r\n| style="text-align:right" data-sort-value="'..timeSortVal..'"|'..timeStr
    result = result..'\r\n| style="text-align:right"|'..fish.fishingXP
    result = result..'\r\n| style="text-align:right"|'..fish.sellsFor
    local cookStr = "N/A"
    if fish.cookingLevel ~= nil then
      cookStr = fish.cookingLevel
    end
    result = result..'\r\n| style="text-align:right"|'..cookStr
   end
   end


285

edits