diff options
Diffstat (limited to 'src')
-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) { |