Anonymous

Module:Items: Difference between revisions

From Melvor Idle
1,085 bytes added ,  16 October 2020
Added skillcape table
(Added exceptions for the Cape of Completion)
(Added skillcape table)
Line 1,880: Line 1,880:
   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.getShopSkillcapeTable()
  local result = ''
  local capeList = {}
  for i, item in pairs(ItemData.Items) do
    if Shared.contains(item.name, 'Skillcape') or item.name == 'Cape of Completion' then
      table.insert(capeList, item)
    end
  end
  result = result..'\r\n{|class="wikitable sortable"'
  result = result..'\r\n!Cape'
  result = result..'!!Description!!Price'
  --Sort the table by cost and then name
  table.sort(capeList, function(a, b)
                        if a.buysFor == b.buysFor then
                          return a.name < b.name
                        else
                          return a.sellsFor < b.buysFor
                        end
                      end)
  for i, thisItem in pairs(capeList) do
    result = result..'\r\n|-\r\n|'..Icons.Icon({thisItem.name, type='item'})
    result = result..'\r\n||'..thisItem.description
    result = result..'||style="text-align:left" data-sort-value="'..thisItem.buysFor..'"'
    result = result..'|'..Icons.GP(thisItem.buysFor)
  end
  result = result..'\r\n|}'


   return result
   return result