Skip to content

Commit 91af580

Browse files
committed
SulphurNaguaAIO first commit
This plugin automates fighting Sulphur Nagua in the Cam Torm region of Valamore
1 parent a1c9a4d commit 91af580

5 files changed

Lines changed: 450 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package net.runelite.client.plugins.microbot.SulphurNaguaAIO;
2+
3+
import net.runelite.client.config.Config;
4+
import net.runelite.client.config.ConfigGroup;
5+
import net.runelite.client.config.ConfigInformation;
6+
import net.runelite.client.config.ConfigItem;
7+
import net.runelite.client.plugins.microbot.inventorysetups.InventorySetup;
8+
9+
@ConfigGroup("SulphurNaguaAIO")
10+
@ConfigInformation("<html>"
11+
+ "<h2 style='color: #6d9eeb;'>Sulphur Nagua script by VIP</h2>"
12+
+ "<p>This plugin automates fighting Sulphur Nagua in the Cam Torm region of Valamore.</p>\n"
13+
+ "<p>Requirements:</p>\n"
14+
+ "<ol>\n"
15+
+ " <li>Access to Valamore and the Cam Torm area</li>\n"
16+
+ " <li>Completion of the 'Perilous Moons' quest</li>\n"
17+
+ " <li>Minimum 43 Prayer</li>\n"
18+
+ " <li>Minimum 38 Herblore</li>\n"
19+
+ " <li>Pestle and Mortar to make Potions</li>\n"
20+
+ "</ol>\n"
21+
+ "<p>This script will automatically fight Sulphur Nagua, drink Moonlight Potions, and brew new ones when supplies run out.</p>\n"
22+
+ "</html>")
23+
24+
25+
public interface SulphurNaguaConfig extends Config {
26+
@ConfigItem(
27+
keyName = "useInventorySetup",
28+
name = "Use Inventory Setup?",
29+
description = "When enabled, the bot will use the specified inventory setup for banking and supplies",
30+
position = 1
31+
)
32+
default boolean useInventorySetup() {
33+
return false;
34+
}
35+
36+
@ConfigItem(
37+
keyName = "inventorySetup",
38+
name = "Inventory Setup",
39+
description = "The inventory setup to use for banking and supplies",
40+
position = 2
41+
)
42+
default InventorySetup inventorySetup() {
43+
return null;
44+
}
45+
}
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
package net.runelite.client.plugins.microbot.SulphurNaguaAIO; // Stelle sicher, dass der Paketname stimmt
2+
3+
import net.runelite.client.plugins.microbot.Microbot;
4+
import net.runelite.client.ui.overlay.OverlayPanel;
5+
import net.runelite.client.ui.overlay.OverlayPosition;
6+
import net.runelite.client.ui.overlay.components.LineComponent;
7+
import net.runelite.client.plugins.microbot.SulphurNaguaAIO.SulphurNaguaScript.SulphurNaguaState; // WICHTIGER IMPORT
8+
9+
import javax.inject.Inject;
10+
import java.awt.*;
11+
12+
public class SulphurNaguaOverlay extends OverlayPanel {
13+
// Farben und Konstanten
14+
private static final Color BACKGROUND_COLOR = new Color(0, 0, 0, 150);
15+
private static final Color NORMAL_COLOR = Color.WHITE;
16+
private static final Color WARNING_COLOR = Color.YELLOW;
17+
private static final Color DANGER_COLOR = Color.RED;
18+
private static final Color SUCCESS_COLOR = Color.GREEN;
19+
private static final Color PREPARATION_COLOR = new Color(0, 170, 255); // Hellblau für Vorbereitung
20+
21+
private final SulphurNaguaPlugin plugin;
22+
23+
@Inject
24+
SulphurNaguaOverlay(SulphurNaguaPlugin plugin) {
25+
super(plugin);
26+
setPosition(OverlayPosition.TOP_LEFT);
27+
setNaughty();
28+
this.plugin = plugin;
29+
}
30+
31+
@Override
32+
public Dimension render(Graphics2D graphics) {
33+
try {
34+
panelComponent.setPreferredSize(new Dimension(200, 300));
35+
panelComponent.setBackgroundColor(BACKGROUND_COLOR);
36+
37+
// Titel - Korrigierte, einfache Darstellung
38+
panelComponent.getChildren().add(LineComponent.builder()
39+
.left("Sulphur Nagua Fighter")
40+
.leftColor(Color.white)
41+
.build());
42+
43+
// Sicherheitsabfrage, um Abstürze zu verhindern, falls das Skript noch nicht initialisiert ist
44+
if (plugin.sulphurNaguaScript == null) {
45+
panelComponent.getChildren().add(LineComponent.builder()
46+
.left("Status:")
47+
.right("Initialisiere...")
48+
.build());
49+
return super.render(graphics);
50+
}
51+
52+
// Laufzeit
53+
panelComponent.getChildren().add(LineComponent.builder()
54+
.left("Laufzeit:")
55+
.right(plugin.getTimeRunning())
56+
.rightColor(NORMAL_COLOR)
57+
.build());
58+
59+
// Aktueller Status
60+
panelComponent.getChildren().add(LineComponent.builder()
61+
.left("Status:")
62+
.right(plugin.sulphurNaguaScript.currentState.name())
63+
// ----- HIER IST DIE KORREKTUR -----
64+
// Die Farbe wird wieder dynamisch gesetzt
65+
.rightColor(getStateColor(plugin.sulphurNaguaScript.currentState))
66+
.build());
67+
68+
// Kills
69+
panelComponent.getChildren().add(LineComponent.builder()
70+
.left("Kills:")
71+
.right(String.valueOf(plugin.sulphurNaguaScript.totalNaguaKills))
72+
.rightColor(NORMAL_COLOR)
73+
.build());
74+
75+
// XP-Informationen
76+
var xpGained = plugin.getXpGained();
77+
var xpPerHour = plugin.getXpPerHour();
78+
panelComponent.getChildren().add(LineComponent.builder()
79+
.left("XP Gained:")
80+
.right(formatNumber(xpGained))
81+
.rightColor(NORMAL_COLOR)
82+
.build());
83+
84+
panelComponent.getChildren().add(LineComponent.builder()
85+
.left("XP/Stunde:")
86+
.right(formatNumber(xpPerHour))
87+
.rightColor(xpPerHour > 0 ? SUCCESS_COLOR : NORMAL_COLOR)
88+
.build());
89+
90+
// Footer mit Version
91+
panelComponent.getChildren().add(LineComponent.builder()
92+
.right("v" + SulphurNaguaScript.version)
93+
.rightColor(new Color(160, 160, 160))
94+
.build());
95+
96+
} catch (Exception ex) {
97+
// Logge den Fehler, damit du im Microbot-Log nachsehen kannst, was schiefgeht
98+
Microbot.logStackTrace("SulphurNaguaOverlay Fehler:", ex);
99+
}
100+
return super.render(graphics);
101+
}
102+
103+
private String formatNumber(long number) {
104+
return String.format("%,d", number);
105+
}
106+
107+
108+
private Color getStateColor(SulphurNaguaState state) {
109+
if (state == null) return NORMAL_COLOR;
110+
111+
switch (state) {
112+
case FIGHTING:
113+
return DANGER_COLOR;
114+
case WALKING:
115+
return WARNING_COLOR;
116+
case PREPARATION:
117+
return PREPARATION_COLOR;
118+
case BANKING:
119+
default:
120+
return NORMAL_COLOR;
121+
}
122+
}
123+
}
124+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package net.runelite.client.plugins.microbot.SulphurNaguaAIO; // Passe den Paketnamen an
2+
3+
import com.google.inject.Provides;
4+
import lombok.extern.slf4j.Slf4j;
5+
import net.runelite.client.config.ConfigManager;
6+
import net.runelite.client.plugins.Plugin;
7+
import net.runelite.client.plugins.PluginDescriptor;
8+
import net.runelite.client.plugins.microbot.Microbot;
9+
import net.runelite.client.plugins.microbot.TaF.GemCrabKiller.GemCrabKillerScript;
10+
import net.runelite.client.plugins.microbot.util.misc.TimeUtils;
11+
import net.runelite.client.ui.overlay.OverlayManager;
12+
13+
import javax.inject.Inject;
14+
import java.awt.*;
15+
import java.time.Instant;
16+
17+
@PluginDescriptor(
18+
name = "Sulphur Nagua Fighter",
19+
description = "Kämpft automatisch gegen Sulphur Nagua.",
20+
tags = {"combat", "pvm", "nagua", "valamore"},
21+
enabledByDefault = false
22+
)
23+
@Slf4j
24+
public class SulphurNaguaPlugin extends Plugin {
25+
@Inject
26+
SulphurNaguaScript sulphurNaguaScript;
27+
@Inject
28+
private SulphurNaguaConfig config;
29+
@Inject
30+
private OverlayManager overlayManager;
31+
@Inject
32+
private SulphurNaguaOverlay sulphurNaguaOverlay;
33+
private Instant scriptStartTime;
34+
private long startTotalExp;
35+
36+
@Provides
37+
SulphurNaguaConfig provideConfig(ConfigManager configManager) {
38+
return configManager.getConfig(SulphurNaguaConfig.class);
39+
}
40+
41+
@Override
42+
protected void startUp() throws AWTException {
43+
scriptStartTime = Instant.now();
44+
startTotalExp = Microbot.getClient().getOverallExperience();
45+
if (overlayManager != null) {
46+
overlayManager.add(sulphurNaguaOverlay);
47+
}
48+
sulphurNaguaScript.run(config);
49+
}
50+
51+
@Override
52+
protected void shutDown() {
53+
sulphurNaguaScript.shutdown();
54+
overlayManager.remove(sulphurNaguaOverlay);
55+
scriptStartTime = null;
56+
startTotalExp = 0;
57+
sulphurNaguaScript.totalNaguaKills = 0;
58+
}
59+
60+
protected String getTimeRunning() {
61+
return scriptStartTime != null ? TimeUtils.getFormattedDurationBetween(scriptStartTime, Instant.now()) : "";
62+
}
63+
64+
public long getXpGained() {
65+
if (startTotalExp == 0) return 0;
66+
return Microbot.getClient().getOverallExperience() - startTotalExp;
67+
}
68+
69+
public long getXpPerHour() {
70+
if (scriptStartTime == null) return 0;
71+
72+
long secondsElapsed = java.time.Duration.between(scriptStartTime, Instant.now()).getSeconds();
73+
if (secondsElapsed <= 0) return 0;
74+
75+
return (getXpGained() * 3600L) / secondsElapsed;
76+
}
77+
}
78+

0 commit comments

Comments
 (0)