From 26f5797bf55cbc34c5c0ae606e6560bb0a1c5661 Mon Sep 17 00:00:00 2001 From: Phoebe <77941535+catgirlseraid@users.noreply.github.com> Date: Fri, 17 May 2024 22:29:33 +1200 Subject: Add tooltip in pv tabs and cookie buff to pv (#1173) Co-authored-by: SeRaid <77941535+SeRaid743@users.noreply.github.com> --- .../notenoughupdates/profileviewer/BasicPage.java | 16 ++++++++-------- .../notenoughupdates/profileviewer/DungeonPage.java | 12 ++++++------ .../notenoughupdates/profileviewer/ExtraPage.java | 21 +++++++++++++++------ .../profileviewer/InventoriesPage.java | 12 ++++++------ .../profileviewer/ProfileViewerUtils.java | 2 +- .../profileviewer/data/APIDataJson.java | 1 + .../profileviewer/level/LevelPage.java | 2 +- .../moulberry/notenoughupdates/util/Utils.java | 7 ++++++- 8 files changed, 44 insertions(+), 29 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java index ea71a2b5..6c43f14b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java @@ -91,7 +91,7 @@ public class BasicPage extends GuiProfileViewerPage { "first_page", Utils.editItemStackInfo( new ItemStack(Items.paper), - EnumChatFormatting.GRAY + "Front Page", + EnumChatFormatting.GRAY + "Home", true ) ); @@ -99,7 +99,7 @@ public class BasicPage extends GuiProfileViewerPage { "second_page", Utils.editItemStackInfo( skull, - EnumChatFormatting.GRAY + "Level Page", + EnumChatFormatting.GRAY + "Level", true ) ); @@ -804,7 +804,7 @@ public class BasicPage extends GuiProfileViewerPage { ); } - drawSideButtons(); + drawSideButtons(mouseX, mouseY); if (NotEnoughUpdates.INSTANCE.config.profileViewer.displayWeight) { renderWeight(mouseX, mouseY, selectedProfile); } @@ -1061,21 +1061,21 @@ public class BasicPage extends GuiProfileViewerPage { return false; } - public void drawSideButtons() { + public void drawSideButtons(int mouseX, int mouseY) { GlStateManager.enableDepth(); GlStateManager.translate(0, 0, 5); if (onSecondPage) { - Utils.drawPvSideButton(1, pageModeIcon.get("second_page"), true, guiProfileViewer); + Utils.drawPvSideButton(1, pageModeIcon.get("second_page"), true, guiProfileViewer, mouseX, mouseY); } else { - Utils.drawPvSideButton(0, pageModeIcon.get("first_page"), true, guiProfileViewer); + Utils.drawPvSideButton(0, pageModeIcon.get("first_page"), true, guiProfileViewer, mouseX, mouseY); } GlStateManager.translate(0, 0, -3); GlStateManager.translate(0, 0, -2); if (!onSecondPage) { - Utils.drawPvSideButton(1, pageModeIcon.get("second_page"), false, guiProfileViewer); + Utils.drawPvSideButton(1, pageModeIcon.get("second_page"), false, guiProfileViewer, mouseX, mouseY); } else { - Utils.drawPvSideButton(0, pageModeIcon.get("first_page"), false, guiProfileViewer); + Utils.drawPvSideButton(0, pageModeIcon.get("first_page"), false, guiProfileViewer, mouseX, mouseY); } GlStateManager.disableDepth(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java index 27f64307..998f4e72 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java @@ -593,7 +593,7 @@ public class DungeonPage extends GuiProfileViewerPage { ); } - drawSideButtons(); + drawSideButtons(mouseX, mouseY); } private boolean isHasTime(float fastestTime, String format, long runsAmount, boolean hasTime) { @@ -659,21 +659,21 @@ public class DungeonPage extends GuiProfileViewerPage { dungeonLevelTextField.keyTyped(typedChar, keyCode); } - private void drawSideButtons() { + private void drawSideButtons(int mouseX, int mouseY) { GlStateManager.enableDepth(); GlStateManager.translate(0, 0, 5); if (onMasterMode) { - Utils.drawPvSideButton(1, pageModeIcon.get("master_catacombs"), true, getInstance()); + Utils.drawPvSideButton(1, pageModeIcon.get("master_catacombs"), true, getInstance(), mouseX, mouseY); } else { - Utils.drawPvSideButton(0, pageModeIcon.get("catacombs"), true, getInstance()); + Utils.drawPvSideButton(0, pageModeIcon.get("catacombs"), true, getInstance(), mouseX, mouseY); } GlStateManager.translate(0, 0, -3); GlStateManager.translate(0, 0, -2); if (!onMasterMode) { - Utils.drawPvSideButton(1, pageModeIcon.get("master_catacombs"), false, getInstance()); + Utils.drawPvSideButton(1, pageModeIcon.get("master_catacombs"), false, getInstance(), mouseX, mouseY); } else { - Utils.drawPvSideButton(0, pageModeIcon.get("catacombs"), false, getInstance()); + Utils.drawPvSideButton(0, pageModeIcon.get("catacombs"), false, getInstance(), mouseX, mouseY); } GlStateManager.disableDepth(); } 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 fd6f701a..78ed2218 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java @@ -224,7 +224,7 @@ public class ExtraPage extends GuiProfileViewerPage { int guiLeft = GuiProfileViewer.getGuiLeft(); int guiTop = GuiProfileViewer.getGuiTop(); - drawSideButtons(); + drawSideButtons(mouseX, mouseY); if (onHoppityPage) { hoppityPage.drawPage(mouseX, mouseY, partialTicks); @@ -343,6 +343,7 @@ public class ExtraPage extends GuiProfileViewerPage { )); int fairySouls = data.fairy_soul.total_collected; + boolean cookieBuff = data.profile.cookie_buff_active; int fairySoulMax = 227; if (Constants.FAIRYSOULS != null && Constants.FAIRYSOULS.has("Max Souls")) { @@ -415,6 +416,14 @@ public class ExtraPage extends GuiProfileViewerPage { guiTop + yStartBottom + yOffset * 4, 76 ); + + Utils.renderAlignedString( + EnumChatFormatting.GOLD + "Cookie Buff", + (cookieBuff) ? EnumChatFormatting.LIGHT_PURPLE + "Active" : EnumChatFormatting.RED + "Inactive", + guiLeft + xStart, + guiTop + yStartBottom + yOffset * 5, + 76 + ); } float auctions_bids = auctions.bids; @@ -652,21 +661,21 @@ public class ExtraPage extends GuiProfileViewerPage { topKills = null; } - private void drawSideButtons() { + private void drawSideButtons(int mouseX, int mouseY) { GlStateManager.enableDepth(); GlStateManager.translate(0, 0, 5); if (onHoppityPage) { - Utils.drawPvSideButton(1, pageModeIcon.get("hoppity"), true, getInstance()); + Utils.drawPvSideButton(1, pageModeIcon.get("hoppity"), true, getInstance(), mouseX, mouseY); } else { - Utils.drawPvSideButton(0, pageModeIcon.get("stats"), true, getInstance()); + Utils.drawPvSideButton(0, pageModeIcon.get("stats"), true, getInstance(), mouseX, mouseY); } GlStateManager.translate(0, 0, -3); GlStateManager.translate(0, 0, -2); if (!onHoppityPage) { - Utils.drawPvSideButton(1, pageModeIcon.get("hoppity"), false, getInstance()); + Utils.drawPvSideButton(1, pageModeIcon.get("hoppity"), false, getInstance(), mouseX, mouseY); } else { - Utils.drawPvSideButton(0, pageModeIcon.get("stats"), false, getInstance()); + Utils.drawPvSideButton(0, pageModeIcon.get("stats"), false, getInstance(), mouseX, mouseY); } GlStateManager.disableDepth(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java index 6ce57846..63734af6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/InventoriesPage.java @@ -168,7 +168,7 @@ public class InventoriesPage extends GuiProfileViewerPage { int guiLeft = GuiProfileViewer.getGuiLeft(); int guiTop = GuiProfileViewer.getGuiTop(); - drawSideButtons(); + drawSideButtons(mouseX, mouseY); if (onSacksPage) { sacksPage.drawPage(mouseX, mouseY, partialTicks); @@ -897,21 +897,21 @@ public class InventoriesPage extends GuiProfileViewerPage { } } - private void drawSideButtons() { + private void drawSideButtons(int mouseX, int mouseY) { GlStateManager.enableDepth(); GlStateManager.translate(0, 0, 5); if (onSacksPage) { - Utils.drawPvSideButton(1, pageModeIcon.get("sacks"), true, getInstance()); + Utils.drawPvSideButton(1, pageModeIcon.get("sacks"), true, getInstance(), mouseX, mouseY); } else { - Utils.drawPvSideButton(0, pageModeIcon.get("inventories"), true, getInstance()); + Utils.drawPvSideButton(0, pageModeIcon.get("inventories"), true, getInstance(), mouseX, mouseY); } GlStateManager.translate(0, 0, -3); GlStateManager.translate(0, 0, -2); if (!onSacksPage) { - Utils.drawPvSideButton(1, pageModeIcon.get("sacks"), false, getInstance()); + Utils.drawPvSideButton(1, pageModeIcon.get("sacks"), false, getInstance(), mouseX, mouseY); } else { - Utils.drawPvSideButton(0, pageModeIcon.get("inventories"), false, getInstance()); + Utils.drawPvSideButton(0, pageModeIcon.get("inventories"), false, getInstance(), mouseX, mouseY); } GlStateManager.disableDepth(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java index f56f1fd1..11c682fc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java @@ -61,7 +61,7 @@ public class ProfileViewerUtils { public static JsonArray readInventoryInfo(JsonObject profileInfo, String bagName) { String bytes = Utils.getElementAsString( Utils.getElement(profileInfo, "inventory.bag_contents." + bagName + ".data"), - "Hz8IAAAAAAAAAD9iYD9kYD9kAAMAPwI/Gw0AAAA=" + "H4sIAAAAAAAAAONiYOBkYMzkYmBg0GUgCQAA4gDYkzoAAAA=" ); NBTTagCompound nbt; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/data/APIDataJson.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/data/APIDataJson.java index fb21c4a4..768ff674 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/data/APIDataJson.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/data/APIDataJson.java @@ -54,6 +54,7 @@ public class APIDataJson { public static class Profile { public int personal_bank_upgrade = 0; + public boolean cookie_buff_active = false; } public Experimentation experimentation = new Experimentation(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java index 60350fca..a9402500 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/LevelPage.java @@ -73,7 +73,7 @@ public class LevelPage extends GuiProfileViewerPage { int guiLeft = GuiProfileViewer.getGuiLeft(); int guiTop = GuiProfileViewer.getGuiTop(); - basicPage.drawSideButtons(); + basicPage.drawSideButtons(mouseX, mouseY); if (constant == null) { Utils.showOutdatedRepoNotification("sblevels.json"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 1e785f58..1e8fb423 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -585,7 +585,9 @@ public class Utils { int yIndex, ItemStack itemStack, boolean pressed, - GuiProfileViewer guiProfileViewer + GuiProfileViewer guiProfileViewer, + int mouseX, + int mouseY ) { int guiLeft = GuiProfileViewer.getGuiLeft(); int guiTop = GuiProfileViewer.getGuiTop(); @@ -643,6 +645,9 @@ public class Utils { GlStateManager.enableDepth(); drawItemStack(itemStack, x + 8, y + 7); + if (mouseY > y && mouseX > x && mouseY < y + 28 && mouseX < x + 28) { + guiProfileViewer.tooltipToDisplay = Collections.singletonList(itemStack.getDisplayName()); + } } public static void drawTexturedRect(float x, float y, float width, float height, int filter) { -- cgit