Skip to content

Commit

Permalink
Merge pull request #31 from tiemonl/feature/GH-29_unix_support
Browse files Browse the repository at this point in the history
Unix support
  • Loading branch information
Liam authored Sep 2, 2019
2 parents 41433b6 + ebfee39 commit dc48a12
Show file tree
Hide file tree
Showing 44 changed files with 463 additions and 34 deletions.
105 changes: 104 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,107 @@ ASALocalRun/
.mfractor/

# Local History for Visual Studio
.localhistory/
.localhistory/



# -------------------------------------------------------

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific
.idea/*
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser



# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.DS_STORE
**/META-INF/*
40 changes: 7 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ 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)
* [Windows](#windows)
* [Upcoming feature(s)](#upcoming-features)
* [Feature request or bug report](#feature-request-or-bug-report)
* [Donation](#Donation)
Expand All @@ -28,34 +25,15 @@ This program allows you to automatically fish for a set amount of bait. Just pic
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:
### Windows
The windows program features a GUI and more setup available. It is compatible with both Steam and Kongregate. For more information please view the [README in the csharp section.](csharp/README.md)

![Fisher GUI](https://i.imgur.com/cajbZ65.png)
### Mac/Linux
This version relies on Java. Please make sure you have java downloaded on your machine. It is a CLI only tool currently. Download [bh-fisher.jar]((https://github.com/tiemonl/Bit-Heroes-Fishing-Bot/releases) from the releases tab.

### 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)
To use it please make sure you are on the fishing start screen where your rod and bait are displayed. Then open up a terminal and `cd` to the directory in which bh-fisher.jar resides. To run the program use the command `java -jar bh-fisher.jar <bait>` where <bait> is replaced by the amount of bait you would like to use up.

### 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.
This version is still in beta. If you come across any issues, please submit an [issue](https://github.com/tiemonl/Bit-Heroes-Fishing-Bot/issues) and be as detailed as possible. I will add another README in the java directory with more details on how to run the program.


## Upcoming feature(s)
Expand All @@ -70,7 +48,3 @@ If this program as helped you save time fishing, please consider donating:
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=
-->
76 changes: 76 additions & 0 deletions csharp/README.md
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.
12 changes: 12 additions & 0 deletions java/bh-fisher/bh-fisher.iml
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>

117 changes: 117 additions & 0 deletions java/bh-fisher/src/dev/garlicbread/Helper.java
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);
}
}
Loading

0 comments on commit dc48a12

Please sign in to comment.