Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,124 @@ default int maxBreakDuration() {
return 15;
}

@ConfigItem(
keyName = "enableLongBreaks",
name = "Enable Long Breaks",
description = "Enable a second independent long-break timer",
position = 4,
section = breakTimingSettings
)
default boolean enableLongBreaks() {
return false;
}

@ConfigItem(
keyName = "minLongBreakInterval",
name = "Min Long Break Interval (minutes)",
description = "Minimum time to play before a long break can trigger",
position = 5,
section = breakTimingSettings
)
@Range(min = 1, max = 600)
default int minLongBreakInterval() {
return 20;
}

@ConfigItem(
keyName = "maxLongBreakInterval",
name = "Max Long Break Interval (minutes)",
description = "Maximum time to play before a long break can trigger",
position = 6,
section = breakTimingSettings
)
@Range(min = 1, max = 600)
default int maxLongBreakInterval() {
return 30;
Comment on lines +87 to +101

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Prevent the default long-break interval from suppressing normal breaks.

The default long-break interval is 20-30 minutes. The default normal playtime is 45-90 minutes. The scheduler creates both deadlines at the same time and handles a due long break first. After that long break, it reschedules the normal deadline. Therefore, enabling long breaks with defaults prevents a normal break from starting.

Set the default long-break interval above the normal-playtime range, or retain the normal deadline when a long break completes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/breakhandler/breakhandlerv2/BreakHandlerV2Config.java`
around lines 87 - 101, Update the default values in BreakHandlerV2Config’s
minLongBreakInterval() and maxLongBreakInterval() so the default long-break
window starts after the normal playtime range, preventing long breaks from
preempting normal breaks; leave the configured range constraints unchanged.

}

@ConfigItem(
keyName = "minLongBreakDuration",
name = "Min Long Break Duration (minutes)",
description = "Minimum long-break duration",
position = 7,
section = breakTimingSettings
)
@Range(min = 1, max = 600)
default int minLongBreakDuration() {
return 8;
}

@ConfigItem(
keyName = "maxLongBreakDuration",
name = "Max Long Break Duration (minutes)",
description = "Maximum long-break duration",
position = 8,
section = breakTimingSettings
)
@Range(min = 1, max = 600)
default int maxLongBreakDuration() {
return 10;
}

@ConfigItem(
keyName = "enableMegaBreaks",
name = "Enable Mega Breaks",
description = "Enable a third independent mega-break timer",
position = 9,
section = breakTimingSettings
)
default boolean enableMegaBreaks() {
return false;
}

@ConfigItem(
keyName = "minMegaBreakInterval",
name = "Min Mega Break Interval (minutes)",
description = "Minimum time to play before a mega break can trigger",
position = 10,
section = breakTimingSettings
)
@Range(min = 1, max = 600)
default int minMegaBreakInterval() {
return 120;
}

@ConfigItem(
keyName = "maxMegaBreakInterval",
name = "Max Mega Break Interval (minutes)",
description = "Maximum time to play before a mega break can trigger",
position = 11,
section = breakTimingSettings
)
@Range(min = 1, max = 600)
default int maxMegaBreakInterval() {
return 180;
}

@ConfigItem(
keyName = "minMegaBreakDuration",
name = "Min Mega Break Duration (minutes)",
description = "Minimum mega-break duration",
position = 12,
section = breakTimingSettings
)
@Range(min = 1, max = 600)
default int minMegaBreakDuration() {
return 20;
}

@ConfigItem(
keyName = "maxMegaBreakDuration",
name = "Max Mega Break Duration (minutes)",
description = "Maximum mega-break duration",
position = 13,
section = breakTimingSettings
)
@Range(min = 1, max = 600)
default int maxMegaBreakDuration() {
return 30;
}

// ========== BREAK BEHAVIOR SECTION ==========
@ConfigSection(
name = "Break Behavior",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ public Dimension render(Graphics2D graphics) {
.rightColor(Color.GRAY)
.build());

panelComponent.getChildren().add(LineComponent.builder()
.left("Runtime:")
.right(formatDuration(script.getScriptActiveSeconds()))
.rightColor(Color.WHITE)
.build());

panelComponent.getChildren().add(LineComponent.builder()
.left("Breaks:")
.right(String.valueOf(script.getBreaksActivatedCount()))
.rightColor(Color.WHITE)
.build());

// Show play schedule info if enabled
if (config.usePlaySchedule()) {
panelComponent.getChildren().add(LineComponent.builder()
Expand All @@ -88,14 +100,30 @@ public Dimension render(Graphics2D graphics) {
.rightColor(Color.GREEN)
.build());
}
long secondsUntilLongBreak = script.getTimeUntilLongBreak();
if (config.enableLongBreaks() && secondsUntilLongBreak >= 0) {
panelComponent.getChildren().add(LineComponent.builder()
.left("Long break:")
.right(formatDuration(secondsUntilLongBreak))
.rightColor(Color.ORANGE)
.build());
}
long secondsUntilMegaBreak = script.getTimeUntilMegaBreak();
if (config.enableMegaBreaks() && secondsUntilMegaBreak >= 0) {
panelComponent.getChildren().add(LineComponent.builder()
.left("Mega break:")
.right(formatDuration(secondsUntilMegaBreak))
.rightColor(Color.MAGENTA)
.build());
}
} else if (BreakHandlerV2State.isBreakActive()) {
long secondsRemaining = script.getBreakTimeRemaining();
if (secondsRemaining >= 0) {
String timeStr = formatDuration(secondsRemaining);
panelComponent.getChildren().add(LineComponent.builder()
.left("Break ends:")
.left(script.isCurrentBreakMega() ? "Mega break ends:" : script.isCurrentBreakLong() ? "Long break ends:" : "Break ends:")
.right(timeStr)
.rightColor(Color.ORANGE)
.rightColor(script.isCurrentBreakMega() ? Color.MAGENTA : Color.ORANGE)
.build());
}
}
Expand Down Expand Up @@ -163,7 +191,9 @@ public Dimension render(Graphics2D graphics) {
// Break configuration
panelComponent.getChildren().add(LineComponent.builder()
.left("Break type:")
.right(config.logoutOnBreak() ? "Logout" : "Stay logged in")
.right((config.logoutOnBreak() ? "Logout" : "Stay logged in")
+ (config.enableLongBreaks() ? " + long" : "")
+ (config.enableMegaBreaks() ? " + mega" : ""))
.rightColor(Color.LIGHT_GRAY)
.build());

Expand Down
Loading