Multithreading working, BRobot seems to be failing

This commit is contained in:
davpapp 2018-03-13 11:15:08 -04:00
parent ae260edfc0
commit 488abeb1c9
6 changed files with 13 additions and 11 deletions

View File

@ -13,7 +13,7 @@ public class DropperThread implements Runnable {
@Override
public void run() {
try {
inventory.update();
//inventory.update();
cursor.moveAndRightlickAtCoordinatesWithRandomness(inventory.getClickCoordinatesForInventorySlot(0, 0), 15, 15);
} catch (IOException e) {
// TODO Auto-generated catch block

View File

@ -71,6 +71,7 @@ public class IronMiner {
}
DetectedObject closestIronOre = getClosestObjectToCharacter(ironOres);
if (closestIronOre != null) {
cursor.moveAndLeftClickAtCoordinatesWithRandomness(closestIronOre.getCenterForClicking(), 10, 10);
@ -85,15 +86,14 @@ public class IronMiner {
System.out.println("Both threads finished?");
}
humanBehavior.randomlyCheckMiningXP(cursor);
randomDetector.dealWithRandoms(screenCapture, cursor);
//dropInventoryIfFull();
if (count % 100 == 0) {
System.out.println((System.currentTimeMillis() - startTime) / 1000);
if (count % 30 == 0) {
System.out.println("WAITING #############################################");
Thread.sleep(5000);
}
//humanBehavior.randomlyCheckMiningXP(cursor);
//randomDetector.dealWithRandoms(screenCapture, cursor);
//dropInventoryIfFull();
}
System.out.println("Completed full mining session.");
}
/*private void dropOre() throws Exception {

View File

@ -31,8 +31,9 @@ public class TrackerThread implements Runnable {
boolean oreAvailable = true;
int oreLostCount = 0;
while (!objectTrackingFailure && oreLostCount < 3 && !isTimeElapsedOverLimit(miningStartTime, maxTimeToMine)) {
BufferedImage screenCapture2 = objectDetector.captureScreenshotGameWindow();
ArrayList<DetectedObject> detectedObjects = objectDetector.getObjectsInImage(screenCapture2, 0.15);
long frameStartTime = System.currentTimeMillis();
screenCapture = objectDetector.captureScreenshotGameWindow();
ArrayList<DetectedObject> detectedObjects = objectDetector.getObjectsInImage(screenCapture, 0.15);
ArrayList<DetectedObject> ironOres = objectDetector.getObjectsOfClassInList(detectedObjects, "ironOre");
objectTrackingFailure = ironOreTracker.update(screenCapture, boundingBox);
oreAvailable = objectDetector.isObjectPresentInBoundingBoxInImage(ironOres, boundingBox, "ironOre");
@ -42,7 +43,8 @@ public class TrackerThread implements Runnable {
else {
oreLostCount = 0;
}
System.out.println("trackerThread working...");
System.out.println("Threaded tracker took " + (System.currentTimeMillis() - frameStartTime) + " milliseconds.");
//System.out.println("trackerThread working...");
}
} catch (IOException e) {
// TODO Auto-generated catch block

Binary file not shown.

Binary file not shown.

Binary file not shown.