Fix rainactive minfrac formula

This commit is contained in:
moneromooo 2015-01-01 15:18:42 +00:00
parent 1071aacefb
commit 4c76c9f616

View file

@ -163,6 +163,7 @@ def RainActive(nick,chan,cmd):
hours=float(hours) hours=float(hours)
if hours <= 0: if hours <= 0:
raise RuntimeError("") raise RuntimeError("")
seconds = hours * 3600
except Exception,e: except Exception,e:
SendTo(chan, "Invalid hours") SendTo(chan, "Invalid hours")
return return
@ -200,8 +201,8 @@ def RainActive(nick,chan,cmd):
if t == None: if t == None:
continue continue
dt = now - t dt = now - t
if dt <= hours * 3600: if dt <= seconds:
w = (1 * (hours * 3600 - dt) + minfrac * (1 - (hours * 3600 - dt))) / (hours * 3600) w = (1 * (seconds - dt) + minfrac * dt) / (seconds)
weights[n] = w weights[n] = w
weight += w weight += w