Module:Items: Difference between revisions

1,210 bytes removed ,  24 July 2021
m
getShopSkillcapeTable: Move to Module:Shop
(Add some more recent Easter Egg items)
m (getShopSkillcapeTable: Move to Module:Shop)
Line 359: Line 359:
   result = result..'||[['..cape.name..']]||'..cape.description
   result = result..'||[['..cape.name..']]||'..cape.description
   result = result..'\r\n|}'
   result = result..'\r\n|}'
  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!colspan="2" style="width:200px"|Cape'
  result = result..'!!Description!!style="width:120px"|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', size='50', notext=true})
    result = result..'||[['..thisItem.name..']]'
    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
end
end