diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-12-23 01:35:10 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-12-23 01:35:10 -0500 |
commit | aaba0391a06ac4546d7ec5ce684534c35d9cbc82 (patch) | |
tree | 9a067fc19577e66bc4362ab4770e6b7af088ddff /src/main/java/me/Danker | |
parent | 457305a5c1894d776b7c30ecc0f4f0cd8edc1e86 (diff) | |
download | SkyblockMod-aaba0391a06ac4546d7ec5ce684534c35d9cbc82.tar.gz SkyblockMod-aaba0391a06ac4546d7ec5ce684534c35d9cbc82.tar.bz2 SkyblockMod-aaba0391a06ac4546d7ec5ce684534c35d9cbc82.zip |
Add dungeon score display
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 1 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/DankerGuiCommand.java | 70 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/MoveCommand.java | 13 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ScaleCommand.java | 10 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ToggleCommand.java | 11 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/DungeonScore.java | 224 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/DankerGui.java | 7 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/EditLocationsGui.java | 25 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 4 |
9 files changed, 290 insertions, 75 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 2ad5141..91f561a 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -121,6 +121,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new CreeperSolver()); MinecraftForge.EVENT_BUS.register(new CrystalHollowWaypoints()); MinecraftForge.EVENT_BUS.register(new CustomMusic()); + MinecraftForge.EVENT_BUS.register(new DungeonScore()); MinecraftForge.EVENT_BUS.register(new DungeonTimer()); MinecraftForge.EVENT_BUS.register(new EndOfFarmAlert()); MinecraftForge.EVENT_BUS.register(new ExpertiseLore()); diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 0bf82f9..14041d1 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -48,75 +48,6 @@ public class DankerGuiCommand extends CommandBase { if (arg1.length > 0 && arg1[0].equalsIgnoreCase("debug")) { StringBuilder debug = new StringBuilder(); debug.append("```md\n"); - debug.append("# Toggles\n"); - debug.append("[gparty][").append(ToggleCommand.gpartyToggled).append("]\n"); - debug.append("[coords][").append(ToggleCommand.coordsToggled).append("]\n"); - debug.append("[golden][").append(ToggleCommand.goldenToggled).append("]\n"); - debug.append("[slayercount][").append(ToggleCommand.slayerCountTotal).append("]\n"); - debug.append("[rngesusalerts][").append(ToggleCommand.rngesusAlerts).append("]\n"); - debug.append("[splitfishing][").append(ToggleCommand.splitFishing).append("]\n"); - debug.append("[chatmaddox][").append(ToggleCommand.chatMaddoxToggled).append("]\n"); - debug.append("[spiritbearalerts][").append(ToggleCommand.spiritBearAlerts).append("]\n"); - debug.append("[flowerweapons][").append(ToggleCommand.flowerWeaponsToggled).append("]\n"); - debug.append("[sceptremessages][").append(ToggleCommand.sceptreMessages).append("]\n"); - debug.append("[petcolors][").append(ToggleCommand.petColoursToggled).append("]\n"); - debug.append("[dungeontimer][").append(ToggleCommand.dungeonTimerToggled).append("]\n"); - debug.append("[golemalerts][").append(ToggleCommand.golemAlertToggled).append("]\n"); - debug.append("[expertiselore][").append(ToggleCommand.expertiseLoreToggled).append("]\n"); - debug.append("[skill50display][").append(ToggleCommand.skill50DisplayToggled).append("]\n"); - debug.append("[outlinetext][").append(ToggleCommand.outlineTextToggled).append("]\n"); - debug.append("[midasstaffmessages][").append(ToggleCommand.midasStaffMessages).append("]\n"); - debug.append("[implosionmessages][").append(ToggleCommand.implosionMessages).append("]\n"); - debug.append("[healmessages][").append(ToggleCommand.healMessages).append("]\n"); - debug.append("[cooldownmessages][").append(ToggleCommand.cooldownMessages).append("]\n"); - debug.append("[manamessages][").append(ToggleCommand.manaMessages).append("]\n"); - debug.append("[killcombomessages][").append(ToggleCommand.killComboMessages).append("]\n"); - debug.append("[caketimer][").append(ToggleCommand.cakeTimerToggled).append("]\n"); - debug.append("[lowhealthnotify][").append(ToggleCommand.lowHealthNotifyToggled).append("]\n"); - debug.append("[lividsolver][").append(ToggleCommand.lividSolverToggled).append("]\n"); - debug.append("[stopsalvagestarred][").append(ToggleCommand.stopSalvageStarredToggled).append("]\n"); - debug.append("[notifyslayerslain][").append(ToggleCommand.notifySlayerSlainToggled).append("]\n"); - debug.append("[necronnotifications][").append(ToggleCommand.necronNotificationsToggled).append("]\n"); - debug.append("[bonzotimer][").append(ToggleCommand.bonzoTimerToggled).append("]\n"); - debug.append("[autoskilltracker][").append(ToggleCommand.autoSkillTrackerToggled).append("]\n"); - debug.append("[threemanpuzzle][").append(ToggleCommand.threeManToggled).append("]\n"); - debug.append("[oruopuzzle][").append(ToggleCommand.oruoToggled).append("]\n"); - debug.append("[blazepuzzle][").append(ToggleCommand.blazeToggled).append("]\n"); - debug.append("[creeperpuzzle][").append(ToggleCommand.creeperToggled).append("]\n"); - debug.append("[creeperlines][").append(ToggleCommand.creeperLinesToggled).append("]\n"); - debug.append("[waterpuzzle][").append(ToggleCommand.waterToggled).append("]\n"); - debug.append("[tictactoepuzzle][").append(ToggleCommand.ticTacToeToggled).append("]\n"); - debug.append("[boulderpuzzle][").append(ToggleCommand.boulderToggled).append("]\n"); - debug.append("[silverfishpuzzle][").append(ToggleCommand.silverfishToggled).append("]\n"); - debug.append("[icewalkpuzzle][").append(ToggleCommand.iceWalkToggled).append("]\n"); - debug.append("[watchermessage][").append(ToggleCommand.watcherReadyToggled).append("]\n"); - debug.append("[startswithterminal][").append(ToggleCommand.startsWithToggled).append("]\n"); - debug.append("[selectallterminal][").append(ToggleCommand.selectAllToggled).append("]\n"); - debug.append("[clickinorderterminal][").append(ToggleCommand.clickInOrderToggled).append("]\n"); - debug.append("[blockwrongterminalclicks][").append(ToggleCommand.blockWrongTerminalClicksToggled).append("]\n"); - debug.append("[itemframeonsealanterns][").append(ToggleCommand.itemFrameOnSeaLanternsToggled).append("]\n"); - debug.append("[ultrasequencer][").append(ToggleCommand.ultrasequencerToggled).append("]\n"); - debug.append("[chronomatron][").append(ToggleCommand.chronomatronToggled).append("]\n"); - debug.append("[superpairs][").append(ToggleCommand.superpairsToggled).append("]\n"); - debug.append("[hidetooltipsinaddons][").append(ToggleCommand.hideTooltipsInExperimentAddonsToggled).append("]\n"); - debug.append("[pickblock][").append(ToggleCommand.swapToPickBlockToggled).append("]\n"); - debug.append("[melodytooltips][").append(ToggleCommand.melodyTooltips).append("]\n"); - debug.append("[highlightslayers][").append(ToggleCommand.highlightSlayers).append("]\n"); - debug.append("[highlightarachne][").append(ToggleCommand.highlightArachne).append("]\n"); - debug.append("[highlightskeletonmasters][").append(ToggleCommand.highlightSkeletonMasters).append("]\n"); - debug.append("[teammatesinradius][").append(ToggleCommand.teammatesInRadius).append("]\n"); - debug.append("[gianthp][").append(ToggleCommand.giantHP).append("]\n"); - debug.append("[hidepetcandy][").append(ToggleCommand.hidePetCandy).append("]\n"); - debug.append("[customcolourednames][").append(ToggleCommand.customColouredNames).append("]\n"); - debug.append("[endoffarmalert][").append(ToggleCommand.endOfFarmAlert).append("]\n"); - debug.append("[gemstonelore][").append(ToggleCommand.gemstoneLore).append("]\n"); - debug.append("[crystalhollowwaypoints][").append(ToggleCommand.crystalHollowWaypoints).append("]\n"); - debug.append("[crystalautowaypoints][").append(ToggleCommand.crystalAutoWaypoints).append("]\n"); - debug.append("[autoacceptreparty][").append(ToggleCommand.autoAcceptReparty).append("]\n"); - debug.append("[abilitycooldowns][").append(ToggleCommand.abilityCooldowns).append("]\n"); - debug.append("[dungeonbossmusic][").append(ToggleCommand.dungeonBossMusic).append("]\n"); - debug.append("[bloodroommusic][").append(ToggleCommand.bloodRoomMusic).append("]\n"); - debug.append("[dungeonmusic][").append(ToggleCommand.dungeonMusic).append("]\n"); debug.append("# Locations\n"); debug.append("[coords][").append(MoveCommand.coordsXY[0]).append(", ").append(MoveCommand.coordsXY[1]).append("]\n"); debug.append("[display][").append(MoveCommand.displayXY[0]).append(", ").append(MoveCommand.displayXY[1]).append("]\n"); @@ -131,6 +62,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[teammatesinradius][").append(MoveCommand.teammatesInRadiusXY[0]).append(", ").append(MoveCommand.teammatesInRadiusXY[1]).append("]\n"); debug.append("[gianthp][").append(MoveCommand.giantHPXY[0]).append(", ").append(MoveCommand.giantHPXY[1]).append("]\n"); debug.append("[abilitycooldowns][").append(MoveCommand.abilityCooldownsXY[0]).append(", ").append(MoveCommand.abilityCooldownsXY[1]).append("]\n"); + debug.append("[dungeonscore][").append(MoveCommand.dungeonScoreXY[0]).append(", ").append(MoveCommand.dungeonScoreXY[1]).append("]\n"); debug.append("# Other Settings\n"); debug.append("[Current Display][").append(LootDisplay.display).append("]\n"); debug.append("[Auto Display][").append(LootDisplay.auto).append("]\n"); diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index a43d09b..5a6c6a2 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -26,6 +26,7 @@ public class MoveCommand extends CommandBase { public static int[] teammatesInRadiusXY = {0, 0}; public static int[] giantHPXY = {0, 0}; public static int[] abilityCooldownsXY = {0, 0}; + public static int[] dungeonScoreXY = {0, 0}; @Override public String getCommandName() { @@ -35,7 +36,8 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/" + - "wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp/abilitycooldowns> <x> <y>"; + "wateranswer/bonzotimer/golemtimer/teammatesinradius/gianthp/" + + "abilitycooldowns/dungeonscore> <x> <y>"; } public static String usage(ICommandSender arg0) { @@ -52,7 +54,7 @@ public class MoveCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius", - "gianthp", "abilitycooldowns"); + "gianthp", "abilitycooldowns", "dungeonscore"); } return null; } @@ -158,6 +160,13 @@ public class MoveCommand extends CommandBase { ConfigHandler.writeIntConfig("locations", "abilityCooldownsY", abilityCooldownsXY[1]); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ability cooldowns has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); break; + case "dungeonscore": + dungeonScoreXY[0] = Integer.parseInt(arg1[1]); + dungeonScoreXY[1] = Integer.parseInt(arg1[2]); + ConfigHandler.writeIntConfig("locations", "dungeonScoreX", dungeonScoreXY[0]); + ConfigHandler.writeIntConfig("locations", "dungeonScoreY", dungeonScoreXY[1]); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Dungeon score has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index b38d57e..9bb1f08 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -26,6 +26,7 @@ public class ScaleCommand extends CommandBase { public static double teammatesInRadiusScale; public static double giantHPScale; public static double abilityCooldownsScale; + public static double dungeonScoreScale; @Override public String getCommandName() { @@ -35,7 +36,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/" + - "bonzotimer/golemtimer/teammatesinradius/gianthp/abilitycooldown> <size (0.1 - 10)>"; + "bonzotimer/golemtimer/teammatesinradius/gianthp/abilitycooldown/dungeonscore> <size (0.1 - 10)>"; } public static String usage(ICommandSender arg0) { @@ -52,7 +53,7 @@ public class ScaleCommand extends CommandBase { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius", - "gianthp", "abilitycooldowns"); + "gianthp", "abilitycooldowns", "dungeonscore"); } return null; } @@ -138,6 +139,11 @@ public class ScaleCommand extends CommandBase { ConfigHandler.writeDoubleConfig("scales", "abilityCooldownsScale", abilityCooldownsScale); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ability cooldowns has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + abilityCooldownsScale + "x")); break; + case "dungeonscore": + dungeonScoreScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "dungeonScoreScale", dungeonScoreScale); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Dungeon score has been scaled to " + DankersSkyblockMod.SECONDARY_COLOUR + dungeonScoreScale + "x")); + break; default: player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index d9ef9b3..94425c0 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -47,6 +47,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean autoAcceptReparty; public static boolean abilityCooldowns; public static boolean alerts; + public static boolean dungeonScore; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; @@ -145,7 +146,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "gemstonelore", "crystalhollowwaypoints", "crystalautowaypoints", "autoacceptreparty", "itemcooldowns", "hubmusic", "islandmusic", "dungeonhubmusic", "farmingislandsmusic", "goldminemusic", "deepcavernsmusic", "dwarvenminesmusic", "crystalhollowsmusic", "spidersdenmusic", "blazingfortressmusic", - "endmusic", "parkmusic", "alerts", "list"); + "endmusic", "parkmusic", "alerts", "dungeonscore", "list"); } return null; } @@ -592,6 +593,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "Alerts", alerts); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Alerts has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + alerts + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "dungeonscore": + dungeonScore = !dungeonScore; + ConfigHandler.writeBooleanConfig("toggles", "DungeonScore", dungeonScore); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Dungeon score has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + dungeonScore + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "list": player.addChatMessage(new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + "Guild party notifications: " + DankersSkyblockMod.VALUE_COLOUR + gpartyToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Coord/Angle display: " + DankersSkyblockMod.VALUE_COLOUR + coordsToggled + "\n" + @@ -666,7 +672,8 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Custom blazing fortress music: " + DankersSkyblockMod.VALUE_COLOUR + blazingFortressMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom end music: " + DankersSkyblockMod.VALUE_COLOUR + endMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom park music: " + DankersSkyblockMod.VALUE_COLOUR + parkMusic + "\n" + - DankersSkyblockMod.TYPE_COLOUR + " Alerts: " + DankersSkyblockMod.VALUE_COLOUR + alerts + DankersSkyblockMod.TYPE_COLOUR + " Alerts: " + DankersSkyblockMod.VALUE_COLOUR + alerts + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Dungeon score: " + DankersSkyblockMod.VALUE_COLOUR + dungeonScore )); break; default: diff --git a/src/main/java/me/Danker/features/DungeonScore.java b/src/main/java/me/Danker/features/DungeonScore.java new file mode 100644 index 0000000..a2bc6e3 --- /dev/null +++ b/src/main/java/me/Danker/features/DungeonScore.java @@ -0,0 +1,224 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlayEvent; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.Collection; +import java.util.List; + +public class DungeonScore { + + int failedPuzzles; + int skillScore; + String secrets; + int exploreScore; + int timeScore; + int bonusScore; + + @SubscribeEvent(receiveCanceled = true) + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (!ToggleCommand.dungeonScore || !Utils.inDungeons) return; + + if (message.contains("PUZZLE FAIL! ") || message.contains("chose the wrong answer! I shall never forget this moment")) { + failedPuzzles++; + } + + if (message.contains(":")) return; + + if (message.contains(" and became a ghost.")) { + skillScore = MathHelper.clamp_int(skillScore - 2, 0, 100); + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + if (!ToggleCommand.dungeonScore || !Utils.inDungeons) return; + + if (DankersSkyblockMod.tickAmount % 20 == 0) { + String floor = ""; + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (sCleaned.contains("The Catacombs (")) { + if (sCleaned.contains("F1")) { + floor = "F1"; + } else if (sCleaned.contains("F2")) { + floor = "F2"; + } else if (sCleaned.contains("F3")) { + floor = "F3"; + } else if (sCleaned.contains("F4")) { + floor = "F4"; + } else if (sCleaned.contains("F5")) { + floor = "F5"; + } else if (sCleaned.contains("F6")) { + floor = "F6"; + } else if (sCleaned.contains("F7")) { + floor = "F7"; + } + } + } + + int missingPuzzles = 0; + double openedRooms = 0; + double completedRooms = 0; + double roomScore = 0; + double secretScore = 0; + + Collection<NetworkPlayerInfo> players = Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap(); + for (NetworkPlayerInfo player : players) { + if (player == null || player.getDisplayName() == null) continue; + String display = player.getDisplayName().getUnformattedText(); + + if (display.startsWith(" Opened Rooms: ")) { + openedRooms = Double.parseDouble(display.replaceAll("[^\\d]", "")); + } else if (display.startsWith(" Completed Rooms: ")) { + completedRooms = Double.parseDouble(display.replaceAll("[^\\d]", "")); + } else if (display.startsWith(" Secrets Found: ") && display.endsWith("%")) { + secrets = player.getDisplayName().getFormattedText(); + + double secretCount = Double.parseDouble(display.replaceAll("[^\\d.]", "")); + + switch (floor) { + case "F1": + secretScore = secretCount / 30D; + break; + case "F2": + secretScore = secretCount / 40D; + break; + case "F3": + secretScore = secretCount / 50D; + break; + case "F4": + secretScore = secretCount / 60D; + break; + case "F5": + secretScore = secretCount / 70D; + break; + case "F6": + secretScore = secretCount / 85D; + break; + default: + secretScore = secretCount / 100D; + } + } else if (display.startsWith("Time Elapsed: ")) { + String timeText = display.substring(display.indexOf(":") + 2).replaceAll("\\s", ""); + int minutes = Integer.parseInt(timeText.substring(0, timeText.indexOf("m"))); + int seconds = Integer.parseInt(timeText.substring(timeText.indexOf("m") + 1, timeText.indexOf("s"))); + int time = minutes * 60 + seconds; + + if (floor.equals("F2")) time -= 120; + + int base; + switch (floor) { + case "F1": + case "F2": + case "F3": + case "F5": + base = 600; + break; + case "F4": + case "F6": + case "F7": + base = 720; + break; + default: + base = 480; + } + + if (time <= base) { + timeScore = 100; + } else if (time <= base + 100) { + timeScore = (int) Math.ceil(100 - 0.1 * (time - base)); + } else if (time <= base + 500) { + timeScore = (int) Math.ceil(90 - 0.05 * (time - base - 100)); + } else if (time < base + 2600) { + timeScore = (int) Math.ceil(70 - (1/30D) * (time - base - 1100)); + } else { + timeScore = 0; + } + } else if (display.startsWith(" Crypts: ")) { + bonusScore = MathHelper.clamp_int(Integer.parseInt(display.replaceAll("[^\\d]", "")), 0, 5); + } else if (display.contains("[✦]")) { + missingPuzzles++; + } + } + + if (openedRooms != 0) { + roomScore = completedRooms / openedRooms; + } + + skillScore = 100 - 14 * (failedPuzzles + missingPuzzles); + exploreScore = (int) (60 * roomScore + 40 * MathHelper.clamp_double(secretScore, 0, 1)); + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlayEvent event) { + if (ToggleCommand.dungeonScore && Utils.inDungeons) { + Minecraft mc = Minecraft.getMinecraft(); + + int totalScore = skillScore + exploreScore + timeScore + bonusScore; + String total; + if (totalScore >= 300) { + total = EnumChatFormatting.GOLD + "S+"; + } else if (totalScore >= 270) { + total = EnumChatFormatting.GOLD + "S"; + } else if (totalScore >= 230) { + total = EnumChatFormatting.DARK_PURPLE + "A"; + } else if (totalScore >= 160) { + total = EnumChatFormatting.GREEN + "B"; + } else if (totalScore >= 100) { + total = EnumChatFormatting.BLUE + "C"; + } else { + total = EnumChatFormatting.RED + "D"; + } + + String scoreText = secrets + "\n" + + EnumChatFormatting.GOLD + "Skill:\n" + + EnumChatFormatting.GOLD + "Explore:\n" + + EnumChatFormatting.GOLD + "Speed:\n" + + EnumChatFormatting.GOLD + "Bonus:\n" + + EnumChatFormatting.GOLD + "Total:"; + String score = "\n" + + EnumChatFormatting.GOLD + skillScore + "\n" + + EnumChatFormatting.GOLD + exploreScore + "\n" + + EnumChatFormatting.GOLD + timeScore + "\n" + + EnumChatFormatting.GOLD + bonusScore + "\n" + + EnumChatFormatting.GOLD + totalScore + EnumChatFormatting.GRAY + " (" + total + EnumChatFormatting.GRAY + ")"; + new TextRenderer(mc, scoreText, MoveCommand.dungeonScoreXY[0], MoveCommand.dungeonScoreXY[1], ScaleCommand.dungeonScoreScale); + new TextRenderer(mc, score, MoveCommand.dungeonScoreXY[0] + 80, MoveCommand.dungeonScoreXY[1], ScaleCommand.dungeonScoreScale); + } + } + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + failedPuzzles = 0; + skillScore = 100; + secrets = ""; + exploreScore = 0; + timeScore = 100; + bonusScore = 0; + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 2a081e1..15360f0 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -84,6 +84,7 @@ public class DankerGui extends GuiScreen { private GuiButton flowerWeapons; private GuiButton necronNotifications; private GuiButton bonzoTimer; + private GuiButton dungeonScore; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -172,6 +173,7 @@ public class DankerGui extends GuiScreen { gemstoneLore = new FeatureButton("Applied Gemstones in Lore: " + Utils.getColouredBoolean(ToggleCommand.gemstoneLore), "Adds applied gemstones to item tooltip."); autoAcceptReparty = new FeatureButton("Auto Accept Reparty: " + Utils.getColouredBoolean(ToggleCommand.autoAcceptReparty), "Automatically rejoins parties when disbanded and invited."); abilityCooldown = new FeatureButton("Ability Cooldowns: " + Utils.getColouredBoolean(ToggleCommand.abilityCooldowns), "Displays ability cooldowns."); + dungeonScore = new FeatureButton("Dungeon Score Display: " + Utils.getColouredBoolean(ToggleCommand.dungeonScore), "Displays an estimated dungeon score with secrets."); allButtons.clear(); allButtons.add(changeDisplay); @@ -226,6 +228,7 @@ public class DankerGui extends GuiScreen { allButtons.add(gemstoneLore); allButtons.add(autoAcceptReparty); allButtons.add(abilityCooldown); + allButtons.add(dungeonScore); search.setText(initSearchText); search.setVisible(true); @@ -498,6 +501,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.abilityCooldowns = !ToggleCommand.abilityCooldowns; ConfigHandler.writeBooleanConfig("toggles", "AbilityCooldowns", ToggleCommand.abilityCooldowns); abilityCooldown.displayString = "Ability Cooldowns: " + Utils.getColouredBoolean(ToggleCommand.abilityCooldowns); + } else if (button == dungeonScore) { + ToggleCommand.dungeonScore = !ToggleCommand.dungeonScore; + ConfigHandler.writeBooleanConfig("toggles", "DungeonScore", ToggleCommand.dungeonScore); + dungeonScore.displayString = "Dungeon Score Display: " + Utils.getColouredBoolean(ToggleCommand.dungeonScore); } } diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index e24de8b..b7f4b02 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -32,6 +32,7 @@ public class EditLocationsGui extends GuiScreen { private LocationButton teammatesInRadius; private LocationButton giantHP; private LocationButton abilityCooldown; + private LocationButton dungeonScore; @Override public boolean doesGuiPauseGame() { @@ -104,6 +105,19 @@ public class EditLocationsGui extends GuiScreen { EnumChatFormatting.GREEN + "Parley: " + EnumChatFormatting.YELLOW + "2.652s\n" + EnumChatFormatting.GREEN + "Ice Spray: " + EnumChatFormatting.YELLOW + "1.429s"; + String dungeonScoreText = " Secrets Found: " + EnumChatFormatting.GREEN + "100.0%\n" + + EnumChatFormatting.GOLD + "Skill:\n" + + EnumChatFormatting.GOLD + "Explore:\n" + + EnumChatFormatting.GOLD + "Speed:\n" + + EnumChatFormatting.GOLD + "Bonus:\n" + + EnumChatFormatting.GOLD + "Total:"; + String dungeonScoreNums = "\n" + + EnumChatFormatting.GOLD + "100\n" + + EnumChatFormatting.GOLD + "100\n" + + EnumChatFormatting.GOLD + "100\n" + + EnumChatFormatting.GOLD + "5\n" + + EnumChatFormatting.GOLD + "305 " + EnumChatFormatting.GRAY + "(" + EnumChatFormatting.GOLD + "S+" + EnumChatFormatting.GRAY + ")"; + display = new LocationButton(MoveCommand.displayXY[0], MoveCommand.displayXY[1], ScaleCommand.displayScale, displayText, displayNums, 110); dungeonTimer = new LocationButton(MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], ScaleCommand.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); coords = new LocationButton(MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], ScaleCommand.coordsScale, NoF3Coords.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); @@ -117,6 +131,7 @@ public class EditLocationsGui extends GuiScreen { teammatesInRadius = new LocationButton(MoveCommand.teammatesInRadiusXY[0], MoveCommand.teammatesInRadiusXY[1], ScaleCommand.teammatesInRadiusScale, teammatesInRadiusText, null, null); giantHP = new LocationButton(MoveCommand.giantHPXY[0], MoveCommand.giantHPXY[1], ScaleCommand.giantHPScale, giantHPText, null, null); abilityCooldown = new LocationButton(MoveCommand.abilityCooldownsXY[0], MoveCommand.abilityCooldownsXY[1], ScaleCommand.abilityCooldownsScale, abilityCooldownText, null, null); + dungeonScore = new LocationButton(MoveCommand.dungeonScoreXY[0], MoveCommand.dungeonScoreXY[1], ScaleCommand.dungeonScoreScale, dungeonScoreText, dungeonScoreNums, 80); this.buttonList.add(coords); this.buttonList.add(dungeonTimer); @@ -131,6 +146,7 @@ public class EditLocationsGui extends GuiScreen { this.buttonList.add(teammatesInRadius); this.buttonList.add(giantHP); this.buttonList.add(abilityCooldown); + this.buttonList.add(dungeonScore); } @Override @@ -246,6 +262,11 @@ public class EditLocationsGui extends GuiScreen { abilityCooldown.xPosition = MoveCommand.abilityCooldownsXY[0]; abilityCooldown.yPosition = MoveCommand.abilityCooldownsXY[1]; break; + case "dungeonScore": + MoveCommand.dungeonScoreXY[0] += xMoved; + MoveCommand.dungeonScoreXY[1] += yMoved; + dungeonScore.xPosition = MoveCommand.dungeonScoreXY[0]; + dungeonScore.yPosition = MoveCommand.dungeonScoreXY[1]; } this.buttonList.clear(); initGui(); @@ -284,6 +305,8 @@ public class EditLocationsGui extends GuiScreen { moving = "giantHP"; } else if (button == abilityCooldown) { moving = "abilityCooldown"; + } else if (button == dungeonScore) { + moving = "dungeonScore"; } } } @@ -318,6 +341,8 @@ public class EditLocationsGui extends GuiScreen { ConfigHandler.writeIntConfig("locations", "giantHPY", MoveCommand.giantHPXY[1]); ConfigHandler.writeIntConfig("locations", "abilityCooldownsX", MoveCommand.abilityCooldownsXY[0]); ConfigHandler.writeIntConfig("locations", "abilityCooldownsY", MoveCommand.abilityCooldownsXY[1]); + ConfigHandler.writeIntConfig("locations", "dungeonScoreX", MoveCommand.dungeonScoreXY[0]); + ConfigHandler.writeIntConfig("locations", "dungeonScoreY", MoveCommand.dungeonScoreXY[1]); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 28f22fe..c785ff1 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -237,6 +237,7 @@ public class ConfigHandler { ToggleCommand.flowerWeaponsToggled = initBoolean("toggles", "FlowerWeapons", false); ToggleCommand.autoSkillTrackerToggled = initBoolean("toggles", "AutoSkillTracker", false); ToggleCommand.alerts = initBoolean("toggles", "Alerts", false); + ToggleCommand.dungeonScore = initBoolean("toggles", "DungeonScore", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); @@ -550,6 +551,8 @@ public class ConfigHandler { MoveCommand.giantHPXY[1] = initInt("locations", "giantHPY", 150); MoveCommand.abilityCooldownsXY[0] = initInt("locations", "abilityCooldownsX", 120); MoveCommand.abilityCooldownsXY[1] = initInt("locations", "abilityCooldownsY", 150); + MoveCommand.dungeonScoreXY[0] = initInt("locations", "dungeonScoreX", 150); + MoveCommand.dungeonScoreXY[1] = initInt("locations", "dungeonScoreY", 150); // Scales ScaleCommand.coordsScale = initDouble("scales", "coordsScale", 1); @@ -565,6 +568,7 @@ public class ConfigHandler { ScaleCommand.teammatesInRadiusScale = initDouble("scales", "teammatesInRadiusScale", 1); ScaleCommand.giantHPScale = initDouble("scales", "giantHPScale", 1); ScaleCommand.abilityCooldownsScale = initDouble("scales", "abilityCooldownsScale", 1); + ScaleCommand.dungeonScoreScale = initDouble("scales", "dungeonScoreScale", 1); // Skills DankersSkyblockMod.farmingLevel = initInt("skills", "farming", -1); |