2,875
edits
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
local Number = require('Module:Number') | local Number = require('Module:Number') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local function getPurchase(itemName) | local function getPurchase(itemName) | ||
Line 98: | Line 97: | ||
function p.getSCItemProfits(frame) | function p.getSCItemProfits(frame) | ||
local args = frame:getParent().args | |||
return p._getSCItemProfits(args[1]) | |||
end | end | ||
Line 141: | Line 142: | ||
end | end | ||
function p.getSCValue( | function p.getSCValue(frame) | ||
local purchase = getPurchase( | local args = frame:getParent().args | ||
return p._getItemSellsFor(args[1], args[2], args.round) | |||
end | |||
function p._getSCValue(itemName, multiplier, rounding) | |||
local purchase = getPurchase(itemName) | |||
if purchase == nil then | if purchase == nil then | ||
return Shared.printError("No Slayer Shop item exists with the name: " .. | return Shared.printError("No Slayer Shop item exists with the name: " .. itemName) | ||
end | end | ||
local itemValue = getPurchaseValue(purchase) | |||
multiplier = tonumber(multiplier) or 1 | |||
rounding = tonumber(rounding) or 0 | |||
return Number.round2(itemValue * multiplier, rounding) | |||
end | end | ||
return p | return p |
edits