-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.cpp
More file actions
87 lines (73 loc) · 1.51 KB
/
utils.cpp
File metadata and controls
87 lines (73 loc) · 1.51 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
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
79
80
81
82
83
84
#include "pch.h"
#include <memory>
#include <chrono>
#include <filesystem>
#include <regex>
#include "utils.h"
#include "ent.h"
#include "actions.h"
#define _CRT_SECURE_NO_WARNINGS
//int oldConsoleSize = 0;
//int idCheck = 0;
//std::string idStringCheck;
//std::string prevConsoleInput;
//
//HWND afkHD;
//HWND g_HWND;
//
//std::string consoleMsg;
//bool oldAfkWindow;
//bool oldActiveWindow;
void GameTimer::Start()
{
if (!toggleTimer)
{
start = std::chrono::high_resolution_clock::now();
std::chrono::duration<float> dur;
dur = start - end;
elapsedTime = dur.count() * 1000.0f;
if (elapsedTime > period)
{
end = std::chrono::high_resolution_clock::now();
}
}
}
void GameTimer::Reset()
{
toggleTimer = true;
end = std::chrono::high_resolution_clock::now();
}
void ExecuteCommand::ExecCmd(std::string say, float coolDownPeriod)
{
coolDown.Start();
coolDown.period = coolDownPeriod;
if (!isExecingOnceAuto && mbiiHandle)
{
prevMessage = say;
std::ofstream ifile;
ifile.open(execPath);
ifile << say;
ifile.close();
std::cin.get();
isExecingOnceAuto = true;
SendMessage(mbiiHandle, WM_KEYDOWN, VK_LEFT, 0);
}
if (coolDown.elapsedTime > coolDown.period - 10)
{
isExecingOnceAuto = false;
}
//isExecingOnce = true;
}
void ExecuteCommand::ExecOneTime(std::string say)
{
if (!isExecingOnce && mbiiHandle)
{
isExecingOnce = true;
std::ofstream ifile;
ifile.open(execPath);
ifile << say;
ifile.close();
std::cin.get();
SendMessage(mbiiHandle, WM_KEYDOWN, VK_LEFT, 0);
}
}