Module:Telos calculator

From WIDEVERSE Wiki
Revision as of 13:59, 14 October 2021 by en>Sfoxrs
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Telos calculator/doc

-- <pre>
local coins = require('Module:Coins')._amount
local exchange = require('Module:Exchange')

local geprice = exchange._price

local orbSword = (geprice("Zaros godsword") - geprice("Dormant Zaros godsword")) / 3
local orbBow = (geprice("Seren godbow") - geprice("Dormant Seren godbow")) / 3
local orbStaff = (geprice("Staff of Sliske") - geprice("Dormant staff of Sliske")) / 3
local dormantCodex = geprice("Dormant Seren godbow") + geprice("Dormant staff of Sliske") + geprice("Dormant Zaros godsword") + geprice("Reprisal ability codex")

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,15) --highest drop chance appears to be 1/15 and not 1/9
 
    res = res .. "<div style=\"font-weight:bold\">The chance of receiving any unique is " .. "1/" .. string.format("%.1f",unique) .. "</div>"
    res = res .. "The chance of receiving an orb is " .. "1/" .. string.format("%.1f",unique * 115/75) .. "<br/>"
    res = res .. "The chance of receiving any dormant/codex is " .. "1/" .. string.format("%.1f",unique * 115/40) .. "<br/>"
    res = res .. "The chance of receiving a specific dormant/codex is " .. "1/" .. string.format("%.1f",unique * 115/10) .. "<br/><br/>"
    res = res .. "The expected profit per kill from uniques (only) is:<br/>"
    res = res .. coins(string.format("%.0f",(10/(unique * 115)) * (dormantCodex) + (75/(unique * 115)) * orbSword )) .. " (When creating Zaros godsword)<br/>"
    res = res .. coins(string.format("%.0f",(10/(unique * 115)) * (dormantCodex) + (75/(unique * 115)) * orbBow )) .. " (When creating Seren godbow)<br/>"
    res = res .. coins(string.format("%.0f",(10/(unique * 115)) * (dormantCodex) + (75/(unique * 115)) * orbStaff )) .. " (When creating Staff of Sliske)"
 
    return res
 
end
return p