Anonymous

Module:Skills/Gathering: Difference between revisions

From Melvor Idle
getMiningGemsTable
m (Fix spacing between fish)
(getMiningGemsTable)
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.getMiningGemsTable(frame)
  local result = '{|class="wikitable sortable stickyHeader"'
  result = result..'\r\n|- class="headerRow-0"'
  result = result..'\r\n!colspan=2|Gem!!Gem Chance!!Gem Price'
  -- There's probably a better way to do this but
  -- Rewrite GemTable keyed by the ID so they're in the correct order
  local gemTable = {}
  for i, gemData in Shared.skpairs(Items.GemTable) do
    gemTable[gemData.id] = gemData
  end
  for i, gemData in Shared.skpairs(gemTable) do
    local gem = Items.getItemByID(gemData.id)
    result = result..'\r\n|-\r\n|style="min-width:25px"|'
    result = result..Icons.Icon({gem.name, type='item', size='50', notext=true})..'||[['..gem.name..']]'
    result = result..'||style="text-align:right"|'..string.format("%.1f%%", gemData.chance)
    result = result..'||data-sort-value="'..gem.sellsFor..'"|'..Icons.GP(gem.sellsFor)
   end
   end


285

edits