aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/DungeonTimer.java
diff options
context:
space:
mode:
authorRabbitType99 <luis.be@gmx.de>2021-03-09 23:27:30 +0100
committerRabbitType99 <luis.be@gmx.de>2021-03-09 23:27:30 +0100
commitcb5106e11c553108a63b9aa8b44c70a449ef627d (patch)
tree4a498919931327c7fff10d9891c9551b4181de1b /src/main/java/me/Danker/features/DungeonTimer.java
parent87f5d4c76b907da4fb5952e7dff5ebad88b080d8 (diff)
parente7237307e71c649b4b7c880259ff1781fcc7c435 (diff)
downloadSkyblockMod-cb5106e11c553108a63b9aa8b44c70a449ef627d.tar.gz
SkyblockMod-cb5106e11c553108a63b9aa8b44c70a449ef627d.tar.bz2
SkyblockMod-cb5106e11c553108a63b9aa8b44c70a449ef627d.zip
Merge branch 'development' into InstallerFrame
# Conflicts: # build.gradle
Diffstat (limited to 'src/main/java/me/Danker/features/DungeonTimer.java')
-rw-r--r--src/main/java/me/Danker/features/DungeonTimer.java79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/DungeonTimer.java b/src/main/java/me/Danker/features/DungeonTimer.java
new file mode 100644
index 0000000..5929f05
--- /dev/null
+++ b/src/main/java/me/Danker/features/DungeonTimer.java
@@ -0,0 +1,79 @@
+package me.Danker.features;
+
+import me.Danker.commands.MoveCommand;
+import me.Danker.commands.ScaleCommand;
+import me.Danker.commands.ToggleCommand;
+import me.Danker.events.RenderOverlay;
+import me.Danker.handlers.TextRenderer;
+import me.Danker.utils.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StringUtils;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+public class DungeonTimer {
+
+ static double dungeonStartTime = 0;
+ static double bloodOpenTime = 0;
+ static double watcherClearTime = 0;
+ static double bossClearTime = 0;
+ static int witherDoors = 0;
+ static int dungeonDeaths = 0;
+ static int puzzleFails = 0;
+
+ @SubscribeEvent
+ public void onChat(ClientChatReceivedEvent event) {
+ String message = StringUtils.stripControlCodes(event.message.getUnformattedText());
+
+ if (!Utils.inDungeons) return;
+
+ if (message.contains("[BOSS] The Watcher: You have proven yourself. You may pass.")) {
+ watcherClearTime = System.currentTimeMillis() / 1000;
+ } else if (message.contains("PUZZLE FAIL! ") || message.contains("chose the wrong answer! I shall never forget this moment")) {
+ puzzleFails++;
+ }
+
+ if (message.contains(":")) return;
+
+ if (message.contains("Dungeon starts in 1 second.")) { // Dungeons Stuff
+ dungeonStartTime = System.currentTimeMillis() / 1000 + 1;
+ bloodOpenTime = dungeonStartTime;
+ watcherClearTime = dungeonStartTime;
+ bossClearTime = dungeonStartTime;
+ witherDoors = 0;
+ dungeonDeaths = 0;
+ puzzleFails = 0;
+ } else if (message.contains("The BLOOD DOOR has been opened!")) {
+ bloodOpenTime = System.currentTimeMillis() / 1000;
+ } else if (message.contains(" opened a WITHER door!")) {
+ witherDoors++;
+ } else if (message.contains(" and became a ghost.")) {
+ dungeonDeaths++;
+ } else if (message.contains(" Defeated ") && message.contains(" in ")) {
+ bossClearTime = System.currentTimeMillis() / 1000;
+ }
+ }
+
+ @SubscribeEvent
+ public void renderPlayerInfo(RenderOverlay event) {
+ if (ToggleCommand.dungeonTimerToggled && Utils.inDungeons) {
+ Minecraft mc = Minecraft.getMinecraft();
+ String dungeonTimerText = EnumChatFormatting.GRAY + "Wither Doors:\n" +
+ EnumChatFormatting.DARK_RED + "Blood Open:\n" +
+ EnumChatFormatting.RED + "Watcher Clear:\n" +
+ EnumChatFormatting.BLUE + "Boss Clear:\n" +
+ EnumChatFormatting.YELLOW + "Deaths:\n" +
+ EnumChatFormatting.YELLOW + "Puzzle Fails:";
+ String dungeonTimers = EnumChatFormatting.GRAY + "" + witherDoors + "\n" +
+ EnumChatFormatting.DARK_RED + Utils.getTimeBetween(dungeonStartTime, bloodOpenTime) + "\n" +
+ EnumChatFormatting.RED + Utils.getTimeBetween(dungeonStartTime, watcherClearTime) + "\n" +
+ EnumChatFormatting.BLUE + Utils.getTimeBetween(dungeonStartTime, bossClearTime) + "\n" +
+ EnumChatFormatting.YELLOW + dungeonDeaths + "\n" +
+ EnumChatFormatting.YELLOW + puzzleFails;
+ new TextRenderer(mc, dungeonTimerText, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale);
+ new TextRenderer(mc, dungeonTimers, (int) (MoveCommand.dungeonTimerXY[0] + (80 * ScaleCommand.dungeonTimerScale)), MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale);
+ }
+ }
+
+}