-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathPickBoxesAction.cs
More file actions
41 lines (35 loc) · 1.25 KB
/
PickBoxesAction.cs
File metadata and controls
41 lines (35 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Text;
using DevChatter.Bot.Core.Games.DealNoDeal;
using DevChatter.Bot.Core.Systems.Chat;
using DevChatter.Bot.Core.Util;
namespace DevChatter.Bot.Core.Automation
{
public class PickBoxesAction : IIntervalAction
{
private readonly IClock _clock;
private DateTime _nextRunTime;
private IChatClient _chatClient;
private DealNoDealGame _dealNoDealGame;
public PickBoxesAction(DealNoDealGame dealNoDealGame, IChatClient chatClient)
{
_dealNoDealGame = dealNoDealGame;
_chatClient = chatClient;
_clock = new SystemClock();
_dealNoDealGame.PrintBoxesRemaining();
SetNextRunTime();
}
public string Name { get; } = nameof(PickBoxesAction);
public bool IsTimeToRun() => _clock.Now >= _nextRunTime;
public void Invoke()
{
_chatClient.SendMessage("Picking a random Box. User did not respond");
_dealNoDealGame.PickRandomBox(_dealNoDealGame.MainPlayer.DisplayName);
}
private void SetNextRunTime()
{
_nextRunTime = _clock.Now.AddSeconds(DealNoDealGame.SECONDS_TO_CHOOSE_BOXES);
}
}
}