2,875
edits
(Add gem link to gem equipment slot) |
(Add function for grabbing item.sellsFor value with mutliplier and rounding parameters) |
||
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 130: | Line 131: | ||
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