918
edits
(Add gem link to gem equipment slot) |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 10: | Line 10: | ||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local Num = require('Module:Number') | |||
p.EasterEggs = {'Amulet of Calculated Promotion', 'Clue Chasers Insignia', '8', 'Lemon', 'Easter Egg', | p.EasterEggs = {'Amulet of Calculated Promotion', 'Clue Chasers Insignia', '8', 'Lemon', 'Easter Egg', | ||
Line 112: | Line 113: | ||
if result == nil and ZeroIfNil then result = 0 end | if result == nil and ZeroIfNil then result = 0 end | ||
return result | return result | ||
end | |||
function p.getItemValueByID(itemID) | |||
local item = p.getItemByID(itemID) | |||
if item == nil then | |||
return 0 | |||
end | |||
return p.getItemValue(item['name']) | |||
end | end | ||
Line 130: | Line 140: | ||
return nil | return nil | ||
end | |||
-- Function already exists, but without fame. | |||
-- Giving it a slightly different name since function overloading doesn't exist | |||
function p.getItemSellsFor(frame) | |||
local args = frame:getParent().args | |||
return p._getItemSellsFor(args[1], args[2], args.round) | |||
end | |||
function p._getItemSellsFor(itemName, multiplier, rounding) | |||
local itemValue = p.getItemValue(itemName) | |||
multiplier = tonumber(multiplier) or 1 | |||
rounding = tonumber(rounding) or 0 | |||
if itemValue == nil then | |||
error('No item named "' .. itemName .. '" exists in the data module') | |||
end | |||
return Num.round2(itemValue * multiplier, rounding) | |||
end | end | ||
edits