aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java42
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java28
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java30
5 files changed, 79 insertions, 51 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 2727c2fb..09fa865f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -1724,30 +1724,7 @@ public class NEUEventListener {
}
}
- private static String[] rarityArrC = new String[] {
- EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON",
- EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON",
- EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE",
- EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC",
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY",
- EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC",
- EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL",
- EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL",
- EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME",
- };
- private static final HashMap<String, String> rarityArrMap = new HashMap<>();
- static {
- rarityArrMap.put("COMMON", rarityArrC[0]);
- rarityArrMap.put("UNCOMMON", rarityArrC[1]);
- rarityArrMap.put("RARE", rarityArrC[2]);
- rarityArrMap.put("EPIC", rarityArrC[3]);
- rarityArrMap.put("LEGENDARY", rarityArrC[4]);
- rarityArrMap.put("MYTHIC", rarityArrC[5]);
- rarityArrMap.put("SPECIAL", rarityArrC[6]);
- rarityArrMap.put("VERY SPECIAL", rarityArrC[7]);
- rarityArrMap.put("SUPREME", rarityArrC[8]);
- }
private HashSet<String> percentStats = new HashSet<>();
{
@@ -1822,9 +1799,9 @@ public class NEUEventListener {
out:
for (int i = list.tagCount(); i >= 0; i--) {
String line = list.getStringTagAt(i);
- for(int j=0; j<rarityArrC.length; j++) {
+ for(int j=0; j<Utils.rarityArrC.length; j++) {
for(Map.Entry<String, JsonElement> entry : enchantsObj.entrySet()) {
- if(line.contains(rarityArrC[j] + " " + entry.getKey()) || line.contains(rarityArrC[j] + " DUNGEON " + entry.getKey())) {
+ if(line.contains(Utils.rarityArrC[j] + " " + entry.getKey()) || line.contains(Utils.rarityArrC[j] + " DUNGEON " + entry.getKey())) {
allItemEnchs = entry.getValue().getAsJsonArray();
break out;
}
@@ -1903,7 +1880,7 @@ public class NEUEventListener {
JsonElement statsE = reforgeInfo.get("reforgeStats");
- String rarityFormatted = rarityArrMap.getOrDefault(rarity, rarity);
+ String rarityFormatted = Utils.rarityArrMap.getOrDefault(rarity, rarity);
JsonElement reforgeAbilityE = reforgeInfo.get("reforgeAbility");
String reforgeAbility = null;
@@ -2068,13 +2045,14 @@ public class NEUEventListener {
//9([a-zA-Z ]+?) ([0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X))(,|$)
Pattern pattern;
try {
- pattern = Pattern.compile("(\\u00A79|\\u00A79\\u00A7d\\u00A7l)("+enchantName+") " +
+ pattern = Pattern.compile("(\\u00A79|\\u00A7(9|l)\\u00A7d\\u00A7l)(?<enchantName>"+enchantName+") " +
"(?<level>[0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX))((\\u00A79)?,|( \\u00A78(?:,?[0-9]+)*)?$)");
} catch(Exception e) {continue;} //malformed regex
Matcher matcher = pattern.matcher(line);
int matchCount = 0;
while(matcher.find() && matchCount < 5) {
- if(Utils.cleanColour(matcher.group(2)).startsWith(" ")) continue;
+ if(Utils.cleanColour(matcher.group("enchantName")).startsWith(" ")) continue;
+
matchCount++;
int level = -1;
@@ -2138,7 +2116,7 @@ public class NEUEventListener {
}
}
if(matches) {
- String enchantText = matcher.group(2);
+ String enchantText = matcher.group("enchantName");
StringBuilder extraModifiersBuilder = new StringBuilder();
if((modifierI & GuiEnchantColour.BOLD_MODIFIER) != 0) {
@@ -2164,6 +2142,8 @@ public class NEUEventListener {
"\u00A7"+colourCode+extraMods+enchantText);
line = line.replace("\u00A79\u00A7d\u00A7l"+enchantText,
"\u00A7"+colourCode+extraMods+enchantText);
+ line = line.replace("\u00A7l\u00A7d\u00A7l"+enchantText,
+ "\u00A7"+colourCode+extraMods+enchantText);
} else {
int offset = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line.replaceAll(
"\\u00A79"+enchantText+".*", ""));
@@ -2173,6 +2153,10 @@ public class NEUEventListener {
"\\u00A79\\u00A7d\\u00A7l"+enchantText+".*", ""));
line = line.replace("\u00A79\u00A7d\u00A7l"+enchantText, Utils.chromaString(enchantText,
offset/12f+index, true));
+ offset = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line.replaceAll(
+ "\\u00A7l\\u00A7d\\u00A7l"+enchantText+".*", ""));
+ line = line.replace("\u00A7l\u00A7d\u00A7l"+enchantText, Utils.chromaString(enchantText,
+ offset/12f+index, true));
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java
index ee83cb28..f5e784a4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java
@@ -172,7 +172,7 @@ public class AccessoryBagOverlay {
int yIndex = 0;
for(Map.Entry<Integer, Integer> entry : talismanCountRarity.descendingMap().entrySet()) {
- String rarityName = rarityArrC[entry.getKey()];
+ String rarityName = Utils.rarityArrC[entry.getKey()];
Utils.renderAlignedString(rarityName, EnumChatFormatting.WHITE.toString()+entry.getValue(), x+5, y+20+11*yIndex, 70);
yIndex++;
}
@@ -887,17 +887,17 @@ public class AccessoryBagOverlay {
// private static String[] rarityArr = new String[] {
// "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME"
// };
- private static String[] rarityArrC = new String[] {
- EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON",
- EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON",
- EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE",
- EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC",
- EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY",
- EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC",
- EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL",
- EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL",
- EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME",
- };
+// private static String[] rarityArrC = new String[] {
+// EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON",
+// EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON",
+// EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE",
+// EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC",
+// EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY",
+// EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC",
+// EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL",
+// EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL",
+// EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME",
+// };
public static int checkItemType(ItemStack stack, boolean contains, String... typeMatches) {
NBTTagCompound tag = stack.getTagCompound();
if(tag != null) {
@@ -955,8 +955,8 @@ public class AccessoryBagOverlay {
NBTTagList list = display.getTagList("Lore", 8);
for (int i = list.tagCount(); i >= 0; i--) {
String line = list.getStringTagAt(i);
- for(int j=0; j<rarityArrC.length; j++) {
- if(line.contains(rarityArrC[j])) {
+ for(int j=0; j<Utils.rarityArrC.length; j++) {
+ if(line.contains(Utils.rarityArrC[j])) {
return j;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index a789acfd..d4a078a9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -264,6 +264,8 @@ public class NEUConfig extends Config {
public static class Hidden {
@Expose
public HashMap<String, NEUConfig.HiddenProfileSpecific> profileSpecific = new HashMap<>();
+ @Expose
+ public HashMap<String, NEUConfig.HiddenLocationSpecific> locationSpecific = new HashMap<>();
@Expose public List<NEUConfig.InventoryButton> inventoryButtons = createDefaultInventoryButtons();
@Expose public boolean enableItemEditing = false;
@@ -284,7 +286,6 @@ public class NEUConfig extends Config {
@Expose public ArrayList<String> enchantColours = createDefaultEnchantColours();
@Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip";
@Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master";
- @Expose public Map<String, Integer> commissionMaxes = new HashMap<>();
@Expose public boolean firstTimeSearchFocus = true;
@@ -361,9 +362,20 @@ public class NEUConfig extends Config {
put("Sapphire", 0);
put("Topaz", 0);
}};
- }
+ }
+
+ public HiddenLocationSpecific getLocationSpecific() {
+ if(SBInfo.getInstance().location == null) {
+ return null;
+ }
+ return hidden.locationSpecific.computeIfAbsent(SBInfo.getInstance().getLocation(), k-> new HiddenLocationSpecific());
+ }
+
+ public static class HiddenLocationSpecific {
+ @Expose public Map<String, Integer> commissionMaxes = new HashMap<>();
+ }
- public static List<InventoryButton> createDefaultInventoryButtons() {
+ public static List<InventoryButton> createDefaultInventoryButtons() {
List<InventoryButton> buttons = new ArrayList<>();
//Below crafting
buttons.add(new InventoryButton(87, 63, null, true, false, false, 0, ""));
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
index 0beb8060..7a888191 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
@@ -79,8 +79,10 @@ public class MiningOverlay extends TextOverlay {
}
}
}
+
+ NEUConfig.HiddenLocationSpecific locationSpecific = NotEnoughUpdates.INSTANCE.config.getLocationSpecific();
if(name != null && numberValue > 0) {
- NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.put(name, numberValue);
+ locationSpecific.commissionMaxes.put(name, numberValue);
}
}
}
@@ -237,12 +239,13 @@ public class MiningOverlay extends TextOverlay {
String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info);
if (name.contains("Mithril Powder:")) {
mithrilPowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "");
+ continue;
}
if (name.contains("Gemstone Powder:")) {
gemstonePowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "");
+ continue;
}
-
if (name.matches("\\xa7r\\xa79\\xa7lForges \\xa7r(?:\\xa7f\\(\\+1 more\\)\\xa7r)?")) {
commissions = false;
forges = true;
@@ -343,8 +346,9 @@ public class MiningOverlay extends TextOverlay {
} else if (entry.getValue() >= 0.25) {
col = GOLD;
}
- if (NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.containsKey(entry.getKey())) {
- int max = NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.get(entry.getKey());
+ NEUConfig.HiddenLocationSpecific locationSpecific = NotEnoughUpdates.INSTANCE.config.getLocationSpecific();
+ int max;
+ if (-1 != (max = locationSpecific.commissionMaxes.getOrDefault(entry.getKey(), -1))) {
commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + Math.round(entry.getValue() * max) + "/" + max);
} else {
String valS = Utils.floatToString(entry.getValue() * 100, 1);
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 b796fbe3..7876776b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -470,9 +470,37 @@ public class Utils {
}
public static String[] rarityArr = new String[] {
- "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME"
+ "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME", "DIVINE"
};
+ public static String[] rarityArrC = new String[] {
+ EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON",
+ EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON",
+ EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE",
+ EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC",
+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY",
+ EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC",
+ EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL",
+ EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL",
+ EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME",
+ EnumChatFormatting.AQUA+EnumChatFormatting.BOLD.toString()+"DIVINE",
+
+ };
+ public static final HashMap<String, String> rarityArrMap = new HashMap<>();
+ static {
+ rarityArrMap.put("COMMON", rarityArrC[0]);
+ rarityArrMap.put("UNCOMMON", rarityArrC[1]);
+ rarityArrMap.put("RARE", rarityArrC[2]);
+ rarityArrMap.put("EPIC", rarityArrC[3]);
+ rarityArrMap.put("LEGENDARY", rarityArrC[4]);
+ rarityArrMap.put("MYTHIC", rarityArrC[5]);
+ rarityArrMap.put("SPECIAL", rarityArrC[6]);
+ rarityArrMap.put("VERY SPECIAL", rarityArrC[7]);
+ rarityArrMap.put("SUPREME", rarityArrC[8]);
+ rarityArrMap.put("DIVINE", rarityArrC[9]);
+
+ }
+
public static String getRarityFromInt(int rarity){
if(rarity < 0|| rarity >= rarityArr.length){ return rarityArr[0]; }
return rarityArr[rarity];