diff options
6 files changed, 339 insertions, 39 deletions
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..ee24472f 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.divanMinesOverlay, mining.divanMinesOverlayPosition); } } @@ -325,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; @@ -334,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/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 3d5c0b09..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(
@@ -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 = false;
+
+ @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..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,11 +3,11 @@ 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; 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; @@ -21,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")) @@ -50,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"); } @@ -77,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)); @@ -87,31 +77,38 @@ 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: ")) { - 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:": + 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!": + 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 (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.put(item, true); + } + } else if (notFinalMatcher.matches()) { + String item = notFinalMatcher.group("part"); + 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 new file mode 100644 index 00000000..7bf359c2 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java @@ -0,0 +1,140 @@ +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; +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 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 ]+)!"); + private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Excellent! You have returned the (?<item>[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 (?<item>[a-z-A-Z ]+)!"); + + public DivanMinesOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> 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; + + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + overlayStrings = new ArrayList<>(); + HashMap<String, String> states = new HashMap<>(); + 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"); + } + 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<Integer, Integer> 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 : 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)); + } + } + } + + 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() && 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()) + hidden.divanMinesParts.replaceAll((k, v) -> false); + else if (alreadyFoundMatcher.matches() && hidden.divanMinesParts.containsKey(alreadyFoundMatcher.group("item"))) + hidden.divanMinesParts.put(alreadyFoundMatcher.group("item"), true); + } + + @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<String> 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<TextOverlay> textOverlays = new ArrayList<>(); static { @@ -135,13 +136,26 @@ public class OverlayManager { } return TextOverlayStyle.BACKGROUND; }); - + List<String> 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); } } |