4,951
edits
Falterfire (talk | contribs) (formatting fix for firemaking table) |
Falterfire (talk | contribs) (Added value per bar to the Smithing tables) |
||
Line 237: | Line 237: | ||
result = result..'\r\n|-class="headerRow-0"' | result = result..'\r\n|-class="headerRow-0"' | ||
result = result..'\r\n!Item!!Name!!'..Icons.Icon({'Smithing', type='skill', notext=true})..' Level!!XP!!Value!!Ingredients' | result = result..'\r\n!Item!!Name!!'..Icons.Icon({'Smithing', type='skill', notext=true})..' Level!!XP!!Value!!Ingredients' | ||
--Adding value/bar for things other than smelting | |||
if bar ~= nil then result = result..'!!Value/Bar' end | |||
table.sort(smithList, function(a, b) | table.sort(smithList, function(a, b) | ||
Line 254: | Line 256: | ||
result = result..'||data-sort-value="'..item.smithingLevel..'"|'..Icons._SkillReq('Smithing', item.smithingLevel) | result = result..'||data-sort-value="'..item.smithingLevel..'"|'..Icons._SkillReq('Smithing', item.smithingLevel) | ||
result = result..'||'..item.smithingXP | result = result..'||'..item.smithingXP | ||
result = result..'||data-sort-value="'.. | local totalValue = item.sellsFor * qty | ||
result = result..'||data-sort-value="'..totalValue..'"|'..Icons.GP(item.sellsFor) | |||
if qty > 1 then | if qty > 1 then | ||
result = result..' (x'..qty..')' | result = result..' (x'..qty..')' | ||
end | end | ||
result = result..'||' | result = result..'||' | ||
local barQty = 0 | |||
for i, mat in Shared.skpairs(item.smithReq) do | for i, mat in Shared.skpairs(item.smithReq) do | ||
matItem = Items.getItemByID(mat.id) | matItem = Items.getItemByID(mat.id) | ||
if i > 1 then result = result..', ' end | if i > 1 then result = result..', ' end | ||
result = result..Icons.Icon({matItem.name, type='item', qty=mat.qty, notext=true}) | result = result..Icons.Icon({matItem.name, type='item', qty=mat.qty, notext=true}) | ||
if bar ~= nil and mat.id == bar.id then | |||
barQty = mat.qty | |||
end | |||
end | |||
--Add the data for the value per bar | |||
if bar ~= nil then | |||
if barQty == 0 then | |||
result = result..'||data-sort-value="0"|N/A' | |||
else | |||
local barVal = totalValue / barQty | |||
result = result..'||data-sort-value="'..barVal..'"|'..Icons.GP(Shared.round(barVal, 2, 2)) | |||
end | |||
end | end | ||
end | end |