Skip to content

Commit

Permalink
upgrade version to 1.2.5 and fix bug AreYouStillThere
Browse files Browse the repository at this point in the history
  • Loading branch information
9-9-9-9 committed Aug 29, 2021
1 parent 95015d3 commit eb1cb4d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

have inspiration from https://github.com/tiemonl/Bit-Heroes-Fishing-Bot

**If you like my bot, please give this repo a Star, thanks**
___
[Wiki version](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki)

Expand Down
2 changes: 2 additions & 0 deletions README.release.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ___
## Bit Heroes bot
##### on Linux / Windows / ~~MacOS~~

**If you like my bot, please give this repo a Star, thanks**

[Wiki version](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki)

This readme file is for normal users
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>bh.bot</groupId>
<artifactId>BitHeroes</artifactId>
<version>1.2.4</version>
<version>1.2.5</version>

<dependencies>
</dependencies>
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/bh/bot/app/AfkApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ private void doLoop(
final short loopSleep = 5_000;
final short originalCheckAreYouStillThereAfter = 20_000 / loopSleep;
short checkAreYouStillThereAfter = originalCheckAreYouStillThereAfter;
final short originalSleepWhileWaitingResourceRegen = 5 * 60_000 / loopSleep;
short sleepWhileWaitingResourceRegen = 0;

ML:
while (!masterSwitch.get()) {
Expand All @@ -136,16 +138,21 @@ private void doLoop(
InteractionUtil.Keyboard.sendEnter();
sleep(1_000);
InteractionUtil.Keyboard.sendEscape();
checkAreYouStillThereAfter = originalCheckAreYouStillThereAfter;
} else {
checkAreYouStillThereAfter = 2;
} else {
checkAreYouStillThereAfter = originalCheckAreYouStillThereAfter;
}
continue ML;
}

if (sleepWhileWaitingResourceRegen > 0) {
sleepWhileWaitingResourceRegen--;
continue ML;
}

if (taskList.stream().allMatch(x -> !isNotBlocked(x._2))) {
info("Waiting for resource generation, sleeping %d minutes", minutesSleepWaitingResourceGeneration);
sleep(minutesSleepWaitingResourceGeneration * 60_000);
sleepWhileWaitingResourceRegen = originalSleepWhileWaitingResourceRegen;
continue ML;
}

Expand Down

0 comments on commit eb1cb4d

Please sign in to comment.