Module:Skills/Artisan: Difference between revisions

Update for v1.0.3
(Update for v1.0.2)
(Update for v1.0.3)
Line 11: Line 11:
function p.getCookedItemsTable(frame)
function p.getCookedItemsTable(frame)
local category = frame.args ~= nil and frame.args[1] or frame
local category = frame.args ~= nil and frame.args[1] or frame
local itemArray = nil
local categoryMap = {
["Cooking Fire"] = 0,
["Furnace"] = 1,
["Pot"] = 2
}
local categoryID = categoryMap[category]
local recipeArray = {}


if category == "Cooking Fire" then
-- Find recipes for the relevant categories
itemArray = Items.getItems(function(item) return item.cookingCategory == 0 end)
for i, recipe in ipairs(SkillData.Cooking.Recipes) do
elseif category == "Furnace" then
-- Note: Excludes Lemon cake
itemArray = Items.getItems(function(item) return item.cookingCategory == 1 and item.name ~= 'Lemon Cake' end)
if (categoryID == nil or recipe.category == categoryID) and recipe.masteryID >= 0 then
elseif category == "Pot" then
table.insert(recipeArray, recipe)
itemArray = Items.getItems(function(item) return item.cookingCategory == 2 end)
end
else
itemArray = Items.getItems(function(item) return item.cookingCategory ~= nil and item.name ~= 'Lemon Cake' end)
end
end
table.sort(itemArray, function(a, b) return a.cookingLevel < b.cookingLevel end)
table.sort(recipeArray, function(a, b) return (a.level == b.level and a.masteryID < b.masteryID) or a.level < b.level end)


-- Logic for generating some cells of the table which are consistent for normal & perfect items
-- Logic for generating some cells of the table which are consistent for normal & perfect items
Line 40: Line 44:
end
end


local result = '{| class="wikitable sortable stickyHeader"'
local resultPart = {}
result = result..'\r\n|- class="headerRow-0"'
table.insert(resultPart, '{| class="wikitable sortable stickyHeader"')
result = result..'\r\n!colspan="3" rowspan="2"|Cooked Item!!rowspan="2"|'..Icons.Icon({'Cooking', type='skill', notext=true})..' Level'
table.insert(resultPart, '\r\n|- class="headerRow-0"')
result = result..'!!rowspan="2"|Cook Time!!rowspan="2"|XP!!colspan="2"|Healing!!colspan="2"|Value!!rowspan="2"|Ingredients'
table.insert(resultPart, '\r\n!colspan="3" rowspan="2"|Cooked Item!!rowspan="2"|'..Icons.Icon({'Cooking', type='skill', notext=true})..' Level')
result = result..'\r\n|- class="headerRow-1"'
table.insert(resultPart, '!!rowspan="2"|Cook Time!!rowspan="2"|XP!!colspan="2"|Healing!!colspan="2"|Value!!rowspan="2"|Ingredients')
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})
table.insert(resultPart, '\r\n|- class="headerRow-1"')
table.insert(resultPart, '\r\n!Normal!!' .. Icons.Icon({'Perfect', type='bonus', ext='png', notext=true, nolink=true}))
table.insert(resultPart, '!!Normal!!' .. Icons.Icon({'Perfect', type='bonus', ext='png', notext=true, nolink=true}))


for i, item in Shared.skpairs(itemArray) do
for i, recipe in ipairs(recipeArray) do
local item = Items.getItemByID(recipe.itemID)
local perfectItem = nil
local perfectItem = nil
if item.perfectItem ~= nil then
if recipe.perfectCookID ~= nil then
perfectItem = Items.getItemByID(item.perfectItem)
perfectItem = Items.getItemByID(recipe.perfectCookID)
end
end
local qty = item.cookingQty
local qty = recipe.baseQuantity or 1
if qty == nil then
 
qty = 1
table.insert(resultPart, '\r\n|-')
end
table.insert(resultPart, '\r\n|style="min-width:25px"|'..Icons.Icon({item.name, type='item', notext=true, size='50'}))
result = result..'\r\n|-'
table.insert(resultPart, '\r\n|style="min-width:25px"| ')
result = result..'\r\n|style="min-width:25px"|'..Icons.Icon({item.name, type='item', notext=true, size='50'})
result = result..'\r\n|style="min-width:25px"| '
if perfectItem ~= nil then
if perfectItem ~= nil then
result = result..Icons.Icon({perfectItem.name, type='item', notext=true, size='50'})
table.insert(resultPart, Icons.Icon({perfectItem.name, type='item', notext=true, size='50'}))
end
end
result = result..'||'
table.insert(resultPart, '||')
if qty > 1 then
if qty > 1 then
result = result..qty..'x '
table.insert(resultPart, qty..'x ')
end
end
result = result..Icons.Icon({item.name, type='item', noicon = true})
table.insert(resultPart, Icons.Icon({item.name, type='item', noicon = true}))
result = result..'||style="text-align:right"|'..item.cookingLevel
table.insert(resultPart, '||style="text-align:right"|' .. recipe.level)
result = result..'||style="text-align:right" data-sort-value="' .. item.cookingInterval .. '"|'..Shared.timeString(item.cookingInterval / 1000, true)
table.insert(resultPart, '||style="text-align:right" data-sort-value="' .. recipe.baseInterval .. '"|' .. Shared.timeString(recipe.baseInterval / 1000, true))
result = result..'||style="text-align:right"|'..item.cookingXP
table.insert(resultPart, '||style="text-align:right" data-sort-value="' .. recipe.baseXP .. '"|' .. Shared.formatnum(recipe.baseXP))
result = result..'||'..getHealingCell(item, qty)..'||'..getHealingCell(perfectItem, qty)
table.insert(resultPart, '||'..getHealingCell(item, qty)..'||'..getHealingCell(perfectItem, qty))
result = result..'||'..getSaleValueCell(item, qty)..'||'..getSaleValueCell(perfectItem, qty)
table.insert(resultPart, '||'..getSaleValueCell(item, qty)..'||'..getSaleValueCell(perfectItem, qty))
local matArray = {}
local matArray = {}
for j, reqSet in pairs(item.recipeRequirements) do
for j, mat in ipairs(recipe.itemCosts) do
for k, mat in pairs(reqSet) do
local matItem = Items.getItemByID(mat.id)
local matItem = Items.getItemByID(mat.id)
if matItem ~= nil then
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty}))
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty}))
end
end
end
end
result = result..'\r\n|'..table.concat(matArray, ' ')
table.insert(resultPart, '\r\n|'..table.concat(matArray, ' '))
end
end


result = result..'\r\n|}'
table.insert(resultPart, '\r\n|}')
return result
return table.concat(resultPart)
end
end


Line 103: Line 108:
end
end


local result = '{|class = "wikitable sortable stickyHeader"'
local resultPart = {}
result = result..'\r\n|- class="headerRow-0"'
table.insert(resultPart, '{|class="wikitable sortable stickyHeader"')
result = result..'\r\n!Potion!!'..Icons.Icon({'Herblore', type='skill', notext=true})..' Level'
table.insert(resultPart, '\r\n|- class="headerRow-0"')
result = result..'!!XP!!Ingredients!!colspan="2"|Tier!!Value!!Charges!!Effect'
table.insert(resultPart, '\r\n!Potion!!'..Icons.Icon({'Herblore', type='skill', notext=true})..' Level')
table.insert(resultPart, '!!XP!!Ingredients!!style="width:30px;"|Tier!!Value!!Charges!!Effect')


table.sort(potionArray, function(a, b) return a.level < b.level end)
table.sort(potionArray, function(a, b) return a.level < b.level end)


for i, potion in ipairs(potionArray) do
for i, potion in ipairs(potionArray) do
result = result..'\r\n|-'
table.insert(resultPart, '\r\n|-')
if potion.name == 'Bird Nests Potion' then
if potion.name == 'Bird Nests Potion' then
result = result..'\r\n|rowspan="4"|[[Bird Nest Potion]]'
table.insert(resultPart, '\r\n|rowspan="4"|[[Bird Nest Potion]]')
else
else
result = result..'\r\n|rowspan="4"|[['..potion.name..']]'
table.insert(resultPart, '\r\n|rowspan="4"|[['..potion.name..']]')
end
end
result = result..'||rowspan="4" style="text-align:right"|'..potion.level
table.insert(resultPart, '||rowspan="4" style="text-align:right"|'..potion.level)
result = result..'||rowspan="4" style="text-align:right"|'..potion.baseXP
table.insert(resultPart, '||rowspan="4" style="text-align:right"|'..potion.baseXP)


local matArray = {}
local matArray = {}
Line 125: Line 131:
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty}))
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty}))
end
end
result = result..'||rowspan="4"|'..table.concat(matArray, ', ')..'||'
table.insert(resultPart, '||rowspan="4"|'..table.concat(matArray, ', ')..'||')


local tierRows = {}
local tierRows = {}
for j, potionID in ipairs(potion.potionIDs) do
for j, potionID in ipairs(potion.potionIDs) do
local rowTxt = {}
local tierPot = Items.getItemByID(potionID)
local tierPot = Items.getItemByID(potionID)
local rowTxt = Icons.Icon({tierPot.name, type='item', notext=true})
table.insert(rowTxt, Icons.Icon({tierPot.name, type='item', notext=true}))
rowTxt = rowTxt..'||'..Icons.Icon({tierPot.name, tierSuffix[j], type = 'item', noicon = true})
table.insert(rowTxt, Icons.Icon({tierPot.name, tierSuffix[j], type = 'item', noicon = true}))
rowTxt = rowTxt..'||style="text-align:right;" data-sort-value="'..tierPot.sellsFor..'"|'..Icons.GP(tierPot.sellsFor)
table.insert(rowTxt, '||style="text-align:right;" data-sort-value="'..tierPot.sellsFor..'"|'..Icons.GP(tierPot.sellsFor))
rowTxt = rowTxt..'||style="text-align:right;"|'..tierPot.potionCharges..'||'..tierPot.description
table.insert(rowTxt, '||style="text-align:right;"|'..tierPot.potionCharges..'||'..tierPot.description)
table.insert(tierRows, rowTxt)
table.insert(tierRows, table.concat(rowTxt))
end
end
result = result..table.concat(tierRows, '\r\n|-\r\n|')
table.insert(resultPart, table.concat(tierRows, '\r\n|-\r\n|'))
end
end


result = result..'\r\n|}'
table.insert(resultPart, '\r\n|}')
return result
return table.concat(resultPart)
end
end


Line 150: Line 157:
function p.getRunecraftingTable(frame)
function p.getRunecraftingTable(frame)
local category = frame.args ~= nil and frame.args[1] or frame
local category = frame.args ~= nil and frame.args[1] or frame
local data = nil
return p._getRecipeTable('Runecrafting', category, {'Item', 'SkillLevel', 'SkillXP', 'GP', 'Ingredients', 'SkillXPSec', 'GPSec'})
end


if    category == "Runes"      then data =
function p.getFletchingTable(frame)
Items.getItems(function(item) return item.runecraftingCategory == 0 end)
local category = frame.args ~= nil and frame.args[1] or frame
elseif category == "ComboRunes" then data =
return p._getRecipeTable('Fletching', category, {'Item', 'SkillLevel', 'SkillXP', 'GP', 'Ingredients'})
Items.getItems(function(item) return item.runecraftingCategory == 1 end)
elseif category == "Weapons"    then data =
Items.getItems(function(item) return item.runecraftingCategory == 2 and item.runecraftingID end)
elseif category == "AirGear"    then data =
Items.getItems(function(item) return item.runecraftingCategory == 3 end)
elseif category == "WaterGear"  then data =
Items.getItems(function(item) return item.runecraftingCategory == 4 end)
elseif category == "EarthGear"  then data =
Items.getItems(function(item) return item.runecraftingCategory == 5 end)
elseif category == "FireGear"  then data =
Items.getItems(function(item) return item.runecraftingCategory == 6 end)
end
 
if data == nil then
return "ERROR: Invalid Runecrafting category name.[[Category:Pages with script errors]]"
end
 
local result = '{| class="wikitable sortable stickyHeader"'
result = result..'\r\n|- class="headerRow-0"'
result = result..'\r\n!Item\r\n!Name\r\n!'..Icons.Icon({'Runecrafting', type='skill', notext=true})..' Level\r\n!Experience'
result = result..'\r\n!Item Price\r\n!Ingredients\r\n!XP/s\r\n!GP/s'
 
table.sort(data, function(a, b) return (a.runecraftingLevel == b.runecraftingLevel and a.id < b.id)
or a.runecraftingLevel < b.runecraftingLevel end)
 
for i, rune in Shared.skpairs(data) do
result = result..'\r\n|-'
result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({rune.name, type='item', size='50', notext=true})
result = result..'\r\n| style ="text-align: left;" |'..Icons.Icon({rune.name, type='item', noicon=true})
result = result..'\r\n| style="text-align:right"|'..rune.runecraftingLevel
result = result..'\r\n| style="text-align:right"|'..rune.runecraftingXP
result = result..'\r\n| style="text-align:right"|'..rune.sellsFor
 
local matArray = {}
for j, mat in Shared.skpairs(rune.runecraftReq) do
local matItem = Items.getItemByID(mat.id)
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty}))
end
result = result..'\r\n|'..table.concat(matArray, ' ')
 
local rcCraftTime = 2.00
local xps = rune.runecraftingXP / rcCraftTime
local gps = rune.sellsFor / rcCraftTime
result = result..'\r\n| style="text-align:right"|'..string.format("%.2f", xps)
result = result..'\r\n| style="text-align:right"|'..string.format("%.2f", gps)
end
 
result = result..'\r\n|}'
return result
end
end


function p.getFletchingTable(frame)
function p.getCraftingTable(frame)
local category = frame.args ~= nil and frame.args[1] or frame
local category = frame.args ~= nil and frame.args[1] or frame
local data = nil
return p._getRecipeTable('Crafting', category, {'Item', 'SkillLevel', 'SkillXP', 'GP', 'Ingredients'})
end


if    category == "Arrows"    then
-- Given a skill name, category, and column list, produces a table of recipes for that
data = Items.getItems(function(item) return item.fletchingCategory == 0 end)
-- skill & category combination. If categoryName is '', all recipes are returned.
elseif category == "Shortbows" then
-- Note: This only supports a number of skills with consistent recipe data structures, being:
data = Items.getItems(function(item) return item.fletchingCategory == 1 end)
-- Fletching, Crafting, and Runecrafting
elseif category == "Longbows"  then
-- Valid column list options are: Item, SkillLevel, SkillXP, GP, Ingredients, SkillXPSec, GPSec
data = Items.getItems(function(item) return item.fletchingCategory == 2 end)
function p._getRecipeTable(skillName, categoryName, columnList)
elseif category == "Bolts"    then
-- Validation: Parameters
data = Items.getItems(function(item) return item.fletchingCategory == 3 end)
if type(skillName) ~= 'string' then
elseif category == "Crossbows" then
return 'ERROR: skillName must be a string'
data = Items.getItems(function(item) return item.fletchingCategory == 4 end)
elseif not Shared.contains({'string', 'nil'}, type(categoryName)) then
elseif category == "Javelins"  then
return 'ERROR: category must be a string or nil'
data = Items.getItems(function(item) return item.fletchingCategory == 5 end)
elseif type(columnList) ~= 'table' or Shared.tableCount(columnList) == 0 then
return 'ERROR: columnList must be a table with 1+ elements'
end
end


if data == nil then
local categoryMap = {
return "ERROR: Invalid Fletching category name.[[Category:Pages with script errors]]"
["Runecrafting"] = {
["Runes"] = 0,
["ComboRunes"] = 1,
["Weapons"] = 2,
["AirGear"] = 3,
["WaterGear"] = 4,
["EarthGear"] = 5,
["FireGear"] = 6
},
["Fletching"] = {
["Arrows"] = 0,
["Shortbows"] = 1,
["Longbows"] = 2,
["Bolts"] = 3,
["Crossbows"] = 4,
["Javelins"] = 5
},
["Crafting"] = {
["Leather"] = 0,
["Dragonhide"] = 1,
["Rings"] = 2,
["Necklaces"] = 3,
["Bags"] = 4
}
}
local actionIntervals = {
["Runecrafting"] = 2,
["Fletching"]  = 2,
["Crafting"] = 2
}
-- Validation: Category
if categoryMap[skillName] == nil then
return 'ERROR: The ' .. skillName .. ' skill is not supported by this function'
elseif categoryName ~= '' and categoryMap[skillName][categoryName] == nil then
local catNames = {}
for catName, catID in pairs(categoryMap[skillName]) do
table.insert(catNames, catName)
end
return 'ERROR: No such category ' .. categoryName .. ' for skill ' .. skillName .. ', the following are available: ' .. table.concat(catNames, ', ')
end
end
local categoryID = categoryMap[skillName][categoryName]
local actionInterval = actionIntervals[skillName]


local result = '{| class="wikitable sortable stickyHeader"'
-- Validation: Skill data
result = result..'\r\n|- class="headerRow-0"'
local recipeKey = 'Recipes'
result = result..'\r\n!Item\r\n!Name\r\n!Fletching Level\r\n!Experience'
if SkillData[skillName] == nil then
result = result..'\r\n!Quantity\r\n!Sells For\r\n!Ingredients'
return 'ERROR: Could not locate skill data for ' .. skillName
elseif SkillData[skillName][recipeKey] == nil then
return 'ERROR: Could not locate recipe data for ' .. skillName
end


table.sort(data, function(a, b) return (a.fletchingLevel == b.fletchingLevel and a.id < b.id)
-- Validation: Column list
or a.fletchingLevel < b.fletchingLevel end)
local columnDef = {
 
["Item"] = {["header"] = 'Item\r\n!Name', ["altRepeat"] = true},
for i, fletch in Shared.skpairs(data) do
["SkillLevel"] = {["header"] = Icons.Icon({skillName, type='skill', notext=true}) .. ' Level', ["altRepeat"] = false},
result = result..'\r\n|-'
["SkillXP"] = {["header"] = 'XP', altRepeat = false},
result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({fletch.name, type='item', size='50', notext=true})
["GP"] = {["header"] = 'Value', ["altRepeat"] = true},
result = result..'\r\n| style ="text-align: left;" |'..Icons.Icon({fletch.name, type='item', noicon=true})
["Ingredients"] = {["header"] = 'Ingredients', ["altRepeat"] = true},
result = result..'\r\n| style="text-align:right"|'..fletch.fletchingLevel
["SkillXPSec"] = {["header"] = 'XP/s', ["altRepeat"] = false},
result = result..'\r\n| style="text-align:right"|'..fletch.fletchingXP
["GPSec"] = {["header"] = 'GP/s', ["altRepeat"] = true}
result = result..'\r\n| style="text-align:right"|'..fletch.fletchQty
}
result = result..'\r\n| style="text-align:right"|'..fletch.sellsFor
-- Build the table header while we're here
 
local resultPart = {}
local matArray = {}
table.insert(resultPart, '{| class="wikitable sortable stickyHeader"\r\n|- class="headerRow-0"')
for j, mat in Shared.skpairs(fletch.fletchReq) do
for i, colID in ipairs(columnList) do
local matItem = Items.getItemByID(mat.id)
if columnDef[colID] == nil then
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty}))
return 'ERROR: Invalid column ' .. colID .. ' requested'
else
table.insert(resultPart, '\r\n! ' .. columnDef[colID].header)
end
end
result = result..'\r\n|'..table.concat(matArray, ' ')
end
end


result = result..'\r\n|}'
-- Determine which recipes to include
return result
local recipeList = {}
end
for i, recipe in ipairs(SkillData[skillName][recipeKey]) do
 
if categoryID == nil or recipe.category == categoryID then
function p.getCraftingTable(frame)
table.insert(recipeList, recipe)
local category = frame.args ~= nil and frame.args[1] or frame
end
local data = nil
 
if     category == "Leather"    then data =
Items.getItems(function(item) return item.tier == "Leather" or item.tier == "Hard Leather" end)
elseif category == "Dragonhide" then data =
Items.getItems(function(item) return item.tier == "Dragonhide" and item.craftingLevel ~= nil end)
elseif category == "Rings"      then data =
Items.getItems(function(item) return (item.validSlots ~= nil and Shared.contains(item.validSlots, 'Ring')) and item.craftingLevel ~= nil end)
elseif category == "Necklaces"  then data =
Items.getItems(function(item) return (item.validSlots ~= nil and Shared.contains(item.validSlots, 'Amulet')) and item.craftingLevel ~= nil end)
elseif category == "Bags" then data =
Items.getItems(function(item) return item.type == 'Bag' and item.craftingLevel ~= nil end)
end
end
 
if Shared.tableCount(recipeList) == 0 then
if data == nil then
return ''
return "ERROR: Invalid Crafting category name.[[Category:Pages with script errors]]"
end
end
table.sort(recipeList, function(a, b) return (a.level == b.level and a.masteryID < b.masteryID) or a.level < b.level end)


table.sort(data, function(a, b) return (a.craftingLevel == b.craftingLevel and a.id < b.id)
-- Build rows based on recipes
or a.craftingLevel < b.craftingLevel end)
for i, recipe in ipairs(recipeList) do
 
local item = Items.getItemByID(recipe.itemID)
local result = '{| class="wikitable sortable stickyHeader"'
if item ~= nil then
result = result..'\r\n|- class="headerRow-0"'
-- Some recipes have alternative costs, so the recipe may require multiple rows
result = result..'\r\n!Item\r\n!Name\r\n!'..Icons.Icon({'Crafting', type='skill', notext=true})..' Level\r\n!Experience'
local costList = nil
result = result..'\r\n!Item Price\r\n!Ingredients'
if recipe.alternativeCosts ~= nil and Shared.tableCount(recipe.alternativeCosts) > 0 then
 
costList = recipe.alternativeCosts
for i, craft in Shared.skpairs(data) do
else
result = result..'\r\n|-'
costList = {{["itemCosts"] = recipe.itemCosts}}
result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({craft.name, type='item', size='50', notext=true})
end
result = result..'\r\n| style ="text-align: left;" |'..Icons.Icon({craft.name, type='item', noicon=true})
local costCount = Shared.tableCount(costList)
result = result..'\r\n| style="text-align:right"|'..craft.craftingLevel
-- Build one row per element within costList
result = result..'\r\n| style="text-align:right"|'..craft.craftingXP
for recipeRow, costDef in ipairs(costList) do
result = result..'\r\n| style="text-align:right" data-sort-value="'..craft.sellsFor..'"|'..Icons.GP(craft.sellsFor)
local rowspanStr = (recipeRow == 1 and costCount > 1 and 'rowspan="' .. costCount .. '" ') or ''
 
local qty = (costDef.quantityMultiplier or 1) * (recipe.baseQuantity or 1)
local matArray = {}
table.insert(resultPart, '\r\n|-')
if craft.craftGPCost ~= nil and craft.craftGPCost > 0 then
for j, colID in ipairs(columnList) do
table.insert(matArray, Icons.GP(craft.craftGPCost))
local altRepeat = columnDef[colID].altRepeat
end
-- All columns must be generated if this is the very first row for a recipe,
for j, mat in Shared.skpairs(craft.craftReq) do
-- for subsequent rows only columns marked as altRepeat = true are generated
local matItem = Items.getItemByID(mat.id)
if recipeRow == 1 or altRepeat then
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty}))
local spanStr = (not altRepeat and rowspanStr) or ''
if colID == 'Item' then
local namePrefix = spanStr .. (qty > 1 and 'data-sort-value="' .. item.name .. '"')
table.insert(resultPart, '\r\n|' .. spanStr .. 'style="text-align:center;min-width:25px"| ' .. Icons.Icon({item.name, type='item', size='50', notext=true}))
table.insert(resultPart, '\r\n|'.. (namePrefix ~= '' and namePrefix .. '| ' or ' ') .. (qty > 1 and '<b>' .. qty .. 'x</b> ' or '') .. Icons.Icon({item.name, type='item', noicon=true}))
elseif colID == 'SkillLevel' then
table.insert(resultPart, '\r\n|' .. spanStr .. 'style="text-align:right"| ' .. recipe.level)
elseif colID == 'SkillXP' then
table.insert(resultPart, '\r\n|' .. spanStr .. 'style="text-align:right"| ' .. recipe.baseXP)
elseif colID == 'GP' then
local val = math.floor(item.sellsFor)
table.insert(resultPart, '\r\n|' .. spanStr .. 'data-sort-value="' .. (val * qty) .. '"| ' .. Icons.GP(val) .. (qty > 1 and ' (x' .. qty .. ')' or ''))
elseif colID == 'Ingredients' then
local matArray = {}
for k, mat in ipairs(costDef.itemCosts) do
local matItem = Items.getItemByID(mat.id)
if matItem ~= nil then
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty}))
end
end
table.insert(resultPart, '\r\n|' .. (spanStr ~= '' and spanStr .. '| ' or ' ') .. table.concat(matArray, ', '))
elseif colID == 'SkillXPSec' then
table.insert(resultPart, '\r\n|' .. spanStr .. 'style="text-align:right"| ' .. string.format('%.2f', recipe.baseXP / actionInterval))
elseif colID == 'GPSec' then
local val = math.floor(item.sellsFor) * qty / actionInterval
table.insert(resultPart, '\r\n|' .. spanStr .. 'data-sort-value="' .. val .. '"| ' .. Icons.GP(string.format('%.2f', val)))
else
table.insert(resultPart, '\r\n| ')
end
end
end
end
end
end
result = result..'\r\n|'..table.concat(matArray, ', ')
end
end
 
table.insert(resultPart, '\r\n|}')
result = result..'\r\n|}'
return table.concat(resultPart)
return result
end
end


return p
return p