17,105
edits
(herbloreLevel -> level to resolve a bunch of script errors) |
(getCookedItemsTable: Add healing/GP values for perfect items) |
||
Line 25: | Line 25: | ||
end | end | ||
table.sort(itemArray, function(a, b) return a.cookingLevel < b.cookingLevel end) | table.sort(itemArray, function(a, b) return a.cookingLevel < b.cookingLevel end) | ||
-- Logic for generating some cells of the table which are consistent for normal & perfect items | |||
local getHealingCell = function(item) | |||
if item ~= nil then | |||
return 'style="text-align:right" data-sort-value="'..math.floor(item.healsFor)..'"|'..Icons.Icon({"Hitpoints", type="skill", notext=true})..' '..math.floor(item.healsFor * 10) | |||
else | |||
return ' ' | |||
end | |||
end | |||
local getSaleValueCell = function(item, qty) | |||
if item ~= nil then | |||
return 'data-sort-value="'..(math.floor(item.sellsFor) * qty)..'"|'..Icons.GP(math.floor(item.sellsFor))..(qty > 1 and ' (x'..qty..')' or '') | |||
else | |||
return ' ' | |||
end | |||
end | |||
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="3"|Cooked Item!!'..Icons.Icon({'Cooking', type='skill', notext=true})..' Level' | result = result..'\r\n!colspan="3" rowspan="2"|Cooked Item!!rowspan="2"|'..Icons.Icon({'Cooking', type='skill', notext=true})..' Level' | ||
result = result..'!!XP!!Healing!!Value!!Ingredients' | result = result..'!!rowspan="2"|XP!!colspan="2"|Healing!!colspan="2"|Value!!rowspan="2"|Ingredients' | ||
result = result..'\r\n|- class="headerRow-1"' | |||
result = result..'\r\n!Normal!!' .. Icons.Icon({'Perfect', type='bonus', ext='png', notext=true, nolink=true}) .. '!!Normal!!' .. Icons.Icon({'Perfect', type='bonus', ext='png', notext=true, nolink=true}) | |||
for i, item in Shared.skpairs(itemArray) do | for i, item in Shared.skpairs(itemArray) do | ||
local perfectItem = nil | local perfectItem = nil | ||
Line 53: | Line 71: | ||
result = result..'||style="text-align:right"|'..item.cookingLevel | result = result..'||style="text-align:right"|'..item.cookingLevel | ||
result = result..'||style="text-align:right"|'..item.cookingXP | result = result..'||style="text-align:right"|'..item.cookingXP | ||
result = result..'|| | result = result..'||'..getHealingCell(item)..'||'..getHealingCell(perfectItem) | ||
result = result..'|| | result = result..'||'..getSaleValueCell(item, qty)..'||'..getSaleValueCell(perfectItem, qty) | ||
local matArray = {} | local matArray = {} | ||
for j, reqSet in pairs(item.recipeRequirements) do | for j, reqSet in pairs(item.recipeRequirements) do |