aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-03-08 16:21:23 +0100
committerGitHub <noreply@github.com>2024-03-08 16:21:23 +0100
commit4fc87fe42d9668c94c2e9208a15abd39dbb0c3ff (patch)
treebdad3c60b3cac2dc24d3f02fa4c2bf0d9a9481e7 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
parenta1f9ab2fb2052c2362caaf0a97dada95b1e9fcab (diff)
downloadnotenoughupdates-4fc87fe42d9668c94c2e9208a15abd39dbb0c3ff.tar.gz
notenoughupdates-4fc87fe42d9668c94c2e9208a15abd39dbb0c3ff.tar.bz2
notenoughupdates-4fc87fe42d9668c94c2e9208a15abd39dbb0c3ff.zip
Tooltips (#1035)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
index 3c2358cf..594facc2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DungeonNpcProfitOverlay.java
@@ -174,32 +174,38 @@ public class DungeonNpcProfitOverlay {
}
dungeonChest.name = stack.getDisplayName();
List<SkyblockItem> items = new ArrayList<>();
+ boolean isInCost = false;
for (String s : lore) {
- if ("§7Contents".equals(s) || "".equals(s) || "§7Cost".equals(s) || "§cCan't open another chest!".equals(s) ||
+ if ("§7Contents".equals(s) || "".equals(s) || "§cCan't open another chest!".equals(s) ||
"§aAlready opened!".equals(s) ||
"§eClick to open!".equals(s)) continue;
+ if ("§7Cost".equals(s)) {
+ isInCost = true;
+ continue;
+ }
//check if this line is showing the cost of opening the Chest
- if (s.endsWith(" Coins")) {
- String coinString = StringUtils.cleanColour(s);
- int whitespace = coinString.indexOf(' ');
- if (whitespace != -1) {
- String amountString = coinString.substring(0, whitespace).replace(",", "");
- dungeonChest.costToOpen = Integer.parseInt(amountString);
- continue;
+ if (isInCost) {
+ if (s.endsWith(" Coins")) {
+ String coinString = StringUtils.cleanColour(s);
+ int whitespace = coinString.indexOf(' ');
+ if (whitespace != -1) {
+ String amountString = coinString.substring(0, whitespace).replace(",", "");
+ dungeonChest.costToOpen = Integer.parseInt(amountString);
+ }
+ } else if (s.equals("§aFREE")) {
+ dungeonChest.costToOpen = 0;
}
- } else if (s.equals("§aFREE")) {
- dungeonChest.costToOpen = 0;
continue;
}
-
//check if the line can be converted to a SkyblockItem
SkyblockItem skyblockItem = SkyblockItem.createFromLoreEntry(s);
if (skyblockItem != null) {
items.add(skyblockItem);
- } else
+ } else {
System.out.println("Unexpected line " + s + " while analyzing croesus lore");
+ }
}
dungeonChest.items = items;
if (dungeonChest.costToOpen != -1) {