From 5a470737bba7edcc7ce20c4ba256ea34adf00ce4 Mon Sep 17 00:00:00 2001 From: HungPV <49741222+9-9-9-9@users.noreply.github.com> Date: Sun, 5 Sep 2021 13:53:39 +0700 Subject: [PATCH] fix setting app (#31) Co-authored-by: 9-9-9-9 <9-9-9-9> --- pom.xml | 2 +- src/main/java/bh/bot/app/AbstractApplication.java | 6 ++++-- src/main/java/bh/bot/app/SettingApp.java | 10 ++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 042eb8e6..129c2113 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 bh.bot BitHeroes - 1.5.2 + 1.5.3 diff --git a/src/main/java/bh/bot/app/AbstractApplication.java b/src/main/java/bh/bot/app/AbstractApplication.java index c0cacebd..e37d3b7f 100644 --- a/src/main/java/bh/bot/app/AbstractApplication.java +++ b/src/main/java/bh/bot/app/AbstractApplication.java @@ -567,9 +567,11 @@ protected void autoReactiveAuto(AtomicBoolean masterSwitch) { } if (ImageUtil.isRedLikeColor(color)) { continousRed++; - if (continousRed >= 2) - info("Detected Auto is not turned on, gonna reactive it soon"); + if (continousRed >= 2 && continousRed < maxContinousRed) { + info("Detected Auto is not turned on, gonna reactive it after %d seconds", (maxContinousRed - continousRed) * sleepMs / 1_000); + } if (continousRed >= maxContinousRed) { + info("Detected Auto is not turned on, gonna reactive it soon"); moveCursor(point); sleep(100); mouseClick(); diff --git a/src/main/java/bh/bot/app/SettingApp.java b/src/main/java/bh/bot/app/SettingApp.java index d574ec9f..405e0cd3 100644 --- a/src/main/java/bh/bot/app/SettingApp.java +++ b/src/main/java/bh/bot/app/SettingApp.java @@ -85,12 +85,6 @@ protected void internalRun(String[] args) { tmp = readIntInput(sb.toString(), woldBossLevelRange._1, woldBossLevelRange._2); worldBossLevel = tmp == null ? worldBossLevel : tmp; // - - sb = new StringBuilder(); - sb.append(String.format("%s=%d\n", UserConfig.raidLevelKey, raidLevel)); - sb.append(String.format("%s=%d\n", UserConfig.raidModeKey, raidMode)); - sb.append(String.format("%s=%d\n", UserConfig.worldBossLevelKey, worldBossLevel)); - UserConfig newCfg = new UserConfig(profileNumber, (byte) raidLevel, (byte) raidMode, (byte) worldBossLevel); sb = new StringBuilder("Your setting:\n"); @@ -115,6 +109,10 @@ protected void internalRun(String[] args) { }); if (save) { + sb = new StringBuilder(); + sb.append(String.format("%s=%d\n", UserConfig.raidLevelKey, raidLevel)); + sb.append(String.format("%s=%d\n", UserConfig.raidModeKey, raidMode)); + sb.append(String.format("%s=%d\n", UserConfig.worldBossLevelKey, worldBossLevel)); Files.write(Paths.get(fileName), sb.toString().getBytes()); info("Saved successfully"); } else {