diff options
Diffstat (limited to 'src')
3 files changed, 49 insertions, 45 deletions
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 380ca674..25f4dcd2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -328,7 +328,7 @@ public class NEUConfig extends Config { public static class HiddenProfileSpecific { - @Expose public long godPotionDuration = 0l; + @Expose public long godPotionDuration = 0L; @Expose public long puzzlerCompleted = 0L; @Expose public long firstCakeAte = 0L; @Expose public long fetchurCompleted = 0L; @@ -337,6 +337,24 @@ public class NEUConfig extends Config { @Expose public long cookieBuffRemaining = 0L; @Expose public int commissionMilestone = 0; + + @Expose public HashMap<String, Boolean> automatonParts = new HashMap<>(); + + @Expose public HashMap<String, Boolean> divanMinesParts = new HashMap<>(); + + public HiddenProfileSpecific(){ + automatonParts.putIfAbsent("Electron Transmitter", false); + automatonParts.putIfAbsent("FTX 3070", false); + automatonParts.putIfAbsent("Robotron Reflector", false); + automatonParts.putIfAbsent("Superlite Motor", false); + automatonParts.putIfAbsent("Control Switch", false); + automatonParts.putIfAbsent("Synthetic Heart", false); + + divanMinesParts.putIfAbsent("Scavenged Lapis Sword", false); + divanMinesParts.putIfAbsent("Scavenged Golden Hammer", false); + divanMinesParts.putIfAbsent("Scavenged Diamond Axe", false); + divanMinesParts.putIfAbsent("Scavenged Emerald Hammer", false); + } } public static List<InventoryButton> createDefaultInventoryButtons() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java index e214b1c0..878bbc44 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.overlays; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -20,28 +21,18 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class AutomatonOverlay extends TextOverlay { - private static final HashMap<String, Boolean> items; private static final Minecraft mc = Minecraft.getMinecraft(); private final StorageManager storageManager = StorageManager.getInstance(); private final Pattern givePattern = Pattern.compile("\\[NPC] Professor Robot: Thanks for bringing me the (?<part>[a-zA-Z0-9 ]+)! Bring me (\\d+|one) more components? to fix the giant!"); private final Pattern notFinalPattern = Pattern.compile("\\[NPC] Professor Robot: That's not the final component! Bring me a (?<part>[a-zA-Z0-9 ]+) to gain access to Automaton Prime's storage container!"); - static { - items = new HashMap<>(); - items.put("Electron Transmitter", false); - items.put("FTX 3070", false); - items.put("Robotron Reflector", false); - items.put("Superlite Motor", false); - items.put("Control Switch", false); - items.put("Synthetic Heart", false); - } - public AutomatonOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) { super(position, dummyStrings, styleSupplier); } @Override public void update() { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); overlayStrings = null; if (!NotEnoughUpdates.INSTANCE.config.mining.automatonOverlay || SBInfo.getInstance().getLocation() == null || !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Lost Precursor City")) @@ -49,8 +40,8 @@ public class AutomatonOverlay extends TextOverlay { overlayStrings = new ArrayList<>(); HashMap<String, String> states = new HashMap<>(); - for (String key : items.keySet()) { - Boolean has = items.get(key); + for (String key : hidden.automatonParts.keySet()) { + Boolean has = hidden.automatonParts.get(key); if (has) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonDoneColor] + "Done"); } @@ -76,8 +67,8 @@ public class AutomatonOverlay extends TextOverlay { } } } - for (String key : items.keySet()) { - if (!NotEnoughUpdates.INSTANCE.config.mining.automatonHideDone || !items.get(key)) { + for (String key : hidden.automatonParts.keySet()) { + if (!NotEnoughUpdates.INSTANCE.config.mining.automatonHideDone || !hidden.automatonParts.get(key)) { if (!states.containsKey(key)) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonMissingColor] + "Missing"); overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonPartColor] + key + ": " + states.get(key)); @@ -86,34 +77,35 @@ public class AutomatonOverlay extends TextOverlay { } public void message(String message) { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); if (message.startsWith(" ")) { String item = message.replace(" ", ""); - if (items.containsKey(item)) { - items.put(item, false); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.put(item, false); } } else if (message.startsWith("[NPC] Professor Robot: ")) { switch (message) { case "[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:": - items.replaceAll((k, v) -> true); + hidden.automatonParts.replaceAll((k, v) -> true); break; case "[NPC] Professor Robot: You've brought me all of the components!": case "[NPC] Professor Robot: You haven't placed the Sapphire Crystal yet!": case "[NPC] Professor Robot: You have already placed the Sapphire Crystal!": - items.replaceAll((k, v) -> false); + hidden.automatonParts.replaceAll((k, v) -> false); break; default: Matcher giveMatcher = givePattern.matcher(message); Matcher notFinalMatcher = notFinalPattern.matcher(message); if (giveMatcher.matches()) { String item = giveMatcher.group("part"); - if (items.containsKey(item)) { - items.put(item, true); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.put(item, true); } } else if (notFinalMatcher.matches()) { String item = notFinalMatcher.group("part"); - if (items.containsKey(item)) { - items.replaceAll((k, v) -> true); - items.put(item, false); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.replaceAll((k, v) -> true); + hidden.automatonParts.put(item, false); } } break; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java index c1a1d227..7bf359c2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.overlays; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -20,7 +21,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class DivanMinesOverlay extends TextOverlay { - private static final HashMap<String, Boolean> items; private static final Minecraft mc = Minecraft.getMinecraft(); private final StorageManager storageManager = StorageManager.getInstance(); private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?<item>[a-z-A-Z ]+)!"); @@ -28,14 +28,6 @@ public class DivanMinesOverlay extends TextOverlay { private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You haven't placed the Jade Crystal yet!|You found all of the items! Behold\\.\\.\\. the Jade Crystal!|You have already placed the Jade Crystal!)"); private final Pattern alreadyFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: You have already restored this Dwarf's (?<item>[a-z-A-Z ]+)!"); - static { - items = new HashMap<>(); - items.put("Scavenged Lapis Sword", false); - items.put("Scavenged Golden Hammer", false); - items.put("Scavenged Diamond Axe", false); - items.put("Scavenged Emerald Hammer", false); - } - public DivanMinesOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) { super(position, dummyStrings, styleSupplier); } @@ -47,10 +39,11 @@ public class DivanMinesOverlay extends TextOverlay { !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Mines of Divan")) return; + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); overlayStrings = new ArrayList<>(); HashMap<String, String> states = new HashMap<>(); - for (String key : items.keySet()) { - Boolean has = items.get(key); + for (String key : hidden.divanMinesParts.keySet()) { + Boolean has = hidden.divanMinesParts.get(key); if (has) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesDoneColor] + "Done"); } @@ -76,8 +69,8 @@ public class DivanMinesOverlay extends TextOverlay { } } } - for (String key : items.keySet()) { - if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesHideDone || !items.get(key)) { + for (String key : hidden.divanMinesParts.keySet()) { + if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesHideDone || !hidden.divanMinesParts.get(key)) { if (!states.containsKey(key)) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesMissingColor] + "Missing"); overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesPartColor] + key + ": " + states.get(key)); @@ -86,19 +79,20 @@ public class DivanMinesOverlay extends TextOverlay { } public void message(String message) { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); Matcher foundMatcher = foundPattern.matcher(message); Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message); Matcher notFoundMatcher = notFoundPattern.matcher(message); Matcher resetMatcher = resetPattern.matcher(message); System.out.println(message); - if (foundMatcher.matches() && items.containsKey(foundMatcher.group("item"))) - items.put(foundMatcher.group("item"), true); - else if (notFoundMatcher.matches() && items.containsKey(notFoundMatcher.group("item"))) - items.put(notFoundMatcher.group("item"), false); + if (foundMatcher.matches() && hidden.divanMinesParts.containsKey(foundMatcher.group("item"))) + hidden.divanMinesParts.put(foundMatcher.group("item"), true); + else if (notFoundMatcher.matches() && hidden.divanMinesParts.containsKey(notFoundMatcher.group("item"))) + hidden.divanMinesParts.put(notFoundMatcher.group("item"), false); else if (resetMatcher.matches()) - items.replaceAll((k, v) -> false); - else if (alreadyFoundMatcher.matches() && items.containsKey(alreadyFoundMatcher.group("item"))) - items.put(alreadyFoundMatcher.group("item"), true); + hidden.divanMinesParts.replaceAll((k, v) -> false); + else if (alreadyFoundMatcher.matches() && hidden.divanMinesParts.containsKey(alreadyFoundMatcher.group("item"))) + hidden.divanMinesParts.put(alreadyFoundMatcher.group("item"), true); } @Override |