Module:WeaponDPS: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
local str = tonumber(frame.args.strength) or | local str = tonumber(frame.args.strength) or | ||
tonumber(frame.args.magic) or | tonumber(frame.args.magic) or | ||
tonumber(frame.args. | tonumber(frame.args.range) | ||
local ticks = tonumber(frame.args.ticks) | local ticks = tonumber(frame.args.ticks) |
Revision as of 12:19, 8 June 2025
Documentation for this module may be created at Module:WeaponDPS/doc
local p = {}
function p.dps(frame)
-- Try each stat in priority order: Strength > Magic > Ranged
local str = tonumber(frame.args.strength) or
tonumber(frame.args.magic) or
tonumber(frame.args.range)
local ticks = tonumber(frame.args.ticks)
if not str or not ticks or ticks == 0 then
return "Invalid input"
end
local maxHit = str / 8
local seconds = ticks * 0.6
local dps = maxHit / seconds
return string.format("%.2f DPS (Max Hit: %.2f)", dps, maxHit)
end
return p