-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from tiemonl/feature/GH-29_unix_support
Unix support
- Loading branch information
Showing
44 changed files
with
463 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Bit Heroes Fishing Bot | ||
|
||
[![GitHub issues](https://img.shields.io/github/issues/tiemonl/Bit-Heroes-Fishing-Bot.svg)](https://github.com/tiemonl/Bit-Heroes-Fishing-Bot/issues) | ||
[![Github All Releases](https://img.shields.io/github/downloads/tiemonl/Bit-Heroes-Fishing-Bot/total.svg)](https://github.com/tiemonl/Bit-Heroes-Fishing-Bot/releases) | ||
[![Donate Paypal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9F2F5CFVSHK8G) | ||
[![Donate Ethereum]( | ||
https://brianmacdonald.github.io/Ethonate/svg/eth-donate-blue.svg)]( | ||
https://brianmacdonald.github.io/Ethonate/address#0xaD3c539d7bb5e3ce993ca87DEA851B308326511a) | ||
|
||
|
||
Table of Contents | ||
================= | ||
* [Introduction](#introduction) | ||
* [How to use](#how-to-use) | ||
* [First Steps](#first-steps) | ||
* [Getting started with the program](#getting-started-with-the-program) | ||
* [Setting up the program](#setting-up-the-program) | ||
* [Fishing](#fishing) | ||
* [Upcoming feature(s)](#upcoming-features) | ||
* [Feature request or bug report](#feature-request-or-bug-report) | ||
* [Donation](#Donation) | ||
|
||
|
||
## Introduction | ||
|
||
This program allows you to automatically fish for a set amount of bait. Just pick the amount of bait you want to use and press start and let the bot fish for you. This program is not 100%, however, it will always be better than a human. I do not guarantee a 100% catch rate, but I do guarantee a very high catch rate for very little effort. | ||
|
||
Pull requests are ***welcomed*** and ***encouraged***! | ||
|
||
## How to use | ||
### First steps | ||
- To make sure this program runs correctly, a few setting settings need to be checked. | ||
- Windows zoom settings need to be set to 100% and you need to be at default resolution as such in Display Settings for Windows 10: | ||
![Windows zoom settings](https://i.imgur.com/VuAGRrh.png) | ||
- If you are using **Steam**: Please make sure the game is set to 800x600 as such: | ||
![Steam zoom setting](https://i.imgur.com/MggpKaq.png) | ||
- If you are using **Kongregate**: Please make sure the browser you are using is on 100% page zoom. For example, chrome: | ||
![Browser zoom setting](https://i.imgur.com/AyrINZf.png) | ||
### Getting started with the program | ||
- Download the .exe from the [releases](https://github.com/tiemonl/Bit-Heroes-Fishing-Bot/releases) tab in GitHub. | ||
- Run the file | ||
- you will see this screen: | ||
|
||
![Fisher GUI](https://i.imgur.com/cajbZ65.png) | ||
|
||
### Setting up the program | ||
- Select Kongregate or Steam depending on which platform you are fishing in | ||
- If you are using steam, make sure to set the window size to 800x600 | ||
- Then select the rod you are using to fish | ||
- Enter the amount of bait you want to go through | ||
- Calibrate the program to know where to fish by pressing the **Find Start Location** button on this screen: | ||
![Calibration screen](https://i.imgur.com/8mJ0T4o.png) | ||
|
||
### Fishing | ||
- Once you've calibrated the program, you should have a coordinate to the right of the button resembling this: {X=100, Y=300} | ||
- If you have multiple monitors, make sure Bit Heroes is in the primary monitor. If Bit Heroes is in the second monitor, the program will not work and your coordinates will be {X=0, Y=0}. This indicates it did not calibrate correctly. | ||
- Press Auto mode and let the program fish for you. | ||
- If you need to cancel Auto Mode for whatever reason, press cancel and the program will finish catching the current fish, before stopping. | ||
|
||
|
||
## Upcoming feature(s) | ||
- Stop fishing after you catch a certain weight of fish to save bait for another event. i.e. Stop fishing if you catch a fish above 12 kg. (currently not working on this project, I may go back to finishing this in the summer when I have more time) | ||
|
||
## Feature request or bug report | ||
To request a feature or report a bug, open up an [issue](https://github.com/tiemonl/Bit-Heroes-Fishing-Bot/issues) in GitHub. | ||
|
||
## Donation | ||
If this program as helped you save time fishing, please consider donating: | ||
[![Donate Ethereum]( | ||
https://brianmacdonald.github.io/Ethonate/svg/eth-donate-blue.svg)]( | ||
https://brianmacdonald.github.io/Ethonate/address#0xaD3c539d7bb5e3ce993ca87DEA851B308326511a) | ||
[![Donate Paypal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9F2F5CFVSHK8G) | ||
|
||
<!--stackedit_data: | ||
eyJoaXN0b3J5IjpbLTIxNTU4NDM0NywxNTIwMTAxMzgzXX0= | ||
--> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package dev.garlicbread; | ||
|
||
import java.awt.*; | ||
import java.awt.event.InputEvent; | ||
import java.awt.event.KeyEvent; | ||
|
||
public class Helper { | ||
Robot robot; | ||
private Color fullRangeCastColor; | ||
private Color startButtonGreen; | ||
|
||
public Helper(Robot r) throws AWTException { | ||
robot = r; | ||
setUpColors(); | ||
} | ||
|
||
private void setUpColors() { | ||
String OS = System.getProperty("os.name").toLowerCase(); | ||
if (OS.indexOf("win") >= 0) { | ||
fullRangeCastColor = new Color(26, 118, 241); | ||
startButtonGreen = new Color(155, 208, 30); | ||
} else { | ||
fullRangeCastColor = new Color(23, 92, 237); | ||
startButtonGreen = new Color(139, 202, 24); | ||
} | ||
} | ||
|
||
public Color GetPixelColor(Point p) { | ||
return robot.getPixelColor(p.x, p.y); | ||
} | ||
|
||
public boolean AreColorsSimilar(Color c1, Color c2, int tolerance) { | ||
return Math.abs(c1.getRed() - c2.getRed()) < tolerance && | ||
Math.abs(c1.getGreen() - c2.getGreen()) < tolerance && | ||
Math.abs(c1.getBlue() - c2.getBlue()) < tolerance; | ||
} | ||
|
||
public void moveCursor(Point p) { | ||
robot.mouseMove(p.x, p.y); | ||
} | ||
|
||
public void mouseClick() { | ||
int mask = InputEvent.BUTTON1_DOWN_MASK; | ||
robot.mousePress(mask); | ||
robot.mouseRelease(mask); | ||
} | ||
|
||
public void sendKey(int key) { | ||
robot.keyPress(key); | ||
robot.keyRelease(key); | ||
} | ||
|
||
public void startCast(Point p) throws InterruptedException { | ||
checkIfUserIsOnStartScreen(p); | ||
Point rangeAreaPosition = new Point(p.x, p.y - 75); | ||
Thread.sleep(100); | ||
castRod(rangeAreaPosition, fullRangeCastColor); | ||
} | ||
|
||
public boolean checkIfUserIsOnStartScreen(Point p) { | ||
if (GetPixelColor(p).equals(startButtonGreen)) { | ||
moveCursor(p); | ||
mouseClick(); | ||
return true; | ||
} else { | ||
moveCursor(p); | ||
} | ||
return false; | ||
} | ||
|
||
public void castRod(Point p, Color c) { | ||
sendSpaceBarEvent(p, c); | ||
} | ||
|
||
public void catchFish(Point p, Color c) { | ||
moveCursor(p); | ||
sendSpaceBarEvent(p, c); | ||
return; | ||
} | ||
|
||
private void sendSpaceBarEvent(Point p, Color c) { | ||
while (true) { | ||
Color locColor = GetPixelColor(p); | ||
if (c.getRed() == locColor.getRed() && c.getGreen() == locColor.getGreen() && c.getBlue() == locColor.getBlue()) { | ||
sendKey(KeyEvent.VK_SPACE); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
public void tradeItemThenCloseClick(Point locTrade, Point locClose) throws InterruptedException { | ||
moveCursor(locTrade); | ||
mouseClick(); | ||
Thread.sleep(500); | ||
moveCursor(locClose); | ||
mouseClick(); | ||
Thread.sleep(500); | ||
} | ||
|
||
public void tradeItemThenCloseSpace() throws InterruptedException { | ||
sendKey(KeyEvent.VK_SPACE); | ||
Thread.sleep(500); | ||
sendKey(KeyEvent.VK_SPACE); | ||
Thread.sleep(500); | ||
} | ||
|
||
public void fishGotAwaySpace() throws InterruptedException { | ||
sendKey(KeyEvent.VK_SPACE); | ||
Thread.sleep(1000); | ||
} | ||
|
||
public void fishGotAwayClick(Point p) throws InterruptedException { | ||
moveCursor(p); | ||
mouseClick(); | ||
Thread.sleep(1000); | ||
} | ||
} |
Oops, something went wrong.