aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2022-12-22 07:22:06 +1100
committerGitHub <noreply@github.com>2022-12-21 21:22:06 +0100
commit4a9e1c462e4bc757c00813bab1944d42fc479d0e (patch)
tree5df37ed043cac7fa7791eeec453f11982667b846 /src/main
parentc6330fc85211706ee6a3c212bfa50005981e3799 (diff)
downloadNotEnoughUpdates-4a9e1c462e4bc757c00813bab1944d42fc479d0e.tar.gz
NotEnoughUpdates-4a9e1c462e4bc757c00813bab1944d42fc479d0e.tar.bz2
NotEnoughUpdates-4a9e1c462e4bc757c00813bab1944d42fc479d0e.zip
Added essence shop tooltip to pv (#488)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java2
2 files changed, 25 insertions, 2 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
index 21ccc683..5f477196 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
@@ -39,6 +39,7 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -108,7 +109,9 @@ public class ExtraPage extends GuiProfileViewerPage {
float xStart,
float yStartTop,
float xOffset,
- float yOffset
+ float yOffset,
+ float mouseX,
+ float mouseY
) {
int guiLeft = GuiProfileViewer.getGuiLeft();
int guiTop = GuiProfileViewer.getGuiTop();
@@ -143,6 +146,24 @@ public class ExtraPage extends GuiProfileViewerPage {
guiTop + yStartTop + (yOffset - 1) * i,
76
);
+ if (Constants.ESSENCESHOPS == null) return;
+ JsonObject essenceShops = Constants.ESSENCESHOPS;
+ if (mouseX >= guiLeft + xStart + xOffset && mouseX <= guiLeft + xStart + xOffset + 76 &&
+ mouseY >= guiTop + yStartTop + (yOffset - 1) * i &&
+ mouseY <= guiTop + yStartTop + (yOffset - 1) * i + 10) {
+ getInstance().tooltipToDisplay = new ArrayList<>();
+ if (essenceShops.get(essenceName) == null) continue;
+
+ for (Map.Entry<String, JsonElement> entry : essenceShops.get(essenceName).getAsJsonObject().entrySet()) {
+ int perkTier =
+ (profileInfo.has("perks") && profileInfo.get("perks").getAsJsonObject().has(entry.getKey()) ? profileInfo.get("perks").getAsJsonObject().get(entry.getKey()).getAsInt() : 0);
+ getInstance().tooltipToDisplay.add(
+ EnumChatFormatting.GOLD + entry.getValue().getAsJsonObject().get("name").getAsString() + ": " + EnumChatFormatting.AQUA +
+ perkTier + "/" + entry.getValue().getAsJsonObject().get("costs").getAsJsonArray().size()
+ );
+ }
+
+ }
}
}
@@ -414,7 +435,7 @@ public class ExtraPage extends GuiProfileViewerPage {
76
);
- drawEssence(profileInfo, xStart, yStartTop, xOffset, yOffset);
+ drawEssence(profileInfo, xStart, yStartTop, xOffset, yOffset, mouseX, mouseY);
if (topKills == null) {
topKills = new TreeMap<>();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
index e7674aa9..0105ba1f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
@@ -77,6 +77,7 @@ public class Constants {
public static JsonObject WEIGHT;
public static JsonObject RNGSCORE;
public static JsonObject ABIPHONE;
+ public static JsonObject ESSENCESHOPS;
private static final ReentrantLock lock = new ReentrantLock();
@@ -100,6 +101,7 @@ public class Constants {
WEIGHT = Utils.getConstant("weight", gson);
RNGSCORE = Utils.getConstant("rngscore", gson);
ABIPHONE = Utils.getConstant("abiphone", gson);
+ ESSENCESHOPS = Utils.getConstant("essenceshops", gson);
parseEssenceCosts();
} catch (Exception ex) {