mob
var
list/cds = list()
dt
proc
setCD(cooldown, delay=0, time=0)
if(delay)
time = world.realtime + delay
cds[cooldown] = time
return time
getCD(cooldown)
if(cooldown in cds)
cdc = cds[cooldown] - world.realtime
return cds[cooldown] - world.realtime
else
return 0
Trying to make a cooldown system, but I can't get it to be perfect. Worldtime only seems to change every 50 seconds, making it completely unreliable for small cooldowns. I could use server time, but if the server crashes/reboots etc, the cooldowns will be based on when the server crashed(If someone used a skill that has a 2 second C/D when its 20:00:00 server time, the CD is up at 20:00:02 but if the game crashes during the CD the server time will be 00:00:00 and the CD will still be 20:00:02). I can reset the C/Ds upon login, but they players can relog to reset cooldowns. Inconsequential for the small C/Ds, but 1min+ C/Ds can be really abused by this. I realize I could use world time for long cooldowns and server time/reset on login for small cooldowns, but the 50 s difference between worldtime changes is still too much for 1min - 5min c/ds. Is there any other way of making cooldowns much more efficient?