17,101
edits
(Use classes rather than styles where possible) |
(getCookingUtilityTable: Add missing modifiers; getToolTable: Emit error when modifiers are omitted) |
||
Line 879: | Line 879: | ||
end | end | ||
-- Keep track of modifiers which are present on tools but not exposed within the table, so | |||
-- that an error may be printed if any are omitted | |||
local modsUnused = {} | |||
for i, tool in ipairs(toolArray) do | for i, tool in ipairs(toolArray) do | ||
local toolName = p._getPurchaseName(tool) | local toolName = p._getPurchaseName(tool) | ||
Line 914: | Line 917: | ||
table.insert(resultPart, '\n|style="text-align:right" data-sort-value="' .. toolCostSort .. '"| ' .. toolCost) | table.insert(resultPart, '\n|style="text-align:right" data-sort-value="' .. toolCostSort .. '"| ' .. toolCost) | ||
local resultPrefix = '' | |||
local cellStart = '\n|style="text-align:right"' | local cellStart = '\n|style="text-align:right"' | ||
if tool.contains ~= nil and tool.contains.modifiers ~= nil then | if tool.contains ~= nil and tool.contains.modifiers ~= nil then | ||
for modName, modVal in pairs(tool.contains.modifiers) do | |||
if modTotal[modName] == nil and not Shared.contains(modsUnused, modName) then | |||
-- Mod with name modName is provided by the purchase, but not exposed within | |||
-- the output table | |||
table.insert(modsUnused, modName) | |||
end | |||
end | |||
for j, modDef in ipairs(modifiers) do | for j, modDef in ipairs(modifiers) do | ||
local modName = modDef.name | local modName = modDef.name | ||
Line 935: | Line 947: | ||
end | end | ||
local resultPrefix = '' | |||
if not Shared.tableIsEmpty(modsUnused) then | |||
resultPrefix = Shared.printError('The following modifiers are not included within the table: ' .. table.concat(modsUnused, ', ')) .. '\n' | |||
end | |||
table.insert(resultPart, '\n|}') | table.insert(resultPart, '\n|}') | ||
return table.concat(resultPart) | return resultPrefix .. table.concat(resultPart) | ||
end | end | ||
Line 985: | Line 1,001: | ||
['Cooking Fire'] = { | ['Cooking Fire'] = { | ||
{ name = 'increasedSkillXP', skillID = 'melvorD:Cooking', header = 'Bonus ' .. Icons.Icon({'Cooking', type='skill', notext=true}) .. ' XP', sign = '+', suffix = '%' }, | { name = 'increasedSkillXP', skillID = 'melvorD:Cooking', header = 'Bonus ' .. Icons.Icon({'Cooking', type='skill', notext=true}) .. ' XP', sign = '+', suffix = '%' }, | ||
{ name = 'increasedChancePerfectCookFire', header = 'Fire Perfect Cook Chance', sign ='+', suffix = '%' }, | { name = 'increasedChancePerfectCookFire', header = Icons.Icon({'Normal Cooking Fire', type='upgrade', notext=true, nolink=true}) .. ' Perfect Cook Chance', sign ='+', suffix = '%' }, | ||
{ name = 'decreasedPassiveCookInterval', header = 'Passive Cook Time Decrease', sign = '-', suffix = '%' }, | { name = 'decreasedPassiveCookInterval', header = 'Passive Cook Time Decrease', sign = '-', suffix = '%' }, | ||
{ name = 'increasedChanceToDoubleItemsSkill', skillID = 'melvorD:Cooking', header = '2x Items Chance', sign = '+', suffix = '%' }, | { name = 'increasedChanceToDoubleItemsSkill', skillID = 'melvorD:Cooking', header = '2x Items Chance', sign = '+', suffix = '%' }, | ||
Line 991: | Line 1,007: | ||
}, | }, | ||
['Furnace'] = { | ['Furnace'] = { | ||
{ name = 'increasedChancePerfectCookFurnace', header = Icons.Icon({'Basic Furnace', type='upgrade', notext=true, nolink=true}) .. ' Perfect Cook Chance', sign = '+', suffix = '%' }, | |||
{ name = 'increasedChanceToDoubleItemsSkill', skillID = 'melvorD:Cooking', header = '2x Items Chance', sign = '+', suffix = '%' }, | { name = 'increasedChanceToDoubleItemsSkill', skillID = 'melvorD:Cooking', header = '2x Items Chance', sign = '+', suffix = '%' }, | ||
{ name = 'decreasedPassiveCookInterval', header = 'Passive Cook Time Decrease', sign = '-', suffix = '%' }, | { name = 'decreasedPassiveCookInterval', header = 'Passive Cook Time Decrease', sign = '-', suffix = '%' }, | ||
Line 997: | Line 1,014: | ||
}, | }, | ||
['Pot'] = { | ['Pot'] = { | ||
{ name = 'increasedChancePerfectCookPot', header = Icons.Icon({'Basic Pot', type='upgrade', notext=true, nolink=true}) .. ' Perfect Cook Chance', sign = '+', suffix = '%' }, | |||
{ name = 'increasedChanceToDoubleItemsSkill', skillID = 'melvorD:Cooking', header = '2x Items Chance', sign = '+', suffix = '%' }, | { name = 'increasedChanceToDoubleItemsSkill', skillID = 'melvorD:Cooking', header = '2x Items Chance', sign = '+', suffix = '%' }, | ||
{ name = 'decreasedPassiveCookInterval', header = 'Passive Cook Time Decrease', sign = '-', suffix = '%' }, | { name = 'decreasedPassiveCookInterval', header = 'Passive Cook Time Decrease', sign = '-', suffix = '%' }, |