Module:Items/UseTables: Difference between revisions

_getItemUseTable: Amend to show XP harvested per quantity for Farming
(getItemUseTable: Resolve Summoning tablets with no non-shard item costs being excluded from output)
(_getItemUseTable: Amend to show XP harvested per quantity for Farming)
(3 intermediate revisions by the same user not shown)
Line 17: Line 17:
Astrology = {'melvorF:Stardust', 'melvorF:Golden_Stardust'},
Astrology = {'melvorF:Stardust', 'melvorF:Golden_Stardust'},
Attack = {},
Attack = {},
Cartography = {'melvorD:Crown_of_Rhaelyx'},
Combat = {'melvorF:Gold_Emerald_Ring', 'melvorD:Obsidian_Cape', 'melvorF:Throwing_Power_Gloves'},
Combat = {'melvorF:Gold_Emerald_Ring', 'melvorD:Obsidian_Cape', 'melvorF:Throwing_Power_Gloves'},
Cooking = {'melvorD:Cooking_Gloves', 'melvorD:Crown_of_Rhaelyx'},
Cooking = {'melvorD:Cooking_Gloves', 'melvorD:Crown_of_Rhaelyx'},
Line 370: Line 371:
end
end
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end


Line 458: Line 459:
local product = Items.getItemByID(recipe.productId)
local product = Items.getItemByID(recipe.productId)
local mat = {{id = recipe.seedCost.id, quantity = recipe.seedCost.quantity}}
local mat = {{id = recipe.seedCost.id, quantity = recipe.seedCost.quantity}}
local xp = recipe.baseExperience
local rowReq = recipe.level
local rowReq = recipe.level
local category = GameData.getEntityByID(SkillData.Farming.categories, recipe.categoryID)
local category = GameData.getEntityByID(SkillData.Farming.categories, recipe.categoryID)
local qty = 5 * category.harvestMultiplier
local qty = 5 * category.harvestMultiplier
local xp = recipe.baseExperience
table.insert(useArray, {item = {id = product.id, name = product.name}, qty = qty, mats = mat, skill = 'Farming', req = rowReq, xp = xp})
table.insert(useArray, {item = {id = product.id, name = product.name}, qty = qty, mats = mat, skill = 'Farming', req = rowReq, xp = xp})
end
end
Line 588: Line 589:
local matQty = itemCost.quantity or itemCost[2] or 1
local matQty = itemCost.quantity or itemCost[2] or 1
if matItem == nil then
if matItem == nil then
table.insert(matRow, 'ERROR: Failed to find item with ID ' .. itemCost.id .. '[[Category:Pages with script errors]]')
table.insert(matRow, Shared.printError('Failed to find item with ID "' .. itemCost.id .. '"'))
elseif type(matQty) == 'number' then
elseif type(matQty) == 'number' then
table.insert(matRow, Icons.Icon({matItem.name, type='item', qty=matQty}))
table.insert(matRow, Icons.Icon({matItem.name, type='item', qty=matQty}))
Line 661: Line 662:
local item = Items.getItem(itemName)
local item = Items.getItem(itemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end


Line 720: Line 721:
local item = Items.getItem(itemName)
local item = Items.getItem(itemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end