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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ We will seek to implement CI/CD in the repository so that developers have a good
- Orbit Helper Quick Login: Adds a button to navigate to Orbit Helper from the menu. By @orbithelper
- Simple Galaxy Gate: Supports ABG, Delta, Epsilon, Zeta, Hades, Kuiper, LoW, Invasion, Mimesis, EBG, GoP, Treacherous, DSE, Fiesta, Trinity and Voyagers. By @do-gamer
- Autobuy: Automatically buys boosters and special items from the shop at a configured interval. By @do-gamer
- Log Overlay: Displays the latest in-game log messages on the canvas (top-center, auto-fade after 5s). Built-in keyword whitelist limits the displayed lines to gains and errors so the canvas does not get cluttered. By @Halizeur
- Log Overlay: Displays the latest in-game log messages on the canvas (top-center, auto-fade after 5s). Built-in keyword whitelist limits the displayed lines to gains and errors so the canvas does not get cluttered. By @Haluzer

## Contributing

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.shared.halizeur.log_overlay;
package dev.shared.haluzer.log_overlay;

import java.util.ArrayDeque;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package dev.shared.halizeur.log_overlay;
package dev.shared.haluzer.log_overlay;

import eu.darkbot.api.config.annotations.Configuration;
import eu.darkbot.api.config.annotations.Option;

@Configuration("halizeur.log_overlay.config")
@Configuration("haluzer.log_overlay.config")
public class LogOverlayConfig {

@Option("halizeur.log_overlay.enabled")
@Option("haluzer.log_overlay.enabled")
public boolean enabled = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package dev.shared.haluzer.revive_loop_watchdog;

import eu.darkbot.api.config.ConfigSetting;
import eu.darkbot.api.config.annotations.Configuration;
import eu.darkbot.api.config.annotations.Number;
import eu.darkbot.api.config.annotations.Option;
import eu.darkbot.api.extensions.Behavior;
import eu.darkbot.api.extensions.Configurable;
import eu.darkbot.api.extensions.Feature;
import eu.darkbot.api.managers.BotAPI;
import eu.darkbot.api.managers.HeroAPI;
import eu.darkbot.api.managers.RepairAPI;

import java.time.Instant;
import java.time.Duration;

@Feature(name = "Revive Loop Watchdog", description =
"Detects the stuck-on-revive refresh loop bug, pauses the bot, and auto-resumes once it recovers.",
enabledByDefault = false)
public class ReviveLoopWatchdog implements Behavior, Configurable<ReviveLoopWatchdog.Config> {

private final HeroAPI hero;
private final BotAPI bot;
private final RepairAPI repair;

private Config config = new Config();

private Instant deadSince = null;
private boolean pausedByWatchdog = false;

public ReviveLoopWatchdog(HeroAPI hero, BotAPI bot, RepairAPI repair) {
this.hero = hero;
this.bot = bot;
this.repair = repair;
}

@Configuration("revive_loop_watchdog.config")
Comment thread
Haluzer marked this conversation as resolved.
public static class Config {
@Option("revive_loop_watchdog.config.stuckthresholdminutes")
@Number(min = 1, max = 30, step = 1)
public int stuckThresholdMinutes = 3;
}

@Override
public void setConfig(ConfigSetting<Config> config) {
this.config = config.getValue();
}

@Override
public void onTickBehavior() {
deadSince = null;
}

@Override
public void onStoppedBehavior() {
if (pausedByWatchdog) {
checkForRecovery();
return;
}

if (repair.isDestroyed()) {
if (deadSince == null) {
deadSince = Instant.now();
}

long stuckMinutes = Duration.between(deadSince, Instant.now()).toMinutes();
if (stuckMinutes >= config.stuckThresholdMinutes) {
pauseForStuckLoop(stuckMinutes);
}
} else {
deadSince = null;
}
}

private void pauseForStuckLoop(long stuckMinutes) {
if (!bot.isRunning()) {
return;
}

System.out.println("Revive Loop Watchdog: ship destroyed for " + stuckMinutes

Check warning on line 80 in src/main/java/dev/shared/haluzer/revive_loop_watchdog/ReviveLoopWatchdog.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this use of System.out by a logger.

See more on https://sonarcloud.io/project/issues?id=Darkbot-Plugins_SharedPlugin&issues=AaCUyC2muNydAlqVfo7A&open=AaCUyC2muNydAlqVfo7A&pullRequest=202
+ "+ minute(s) with no successful revive, pausing bot to stop wasted refreshing.");
bot.setRunning(false);
pausedByWatchdog = true;
}

private void checkForRecovery() {
boolean loaded = hero.getLocationInfo() != null && hero.getLocationInfo().isInitialized();
boolean alive = !repair.isDestroyed();

if (loaded && alive) {
System.out.println("Revive Loop Watchdog: game loaded and ship alive again, resuming bot.");

Check warning on line 91 in src/main/java/dev/shared/haluzer/revive_loop_watchdog/ReviveLoopWatchdog.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this use of System.out by a logger.

See more on https://sonarcloud.io/project/issues?id=Darkbot-Plugins_SharedPlugin&issues=AaCUyC2muNydAlqVfo7B&open=AaCUyC2muNydAlqVfo7B&pullRequest=202
pausedByWatchdog = false;
deadSince = null;
bot.setRunning(true);
}
}
}
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_bg.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Активиране


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=Ремонт на HP (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Ремонт на щита (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_cs.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Povolit


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=Oprava HP (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Oprava štítu (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Aktivieren


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=HP-Reparatur (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Schildreparatur (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_el.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Ενεργοποίηση


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=Επισκευή HP (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Επισκευή ασπίδας (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Enable


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=HP Repair (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Shield Repair (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Activar


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=Reparación de HP (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Reparación de escudo (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Activer


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Activé
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Activé

do_gamer.simple_healing.hp_repair=Réparation des PV (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Réparation du bouclier (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_hu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Engedélyezés


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=HP javítás (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Pajzs javítás (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Abilita


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=Riparazione HP (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Riparazione scudo (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_lt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Įjungti


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=HP taisymas (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Skydo taisymas (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_pl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Włącz


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=Naprawa HP (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Naprawa osłon (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_pt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Ativar


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=Reparo de HP (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Reparo de escudo (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_ro.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Activează


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=Reparare HP (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Reparare scut (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Включить


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=Ремонт HP (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Ремонт щита (Aegis, Hammerclaw)
Expand Down
11 changes: 8 additions & 3 deletions src/main/resources/dev/shared/lang/strings_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ example.translation=Example translation
general.enabled=Etkinleştir


# ----- Halizeur : Log Overlay -----
halizeur.log_overlay.config=Log Overlay
halizeur.log_overlay.enabled=Enabled
# ----- Haluzer : Revive Loop Watchdog -----
revive_loop_watchdog.config=Revive Loop Watchdog
revive_loop_watchdog.config.stuckthresholdminutes=Stuck threshold (min)
revive_loop_watchdog.config.stuckthresholdminutes.desc=Minutes of continuous destruction before the watchdog pauses the bot

# ----- Haluzer : Log Overlay -----
haluzer.log_overlay.config=Log Overlay
haluzer.log_overlay.enabled=Enabled

do_gamer.simple_healing.hp_repair=HP Onarımı (Solace, Orcus, Aegis, Hammerclaw)
do_gamer.simple_healing.shield_repair=Kalkan Onarımı (Aegis, Hammerclaw)
Expand Down
Loading
Loading