diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2022-12-22 07:22:06 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-21 21:22:06 +0100 |
commit | 4a9e1c462e4bc757c00813bab1944d42fc479d0e (patch) | |
tree | 5df37ed043cac7fa7791eeec453f11982667b846 | |
parent | c6330fc85211706ee6a3c212bfa50005981e3799 (diff) | |
download | NotEnoughUpdates-4a9e1c462e4bc757c00813bab1944d42fc479d0e.tar.gz NotEnoughUpdates-4a9e1c462e4bc757c00813bab1944d42fc479d0e.tar.bz2 NotEnoughUpdates-4a9e1c462e4bc757c00813bab1944d42fc479d0e.zip |
Added essence shop tooltip to pv (#488)
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java | 25 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java | 2 |
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) { |