Module:WeaponDPS: Difference between revisions

From HighSpell Wiki
Jump to navigation Jump to search
No edit summary
Tag: Manual revert
No edit summary
Line 9: Line 9:
         or tonumber(args.Range or parent.args.Range)
         or tonumber(args.Range or parent.args.Range)


     local ticks = tonumber(args.Ticks or parent.args.Ticks)
     local ticks = tonumber(args.Speed or parent.args.Speed)


     if not str then return "No STR" end
     if not str then return "No STR" end
     if not ticks then return "No ticks" end
     if not ticks then return "No speed" end


     local maxHit = str / 8
     local maxHit = str / 8

Revision as of 13:04, 8 June 2025

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

local p = {}

function p.dps(frame)
    local args = frame.args
    local parent = frame:getParent()

    local str = tonumber(args.Strength or parent.args.Strength)
        or tonumber(args.Magic or parent.args.Magic)
        or tonumber(args.Range or parent.args.Range)

    local ticks = tonumber(args.Speed or parent.args.Speed)

    if not str then return "No STR" end
    if not ticks then return "No speed" end

    local maxHit = str / 8
    local seconds = ticks * 0.6
    local dps = maxHit / seconds

    return string.format("%.2f", (dps * 10))
end

return p