Working at 23k / xp an hour with 2 ores

This commit is contained in:
davpapp 2018-03-13 06:43:04 -04:00
parent 390b9e157d
commit 957ddd61e1
6 changed files with 15 additions and 2 deletions

View File

@ -26,6 +26,10 @@ public class CursorTask {
return (int) (Math.hypot(a.x - b.x, a.y - b.y)); return (int) (Math.hypot(a.x - b.x, a.y - b.y));
} }
public void dropOre(Cursor cursor, Inventory inventory) throws Exception {
dropItem(cursor, inventory, 0, 0);
}
public void dropAllItemsInInventory(Cursor cursor, Inventory inventory) throws Exception { public void dropAllItemsInInventory(Cursor cursor, Inventory inventory) throws Exception {
for (int row = 0; row < 4; row++) { for (int row = 0; row < 4; row++) {
for (int column = 0; column < 7; column++) { for (int column = 0; column < 7; column++) {

View File

@ -79,6 +79,10 @@ public class Inventory {
return inventorySlots[row][column].getItemNameInInventorySlot(items); return inventorySlots[row][column].getItemNameInInventorySlot(items);
} }
public boolean inventorySlotIsEmpty(int row, int column) {
return inventorySlots[row][column].isInventorySlotEmpty(items);
}
public boolean isLastSlotInInventoryFull() { public boolean isLastSlotInInventoryFull() {
return !inventorySlots[Constants.INVENTORY_NUM_ROWS - 1][Constants.INVENTORY_NUM_COLUMNS - 1].isInventorySlotEmpty(items); return !inventorySlots[Constants.INVENTORY_NUM_ROWS - 1][Constants.INVENTORY_NUM_COLUMNS - 1].isInventorySlotEmpty(items);
} }

View File

@ -58,7 +58,7 @@ public class IronMiner {
count++; count++;
BufferedImage screenCapture = objectDetector.captureScreenshotGameWindow(); BufferedImage screenCapture = objectDetector.captureScreenshotGameWindow();
ArrayList<DetectedObject> detectedObjects = objectDetector.getObjectsInImage(screenCapture, 0.20); ArrayList<DetectedObject> detectedObjects = objectDetector.getObjectsInImage(screenCapture, 0.30);
ArrayList<DetectedObject> ironOres = objectDetector.getIronOres(detectedObjects); ArrayList<DetectedObject> ironOres = objectDetector.getIronOres(detectedObjects);
if (ironOres.size() == 0) { if (ironOres.size() == 0) {
@ -99,11 +99,16 @@ public class IronMiner {
oreLostCount = 0; oreLostCount = 0;
} }
} }
inventory.update();
if (!inventory.inventorySlotIsEmpty(0, 0)) {
cursorTask.dropOre(cursor, inventory);
}
} }
humanBehavior.randomlyCheckMiningXP(cursor); humanBehavior.randomlyCheckMiningXP(cursor);
randomDetector.dealWithRandoms(screenCapture, cursor); randomDetector.dealWithRandoms(screenCapture, cursor);
dropInventoryIfFull(); //dropInventoryIfFull();
if (count % 100 == 0) { if (count % 100 == 0) {
System.out.println((System.currentTimeMillis() - startTime) / 1000); System.out.println((System.currentTimeMillis() - startTime) / 1000);
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.