Module:WeaponDPS: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
local args = frame.args | local args = frame.args | ||
local parent = frame:getParent() | local parent = frame:getParent() | ||
local | 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) | |||
if not str | local ticks = tonumber(args.Ticks or parent.args.Ticks) | ||
if not str then return "No STR" end | |||
if not ticks then return "No ticks" end | |||
local maxHit = str / 8 | local maxHit = str / 8 | ||
Line 20: | Line 18: | ||
local dps = maxHit / seconds | local dps = maxHit / seconds | ||
return string.format("%.2f | return string.format("%.2f", dps) | ||
end | end | ||
return p | return p |
Revision as of 12:27, 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.Ticks or parent.args.Ticks)
if not str then return "No STR" end
if not ticks then return "No ticks" end
local maxHit = str / 8
local seconds = ticks * 0.6
local dps = maxHit / seconds
return string.format("%.2f", dps)
end
return p