lolautoaccept/include/lolautoaccept.h

66 lines
1.2 KiB
C++

#pragma once
#include "scaleableinputs.h"
#include "screen.h"
#include "matcher.h"
#include <xinputsimulator.h>
#include <thread>
class LolAutoAccept {
private:
ScreenShot* screen = nullptr;
Matcher acceptmatcher;
Matcher arrowmatcher;
Matcher banmatcher;
Matcher::Match lastacceptmatch;
XInputSimulator& sim;
ScaleableInputs inputs;
std::string prepick;
std::string ban;
std::string pick;
bool autoacceptenabled = false;
bool prepickenabled = false;
bool banenabled = false;
bool pickenabled = false;
bool shouldrun = false;
std::thread lolaathread;
enum class State {
LOBBY,
PREPICK,
BAN,
PICK,
GAME
};
State state = State::LOBBY;
void checkForGame();
void checkForBan();
void performClick(uint32_t nr);
void enterSearch(const std::string& text);
void pickFirst(const std::string& search);
public:
LolAutoAccept();
~LolAutoAccept();
void setPrePick(const std::string& prePick);
void setBan(const std::string& ban);
void setPick(const std::string& pick);
void setAutoAcceptEnabled(bool b);
void setPrePickEnabled(bool b);
void setBanEnabled(bool b);
void setPickEnabled(bool b);
bool init(); // returns true on success
void run();
void stop();
private:
void stopJoinThread();
void innerRun();
};