Módulo:Telos calculator

De RuneScape Wiki
Ir para: navegação, pesquisa

This template should be used when there is no documentation for a Module.


-- <pre>
local p = {}
 
local yesno = require ("Module:Yesno")
 
function p.main(frame)
    local args = frame:getParent().args
    local enrage = tonumber(args.enrage) or 0
    local streak = tonumber(args.streak) or 0    
    local lotd = yesno(args.lotd) or false
    local modifiedEnrage = enrage
 
    if lotd then
        modifiedEnrage = math.min(enrage + 25,4000)
    end
 
    local res = ""
 
    local unique = math.floor(10000 / (10 + .25*modifiedEnrage + 3*streak) )
    if enrage<100 then
        unique = unique*10
    end
    if enrage<25 then
        unique = unique*3
    end
 
    unique = math.max(unique,9)
 
    res = res .. "<div style=\"font-weight:bold\">The chance of receiving any unique is " .. "1/" .. string.format("%.0f",unique) .. "</div>"
    res = res .. "The chance of receiving an orb is " .. "1/" .. string.format("%.0f",unique * 115/75) .. "<br/>"
    res = res .. "The chance of receiving any dormant/codex is " .. "1/" .. string.format("%.0f",unique * 115/40) .. "<br/>"
    res = res .. "The chance of receiving a specific dormant/codex is " .. "1/" .. string.format("%.0f",unique * 115/10)
 
    return res
 
end
return p