diff --git a/src/CursorTask.java b/src/CursorTask.java index 01dca78..3c5982c 100644 --- a/src/CursorTask.java +++ b/src/CursorTask.java @@ -26,6 +26,10 @@ public class CursorTask { 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 { for (int row = 0; row < 4; row++) { for (int column = 0; column < 7; column++) { diff --git a/src/Inventory.java b/src/Inventory.java index 5beaeca..4397b32 100644 --- a/src/Inventory.java +++ b/src/Inventory.java @@ -79,6 +79,10 @@ public class Inventory { return inventorySlots[row][column].getItemNameInInventorySlot(items); } + public boolean inventorySlotIsEmpty(int row, int column) { + return inventorySlots[row][column].isInventorySlotEmpty(items); + } + public boolean isLastSlotInInventoryFull() { return !inventorySlots[Constants.INVENTORY_NUM_ROWS - 1][Constants.INVENTORY_NUM_COLUMNS - 1].isInventorySlotEmpty(items); } diff --git a/src/IronMiner.java b/src/IronMiner.java index e4316ce..dbff826 100644 --- a/src/IronMiner.java +++ b/src/IronMiner.java @@ -58,7 +58,7 @@ public class IronMiner { count++; BufferedImage screenCapture = objectDetector.captureScreenshotGameWindow(); - ArrayList detectedObjects = objectDetector.getObjectsInImage(screenCapture, 0.20); + ArrayList detectedObjects = objectDetector.getObjectsInImage(screenCapture, 0.30); ArrayList ironOres = objectDetector.getIronOres(detectedObjects); if (ironOres.size() == 0) { @@ -99,11 +99,16 @@ public class IronMiner { oreLostCount = 0; } } + + inventory.update(); + if (!inventory.inventorySlotIsEmpty(0, 0)) { + cursorTask.dropOre(cursor, inventory); + } } humanBehavior.randomlyCheckMiningXP(cursor); randomDetector.dealWithRandoms(screenCapture, cursor); - dropInventoryIfFull(); + //dropInventoryIfFull(); if (count % 100 == 0) { System.out.println((System.currentTimeMillis() - startTime) / 1000); } diff --git a/target/classes/CursorTask.class b/target/classes/CursorTask.class index 43d8617..15d5de7 100644 Binary files a/target/classes/CursorTask.class and b/target/classes/CursorTask.class differ diff --git a/target/classes/Inventory.class b/target/classes/Inventory.class index c585e04..b42b638 100644 Binary files a/target/classes/Inventory.class and b/target/classes/Inventory.class differ diff --git a/target/classes/IronMiner.class b/target/classes/IronMiner.class index 240ceeb..f86848d 100644 Binary files a/target/classes/IronMiner.class and b/target/classes/IronMiner.class differ