-
Notifications
You must be signed in to change notification settings - Fork 2
/
BotAfk.cs
78 lines (77 loc) · 2.46 KB
/
BotAfk.cs
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Drawing;
using System.Threading;
namespace BlumClickWinForm
{
internal class BotAfk
{
public bool isAutoStart;
public bool clickNewGame;
private System.Timers.Timer _timerNewGame;
private System.Timers.Timer _timerForNewGame;
private double _timeForNewGame = 50;
private BlumClickForm _blumForm;
private Bot _bot;
public BotAfk(Bot bot, BlumClickForm blumForm)
{
_blumForm = blumForm;
_bot = bot;
TimerInitialize();
}
public void StartTimer()
{
_timerNewGame.Start();
_timerForNewGame.Start();
}
public void StopTimer()
{
_timeForNewGame = 0;
ShowTimeInfo();
_timerNewGame.Stop();
_timerForNewGame.Stop();
}
private void TimerInitialize()
{
_timerNewGame = new System.Timers.Timer();
_timerForNewGame = new System.Timers.Timer();
_timerForNewGame.Interval = 1000;
_timerNewGame.Interval = 50000;
_timerNewGame.Elapsed += _timerNewGame_Elapsed;
_timerForNewGame.Elapsed += _timerNewGame_ElapsedTime;
}
private void _timerNewGame_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
_timerNewGame.Stop();
_timerForNewGame.Stop();
if (_bot.GetActive() && isAutoStart)
{
clickNewGame = true;
MouseSimulator.MouseMoveToPoint(GetBlumStartPosition());
}
Thread.Sleep(100);
clickNewGame = false;
_timeForNewGame = 50;
_timerForNewGame.Start();
_timerNewGame.Start();
}
private void _timerNewGame_ElapsedTime(object sender, System.Timers.ElapsedEventArgs e)
{
_timeForNewGame -= 1;
ShowTimeInfo();
}
public void ShowTimeInfo()
{
_blumForm.Invoke((Action)(() =>
{
_blumForm.labelTime.Text = "Time to new Play: " + _timeForNewGame.ToString("0.0");
}));
}
public Point GetBlumStartPosition()
{
Point position = new Point();
position.X = ImageProcess.GetScreenBounds().Width / 2;
position.Y = ((ImageProcess.GetScreenBounds().Height - 695) / 2) + 600;
return position;
}
}
}