This commit is contained in:
mrbesen 2022-04-24 21:04:36 +02:00
parent 494f2b23a1
commit 85e6f5d5be
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
5 changed files with 34 additions and 9 deletions

View File

@ -17,7 +17,16 @@ protected:
std::string champ; // not every stage has a champ
bool enabled = false;
virtual void action(LolAutoAccept& lolaa) = 0;
bool process(LolAutoAccept& lolaa, cv::Mat& img);
virtual bool process(LolAutoAccept& lolaa, cv::Mat& img);
};
struct CooldownStage : public Stage {
CooldownStage(const std::string& matchertmpl);
time_t lastused = 0;
uint32_t cooldown = 30; // how long until this stage can be used again (seconds)
virtual bool process(LolAutoAccept& lolaa, cv::Mat& img) override;
};
struct AcceptStage : public Stage {
@ -25,17 +34,17 @@ protected:
virtual void action(LolAutoAccept& lolaa) override;
};
struct PrePickStage : public Stage {
struct PrePickStage : public CooldownStage {
PrePickStage();
virtual void action(LolAutoAccept& lolaa) override;
};
struct BanStage : public Stage {
struct BanStage : public CooldownStage {
BanStage();
virtual void action(LolAutoAccept& lolaa) override;
};
struct PickStage : public Stage {
struct PickStage : public CooldownStage {
PickStage();
virtual void action(LolAutoAccept& lolaa) override;
};

View File

@ -35,6 +35,19 @@ bool LolAutoAccept::Stage::process(LolAutoAccept& lolaa, cv::Mat& img) {
return false;
}
LolAutoAccept::CooldownStage::CooldownStage(const std::string& matchertmpl) : Stage(matchertmpl) {}
bool LolAutoAccept::CooldownStage::process(LolAutoAccept& lolaa, cv::Mat& img) {
if((time(0) - lastused) > cooldown) {
if(Stage::process(lolaa, img)) {
lastused = time(0);
return true;
}
}
return false;
}
void LolAutoAccept::performClick(uint32_t nr, bool movemouseaway) {
inputs.setOffset(screen->getXOffset(), screen->getYOffset());
inputs.setScale(screen->getXScale(), screen->getYScale());

View File

@ -1,14 +1,15 @@
#include "lolautoaccept.h"
LolAutoAccept::BanStage::BanStage() : Stage("imgs/ban.png") {
LolAutoAccept::BanStage::BanStage() : CooldownStage("imgs/ban.png") {
matcher.setOffset(1232, 90);
cooldown = 30;
}
void LolAutoAccept::BanStage::action(LolAutoAccept& lolaa) {
if(!champ.empty()) {
lolaa.pickFirst(champ);
std::this_thread::sleep_for(std::chrono::milliseconds(800));
std::this_thread::sleep_for(std::chrono::milliseconds(1800));
// click "ban"
lolaa.performClick(4);

View File

@ -1,14 +1,15 @@
#include "lolautoaccept.h"
LolAutoAccept::PickStage::PickStage() : Stage("imgs/pick.png") {
LolAutoAccept::PickStage::PickStage() : CooldownStage("imgs/pick.png") {
matcher.setOffset(538, 587);
cooldown = 30;
}
void LolAutoAccept::PickStage::action(LolAutoAccept& lolaa) {
if(!champ.empty()) {
lolaa.pickFirst(champ);
std::this_thread::sleep_for(std::chrono::milliseconds(800));
std::this_thread::sleep_for(std::chrono::milliseconds(1800));
// click "accept"
lolaa.performClick(4);

View File

@ -1,7 +1,8 @@
#include "lolautoaccept.h"
LolAutoAccept::PrePickStage::PrePickStage() : Stage("imgs/arrowdown.png") {
LolAutoAccept::PrePickStage::PrePickStage() : CooldownStage("imgs/arrowdown.png") {
matcher.setOffset(615, 617);
cooldown = 15;
}
void LolAutoAccept::PrePickStage::action(LolAutoAccept& lolaa) {