Module:Items: Difference between revisions

179 bytes removed ,  27 December 2022
Use printError function
(Added code for a craftable armour navbox)
(Use printError function)
Line 7: Line 7:


local GameData = require('Module:GameData')
local GameData = require('Module:GameData')
local Constants = require('Module:Constants')
local Constants = require('Module:Constants')
local Shared = require('Module:Shared')
local Shared = require('Module:Shared')
Line 99: Line 98:
local item = p.getItem(ItemName)
local item = p.getItem(ItemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..ItemName.." exists in the data module[[Category:Pages with script errors]]"
return Shared.printError('No item named "' .. ItemName .. '" exists in the data module')
end
end
local result = p._getItemStat(item, StatName, ZeroIfNil)
local result = p._getItemStat(item, StatName, ZeroIfNil)
Line 178: Line 177:
local item = p.getItem(itemName)
local item = p.getItem(itemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module[[Category:Pages with script errors]]"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end


Line 199: Line 198:
local item = p.getItem(itemName)
local item = p.getItem(itemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module[[Category:Pages with script errors]]"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end
return p._getWeaponAttackType(item)
return p._getWeaponAttackType(item)
Line 284: Line 283:
local item = p.getItem(itemName)
local item = p.getItem(itemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module[[Category:Pages with script errors]]"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end


Line 341: Line 340:
local item = p.getItem(itemName)
local item = p.getItem(itemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module[[Category:Pages with script errors]]"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end


Line 381: Line 380:
compName = "Throne of the Herald"
compName = "Throne of the Herald"
else
else
return '\r\n!style="text-align:right;" colspan=2|ERROR: Invalid namespace for completion requirement "..req.namespace.."[[Category:Pages with script errors]]'
return '\r\n!style="text-align:right;" colspan=2|' .. Shared.printError('Invalid namespace for completion requirement "' .. req.namespace .. '"')
end
end
result = '\r\n!style="text-align:right;"| '..compName..' Completion'
result = '\r\n!style="text-align:right;"| '..compName..' Completion'
result = result..'\r\n|style="text-align:right;"| '..req.percent..'%'
result = result..'\r\n|style="text-align:right;"| '..req.percent..'%'
else
else
return '\r\n!style="text-align:right;" colspan=2|ERROR: Invalid equip requirement type "..req.type.."[[Category:Pages with script errors]]'
return '\r\n!style="text-align:right;" colspan=2|' .. Shared.printError('Invalid equip requirement type "' .. req.type .. '"')
end
end
return result
return result
Line 395: Line 394:
local item = p.getItem(itemName)
local item = p.getItem(itemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module[[Category:Pages with script errors]]"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end


Line 505: Line 504:
local item = p.getItem(itemName)
local item = p.getItem(itemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module[[Category:Pages with script errors]]"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end


Line 609: Line 608:
local item = p.getItem(itemName)
local item = p.getItem(itemName)
if item == nil then
if item == nil then
return "ERROR: No item named "..itemName.." exists in the data module[[Category:Pages with script errors]]"
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
end