aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorefefury <69400149+efefury@users.noreply.github.com>2022-08-21 10:37:00 +0000
committerGitHub <noreply@github.com>2022-08-21 20:37:00 +1000
commit013abf6525c39b99afdeba62d33dbeac9b9f766e (patch)
treeb87a8204253ac195664131231e66f20fa60723c8 /src/main
parent38771c209e98c8e0a5325798c0c99101d00f0762 (diff)
downloadNotEnoughUpdates-013abf6525c39b99afdeba62d33dbeac9b9f766e.tar.gz
NotEnoughUpdates-013abf6525c39b99afdeba62d33dbeac9b9f766e.tar.bz2
NotEnoughUpdates-013abf6525c39b99afdeba62d33dbeac9b9f766e.zip
misc dungeon profit changes (#240)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java42
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java23
3 files changed, 70 insertions, 4 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
index 31480016..3aeee590 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -23,6 +23,7 @@ import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
@@ -140,6 +141,7 @@ public class RenderListener {
private String correctingItem;
private boolean typing;
private HashMap<String, String> cachedDefinitions;
+ private boolean inDungeonPage = false;
public RenderListener(NotEnoughUpdates neu) {
this.neu = neu;
@@ -528,6 +530,12 @@ public class RenderListener {
x -= 25;
}
}
+ if (inDungeonPage) {
+ if (x + 10 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
+ y < guiTop + 100) {
+ x += 185;
+ }
+ }
GlStateManager.color(1, 1, 1, 1f);
@@ -650,6 +658,13 @@ public class RenderListener {
}
}
+ if (inDungeonPage) {
+ if (x + 10 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
+ y < guiTop + 100) {
+ x += 185;
+ }
+ }
+
if (x - guiLeft >= 85 && x - guiLeft <= 115 && y - guiTop >= 4 && y - guiTop <= 25) {
disableCraftingText = true;
}
@@ -697,7 +712,6 @@ public class RenderListener {
private void renderDungeonChestOverlay(GuiScreen gui) {
if (NotEnoughUpdates.INSTANCE.config.dungeons.profitDisplayLoc == 3) return;
-
if (gui instanceof GuiChest && NotEnoughUpdates.INSTANCE.config.dungeons.profitDisplayLoc != 2) {
try {
int xSize = ((AccessorGuiContainer) gui).getXSize();
@@ -709,8 +723,9 @@ public class RenderListener {
IInventory lower = cc.getLowerChestInventory();
ItemStack rewardChest = lower.getStackInSlot(31);
- if (rewardChest != null && rewardChest.getDisplayName().endsWith(
- EnumChatFormatting.GREEN + "Open Reward Chest")) {
+ this.inDungeonPage = rewardChest != null && rewardChest.getDisplayName().endsWith(
+ EnumChatFormatting.GREEN + "Open Reward Chest");
+ if (inDungeonPage) {
int chestCost = 0;
try {
String line6 = Utils.cleanColour(neu.manager.getLoreFromNBT(rewardChest.getTagCompound())[6]);
@@ -906,6 +921,21 @@ public class RenderListener {
160
);
}
+ JsonObject mayorJson = SBInfo.getInstance().getMayorJson();
+ JsonElement mayor = mayorJson.get("mayor");
+ if (mayorJson.has("mayor") && mayor != null && mayor.getAsJsonObject().has("name") &&
+ mayor.getAsJsonObject().get("name").getAsString().equals("Derpy")
+ && NotEnoughUpdates.INSTANCE.config.dungeons.shouldWarningDerpy) {
+ Utils.drawStringScaled(
+ EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "shMayor Derpy active!",
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + xSize + 4 + 10,
+ guiTop + 85,
+ true,
+ 0,
+ 1.3f
+ );
+ }
}
} catch (Exception e) {
e.printStackTrace();
@@ -1070,6 +1100,12 @@ public class RenderListener {
x -= 25;
}
}
+ if (inDungeonPage) {
+ if (x + 10 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
+ y < guiTop + 100) {
+ x += 185;
+ }
+ }
if (mouseX >= x && mouseX <= x + 18 && mouseY >= y && mouseY <= y + 18) {
if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java
index fead6780..e080db7d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java
@@ -114,6 +114,15 @@ public class Dungeons {
@ConfigAccordionId(id = 1)
public boolean useKismetOnDungeonProfit = true;
+ @Expose
+ @ConfigOption(
+ name = "Warning if Derpy active",
+ desc = "Shows a warning if the mayor Derpy is active"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean shouldWarningDerpy = true;
+
@ConfigOption(
name = "Dungeon Win Overlay",
desc = ""
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index 74409648..4e920aea 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -61,6 +61,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -87,6 +89,8 @@ public class SBInfo {
public Date currentTimeDate = null;
+ private JsonObject mayorJson = new JsonObject();
+
/**
* Use Utils.getOpenChestName() instead
*/
@@ -97,6 +101,7 @@ public class SBInfo {
private long lastManualLocRaw = -1;
private long lastLocRaw = -1;
public long joinedWorld = -1;
+ private long lastMayorUpdate;
public long unloadedWorld = -1;
private JsonObject locraw = null;
public boolean isInDungeon = false;
@@ -297,7 +302,10 @@ public class SBInfo {
lastLocRaw = System.currentTimeMillis();
NotEnoughUpdates.INSTANCE.sendChatMessage("/locraw");
}
-
+ if (currentTime - lastMayorUpdate > 300 * 1000) {
+ updateMayor();
+ lastMayorUpdate = currentTime;
+ }
try {
for (NetworkPlayerInfo info : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) {
String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info);
@@ -421,4 +429,17 @@ public class SBInfo {
e.printStackTrace();
}
}
+
+ public void updateMayor() {
+ NotEnoughUpdates.INSTANCE.manager.hypixelApi.getHypixelApiAsync(
+ NotEnoughUpdates.INSTANCE.config.apiData.apiKey,
+ "resources/skyblock/election",
+ new HashMap<>()
+ ).thenAcceptAsync(newJson -> mayorJson = newJson);
+ }
+
+
+ public JsonObject getMayorJson() {
+ return mayorJson;
+ }
}