basics working

This commit is contained in:
mrbesen 2022-04-21 19:33:46 +02:00
parent 6d655b4984
commit d14493e5cc
Signed by untrusted user: MrBesen
GPG Key ID: 596B2350DCD67504
5 changed files with 67 additions and 20 deletions

View File

@ -41,7 +41,7 @@ private:
void checkForGame();
void checkForBan();
void performClick(uint32_t nr);
void performClick(uint32_t nr, bool movemouseaway = true);
void enterSearch(const std::string& text);
void pickFirst(const std::string& search);
public:

View File

@ -18,7 +18,8 @@ public:
~MainWindow();
private slots:
void aatoggled(int);
void toggleMainswitch(bool);
void aatoggled(bool);
void pptoggled(bool);
void ppedited(const QString&);
void bantoggled(bool);

View File

@ -42,7 +42,8 @@ void LolAutoAccept::checkForGame() {
return;
}
performClick(1); // accept Game
if(autoacceptenabled)
performClick(1); // accept Game
// security sleep
std::this_thread::sleep_for(std::chrono::seconds(3));
@ -55,7 +56,7 @@ void LolAutoAccept::checkForGame() {
if(mat.doesMatch) {
Log::info << "Pre pick state";
if(!prepick.empty())
if(prepickenabled && !prepick.empty())
pickFirst(prepick);
state = State::PREPICK;
@ -74,19 +75,20 @@ void LolAutoAccept::checkForBan() {
if(mat.doesMatch) {
Log::info << "Ban state";
if(!ban.empty())
if(banenabled && !ban.empty()) {
pickFirst(ban);
std::this_thread::sleep_for(std::chrono::milliseconds(800));
std::this_thread::sleep_for(std::chrono::milliseconds(800));
// click "ban"
performClick(4);
// click "ban"
performClick(4);
}
state = State::BAN;
}
}
void LolAutoAccept::performClick(uint32_t nr) {
void LolAutoAccept::performClick(uint32_t nr, bool movemouseaway) {
inputs.setOffset(screen->getXOffset(), screen->getYOffset());
inputs.setScale(screen->getXScale(), screen->getYScale());
@ -99,13 +101,15 @@ void LolAutoAccept::performClick(uint32_t nr) {
sim.mouseClick(XIS::LEFT_MOUSE_BUTTON);
// move mouse away
std::this_thread::sleep_for(std::chrono::milliseconds(170));
p = inputs.get(0);
sim.mouseMoveTo(p.x, p.y);
if(movemouseaway) {
std::this_thread::sleep_for(std::chrono::milliseconds(170));
p = inputs.get(0);
sim.mouseMoveTo(p.x, p.y);
}
}
void LolAutoAccept::enterSearch(const std::string& text) {
performClick(2); // click searchbox
performClick(2, false); // click searchbox
Log::debug << "enter text: " << text;
@ -125,7 +129,7 @@ LolAutoAccept::LolAutoAccept() : acceptmatcher("imgs/Accept.png"), arrowmatcher(
inputs.addPoint({645, 560}); // accept game
inputs.addPoint({775, 105}); // search box
inputs.addPoint({380, 160}); // first champ
inputs.addPoint({638, 608}); // pick champ
inputs.addPoint({638, 608}); // pick/ban champ
acceptmatcher.setOffset(539, 529);
arrowmatcher.setOffset(615, 617);

View File

@ -14,10 +14,28 @@ MainWindow::~MainWindow() {
delete ui;
}
void MainWindow::aatoggled(int state) {
void MainWindow::toggleMainswitch(bool state) {
Log::info << "mainswitch toggled: " << state;
if(state) {
if(!lolaa.init()) {
Log::error << "League Client not found!";
ui->statusbar->showMessage(tr("League of Legends Client not found!"));
ui->mainswitch->setCheckState(Qt::CheckState::Unchecked);
return;
}
lolaa.run();
ui->statusbar->showMessage(tr("Auto-Acceptor started!"));
} else {
lolaa.stop();
ui->statusbar->showMessage(tr("Auto-Acceptor stoped!"));
}
}
void MainWindow::aatoggled(bool state) {
Log::info << "enableAll checkbox toggled " << state;
lolaa.setAutoAcceptEnabled(state == Qt::CheckState::Checked);
lolaa.setAutoAcceptEnabled(state);
}
void MainWindow::pptoggled(bool state) {

View File

@ -24,6 +24,13 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="mainswitch">
<property name="text">
<string>Mainswitch</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableAll">
<property name="text">
@ -133,13 +140,13 @@
<connections>
<connection>
<sender>enableAll</sender>
<signal>stateChanged(int)</signal>
<signal>clicked(bool)</signal>
<receiver>MainWindow</receiver>
<slot>aatoggled(int)</slot>
<slot>aatoggled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>16</x>
<y>75</y>
<y>106</y>
</hint>
<hint type="destinationlabel">
<x>393</x>
@ -243,14 +250,31 @@
</hint>
</hints>
</connection>
<connection>
<sender>mainswitch</sender>
<signal>clicked(bool)</signal>
<receiver>MainWindow</receiver>
<slot>toggleMainswitch(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>85</x>
<y>83</y>
</hint>
<hint type="destinationlabel">
<x>1</x>
<y>61</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>aatoggled(int)</slot>
<slot>aatoggled(bool)</slot>
<slot>pptoggled(bool)</slot>
<slot>ppedited(QString)</slot>
<slot>bantoggled(bool)</slot>
<slot>picktoggled(bool)</slot>
<slot>banedited(QString)</slot>
<slot>pickedited(QString)</slot>
<slot>toggleMainswitch(bool)</slot>
</slots>
</ui>