From 7e1c4e11065b6b67f520efb9d5f37f01dd407da7 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Mon, 6 Nov 2017 14:40:43 -0500 Subject: [PATCH] sisyphus: modify min/max times a little more --- config/config.go | 2 ++ plugins/sisyphus/sisyphus.go | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 360e3be..d00cb5c 100644 --- a/config/config.go +++ b/config/config.go @@ -105,7 +105,9 @@ type Config struct { } Sisyphus struct { MinDecrement int + MaxDecrement int MinPush int + MaxPush int } } diff --git a/plugins/sisyphus/sisyphus.go b/plugins/sisyphus/sisyphus.go index 2ba8343..926dfc1 100644 --- a/plugins/sisyphus/sisyphus.go +++ b/plugins/sisyphus/sisyphus.go @@ -60,7 +60,8 @@ func (g *game) scheduleDecrement() { g.timers[0].Stop() } minDec := g.bot.Config().Sisyphus.MinDecrement - g.nextDec = time.Now().Add(time.Duration((60 + rand.Intn(60*minDec))) * time.Minute) + maxDec := g.bot.Config().Sisyphus.MinDecrement + g.nextDec = time.Now().Add(time.Duration((minDec + rand.Intn(maxDec))) * time.Minute) go func() { t := time.NewTimer(g.nextDec.Sub(time.Now())) g.timers[0] = t @@ -76,7 +77,8 @@ func (g *game) schedulePush() { g.timers[1].Stop() } minPush := g.bot.Config().Sisyphus.MinPush - g.nextPush = time.Now().Add(time.Duration(rand.Intn(60)+minPush) * time.Minute) + maxPush := g.bot.Config().Sisyphus.MaxPush + g.nextPush = time.Now().Add(time.Duration(rand.Intn(maxPush)+minPush) * time.Minute) go func() { t := time.NewTimer(g.nextPush.Sub(time.Now())) g.timers[1] = t