Skip to content

Commit 409de8e

Browse files
author
9-9-9-9
committed
update version to 2.8.2 and display warning for World Boss Team every 60s
1 parent 0cf08a0 commit 409de8e

File tree

3 files changed

+29
-13
lines changed

3 files changed

+29
-13
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>bh.bot</groupId>
88
<artifactId>99bot</artifactId>
9-
<version>2.8.1</version>
9+
<version>2.8.2</version>
1010

1111
<dependencies>
1212
<dependency>

src/main/java/bh/bot/app/AbstractApplication.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.concurrent.CompletableFuture;
3232
import java.util.concurrent.atomic.AtomicBoolean;
3333
import java.util.concurrent.atomic.AtomicInteger;
34+
import java.util.function.Function;
3435
import java.util.function.Supplier;
3536
import java.util.stream.Collectors;
3637

@@ -80,6 +81,7 @@
8081
import bh.bot.common.utils.ValidationUtil;
8182
import bh.bot.common.utils.VersionUtil;
8283
import com.sun.jna.platform.win32.WinNT;
84+
import org.fusesource.jansi.Ansi;
8385

8486
public abstract class AbstractApplication {
8587
protected ParseArgumentsResult argumentInfo;
@@ -715,6 +717,7 @@ protected Tuple2<Point[], Byte> detectRadioButtons(Rectangle scanRect) {
715717
private static final int persuadeSleepSecs = 60;
716718
private static final int persuadeSleepSecsIntervalInCaseManual = 30;
717719
private static final int persuadeSleepSecsAwaitAction = 20;
720+
private static final int showWarningWorldBossTeamSleepSecs = 60;
718721

719722
protected void internalDoSmallTasks(AtomicBoolean masterSwitch, SmallTasks st) {
720723
try {
@@ -726,6 +729,8 @@ protected void internalDoSmallTasks(AtomicBoolean masterSwitch, SmallTasks st) {
726729
final AtomicInteger continousPersuadeScreen = new AtomicInteger(0);
727730
long nextPersuade = addSec(persuadeSleepSecs);
728731
boolean persuade = st.persuade && !argumentInfo.disablePersuade;
732+
long nextShowWarningWorldBossTeam = addSec(showWarningWorldBossTeamSleepSecs);
733+
boolean showWarningWorldBossTeam = st.showWarningWorldBossTeam;
729734

730735
if (persuade) {
731736
if (Configuration.enableDevFeatures) {
@@ -791,6 +796,12 @@ protected void internalDoSmallTasks(AtomicBoolean masterSwitch, SmallTasks st) {
791796

792797
if (persuade && nextPersuade <= System.currentTimeMillis())
793798
nextPersuade = doPersuade(continousPersuadeScreen);
799+
800+
if (showWarningWorldBossTeam && nextShowWarningWorldBossTeam <= System.currentTimeMillis())
801+
{
802+
warningWatchWorldBossTeam(ColorizeUtil.formatWarning);
803+
nextShowWarningWorldBossTeam = addSec(showWarningWorldBossTeamSleepSecs);
804+
}
794805
}
795806
} catch (Exception ex) {
796807
ex.printStackTrace();
@@ -810,6 +821,7 @@ protected static class SmallTasks {
810821
public final boolean autoExit;
811822
public final boolean closeEnterGameNewsDialog;
812823
public final boolean persuade;
824+
public final boolean showWarningWorldBossTeam;
813825

814826
private SmallTasks(Builder b) {
815827
this.clickTalk = b.f(0);
@@ -818,6 +830,7 @@ private SmallTasks(Builder b) {
818830
this.autoExit = b.f(3);
819831
this.closeEnterGameNewsDialog = b.f(4);
820832
this.persuade = b.f(5);
833+
this.showWarningWorldBossTeam = b.f(6);
821834
}
822835

823836
public static Builder builder() {
@@ -863,6 +876,10 @@ public Builder closeEnterGameNewsDialog() {
863876
public Builder persuade() {
864877
return this.set(5);
865878
}
879+
880+
public Builder warningWorldBossTeam() {
881+
return this.set(6);
882+
}
866883
}
867884
}
868885

@@ -1510,6 +1527,10 @@ protected void warningPvpTargetSelectionCase() {
15101527
info(Cu.i().yellow("** WARNING ** ").red("about selecting PVP target").yellow(" feature, to prevent wrong targeting and un-expected loss on other target-selectable ranking like GVG... (which having the same target-selection method), ").cyan("while doing AFK").yellow(", this feature works and ").cyan("only works when bot itself attends to PVP").yellow(" by selecting the PVP icon (top left of game screen). That means if you select the PVP icon yourself or enter PVP before bot click etc.., it only select the first line as target as default").reset());
15111528
}
15121529

1530+
protected void warningWatchWorldBossTeam(Function<Ansi, Ansi> ansiFormat) {
1531+
info(ansiFormat, "*** NOTICE: REMEMBER YOU HAVE TO WATCH/CHECK THE GAME SOMETIME TO PREVENT UN-EXPECTED HANG/LOSS DUE TO UN-MANAGED BEHAVIORS LIKE MISSING MEMBERS, RE-GROUP FAILED, INCORRECT GROUP MATCHING...ETC ***");
1532+
}
1533+
15131534
protected int getDefaultMainLoopInterval() {
15141535
return 0;
15151536
}

src/main/java/bh/bot/app/farming/WorldBossTeamApp.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@
1515
import org.fusesource.jansi.Ansi;
1616

1717
import java.awt.*;
18-
import java.util.Arrays;
19-
import java.util.List;
2018
import java.util.concurrent.atomic.AtomicBoolean;
2119
import java.util.function.Function;
22-
import java.util.function.Supplier;
2320

2421
import static bh.bot.Main.*;
2522
import static bh.bot.common.Log.*;
@@ -45,16 +42,17 @@ protected void internalRun(String[] args) {
4542
}
4643

4744
longTimeNoSee = Configuration.Timeout.longTimeNoSeeInMinutes * 60_000;
45+
boolean skipConfirm = true;
46+
4847
int arg;
4948
try {
5049
arg = Integer.parseInt(args[0]);
5150
} catch (ArrayIndexOutOfBoundsException | NumberFormatException ex) {
5251
info(getHelp());
5352
arg = readInputLoopCount("How many times do you want to attack the world bosses?");
53+
skipConfirm = false;
5454
}
5555

56-
boolean skipConfirm = true;
57-
5856
if (args.length == 3) {
5957
try {
6058
minimumNumberOfTeamMembers = Integer.parseInt(args[1]);
@@ -137,6 +135,7 @@ protected void internalRun(String[] args) {
137135
.clickDisconnect() //
138136
.reactiveAuto() //
139137
.autoExit() //
138+
.warningWorldBossTeam() //
140139
.build() //
141140
), //
142141
() -> doCheckGameScreenOffset(masterSwitch)
@@ -148,9 +147,9 @@ private void doLoopClickImage(int loopCount, AtomicBoolean masterSwitch) {
148147
final Point coordinateHideMouse = new Point(0, 0);
149148

150149
info(ColorizeUtil.formatInfo, "\n\nStarting World Boss (Team)");
151-
warningWatch(ColorizeUtil.formatError);
152-
warningWatch(ColorizeUtil.formatWarning);
153-
warningWatch(ColorizeUtil.formatInfo);
150+
warningWatchWorldBossTeam(ColorizeUtil.formatError);
151+
warningWatchWorldBossTeam(ColorizeUtil.formatWarning);
152+
warningWatchWorldBossTeam(ColorizeUtil.formatInfo);
154153
try {
155154
final int mainLoopInterval = Configuration.Interval.Loop.getMainLoopInterval(getDefaultMainLoopInterval());
156155

@@ -267,10 +266,6 @@ private void doLoopClickImage(int loopCount, AtomicBoolean masterSwitch) {
267266
}
268267
}
269268

270-
private void warningWatch(Function<Ansi, Ansi> ansiFormat) {
271-
info(ansiFormat, "*** NOTICE: REMEMBER YOU HAVE TO WATCH/CHECK THE GAME SOMETIME TO PREVENT UN-EXPECTED HANG/LOSS DUE TO UN-MANAGED BEHAVIORS LIKE MISSING MEMBERS, RE-GROUP FAILED, INCORRECT GROUP MATCHING...ETC ***");
272-
}
273-
274269
@Override
275270
protected String getUsage() {
276271
return "<loop_count> <minimum_number_of_team_members> <number_of_team_members_the_world_boss_supports>";

0 commit comments

Comments
 (0)