Browse Source

Finally fixed false-positives; removed auto-recast on delay; adjusted sliders

master v0.1.6
Gitea 2 years ago
parent
commit
a98edc280e
  1. 4
      .gitignore
  2. 10
      README.md
  3. 31
      src/xyz/unbewohnte/albionFisher/fisher.java
  4. 2
      src/xyz/unbewohnte/albionFisher/gui.java
  5. 2
      src/xyz/unbewohnte/albionFisher/imgutils.java
  6. 4
      src/xyz/unbewohnte/albionFisher/rgb.java

4
.gitignore vendored

@ -1 +1,3 @@
release/ release/
albionFisher.jar
*.zip

10
README.md

@ -1,7 +1,7 @@
# albionFisher - albion online fisher bot # albionFisher - albion online fishing bot
# Compiling # Compiling
`make jar` if you're on GNU/Linux, else - `javac src/xyz/unbewohnte/albionFisher/*.java`+`jar cvmf MANIFEST.txt albionFisher.jar *.class && rm *.class` `make jar` if you're on GNU/Linux, else - translate the commands in the makefile to compile
# Launch # Launch
`java -jar albionFisher.jar` `java -jar albionFisher.jar`
@ -11,7 +11,7 @@
2. Set your cursor at the exact position where you want to drop the bobber 2. Set your cursor at the exact position where you want to drop the bobber
3. Look at the coordinates on the fisher's window and put them in the xy fields 3. Look at the coordinates on the fisher's window and put them in the xy fields
4. By trial and error specify needed hold time in miliseconds so you could see ingame bobber being in the center of fisher's sight box (by clicking "fish" button) 4. By trial and error specify needed hold time in miliseconds so you could see ingame bobber being in the center of fisher's sight box (by clicking "fish" button)
5. With the same method set difference threshold (in most cases it is somewhere around 3-4 if you fish horizontally, 1-2 if vertically) 5. With the same method set difference threshold (in most cases it is somewhere around 2-3)
6. Start the bot again and leave the computer as is 6. Start the bot again and leave the mouse cursor as is
Moving the mouse automatically (though not very reliably) stops the bot so you can move onto the next spot or entirely stop fishing without manual click on "stop" button Moving the mouse automatically stops the bot so you can move onto the next spot or entirely stop fishing without the manual click on "stop" button

31
src/xyz/unbewohnte/albionFisher/fisher.java

@ -26,9 +26,9 @@ import javax.swing.ImageIcon;
public class fisher { public class fisher {
static String VERSION = "v0.1.5"; static String VERSION = "v0.1.6";
static RGB BOBBER_COLOR = new RGB(255, 180, 31); static rgb BOBBER_COLOR = new rgb(255, 180, 31);
static boolean fishing = false; static boolean fishing = false;
@ -101,7 +101,7 @@ public class fisher {
bot = new Robot(); bot = new Robot();
// GUI // GUI
gui.launchGUI("fisher", VERSION); gui.launchGUI("albionFisher", VERSION);
// update gui in the separate thread // update gui in the separate thread
Thread updateGUIThread = new Thread() { Thread updateGUIThread = new Thread() {
@ -114,14 +114,11 @@ public class fisher {
// fishing logic // fishing logic
boolean windowActivated = false; boolean windowActivated = false;
int idleCountMsMax = 35000; // 35 seconds
int idleCountMs = 0;
while (true) { while (true) {
Thread.sleep(50); Thread.sleep(50);
if (!fishing) { if (!fishing) {
windowActivated = false; windowActivated = false;
idleCountMs = 0;
continue; continue;
} }
@ -169,13 +166,7 @@ public class fisher {
Thread.sleep(3500); Thread.sleep(3500);
// wait for fish as long as the user does not move the mouse // wait for fish as long as the user does not move the mouse
idleCountMs = 0;
while (true) { while (true) {
if (idleCountMs >= idleCountMsMax) {
// something must be wrong
break;
}
if (mousePos_x != xpos && mousePos_y != ypos) { if (mousePos_x != xpos && mousePos_y != ypos) {
fishing = false; fishing = false;
break; // break out of loop with fishing flag set to FALSE break; // break out of loop with fishing flag set to FALSE
@ -205,14 +196,12 @@ public class fisher {
} }
Thread.sleep(50); Thread.sleep(50);
idleCountMs += 50;
} }
// play minigame if still fishing // play minigame if still fishing
lastMean = 0.0f; lastMean = 0.0f;
currentMean = 0.0f; currentMean = 0.0f;
if (!fishing || idleCountMs >= idleCountMsMax) { if (!fishing) {
idleCountMs = 0;
continue; continue;
}; };
@ -255,6 +244,18 @@ public class fisher {
// the game has been finished // the game has been finished
bot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); bot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
Thread.sleep(5000); Thread.sleep(5000);
if (mousePos_x != xpos && mousePos_y != ypos) {
fishing = false;
}
break;
}
if (bobberCoords.x == -1 && bobberCoords.y == -1 && initialBobberPosition.x == -1 && initialBobberPosition.y == -1) {
// false-positive !
// recast
Thread.sleep(5000);
break; break;
} }
} }

2
src/xyz/unbewohnte/albionFisher/gui.java

@ -102,7 +102,7 @@ public class gui {
holdSliderLabel.setBounds(20, 90, 70, 20); holdSliderLabel.setBounds(20, 90, 70, 20);
window.add(holdSliderLabel); window.add(holdSliderLabel);
holdMsSlider = new JSlider(JSlider.HORIZONTAL, 0, 1500, 250); holdMsSlider = new JSlider(JSlider.HORIZONTAL, 0, 1100, 250);
holdMsSlider.setValue(250); holdMsSlider.setValue(250);
holdMsSlider.setMajorTickSpacing(500); holdMsSlider.setMajorTickSpacing(500);
holdMsSlider.setMinorTickSpacing(250); holdMsSlider.setMinorTickSpacing(250);

2
src/xyz/unbewohnte/albionFisher/imgutils.java

@ -33,7 +33,7 @@ public class imgutils {
return sum / (img.getWidth() * img.getHeight()); return sum / (img.getWidth() * img.getHeight());
} }
public static Point getPixelCoordinates(BufferedImage img, RGB color) { public static Point getPixelCoordinates(BufferedImage img, rgb color) {
for (int y = 0; y < img.getHeight(); y++) { for (int y = 0; y < img.getHeight(); y++) {
for (int x = 0; x < img.getWidth(); x++) { for (int x = 0; x < img.getWidth(); x++) {
int imgColor = img.getRGB(x, y); int imgColor = img.getRGB(x, y);

4
src/xyz/unbewohnte/albionFisher/RGB.java → src/xyz/unbewohnte/albionFisher/rgb.java

@ -16,12 +16,12 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
public class RGB { public class rgb {
public int r; public int r;
public int g; public int g;
public int b; public int b;
public RGB(int r, int g, int b) { public rgb(int r, int g, int b) {
this.r = r; this.r = r;
this.g = g; this.g = g;
this.b = b; this.b = b;
Loading…
Cancel
Save