Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
_getCreationTable: Fix recipe quantity & account for GP/SC costs for alterative cost recipes (example: Arrow Shafts); buildCreationTable: Support SC cost
(_getItemSources: Resolve missing skill sources for Herblore, Mining)
(_getCreationTable: Fix recipe quantity & account for GP/SC costs for alterative cost recipes (example: Arrow Shafts); buildCreationTable: Support SC cost)
Line 110: Line 110:
table.insert(reqSubPart, itemCost.qty .. 'x ?????')
table.insert(reqSubPart, itemCost.qty .. 'x ?????')
else
else
table.insert(reqSubPart, Icons.Icon({reqItem.name, type='item', qty=altCost.itemCosts.qty}))
table.insert(reqSubPart, Icons.Icon({reqItem.name, type='item', qty=itemCost.qty}))
end
end
end
if recipe.gpCost ~= nil and recipe.gpCost > 0 then
table.insert(reqSubPart, Icons.GP(recipe.gpCost))
end
if recipe.scCost ~= nil and recipe.scCost > 0 then
table.insert(reqSubPart, Icons.GP(recipe.scCost))
end
end
table.insert(reqPart, table.concat(reqSubPart, ', '))
table.insert(reqPart, table.concat(reqSubPart, ', '))
Line 122: Line 128:
elseif type(recipe.itemCosts) == 'table' and Shared.tableCount(recipe.itemCosts) > 0 then
elseif type(recipe.itemCosts) == 'table' and Shared.tableCount(recipe.itemCosts) > 0 then
req = recipe.itemCosts
req = recipe.itemCosts
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, baseQty, time, maxTime, specialReq))
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, baseQty, time, maxTime, specialReq, recipe.gpCost, recipe.scCost))
end
end
end
end
Line 295: Line 301:
end
end


function p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime, specialReq, gpCost)
function p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime, specialReq, gpCost, scCost)
if qty == nil then qty = 1 end
if qty == nil then qty = 1 end
local resultPart = {}
local resultPart = {}
Line 323: Line 329:
table.insert(resultPart, '<br/>')
table.insert(resultPart, '<br/>')
table.insert(resultPart, Icons.GP(gpCost))
table.insert(resultPart, Icons.GP(gpCost))
end
if scCost ~= nil and scCost > 0 then
table.insert(resultPart, '<br/>')
table.insert(resultPart, Icons.SC(scCost))
end
end
else
else
Line 1,098: Line 1,108:
'Mysterious Stone',
'Mysterious Stone',
'Mastery Token (Cooking)',
'Mastery Token (Cooking)',
'Gem Gloves'
'Gem Gloves',
"Thief's Moneysack"
}
}
local checkFuncs = {
local checkFuncs = {