Skip to content

Commit

Permalink
simple README + show time each loop of some functions
Browse files Browse the repository at this point in the history
  • Loading branch information
9-9-9-9 committed Dec 26, 2021
1 parent 409de8e commit 0ca1f1f
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 300 deletions.
58 changes: 13 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,31 @@
## Bit Heroes bot
##### on Linux / Windows / ~~MacOS~~
[![Github Open Issues](https://img.shields.io/github/issues/9-9-9-9/Bit-Heroes-bot.svg)](https://github.com/9-9-9-9/Bit-Heroes-bot/issues)
[![Github All Releases](https://img.shields.io/github/downloads/9-9-9-9/Bit-Heroes-bot/total.svg)](https://github.com/9-9-9-9/Bit-Heroes-bot/releases)

Hi, I'm the bot, please give this repository a Star, thanks

This project has inspiration from https://github.com/tiemonl/Bit-Heroes-Fishing-Bot

> We play the game, don't let the game play us
> You spend your time for your family and me helps you persuade the Familiars
> Eat duck, eat all the bones. With me, you wont waste any minute of your Bitgor also your sleeping time
**Upgrade notes:** copy configuration files `user-config.properties` and `readonly.*.user-config.properties` from previous bot version's directory
___
[Wiki version](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki)

**This readme file is for developers**

Normal users please [read at this page](https://github.com/9-9-9-9/Bit-Heroes-bot/blob/master/README.release.md)
Bit Heroes bot
##### on Linux / Windows

[_There're some notes for MacOS users, please read here_](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Notes-for-MacOS-users)
> We play the game, don't let the game play us
___
Officially support [Bit Heroes on Steam](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Does-this-bot-supports-Steam-version-of-Bit-Heroes%3F) and [Bit Heroes on web](https://www.kongregate.com/games/Juppiomenz/bit-heroes) + [mini-client](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22client%22-(mini-client-on-Chrome))

**Only support English user interface**

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

[Note for MacOS users](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Notes-for-MacOS-users)

### Contains the following functions:
1. [Auto fishing](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22fishing%22)
2. [**ReRun** Dungeons and Raid](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22rerun%22)
3. [Do stuffs while AFK](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22afk%22)
4. Farm [World Boss](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22world-boss%22) / [Raid](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22raid%22) / [PVP](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22pvp%22) / [Invasion](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22invasion%22) / [GVG](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22GVG%22) / [Expedition](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22expedition%22) / [Trials](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22trials%22) / [Gauntlet](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22gauntlet%22)
5. [Launch game in mini client using Google Chrome](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22client%22-(mini-client-on-Chrome))

And some extra functions support developers on developing this bot
5. Farm [World Boss in Team mode](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22world-boss%22-(team))
6. [Launch game in mini client using Google Chrome](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Function-%22client%22-(mini-client-on-Chrome))

[Also supports pushing messages to Telegram for notification purpose](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Configure-Telegram-in-able-to-receive-notification)

### Minimum requirement:
- [JDK 8 (not tested on version 9 and above but probably it works)](https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html)
- [Apache Maven](https://maven.apache.org/install.html)
- [Google Chrome (if you wish to use the mini client)](https://www.google.com/chrome)

### Installation:
1. `git clone https://github.com/9-9-9-9/Bit-Heroes-bot` or download ZIP file then extract
2. Depends on OS:
- Windows: click and run the file `build.bat`
- Linux/MacOS: run command `./build.sh` in terminal
- [Java 8 (not tested on version 9+ but probably it works)](https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html)
- [Google Chrome installed (if you wish to use the mini client)](https://www.google.com/chrome)

#### Easy to use:
1. Configure follow [instruction on Wiki (click me)](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Basic-setup)
Expand All @@ -66,15 +45,4 @@ Tips 2: see help
- [Configure Raid/World Boss/Expedition](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Select-Raid-World-Boss-level,-mode,..-using-%60setting%60-function):
- Windows: run file `setting.bat`
- Linux/MacOS: run script `./setting.sh`
- [push notification via Telegram](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Configure-Telegram-in-able-to-receive-notification)

#### Tested environments:
Please find out on each function on [wiki](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki)

### MacOS users
1. From MacOS 10.13+, java.awt.Robot class of Java can not do mouse and keyboard interaction, thus none of bot functions will work
2. With a bit of luck, you can try to add Java to [System Preferences > Security & Privacy > Accessibility] and see if it works (because MacOS prevent apps from controlling your mac by default).
If it doesn't work, install a higher version of Java, add Accessibility and try again. If it still doesn't work, just give up
3. Thus this whole project only has the mini-client function will work on MacOS

So this project does not officially supported MacOS, any developer can resolve the above issue, please make a pull request
- [push notification via Telegram](https://github.com/9-9-9-9/Bit-Heroes-bot/wiki/Configure-Telegram-in-able-to-receive-notification)
72 changes: 0 additions & 72 deletions README.release.md

This file was deleted.

6 changes: 0 additions & 6 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ cp ./client.bat ./release/
cp ./help.bat ./release/
cp ./setting.bat ./release/


# Include README.md
echo '[![Github Release](https://img.shields.io/github/downloads/9-9-9-9/Bit-Heroes-bot/release-'$VERSION'/total?style=social)](https://github.com/9-9-9-9/Bit-Heroes-bot/releases/tag/release-'$VERSION')' > ./release/README.md
echo >> ./release/README.md
cat ./README.release.md >> ./release/README.md

# Remove secret
rm -f ./release/bh-client/*.html
rm -f ./release/readonly.*.properties
Expand Down
1 change: 0 additions & 1 deletion src/main/java/bh/bot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public static void main(String[] args) {
//
ScreenCaptureApp.class, //
TestApp.class, //
DualWorldBoss.class, //
GenerateMetaApp.class //
);

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/bh/bot/app/ReRunApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ private void doLoopClickImage(int loopCount, AtomicBoolean masterSwitch) {
sleep(mainLoopInterval);
if (clickImage(BwMatrixMeta.Metas.Dungeons.Buttons.rerun)) {
loopCount--;
lastFound = System.currentTimeMillis();
info("%d loop left", loopCount);
long now = System.currentTimeMillis();
info("%d loop left (last round: %ds)", loopCount, (now - lastFound) / 1000);
lastFound = now;
clickedOnPreviousRound = true;
} else {
if (System.currentTimeMillis() - lastFound > longTimeNoSee) {
Expand Down
173 changes: 0 additions & 173 deletions src/main/java/bh/bot/app/dev/DualWorldBoss.java

This file was deleted.

6 changes: 5 additions & 1 deletion src/main/java/bh/bot/app/farming/AbstractDoFarmingApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ protected void loop(int loopCount, AtomicBoolean masterSwitch) {

Main.warningEnergyRefill();

long lastLoop = System.currentTimeMillis();

ML:
while (!masterSwitch.get() && loopCount > 0) {
sleep(mainLoopInterval);
Expand All @@ -138,7 +140,9 @@ protected void loop(int loopCount, AtomicBoolean masterSwitch) {
continuousNotFound = 0;
if (predefinedImageAction.reduceLoopCountOnFound) {
loopCount--;
info("%d loop left", loopCount);
long now = System.currentTimeMillis();
info("%d loop left (last round: %ds)", loopCount, (now - lastLoop) / 1000);
lastLoop = now;
}
if (predefinedImageAction.isOutOfTurns) {
InteractionUtil.Keyboard.sendEscape();
Expand Down

0 comments on commit 0ca1f1f

Please sign in to comment.