From 6899df634766e2a8666ac7f45cac1008da140c4e Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 16:28:33 +0200 Subject: Mines of Divan overlay --- .../notenoughupdates/NEUEventListener.java | 2 + .../notenoughupdates/options/NEUConfig.java | 3 + .../options/seperateSections/Mining.java | 126 ++++++++++++++++++ .../overlays/AutomatonOverlay.java | 43 ++++--- .../overlays/DivanMinesOverlay.java | 143 +++++++++++++++++++++ .../notenoughupdates/overlays/OverlayManager.java | 16 ++- 6 files changed, 313 insertions(+), 20 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 8c668da0..4f565fa6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -838,6 +838,8 @@ public class NEUEventListener { } if(unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ")) OverlayManager.automatonOverlay.message(unformatted); + else if(unformatted.startsWith("[NPC] Keeper of ")) + OverlayManager.divanMinesOverlay.message(unformatted); } public static boolean drawingGuiScreen = false; 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 3aca1041..380ca674 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -87,6 +87,9 @@ public class NEUConfig extends Config { return; case 10: editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.automatonOverlayPosition); + return; + case 11: + editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.divanMinesOverlayPosition); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 3d5c0b09..e8f06eca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -291,6 +291,132 @@ public class Mining { @ConfigAccordionId(id = 5) public int automatonMissingColor = 12; + @ConfigOption( + name = "Mines of Divan overlay", + desc = "" + ) + @ConfigEditorAccordion(id = 6) + public boolean divanMinesOverlayAccordion = false; + + @Expose + @ConfigOption( + name = "Enabled", + desc = "Enables the Mines of Divan overlay." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean divanMinesOverlay = true; + + @Expose + @ConfigOption( + name = "Position", + desc = "Change the position of the AMines of Divan overlay." + ) + @ConfigEditorButton( + runnableId = 11, + buttonText = "Edit" + ) + @ConfigAccordionId(id = 6) + public Position divanMinesOverlayPosition = new Position(200, 0); + + @Expose + @ConfigOption( + name = "Style", + desc = "Change the style of the Mines of Divan overlay." + ) + @ConfigEditorDropdown( + values = {"Background", "No Shadow", "Shadow", "Full Shadow"} + ) + @ConfigAccordionId(id = 6) + public int divanMinesOverlayStyle = 0; + + @Expose + @ConfigOption( + name = "Show Icons", + desc = "Show icons in the overlay that represent the part." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean divanMinesIcons = true; + + + @Expose + @ConfigOption( + name = "Hide Done", + desc = "Don't show parts you've given to the Keepers." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean divanMinesHideDone = false; + + @ConfigOption( + name = "Colours", + desc = "" + ) + @ConfigEditorAccordion(id = 7) + @ConfigAccordionId(id = 6) + public boolean divanMinesColourAccordion = false; + + @Expose + @ConfigOption( + name = "Part colour", + desc = "Change the colour of the part text." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesPartColor = 3; + + @Expose + @ConfigOption( + name = "Ready colour", + desc = "Change the colour when the part is given to the Keepers." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesDoneColor = 10; + + @Expose + @ConfigOption( + name = "In Inventory Color", + desc = "Change the colour when the part is in the inventory." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesInventoryColor = 14; + + @Expose + @ConfigOption( + name = "In Storage Color", + desc = "Change the colour when the part is in the storage." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesStorageColor = 14; + + @Expose + @ConfigOption( + name = "Missing Color", + desc = "Change the colour when the part is missing." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesMissingColor = 12; + @Expose @ConfigOption( name = "Puzzler Solver", 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 bbdb4786..e214b1c0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java @@ -7,7 +7,6 @@ import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.lwjgl.util.vector.Vector2f; @@ -93,25 +92,31 @@ public class AutomatonOverlay extends TextOverlay { items.put(item, false); } } else if (message.startsWith("[NPC] Professor Robot: ")) { - if (message.equals("[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:")) { - items.replaceAll((k, v) -> true); - } else if (message.equals("[NPC] Professor Robot: You've brought me all of the components!")) { - items.replaceAll((k, v) -> false); - } else { - 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); - } - } else if (notFinalMatcher.matches()) { - String item = notFinalMatcher.group("part"); - if (items.containsKey(item)) { - items.replaceAll((k, v) -> true); - items.put(item, false); + 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); + 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); + 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); + } + } else if (notFinalMatcher.matches()) { + String item = notFinalMatcher.group("part"); + if (items.containsKey(item)) { + items.replaceAll((k, v) -> true); + items.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 new file mode 100644 index 00000000..d6ec1d98 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java @@ -0,0 +1,143 @@ +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.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.util.vector.Vector2f; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class DivanMinesOverlay extends TextOverlay { + private static final HashMap 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 (?[a-z-A-Z ]+)!"); + private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (Excellent! You have returned the|You have already restored this Dwarf's) (?[a-z-A-Z ]+)(!| to its rightful place!)"); + 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!)"); + + 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> dummyStrings, Supplier styleSupplier) { + super(position, dummyStrings, styleSupplier); + } + + @Override + public void update() { + overlayStrings = null; + if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlay || SBInfo.getInstance().getLocation() == null || + !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Mines of Divan")) + return; + + overlayStrings = new ArrayList<>(); + HashMap states = new HashMap<>(); + for (String key : items.keySet()) { + Boolean has = items.get(key); + if (has) + states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesDoneColor] + "Done"); + } + for (ItemStack item : mc.thePlayer.inventory.mainInventory) { + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (!states.containsKey(name)) { + states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesInventoryColor] + "In Inventory"); + } + } + } + for (Map.Entry entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) { + int storageId = entry.getValue(); + StorageManager.StoragePage page = storageManager.getPage(storageId, false); + if (page != null && page.rows > 0) { + for (ItemStack item : page.items) { + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (!states.containsKey(name)) { + states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesStorageColor] + "In Storage"); + } + } + } + } + } + for (String key : items.keySet()) { + if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesHideDone || !items.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)); + } + } + } + + public void message(String message) { + Matcher foundMatcher = foundPattern.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); + } else if (resetMatcher.matches()) { + items.replaceAll((k, v) -> false); + } + } + + @Override + protected void renderLine(String line, Vector2f position, boolean dummy) { + if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesIcons) return; + GlStateManager.enableDepth(); + + ItemStack icon = null; + String cleaned = Utils.cleanColour(line); + String beforeColon = cleaned.split(":")[0]; + switch (beforeColon) { + case "Scavenged Lapis Sword": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_LAPIS_SWORD")); + break; + case "Scavenged Golden Hammer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_GOLD_HAMMER")); + break; + case "Scavenged Diamond Axe": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_DIAMOND_AXE")); + break; + case "Scavenged Emerald Hammer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_EMERALD_HAMMER")); + break; + } + + if (icon != null) { + GlStateManager.pushMatrix(); + GlStateManager.translate(position.x, position.y, 0); + GlStateManager.scale(0.5f, 0.5f, 1f); + Utils.drawItemStack(icon, 0, 0); + GlStateManager.popMatrix(); + + position.x += 12; + } + + super.renderLine(line, position, dummy); + } + + @Override + protected Vector2f getSize(List strings) { + if (NotEnoughUpdates.INSTANCE.config.mining.divanMinesIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index a08eef1e..0aa0d273 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -17,6 +17,7 @@ public class OverlayManager { public static TimersOverlay timersOverlay; public static BonemerangOverlay bonemerangOverlay; public static AutomatonOverlay automatonOverlay; + public static DivanMinesOverlay divanMinesOverlay; public static final List textOverlays = new ArrayList<>(); static { @@ -135,13 +136,26 @@ public class OverlayManager { } return TextOverlayStyle.BACKGROUND; }); - + List divanMinesOverlayDummy = Lists.newArrayList( + "\u00a73Scavenged Lapis Sword: \u00a7aDone", + "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage", + "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory", + "\u00a73Scavenged Emerald Hammer: \u00a7cMissing" + ); + divanMinesOverlay = new DivanMinesOverlay(NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlayPosition, () -> divanMinesOverlayDummy, () -> { + int style = NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlayStyle; + if(style >= 0 && style < TextOverlayStyle.values().length) { + return TextOverlayStyle.values()[style]; + } + return TextOverlayStyle.BACKGROUND; + }); textOverlays.add(miningOverlay); textOverlays.add(farmingOverlay); textOverlays.add(petInfoOverlay); textOverlays.add(bonemerangOverlay); textOverlays.add(automatonOverlay); + textOverlays.add(divanMinesOverlay); } } -- cgit From edaeda189cdad59fbb905a7c67d7b2350976b4eb Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 16:40:43 +0200 Subject: fix --- .../notenoughupdates/overlays/DivanMinesOverlay.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') 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 d6ec1d98..c1a1d227 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java @@ -24,8 +24,9 @@ public class DivanMinesOverlay extends TextOverlay { 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 (?[a-z-A-Z ]+)!"); - private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (Excellent! You have returned the|You have already restored this Dwarf's) (?[a-z-A-Z ]+)(!| to its rightful place!)"); + private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Excellent! You have returned the (?[a-z-A-Z ]+) to its rightful place!"); 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 (?[a-z-A-Z ]+)!"); static { items = new HashMap<>(); @@ -86,16 +87,18 @@ public class DivanMinesOverlay extends TextOverlay { public void message(String message) { 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"))) { + if (foundMatcher.matches() && items.containsKey(foundMatcher.group("item"))) items.put(foundMatcher.group("item"), true); - } else if (notFoundMatcher.matches() && items.containsKey(notFoundMatcher.group("item"))) { + else if (notFoundMatcher.matches() && items.containsKey(notFoundMatcher.group("item"))) items.put(notFoundMatcher.group("item"), false); - } else if (resetMatcher.matches()) { + else if (resetMatcher.matches()) items.replaceAll((k, v) -> false); - } + else if (alreadyFoundMatcher.matches() && items.containsKey(alreadyFoundMatcher.group("item"))) + items.put(alreadyFoundMatcher.group("item"), true); } @Override -- cgit From abcef8532470e4b39fd3ef0021495c3e40073ed8 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 17:48:11 +0200 Subject: saving --- .../notenoughupdates/options/NEUConfig.java | 20 ++++++++++- .../overlays/AutomatonOverlay.java | 40 +++++++++------------- .../overlays/DivanMinesOverlay.java | 34 ++++++++---------- 3 files changed, 49 insertions(+), 45 deletions(-) (limited to 'src') 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 automatonParts = new HashMap<>(); + + @Expose public HashMap 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 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 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 (?[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 (?[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> dummyStrings, Supplier 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 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 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 (?[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 (?[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> dummyStrings, Supplier 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 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 -- cgit From 2ccf69ec446c51f4db1f3a25b4e031593e933048 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 17:55:59 +0200 Subject: oops --- .../java/io/github/moulberry/notenoughupdates/options/NEUConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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 25f4dcd2..ee24472f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -89,7 +89,7 @@ public class NEUConfig extends Config { editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.automatonOverlayPosition); return; case 11: - editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.divanMinesOverlayPosition); + editOverlay(activeConfigCategory, OverlayManager.divanMinesOverlay, mining.divanMinesOverlayPosition); } } -- cgit From b4f6ba2cffcf4c9e1a91e3923c4603b581980f29 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 17:59:48 +0200 Subject: off by defualt --- .../moulberry/notenoughupdates/options/seperateSections/Mining.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index e8f06eca..b35704d0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -179,7 +179,7 @@ public class Mining { ) @ConfigEditorBoolean @ConfigAccordionId(id = 4) - public boolean automatonOverlay = true; + public boolean automatonOverlay = false; @Expose @ConfigOption( @@ -305,7 +305,7 @@ public class Mining { ) @ConfigEditorBoolean @ConfigAccordionId(id = 6) - public boolean divanMinesOverlay = true; + public boolean divanMinesOverlay = false; @Expose @ConfigOption( -- cgit