Module:Shop: Difference between revisions

1,229 bytes added ,  24 July 2021
getShopSkillcapeTable: Move from Module:Items & enforce min-width for icon column
(_getShopTable: Minor amends to disable links on certain Golbin raid purchases; enforce minimum width on image column to prevent image disappearing completely on some mobile resolutions)
(getShopSkillcapeTable: Move from Module:Items & enforce min-width for icon column)
Line 253: Line 253:


   return p._getItemShopTable(item)
   return p._getItemShopTable(item)
end
function p.getShopSkillcapeTable()
  local result = ''
  local capeList = Items.getItems(function(item) return Shared.contains(item.name, 'Skillcape') or item.name == 'Cape of Completion' end)
  result = result..'\r\n{|class="wikitable sortable stickyHeader"'
  result = result..'\r\n|- class="headerRow-0"'
  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|style="min-width:25px"|'..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
end
end


return p
return p