12,714
edits
Falterfire (talk | contribs) (Added links to purchase names in the shop table) |
(getShopSkillcapeTable: Move from Module:Items & enforce min-width for icon column) |
||
(One intermediate revision by the same user not shown) | |||
Line 95: | Line 95: | ||
local result = '{| class="wikitable sortable stickyHeader"' | local result = '{| class="wikitable sortable stickyHeader"' | ||
result = result..'\r\n|- class="headerRow-0"' | result = result..'\r\n|- class="headerRow-0"' | ||
result = result..'\r\n!colspan="2"|Purchase!!Type!!Description!!style="min-width: | result = result..'\r\n!colspan="2"|Purchase!!Type!!Description!!style="min-width:90px"|Cost!!Requirements' | ||
local costCurrencies = {'gp', 'slayerCoins', 'raidCoins'} | local costCurrencies = {'gp', 'slayerCoins', 'raidCoins'} | ||
Line 113: | Line 113: | ||
local iconOverrides = { | local iconOverrides = { | ||
["assets/media/main/logo.svg"] = { icon = 'Melvor Logo', type = nil, noLink = true }, | ["assets/media/main/logo.svg"] = { icon = 'Melvor Logo', type = nil, noLink = true }, | ||
["assets/media/skills/prayer/prayer.svg"] = { icon = 'Prayer', type = 'skill' } | ["assets/media/skills/prayer/prayer.svg"] = { icon = 'Prayer', type = 'skill', noLink = true } | ||
} | } | ||
local iconName, iconType, iconNoLink = purchase.name, (purchType == 'Item Bundle' and 'item' or string.lower(purchType)), nil | local iconName, iconType, iconNoLink = purchase.name, (purchType == 'Item Bundle' and 'item' or string.lower(purchType)), nil | ||
if iconOverrides[purchase.media] ~= nil then | if iconOverrides[purchase.media] ~= nil then | ||
iconName, iconType,iconNoLink = iconOverrides[purchase.media].icon, iconOverrides[purchase.media].type, iconOverrides[purchase.media].noLink | iconName, iconType, iconNoLink = iconOverrides[purchase.media].icon, iconOverrides[purchase.media].type, iconOverrides[purchase.media].noLink | ||
end | end | ||
result = result..Icons.Icon({iconName, type=iconType, notext=true, nolink=iconNoLink, size='50'}) | |||
result = result..'|| | local purchName = purchase.name | ||
if iconNoLink == nil or iconNoLink ~= true then purchName = '[[' .. purchName .. ']]' end | |||
result = result..'style="min-width:25px"|'..Icons.Icon({iconName, type=iconType, notext=true, nolink=iconNoLink, size='50'}) | |||
result = result..'||'..purchName..'||'..purchType | |||
result = result..'||'..purchase.description..'||style="text-align:right;"' | result = result..'||'..purchase.description..'||style="text-align:right;"' | ||
Line 250: | 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 |