mirror of
https://github.com/davpapp/PowerMiner
synced 2025-01-09 13:08:01 -05:00
Multithreading working, BRobot seems to be failing
This commit is contained in:
parent
ae260edfc0
commit
488abeb1c9
@ -13,7 +13,7 @@ public class DropperThread implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
inventory.update();
|
//inventory.update();
|
||||||
cursor.moveAndRightlickAtCoordinatesWithRandomness(inventory.getClickCoordinatesForInventorySlot(0, 0), 15, 15);
|
cursor.moveAndRightlickAtCoordinatesWithRandomness(inventory.getClickCoordinatesForInventorySlot(0, 0), 15, 15);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
|
@ -71,6 +71,7 @@ public class IronMiner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DetectedObject closestIronOre = getClosestObjectToCharacter(ironOres);
|
DetectedObject closestIronOre = getClosestObjectToCharacter(ironOres);
|
||||||
|
|
||||||
if (closestIronOre != null) {
|
if (closestIronOre != null) {
|
||||||
cursor.moveAndLeftClickAtCoordinatesWithRandomness(closestIronOre.getCenterForClicking(), 10, 10);
|
cursor.moveAndLeftClickAtCoordinatesWithRandomness(closestIronOre.getCenterForClicking(), 10, 10);
|
||||||
|
|
||||||
@ -85,16 +86,15 @@ public class IronMiner {
|
|||||||
|
|
||||||
System.out.println("Both threads finished?");
|
System.out.println("Both threads finished?");
|
||||||
}
|
}
|
||||||
|
if (count % 30 == 0) {
|
||||||
humanBehavior.randomlyCheckMiningXP(cursor);
|
System.out.println("WAITING #############################################");
|
||||||
randomDetector.dealWithRandoms(screenCapture, cursor);
|
Thread.sleep(5000);
|
||||||
|
}
|
||||||
|
//humanBehavior.randomlyCheckMiningXP(cursor);
|
||||||
|
//randomDetector.dealWithRandoms(screenCapture, cursor);
|
||||||
//dropInventoryIfFull();
|
//dropInventoryIfFull();
|
||||||
if (count % 100 == 0) {
|
|
||||||
System.out.println((System.currentTimeMillis() - startTime) / 1000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("Completed full mining session.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*private void dropOre() throws Exception {
|
/*private void dropOre() throws Exception {
|
||||||
inventory.update();
|
inventory.update();
|
||||||
|
@ -31,8 +31,9 @@ public class TrackerThread implements Runnable {
|
|||||||
boolean oreAvailable = true;
|
boolean oreAvailable = true;
|
||||||
int oreLostCount = 0;
|
int oreLostCount = 0;
|
||||||
while (!objectTrackingFailure && oreLostCount < 3 && !isTimeElapsedOverLimit(miningStartTime, maxTimeToMine)) {
|
while (!objectTrackingFailure && oreLostCount < 3 && !isTimeElapsedOverLimit(miningStartTime, maxTimeToMine)) {
|
||||||
BufferedImage screenCapture2 = objectDetector.captureScreenshotGameWindow();
|
long frameStartTime = System.currentTimeMillis();
|
||||||
ArrayList<DetectedObject> detectedObjects = objectDetector.getObjectsInImage(screenCapture2, 0.15);
|
screenCapture = objectDetector.captureScreenshotGameWindow();
|
||||||
|
ArrayList<DetectedObject> detectedObjects = objectDetector.getObjectsInImage(screenCapture, 0.15);
|
||||||
ArrayList<DetectedObject> ironOres = objectDetector.getObjectsOfClassInList(detectedObjects, "ironOre");
|
ArrayList<DetectedObject> ironOres = objectDetector.getObjectsOfClassInList(detectedObjects, "ironOre");
|
||||||
objectTrackingFailure = ironOreTracker.update(screenCapture, boundingBox);
|
objectTrackingFailure = ironOreTracker.update(screenCapture, boundingBox);
|
||||||
oreAvailable = objectDetector.isObjectPresentInBoundingBoxInImage(ironOres, boundingBox, "ironOre");
|
oreAvailable = objectDetector.isObjectPresentInBoundingBoxInImage(ironOres, boundingBox, "ironOre");
|
||||||
@ -42,7 +43,8 @@ public class TrackerThread implements Runnable {
|
|||||||
else {
|
else {
|
||||||
oreLostCount = 0;
|
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) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user