diff options
author | DoKM <mcazzyman@gmail.com> | 2021-07-05 17:11:16 +0200 |
---|---|---|
committer | DoKM <mcazzyman@gmail.com> | 2021-07-05 17:11:16 +0200 |
commit | cdb2563b6ab656fefb6b19f38d7e742ab4278d85 (patch) | |
tree | 54d170917953571bb710a3bbd81311667a3a273e /src/main/java/io | |
parent | 48f309c1676626e0c8d0128220e50e51247c9abb (diff) | |
download | NotEnoughUpdates-cdb2563b6ab656fefb6b19f38d7e742ab4278d85.tar.gz NotEnoughUpdates-cdb2563b6ab656fefb6b19f38d7e742ab4278d85.tar.bz2 NotEnoughUpdates-cdb2563b6ab656fefb6b19f38d7e742ab4278d85.zip |
fixed todo list
added colour coding to todolist
added time based display options
godpot works
array out of bounds exception due to me removing config options that are still used but not needed
Diffstat (limited to 'src/main/java/io')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java | 185 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java | 208 |
2 files changed, 333 insertions, 60 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 a80cc94a..c6203059 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -1146,13 +1146,6 @@ public class NEUConfig extends Config { ) @ConfigEditorDraggableList( exampleText = { - "\u00a73Cakes: \u00a7eInactive!", - "\u00a73Cookie Buff: \u00a7eInactive!", - "\u00a73Godpot: \u00a7eInactive!", - "\u00a73Puzzler: \u00a7eReady!", - "\u00a73Fetchur: \u00a7eReady!", - "\u00a73Commissions: \u00a7eReady!", - "\u00a73Experiments: \u00a7eReady!", "\u00a73Cakes: \u00a7e1d21h", "\u00a73Cookie Buff: \u00a7e2d23h", "\u00a73Godpot: \u00a7e19h", @@ -1164,6 +1157,182 @@ public class NEUConfig extends Config { @ConfigAccordionId(id = 0) public List<Integer> todoText = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6)); + @ConfigOption( + name = "Show Only If Soon", + desc = "" + ) + @ConfigAccordionId(id = 0) + @ConfigEditorAccordion(id = 1) + public boolean TodoAccordion = false; + + @Expose + @ConfigOption( + name = "Experimentation Display", + desc = "Change the way the experimentation timer displays\n" + + "Only when ready, When very Soon, When soon, When kinda soon or always." + ) + @ConfigAccordionId(id =1) + @ConfigEditorDropdown( + values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"} + ) + public int experimentationDisplay = 0; + + + @Expose + @ConfigOption( + name = "Puzzler Reset Display", + desc = "Change the way the puzzler reset timer displays\n" + + "Only when ready, When very Soon, When soon, When kinda soon or always." + ) + @ConfigAccordionId(id =1) + @ConfigEditorDropdown( + values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"} + ) + public int puzzlerDisplay = 0; + + @Expose + @ConfigOption( + name = "Fetchur Reset Display", + desc = "Change the way the fetchur reset timer displays\n" + + "Only when ready, When very Soon, When soon, When kinda soon or always." + ) + @ConfigAccordionId(id =1) + @ConfigEditorDropdown( + values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"} + ) + public int fetchurDisplay = 0; + + @Expose + @ConfigOption( + name = "Commission timer Display", + desc = "Change the way the Commission timer displays\n" + + "Only when ready, When very Soon, When soon, When kinda soon or always." + ) + @ConfigAccordionId(id =1) + @ConfigEditorDropdown( + values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"} + ) + public int commissionDisplay = 0; + + @Expose + @ConfigOption( + name = "Cake Buff Display", + desc = "Change the way the cake buff timer displays\n" + + "Only when ready, When very Soon, When soon, When kinda soon or always." + ) + @ConfigAccordionId(id =1) + @ConfigEditorDropdown( + values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"} + ) + public int cakesDisplay = 0; + + @Expose + @ConfigOption( + name = "Cookie Buff Display", + desc = "Change the way the cookie buff displays\n" + + "Only when ready, When very Soon, When soon, When kinda soon or always." + ) + @ConfigAccordionId(id =1) + @ConfigEditorDropdown( + values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"} + ) + public int cookieBuffDisplay = 0; + + @Expose + @ConfigOption( + name = "God Pot Display", + desc = "Change the way the god pot displays\n" + + "Only when ready, When very Soon, When soon, When kinda soon or always." + ) + @ConfigAccordionId(id =1) + @ConfigEditorDropdown( + values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"} + ) + public int godpotDisplay = 0; + + @ConfigOption( + name = "Colours", + desc = "" + ) + + @ConfigEditorAccordion(id = 2) + @ConfigAccordionId(id = 0) + public boolean TodoColourAccordion = false; + + @Expose + @ConfigOption( + name = "Ready colour", + desc = "Change the colour of when the timer is ready" + + ) + @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"} + ) + @ConfigEditorAccordion(id = 2) + public int readyColour = 0; + + @Expose + @ConfigOption( + name = "Gone colour", + desc = "Change the colour of when the timer is gone" + + ) + @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"} + ) + @ConfigEditorAccordion(id = 2) + public int goneColour = 0; + + @Expose + @ConfigOption( + name = "Very soon colour", + desc = "Change the colour of when the timer is almost ready/gone" + + ) + @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"} + ) + @ConfigEditorAccordion(id = 2) + public int verySoonColour = 0; + + @Expose + @ConfigOption( + name = "Soon Colour", + desc = "Change the colour of when the timer is soon ready/gone" + + ) + @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"} + ) + @ConfigEditorAccordion(id = 2) + public int soonColour = 0; + + @Expose + @ConfigOption( + name = "Kinda Soon Colour", + desc = "Change the colour of when the timer is kinda soon ready/gone" + + ) + @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"} + ) + @ConfigEditorAccordion(id = 2) + public int kindaSoonColour = 0; + + + @Expose + @ConfigOption( + name = "Default Colour", + desc = "Change the default colour of the timers" + + ) + + @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"} + ) + @ConfigEditorAccordion(id = 2) + public int defaultColour = 0; + @Expose @ConfigOption( name = "Todo Position", @@ -2138,7 +2307,7 @@ public class NEUConfig extends Config { } public static class HiddenProfileSpecific { - @Expose public long godPotionDrunk = 0L; + @Expose public long godPotionDuration = 0L; @Expose public long puzzlerCompleted = 0L; @Expose public long firstCakeAte = 0L; @Expose public long fetchurCompleted = 0L; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java index 0b6d1740..a1fca448 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -17,6 +17,7 @@ import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.WorldSettings; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -25,6 +26,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.util.vector.Vector2f; +import java.time.ZoneId; +import java.time.ZonedDateTime; import java.util.*; import java.util.function.Supplier; import java.util.regex.Matcher; @@ -34,7 +37,7 @@ import static net.minecraft.util.EnumChatFormatting.*; public class TimersOverlay extends TextOverlay { - private static final Pattern PATTERN_ACTIVE_EFFECTS = Pattern.compile("\u00a77You have \u00a7r\u00a7e(\\d+) \u00a7r\u00a77active effects."); + private static final Pattern PATTERN_ACTIVE_EFFECTS = Pattern.compile("\u00a7r\u00a7r\u00a77You have a \u00a7r\u00a7cGod Potion \u00a7r\u00a77active! \u00a7r\u00a7d([0-9]*?:?[0-9]*?:?[0-9]*)\u00a7r"); public TimersOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) { super(position, dummyStrings, styleSupplier); @@ -44,8 +47,7 @@ public class TimersOverlay extends TextOverlay { private static final Pattern PUZZLER_PATTERN = Pattern.compile("\u00a7r\u00a7dPuzzler\u00a7r\u00a76 gave you .+ \u00a7r\u00a76for solving the puzzle!\u00a7r"); private static final Pattern FETCHUR_PATTERN = Pattern.compile("\u00a7e\\[NPC] Fetchur\u00a7f: \u00a7rthanks thats probably what i needed\u00a7r"); private static final Pattern FETCHUR2_PATTERN = Pattern.compile("\u00a7e\\[NPC] Fetchur\u00a7f: \u00a7rcome back another time, maybe tmrw\u00a7r"); - private static final Pattern GODPOT_PATTERN = Pattern.compile("\u00a7r\u00a7a\u00a7lGULP! \u00a7r\u00a7eThe \u00a7r\u00a7cGod Potion \u00a7r\u00a7egrants you" + - " powers for \u00a7r\u00a7924 hours\u00a7r\u00a7e!\u00a7r"); + private boolean hideGodpot = false; @@ -81,11 +83,7 @@ public class TimersOverlay extends TextOverlay { return; } - Matcher godpotMatcher = GODPOT_PATTERN.matcher(event.message.getFormattedText()); - if(godpotMatcher.matches()) { - hidden.godPotionDrunk = currentTime; - return; - } + } } @@ -136,7 +134,9 @@ public class TimersOverlay extends TextOverlay { } long currentTime = System.currentTimeMillis(); - long fetchurIndex = (currentTime-18000000)/86400000 % 13 - 4; + ZonedDateTime currentTimeEST = ZonedDateTime.now(ZoneId.of("America/Atikokan")); + + long fetchurIndex = currentTimeEST.getDayOfMonth()-1 % 13; if(fetchurIndex < 0) fetchurIndex += 13; icon = FETCHUR_ICONS[(int)fetchurIndex]; @@ -162,10 +162,7 @@ public class TimersOverlay extends TextOverlay { @Override public void update() { - if(true) { - overlayStrings = null; - return; - } + long currentTime = System.currentTimeMillis(); @@ -213,12 +210,30 @@ public class TimersOverlay extends TextOverlay { String formatted = SBInfo.getInstance().footer.getFormattedText(); for(String line : formatted.split("\n")) { Matcher activeEffectsMatcher = PATTERN_ACTIVE_EFFECTS.matcher(line); - if(activeEffectsMatcher.find()) { - String numEffectsS = activeEffectsMatcher.group(1); + if(activeEffectsMatcher.matches()) { + String[] godpotRemaingTimeUnformatted= activeEffectsMatcher.group(1).split(":"); + long godPotDuration = 0; try { - int numEffects = Integer.parseInt(numEffectsS); - hideGodpot = numEffects > 25; - } catch(NumberFormatException ignored) {} + int i = 0; + if (godpotRemaingTimeUnformatted.length == 4) { + godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 24 * 60 * 60 * 1000; + i++; + } + if (godpotRemaingTimeUnformatted.length >= 3) { + godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 60 * 60 * 1000; + i++; + } + if (godpotRemaingTimeUnformatted.length >= 2) { + godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 60 * 1000; + i++; + } + if (godpotRemaingTimeUnformatted.length >= 1) { + godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 1000; + + } + } catch(Exception ignored){} + hidden.godPotionDuration = godPotDuration; + } else if(line.contains("\u00a7d\u00a7lCookie Buff")) { foundCookieBuffText = true; } else if(foundCookieBuffText) { @@ -272,59 +287,124 @@ public class TimersOverlay extends TextOverlay { HashMap<Integer, String> map = new HashMap<>(); long cakeEnd = hidden.firstCakeAte + 1000*60*60*48 - currentTime; - if(cakeEnd < 0) { - map.put(0, DARK_AQUA+"Cakes: "+YELLOW+"Inactive!"); - map.put(0+7, DARK_AQUA+"Cakes: "+YELLOW+"Inactive!"); - } else { - map.put(0+7, DARK_AQUA+"Cakes: "+YELLOW+Utils.prettyTime(cakeEnd)); + + //Cake Display + if(cakeEnd <= 0) { + map.put(0, DARK_AQUA+"Cakes: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.goneColour]+"Inactive!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.cakesDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + cakeEnd < TimeEnums.HOUR.time){ + map.put(0, DARK_AQUA+"Cakes: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(cakeEnd)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.cakesDisplay >= DISPLAYTYPE.SOON.ordinal() && + cakeEnd < TimeEnums.HALFDAY.time){ + map.put(0, DARK_AQUA+"Cakes: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(cakeEnd)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.cakesDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + cakeEnd < TimeEnums.DAY.time) { + map.put(0, DARK_AQUA+"Cakes: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(cakeEnd)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.cakesDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(0, DARK_AQUA+"Cakes: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(cakeEnd)); } + //CookieBuff Display if(hidden.cookieBuffRemaining <= 0) { - map.put(1, DARK_AQUA+"Cookie Buff: "+YELLOW+"Inactive!"); - map.put(1+7, DARK_AQUA+"Cookie Buff: "+YELLOW+"Inactive!"); - } else { - map.put(1+7, DARK_AQUA+"Cookie Buff: "+YELLOW+Utils.prettyTime(hidden.cookieBuffRemaining)); + map.put(1, DARK_AQUA+"Cookie Buff: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.goneColour]+"Inactive!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + hidden.cookieBuffRemaining < TimeEnums.HOUR.time){ + map.put(1, DARK_AQUA+"Cookie Buff: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(hidden.cookieBuffRemaining)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.SOON.ordinal() && + hidden.cookieBuffRemaining < TimeEnums.HALFDAY.time){ + map.put(1, DARK_AQUA+"Cookie Buff: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(hidden.cookieBuffRemaining)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + hidden.cookieBuffRemaining < TimeEnums.DAY.time) { + map.put(1, DARK_AQUA+"Cookie Buff: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(hidden.cookieBuffRemaining)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.cookieBuffDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(1, DARK_AQUA+"Cookie Buff: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(hidden.cookieBuffRemaining)); } - long godpotEnd = hidden.godPotionDrunk + 1000*60*60*24 - currentTime; - if(godpotEnd < 0) { - if(!hideGodpot) { - map.put(2, DARK_AQUA+"Godpot: "+YELLOW+"Inactive!"); - map.put(2+7, DARK_AQUA+"Godpot: "+YELLOW+"Inactive!"); - } - } else { - map.put(2+7, DARK_AQUA+"Godpot: "+YELLOW+Utils.prettyTime(godpotEnd)); + long godpotEnd = hidden.godPotionDuration; + //Godpot Display + if(hidden.godPotionDuration <= 0) { + map.put(2, DARK_AQUA+"Godpot: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.goneColour]+"Inactive!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + hidden.godPotionDuration < TimeEnums.HOUR.time){ + map.put(2, DARK_AQUA+"Godpot: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(hidden.godPotionDuration)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.SOON.ordinal() && + hidden.godPotionDuration < TimeEnums.HALFDAY.time){ + map.put(2, DARK_AQUA+"Godpot: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(hidden.godPotionDuration)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + hidden.godPotionDuration < TimeEnums.DAY.time) { + map.put(2, DARK_AQUA+"Godpot: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(hidden.godPotionDuration)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(2, DARK_AQUA+"Godpotf: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(hidden.godPotionDuration)); } long puzzlerEnd = hidden.puzzlerCompleted + 1000*60*60*24 - currentTime; - if(puzzlerEnd < 0) { - map.put(3, DARK_AQUA+"Puzzler: "+YELLOW+"Ready!"); - map.put(3+7, DARK_AQUA+"Puzzler: "+YELLOW+"Ready!"); - } else { - map.put(3+7, DARK_AQUA+"Puzzler: "+YELLOW+Utils.prettyTime(puzzlerEnd)); + //Puzzler Display + if((hidden.puzzlerCompleted + TimeEnums.DAY.time) < currentTime) { + map.put(3, DARK_AQUA+"Puzzler: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour]+"Ready!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.puzzlerDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + (hidden.puzzlerCompleted + (TimeEnums.DAY.time - TimeEnums.HALFANHOUR.time)) < currentTime){ + map.put(3, DARK_AQUA+"Puzzler: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(puzzlerEnd)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.puzzlerDisplay >= DISPLAYTYPE.SOON.ordinal() && + (hidden.puzzlerCompleted + (TimeEnums.DAY.time - TimeEnums.HOUR.time)) < currentTime){ + map.put(3, DARK_AQUA+"Puzzler: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(puzzlerEnd)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.puzzlerDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + (hidden.puzzlerCompleted + (TimeEnums.DAY.time - (TimeEnums.HOUR.time)*3)) < currentTime) { + map.put(3, DARK_AQUA+"Puzzler: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(puzzlerEnd)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.puzzlerDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(3, DARK_AQUA+"Puzzler: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(puzzlerEnd)); } long midnightReset = (currentTime-18000000)/86400000*86400000+18000000; long fetchurComplete = hidden.fetchurCompleted; + + long timeDiffMidnightNow = midnightReset + 86400000 - currentTime; + + //Fetchur Display if(fetchurComplete < midnightReset) { - map.put(4, DARK_AQUA+"Fetchur: "+YELLOW+"Ready!"); - map.put(4+7, DARK_AQUA+"Fetchur: "+YELLOW+"Ready!"); - } else { - map.put(4+7, DARK_AQUA+"Fetchur: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); + map.put(4, DARK_AQUA+"Fetchur: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour]+"Ready!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.fetchurDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + (fetchurComplete < (midnightReset-TimeEnums.HALFANHOUR.time))){ + map.put(4, DARK_AQUA+"Fetchur: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.fetchurDisplay >= DISPLAYTYPE.SOON.ordinal() && + (fetchurComplete < (midnightReset-TimeEnums.HOUR.time))){ + map.put(4, DARK_AQUA+"Fetchur: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.fetchurDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + (fetchurComplete < (midnightReset-(TimeEnums.HOUR.time*3)))) { + map.put(4, DARK_AQUA+"Fetchur: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.fetchurDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(4, DARK_AQUA+"Fetchur: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(timeDiffMidnightNow)); } + //Commissions Display if(hidden.commissionsCompleted < midnightReset) { - map.put(5, DARK_AQUA+"Commissions: "+YELLOW+"Ready!"); - map.put(5+7, DARK_AQUA+"Commissions: "+YELLOW+"Ready!"); - } else { - map.put(5+7, DARK_AQUA+"Commissions: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); + map.put(5, DARK_AQUA+"Commissions: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour]+"Ready!"); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.commissionDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + (hidden.commissionsCompleted < (midnightReset-TimeEnums.HALFANHOUR.time))){ + map.put(5, DARK_AQUA+"Commissions: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.commissionDisplay >= DISPLAYTYPE.SOON.ordinal() && + (hidden.commissionsCompleted < (midnightReset-TimeEnums.HOUR.time))){ + map.put(5, DARK_AQUA+"Commissions: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.commissionDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + (hidden.commissionsCompleted < (midnightReset-(TimeEnums.HOUR.time*3)))) { + map.put(5, DARK_AQUA+"Commissions: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.commissionDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(5, DARK_AQUA+"Commissions: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(timeDiffMidnightNow)); } + //Experiment Display if(hidden.experimentsCompleted < midnightReset) { - map.put(6, DARK_AQUA+"Experiments: "+YELLOW+"Ready!"); - map.put(6+7, DARK_AQUA+"Experiments: "+YELLOW+"Ready!"); - } else { - map.put(6+7, DARK_AQUA+"Experiments: "+YELLOW+Utils.prettyTime(midnightReset + 86400000 - currentTime)); + map.put(6, DARK_AQUA+"Experiments: "+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour]+"Ready!"+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + (hidden.experimentsCompleted < (midnightReset-TimeEnums.HALFANHOUR.time))){ + map.put(6, DARK_AQUA+"Experiments: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.SOON.ordinal() && + (hidden.experimentsCompleted < (midnightReset-TimeEnums.HOUR.time))){ + map.put(6, DARK_AQUA+"Experiments: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + (hidden.experimentsCompleted < (midnightReset-(TimeEnums.HOUR.time*3)))) { + map.put(6, DARK_AQUA+"Experiments: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour]+Utils.prettyTime(timeDiffMidnightNow)); + } else if(NotEnoughUpdates.INSTANCE.config.miscOverlays.experimentationDisplay >= DISPLAYTYPE.ALWAYS.ordinal()){ + map.put(6, DARK_AQUA+"Experiments: "+EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour]+Utils.prettyTime(timeDiffMidnightNow)); } overlayStrings = new ArrayList<>(); @@ -336,4 +416,28 @@ public class TimersOverlay extends TextOverlay { if(overlayStrings.isEmpty()) overlayStrings = null; } + + private enum TimeEnums { + DAY (86400000), + HALFDAY(43200000), + HOUR(3600000), + HALFANHOUR(1800000); + + TimeEnums(long time) { + this.time = time; + } + + public final long time; + } + + private enum DISPLAYTYPE { + NOW, + VERYSOON, + SOON, + KINDASOON, + ALWAYS, + + } + } + |