diff --git a/src/main/java/bh/bot/app/AbstractApplication.java b/src/main/java/bh/bot/app/AbstractApplication.java index b320a7fe..3fbc4abe 100644 --- a/src/main/java/bh/bot/app/AbstractApplication.java +++ b/src/main/java/bh/bot/app/AbstractApplication.java @@ -605,7 +605,9 @@ protected Tuple2 detectRadioButtons(Rectangle scanRect) { try (ScreenCapturedResult screenCapturedResult = captureElementInEstimatedArea( new Offset(Math.max(0, scanRect.x - positionTolerant), Math.max(0, scanRect.y - positionTolerant)), - scanRect.width + positionTolerant * 2, scanRect.height + positionTolerant * 2)) { + scanRect.width + positionTolerant * 2, + scanRect.height + positionTolerant * 2 + )) { BufferedImage sc = screenCapturedResult.image; saveDebugImage(sc, "detectRadioButtons"); @@ -675,7 +677,7 @@ protected Tuple2 detectRadioButtons(Rectangle scanRect) { else { if (selectedRadioButtonIndex != curRadioButtonIndex) throw new InvalidDataException( - "Found more than one selected radio button which is absolutely wrong!" + String.format("Found more than one selected radio button which is absolutely wrong! (no.%d conflicts with no.%d)", curRadioButtonIndex + 1, selectedRadioButtonIndex + 1) ); } break; @@ -687,6 +689,7 @@ protected Tuple2 detectRadioButtons(Rectangle scanRect) { x, y ); startingCoords.add(new Point(x, y)); + x += Math.max(0, im.getWidth() - 2); } } diff --git a/src/main/java/bh/bot/app/dev/TestApp.java b/src/main/java/bh/bot/app/dev/TestApp.java index 0d2366b7..b18ae469 100644 --- a/src/main/java/bh/bot/app/dev/TestApp.java +++ b/src/main/java/bh/bot/app/dev/TestApp.java @@ -41,7 +41,16 @@ protected void internalRun(String[] args) { adjustScreenOffset(); // - findAttendablePlaces(); + Tuple2 result = detectRadioButtons( + Configuration.screenResolutionProfile.getRectangleRadioButtonsOfRaid() + ); + Point[] points = result._1; + int selectedLevel = result._2 + 1; + info("Selected %d", selectedLevel); + for (int i = 0; i < points.length; i++) { + Point p = points[i]; + info("[%d] %d,%d", i + 1, p.x - Configuration.gameScreenOffset.X.get(), p.y - Configuration.gameScreenOffset.Y.get()); + } } private static void testParseTime() { diff --git a/src/main/java/bh/bot/common/types/images/BwMatrixMeta.java b/src/main/java/bh/bot/common/types/images/BwMatrixMeta.java index 78bc312f..1972cdf5 100644 --- a/src/main/java/bh/bot/common/types/images/BwMatrixMeta.java +++ b/src/main/java/bh/bot/common/types/images/BwMatrixMeta.java @@ -393,7 +393,7 @@ public static void load() throws IOException { 0xFFFFFF ); Metas.Globally.Buttons.radioButton = BwMatrixMeta.from(// - "buttons/globally.radio-button2?", + "buttons/globally.radio-button3?", Offset.none(), // 0x000000 ); diff --git a/src/main/java/bh/bot/common/utils/InteractionUtil.java b/src/main/java/bh/bot/common/utils/InteractionUtil.java index 36d8ca81..261f70c6 100644 --- a/src/main/java/bh/bot/common/utils/InteractionUtil.java +++ b/src/main/java/bh/bot/common/utils/InteractionUtil.java @@ -77,7 +77,7 @@ public static void hideCursor() { public static void clickRadioButton(int level, Point[] points, String evName) { if (level < 1 || level > points.length) throw new InvalidDataException( - "Can not select level %d of %s because it's not exists, do you setup wrongly?", level, evName + "Can not select level %d/%d of %s because it's not exists, do you setup wrongly?", level, points.length, evName ); Point p = points[level - 1]; moveCursor(new Point(p.x + 7, p.y + 7)); diff --git a/src/main/resources/game-images/800x520/buttons/globally.radio-button2-mx.bmp b/src/main/resources/game-images/800x520/buttons/globally.radio-button2-mx.bmp deleted file mode 100644 index 3654b405..00000000 Binary files a/src/main/resources/game-images/800x520/buttons/globally.radio-button2-mx.bmp and /dev/null differ diff --git a/src/main/resources/game-images/800x520/buttons/globally.radio-button3-mx.bmp b/src/main/resources/game-images/800x520/buttons/globally.radio-button3-mx.bmp new file mode 100644 index 00000000..71af434c Binary files /dev/null and b/src/main/resources/game-images/800x520/buttons/globally.radio-button3-mx.bmp differ