aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-23 15:08:16 +0200
committerGitHub <noreply@github.com>2022-09-23 15:08:16 +0200
commit21a353f09edc1623d339dd9f7eea639b35891d57 (patch)
tree0911353efab7419bc42c390adf7c44f80ad3f505 /src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
parent005f9ef89baa3bde63fcfc188359034606506550 (diff)
downloadnotenoughupdates-21a353f09edc1623d339dd9f7eea639b35891d57.tar.gz
notenoughupdates-21a353f09edc1623d339dd9f7eea639b35891d57.tar.bz2
notenoughupdates-21a353f09edc1623d339dd9f7eea639b35891d57.zip
probably game changing rng meter changes (#295)
* probably game changing rng meter changes * Updating the rng score with data from repo. This is needed since hypixel doesn't show the exact values for selected items. (Only 3k instead of 3,100)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
index 48eb6fad..75086b1f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemResolutionQuery.java
@@ -19,10 +19,11 @@
package io.github.moulberry.notenoughupdates.util;
-import com.google.common.collect.Iterables;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import io.github.moulberry.notenoughupdates.NEUManager;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.inventory.GuiChest;
@@ -37,6 +38,7 @@ import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -170,6 +172,40 @@ public class ItemResolutionQuery {
}
return null;
}
+ if (guiName.equals("Catacombs RNG Meter")) {
+ return resolveItemInCatacombsRngMeter();
+ }
+ return null;
+ }
+
+ private String resolveItemInCatacombsRngMeter() {
+ List<String> lore = ItemUtils.getLore(compound);
+ if (lore.size() > 16) {
+ String s = lore.get(15);
+ if (s.equals("ยง7Selected Drop")) {
+ String displayName = lore.get(16);
+ return getInternalNameByDisplayName(displayName);
+ }
+ }
+
+ return null;
+ }
+
+ private String getInternalNameByDisplayName(String displayName) {
+ String cleanDisplayName = StringUtils.cleanColour(displayName);
+ for (Map.Entry<String, JsonObject> entry : NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .entrySet()) {
+
+ JsonObject object = entry.getValue();
+ if (object.has("displayname")) {
+ String name = object.get("displayname").getAsString();
+ if (StringUtils.cleanColour(name).equals(cleanDisplayName)) {
+ return entry.getKey();
+ }
+ }
+ }
+
return null;
}