Anonymous

Module:SCValue: Difference between revisions

From Melvor Idle
no edit summary
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 Debug = require('Module:Debug')


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(item)
function p.getSCValue(frame)
local purchase = getPurchase(item)
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: " .. item)
return Shared.printError("No Slayer Shop item exists with the name: " .. itemName)
end
end
return getPurchaseValue(purchase)
local itemValue = getPurchaseValue(purchase)
end
multiplier = tonumber(multiplier) or 1
 
rounding = tonumber(rounding) or 0
function p.test()
return p._getSCItemProfits(1)
return Number.round2(itemValue * multiplier, rounding)
 
--mw.log(p.getSCValue(item))
end
end


return p
return p
2,875

edits