diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 218 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/DHelpCommand.java | 8 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/LootCommand.java | 4 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/MoveCommand.java | 12 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ScaleCommand.java | 9 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/SkillTrackerCommand.java | 94 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/DankerGui.java | 43 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/EditLocationsGui.java | 16 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/SkillTrackerGui.java | 99 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 12 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 8 |
11 files changed, 470 insertions, 53 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 9478d6c..5c992ae 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -12,6 +12,7 @@ import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; +import org.apache.commons.lang3.time.StopWatch; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -36,6 +37,7 @@ import me.Danker.commands.ReloadConfigCommand; import me.Danker.commands.ResetLootCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.SetkeyCommand; +import me.Danker.commands.SkillTrackerCommand; import me.Danker.commands.SkillsCommand; import me.Danker.commands.SkyblockPlayersCommand; import me.Danker.commands.SlayerCommand; @@ -45,6 +47,7 @@ import me.Danker.gui.DisplayGui; import me.Danker.gui.EditLocationsGui; import me.Danker.gui.OnlySlayerGui; import me.Danker.gui.PuzzleSolversGui; +import me.Danker.gui.SkillTrackerGui; import me.Danker.handlers.APIHandler; import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.PacketHandler; @@ -126,16 +129,22 @@ public class TheMod static int tickAmount = 1; static String lastMaddoxCommand = "/cb placeholder"; static double lastMaddoxTime = 0; - static KeyBinding[] keyBindings = new KeyBinding[1]; + static KeyBinding[] keyBindings = new KeyBinding[2]; static int lastMouse = -1; static boolean usingLabymod = false; public static String guiToOpen = null; + static boolean foundLivid = false; + static Entity livid = null; + public static double cakeTime; + + public static final ResourceLocation CAKE_ICON = new ResourceLocation("dsm", "icons/cake.png"); + static String[] riddleSolutions = {"The reward is not in my chest!", "At least one of them is lying, and the reward is not in", - "My chest doesn't have the reward. We are all telling the truth", "My chest has the reward and I'm telling the truth", - "The reward isn't in any of our chests", "Both of them are telling the truth."}; - static Map<String, String[]> triviaSolutions = new HashMap<String, String[]>(); - static String[] triviaAnswers = null; - static Entity highestBlaze = null; + "My chest doesn't have the reward. We are all telling the truth", "My chest has the reward and I'm telling the truth", + "The reward isn't in any of our chests", "Both of them are telling the truth."}; + static Map<String, String[]> triviaSolutions = new HashMap<String, String[]>(); + static String[] triviaAnswers = null; + static Entity highestBlaze = null; static Entity lowestBlaze = null; // Among Us colours static final int[] CREEPER_COLOURS = {0x50EF39, 0xC51111, 0x132ED1, 0x117F2D, 0xED54BA, 0xEF7D0D, 0xF5F557, 0xD6E0F0, 0x6B2FBB, 0x39FEDC}; @@ -144,12 +153,7 @@ public class TheMod static List<Vec3[]> creeperLines = new ArrayList<Vec3[]>(); static boolean prevInWaterRoom = false; static boolean inWaterRoom = false; - static boolean foundLivid = false; - static Entity livid = null; - public static double cakeTime; - public static final ResourceLocation CAKE_ICON = new ResourceLocation("dsm", "icons/cake.png"); - static double dungeonStartTime = 0; static double bloodOpenTime = 0; static double watcherClearTime = 0; @@ -158,6 +162,24 @@ public class TheMod static int dungeonDeaths = 0; static int puzzleFails = 0; + static String lastSkill = "Farming"; + public static boolean showSkillTracker; + public static StopWatch skillStopwatch = new StopWatch(); + static double farmingXP = 0; + public static double farmingXPGained = 0; + static double miningXP = 0; + public static double miningXPGained = 0; + static double combatXP = 0; + public static double combatXPGained = 0; + static double foragingXP = 0; + public static double foragingXPGained = 0; + static double fishingXP = 0; + public static double fishingXPGained = 0; + static double enchantingXP = 0; + public static double enchantingXPGained = 0; + static double alchemyXP = 0; + public static double alchemyXPGained = 0; + public static String MAIN_COLOUR; public static String SECONDARY_COLOUR; public static String ERROR_COLOUR; @@ -169,6 +191,7 @@ public class TheMod public static String SKILL_50_COLOUR; public static String COORDS_COLOUR; public static String CAKE_COLOUR; + public static String SKILL_TRACKER_COLOUR; @EventHandler public void init(FMLInitializationEvent event) { @@ -250,6 +273,7 @@ public class TheMod pattern = Pattern.compile(patternString); keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod"); + keyBindings[1] = new KeyBinding("Start/Stop Skill Tracker", Keyboard.KEY_NUMPAD5, "Danker's Skyblock Mod"); for (int i = 0; i < keyBindings.length; i++) { ClientRegistry.registerKeyBinding(keyBindings[i]); @@ -279,7 +303,8 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand()); ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); - ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); + ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); + ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); } @EventHandler @@ -339,12 +364,86 @@ public class TheMod if (event.type == 2) { String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); for (String section : actionBarSections) { - if (ToggleCommand.skill50DisplayToggled) { - if (section.contains("+") && section.contains("/") && section.contains("(")) { - if (section.contains("Runecrafting")) return; - + if (section.contains("+") && section.contains("/") && section.contains("(")) { + if (!section.contains("Runecrafting") && !section.contains("Carpentry")) { + int limit = section.contains("Farming") ? 60 : 50; + double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); + int previousXP = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")), limit); + double totalXP = currentXP + previousXP; + double xpGained = Double.parseDouble(section.substring(section.indexOf("+") + 1, section.indexOf(" ")).replace(",", "")); + String skill = section.substring(section.indexOf(" ") + 1, section.lastIndexOf(" ")); + switch (skill) { + case "Farming": + lastSkill = "Farming"; + if (farmingXP == 0) { + farmingXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) farmingXPGained += totalXP - farmingXP; + farmingXP = totalXP; + } + break; + case "Mining": + lastSkill = "Mining"; + if (miningXP == 0) { + miningXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) miningXPGained += totalXP - miningXP; + miningXP = totalXP; + } + break; + case "Combat": + lastSkill = "Combat"; + if (combatXP == 0) { + combatXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) combatXPGained += totalXP - combatXP; + combatXP = totalXP; + } + break; + case "Foraging": + lastSkill = "Foraging"; + if (foragingXP == 0) { + foragingXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) foragingXPGained += totalXP - foragingXP; + foragingXP = totalXP; + } + break; + case "Fishing": + lastSkill = "Fishing"; + if (fishingXP == 0) { + fishingXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) fishingXPGained += totalXP - fishingXP; + fishingXP = totalXP; + } + break; + case "Enchanting": + lastSkill = "Enchanting"; + if (enchantingXP == 0) { + enchantingXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) enchantingXPGained += totalXP - enchantingXP; + enchantingXP = totalXP; + } + break; + case "Alchemy": + lastSkill = "Alchemy"; + if (alchemyXP == 0) { + alchemyXP = totalXP; + } else { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) alchemyXPGained += totalXP - alchemyXP; + alchemyXP = totalXP; + } + break; + default: + System.err.println("Unknown skill."); + } + } + + if (ToggleCommand.skill50DisplayToggled && !section.contains("Runecrafting")) { String xpGained = section.substring(section.indexOf("+"), section.indexOf("(") - 1); - double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replaceAll(",", "")); + double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); int limit; int totalXp; if (section.contains("Farming")) { @@ -988,33 +1087,47 @@ public class TheMod } else if (message.contains("Wither Blood")) { // F7 LootCommand.witherBloods++; LootCommand.witherBloodsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherBlood", LootCommand.witherBloods); } else if (message.contains("Wither Cloak")) { LootCommand.witherCloaks++; LootCommand.witherCloaksSession++; + ConfigHandler.writeIntConfig("catacombs", "witherCloak", LootCommand.witherCloaks); } else if (message.contains("Implosion")) { LootCommand.implosions++; LootCommand.implosionsSession++; + ConfigHandler.writeIntConfig("catacombs", "implosion", LootCommand.implosions); } else if (message.contains("Wither Shield")) { LootCommand.witherShields++; LootCommand.witherShieldsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherShield", LootCommand.witherShields); } else if (message.contains("Shadow Warp")) { LootCommand.shadowWarps++; LootCommand.shadowWarpsSession++; + ConfigHandler.writeIntConfig("catacombs", "shadowWarp", LootCommand.shadowWarps); + } else if (message.contains("Necron's Handle")) { + LootCommand.necronsHandles++; + LootCommand.necronsHandlesSession++; + ConfigHandler.writeIntConfig("catacombs", "necronsHandle", LootCommand.necronsHandles); } else if (message.contains("Auto Recombobulator")) { LootCommand.autoRecombs++; LootCommand.autoRecombsSession++; + ConfigHandler.writeIntConfig("catacombs", "autoRecomb", LootCommand.autoRecombs); } else if (message.contains("Wither Helmet")) { LootCommand.witherHelms++; LootCommand.witherHelmsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherHelm", LootCommand.witherHelms); } else if (message.contains("Wither Chestplate")) { LootCommand.witherChests++; LootCommand.witherChestsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherChest", LootCommand.witherChests); } else if (message.contains("Wither Leggings")) { LootCommand.witherLegs++; LootCommand.witherLegsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherLegging", LootCommand.witherLegs); } else if (message.contains("Wither Boots")) { LootCommand.witherBoots++; LootCommand.witherBootsSession++; + ConfigHandler.writeIntConfig("catacombs", "witherBoot", LootCommand.witherBoots); } } @@ -1109,6 +1222,45 @@ public class TheMod GL11.glScaled(scaleReset, scaleReset, scaleReset); } + if (showSkillTracker && Utils.inSkyblock) { + int xpPerHour = 0; + double xpToShow = 0; + switch (lastSkill) { + case "Farming": + xpToShow = farmingXPGained; + break; + case "Mining": + xpToShow = miningXPGained; + break; + case "Combat": + xpToShow = combatXPGained; + break; + case "Foraging": + xpToShow = foragingXPGained; + break; + case "Fishing": + xpToShow = fishingXPGained; + break; + case "Enchanting": + xpToShow = enchantingXPGained; + break; + case "Alchemy": + xpToShow = alchemyXPGained; + break; + default: + System.err.println("Unknown skill in rendering."); + } + xpPerHour = (int) Math.round(xpToShow / ((skillStopwatch.getTime() + 1) / 3600000d)); + String skillTrackerText = SKILL_TRACKER_COLOUR + lastSkill + " XP Earned: " + NumberFormat.getNumberInstance(Locale.US).format(xpToShow) + "\n" + + SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, skillStopwatch.getTime() / 1000d) + "\n" + + SKILL_TRACKER_COLOUR + "XP Per Hour: " + NumberFormat.getIntegerInstance(Locale.US).format(xpPerHour); + if (!skillStopwatch.isStarted() || skillStopwatch.isSuspended()) { + skillTrackerText += "\n" + EnumChatFormatting.RED + "PAUSED"; + } + + new TextRenderer(mc, skillTrackerText, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], ScaleCommand.skillTrackerScale); + } + if (!DisplayCommand.display.equals("off")) { String dropsText = ""; String countText = ""; @@ -1850,6 +2002,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Implosions:\n" + EnumChatFormatting.DARK_PURPLE + "Wither Shields:\n" + EnumChatFormatting.DARK_PURPLE + "Shadow Warps:\n" + + EnumChatFormatting.DARK_PURPLE + "Necron's Handles:\n" + EnumChatFormatting.GOLD + "Auto Recombobs:\n" + EnumChatFormatting.GOLD + "Wither Helmets:\n" + EnumChatFormatting.GOLD + "Wither Chests:\n" + @@ -1864,6 +2017,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(LootCommand.implosions) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(LootCommand.witherShields) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(LootCommand.shadowWarps) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootCommand.necronsHandles) + "\n" + EnumChatFormatting.GOLD + nf.format(LootCommand.autoRecombs) + "\n" + EnumChatFormatting.GOLD + nf.format(LootCommand.witherHelms) + "\n" + EnumChatFormatting.GOLD + nf.format(LootCommand.witherChests) + "\n" + @@ -1879,6 +2033,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + "Implosions:\n" + EnumChatFormatting.DARK_PURPLE + "Wither Shields:\n" + EnumChatFormatting.DARK_PURPLE + "Shadow Warps:\n" + + EnumChatFormatting.DARK_PURPLE + "Necron's Handles:\n" + EnumChatFormatting.GOLD + "Auto Recombobulators:\n" + EnumChatFormatting.GOLD + "Wither Helmets:\n" + EnumChatFormatting.GOLD + "Wither Chests:\n" + @@ -1893,6 +2048,7 @@ public class TheMod EnumChatFormatting.DARK_PURPLE + nf.format(LootCommand.implosionsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(LootCommand.witherShieldsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + nf.format(LootCommand.shadowWarpsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + nf.format(LootCommand.necronsHandlesSession) + "\n" + EnumChatFormatting.GOLD + nf.format(LootCommand.autoRecombsSession) + "\n" + EnumChatFormatting.GOLD + nf.format(LootCommand.witherHelmsSession) + "\n" + EnumChatFormatting.GOLD + nf.format(LootCommand.witherChestsSession) + "\n" + @@ -2157,11 +2313,11 @@ public class TheMod red = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.DARK_GRAY + "Coal, " + EnumChatFormatting.GREEN + "Emerald"; break; case 3: - purple = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.AQUA + "Diamond"; - orange = EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald"; - blue = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.AQUA + "Diamond"; - green = EnumChatFormatting.YELLOW + "Gold"; - red = EnumChatFormatting.GREEN + "Emerald"; + purple = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.AQUA + "Diamond"; + orange = EnumChatFormatting.GREEN + "Emerald"; + blue = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.AQUA + "Diamond"; + green = EnumChatFormatting.GRAY + "None"; + red = EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald"; break; case 4: purple = EnumChatFormatting.WHITE + "Quartz, " + EnumChatFormatting.YELLOW + "Gold, " + EnumChatFormatting.GREEN + "Emerald, " + EnumChatFormatting.RED + "Clay"; @@ -2283,6 +2439,8 @@ public class TheMod mc.displayGuiScreen(new EditLocationsGui()); } else if (guiToOpen.equals("puzzlesolvers")) { mc.displayGuiScreen(new PuzzleSolversGui()); + } else if (guiToOpen.equals("skilltracker")) { + mc.displayGuiScreen(new SkillTrackerGui()); } guiToOpen = null; } @@ -2330,8 +2488,22 @@ public class TheMod @SubscribeEvent public void onKey(KeyInputEvent event) { if (!Utils.inSkyblock) return; + + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; if (keyBindings[0].isPressed()) { - Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand); + player.sendChatMessage(lastMaddoxCommand); + } + if (keyBindings[1].isPressed()) { + if (skillStopwatch.isStarted() && skillStopwatch.isSuspended()) { + skillStopwatch.resume(); + player.addChatMessage(new ChatComponentText(MAIN_COLOUR + "Skill tracker started.")); + } else if (!skillStopwatch.isStarted()) { + skillStopwatch.start(); + player.addChatMessage(new ChatComponentText(MAIN_COLOUR + "Skill tracker started.")); + } else if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) { + skillStopwatch.suspend(); + player.addChatMessage(new ChatComponentText(MAIN_COLOUR + "Skill tracker paused.")); + } } } diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 4fadb54..d514fbd 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -40,8 +40,8 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing/catacombs> [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + EnumChatFormatting.GOLD + " /display <zombie/spider/wolf/fishing/catacombs/auto/off> [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active.\n" + EnumChatFormatting.GOLD + " /resetloot <zombie/spider/wolf/fishing/catacombs/confirm/cancel>" + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + - EnumChatFormatting.GOLD + " /move <coords/display/dungeontimer/skill50/lividhp/caketimer> <x> <y>" + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + - EnumChatFormatting.GOLD + " /scale <coords/display/dungeontimer/skill50/lividhp/caketimer> <scale (0.1 - 10)>" + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + + EnumChatFormatting.GOLD + " /move <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <x> <y>" + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + + EnumChatFormatting.GOLD + " /scale <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <scale (0.1 - 10)>" + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /lobbyskills" + EnumChatFormatting.AQUA + " - Uses API to find the average skills of the lobby, as well the three players with the highest skill average.\n" + @@ -53,7 +53,9 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " /importfishing" + EnumChatFormatting.AQUA + " - Imports your fishing stats from your latest profile to your fishing tracker using the API.\n" + EnumChatFormatting.GOLD + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" + EnumChatFormatting.GOLD + " /onlyslayer <zombie/spider/wolf> <1/2/3/4>" + EnumChatFormatting.AQUA + " - Stops you from starting a slayer quest other than the one specified.\n" + - EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n")); + EnumChatFormatting.GOLD + " /skilltracker <start/stop/reset>" + EnumChatFormatting.AQUA + " - Text display for skill xp/hour.\n" + + EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n" + + EnumChatFormatting.GREEN + " Start/Stop Skill Tracker" + EnumChatFormatting.AQUA + " - Numpad 5 by default.\n")); } } diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java index 867139f..f66d0c4 100644 --- a/src/main/java/me/Danker/commands/LootCommand.java +++ b/src/main/java/me/Danker/commands/LootCommand.java @@ -153,6 +153,7 @@ public class LootCommand extends CommandBase { public static int implosions; public static int witherShields; public static int shadowWarps; + public static int necronsHandles; public static int autoRecombs; public static int witherHelms; public static int witherChests; @@ -300,6 +301,7 @@ public class LootCommand extends CommandBase { public static int implosionsSession = 0; public static int witherShieldsSession = 0; public static int shadowWarpsSession = 0; + public static int necronsHandlesSession = 0; public static int autoRecombsSession = 0; public static int witherHelmsSession = 0; public static int witherChestsSession = 0; @@ -897,6 +899,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.DARK_PURPLE + " Implosions: " + nf.format(implosionsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Wither Shields: " + nf.format(witherShieldsSession) + "\n" + EnumChatFormatting.DARK_PURPLE + " Shadow Warps: " + nf.format(shadowWarpsSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Necron's Handles: " + nf.format(necronsHandlesSession) + "\n" + EnumChatFormatting.GOLD + " Auto Recombobulator: " + nf.format(autoRecombsSession) + "\n" + EnumChatFormatting.GOLD + " Wither Helmets: " + nf.format(witherHelmsSession) + "\n" + EnumChatFormatting.GOLD + " Wither Chesplates: " + nf.format(witherChestsSession) + "\n" + @@ -916,6 +919,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.DARK_PURPLE + " Implosions: " + nf.format(implosions) + "\n" + EnumChatFormatting.DARK_PURPLE + " Wither Shields: " + nf.format(witherShields) + "\n" + EnumChatFormatting.DARK_PURPLE + " Shadow Warps: " + nf.format(shadowWarps) + "\n" + + EnumChatFormatting.DARK_PURPLE + " Necron's Handles: " + nf.format(necronsHandles) + "\n" + EnumChatFormatting.GOLD + " Auto Recombobulator: " + nf.format(autoRecombs) + "\n" + EnumChatFormatting.GOLD + " Wither Helmets: " + nf.format(witherHelms) + "\n" + EnumChatFormatting.GOLD + " Wither Chesplates: " + nf.format(witherChests) + "\n" + diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index 0581d8c..93e04a3 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -19,6 +19,7 @@ public class MoveCommand extends CommandBase { public static int[] skill50XY = {0, 0}; public static int[] lividHpXY = {0, 0}; public static int[] cakeTimerXY = {0, 0}; + public static int[] skillTrackerXY = {0, 0}; @Override public String getCommandName() { @@ -27,7 +28,7 @@ public class MoveCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer> <x> <y>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <x> <y>"; } @Override @@ -38,7 +39,7 @@ public class MoveCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker"); } return null; } @@ -87,6 +88,13 @@ public class MoveCommand extends CommandBase { cakeTimerXY[1] = Integer.parseInt(arg1[2]); ConfigHandler.writeIntConfig("locations", "cakeTimerX", cakeTimerXY[0]); ConfigHandler.writeIntConfig("locations", "cakeTimerY", cakeTimerXY[1]); + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Cake timer has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); + } else if (arg1[0].equalsIgnoreCase("skilltracker")) { + skillTrackerXY[0] = Integer.parseInt(arg1[1]); + skillTrackerXY[1] = Integer.parseInt(arg1[2]); + ConfigHandler.writeIntConfig("locations", "skillTrackerX", skillTrackerXY[0]); + ConfigHandler.writeIntConfig("locations", "skillTrackerY", skillTrackerXY[1]); + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); } else { player.addChatMessage(new ChatComponentText(TheMod.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 1527e40..cfc7282 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -19,6 +19,7 @@ public class ScaleCommand extends CommandBase { public static double skill50Scale; public static double lividHpScale; public static double cakeTimerScale; + public static double skillTrackerScale; @Override public String getCommandName() { @@ -27,7 +28,7 @@ public class ScaleCommand extends CommandBase { @Override public String getCommandUsage(ICommandSender arg0) { - return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer> <size (0.1 - 10)>"; + return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <size (0.1 - 10)>"; } @Override @@ -38,7 +39,7 @@ public class ScaleCommand extends CommandBase { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer"); + return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer", "skilltracker"); } return null; } @@ -82,6 +83,10 @@ public class ScaleCommand extends CommandBase { cakeTimerScale = scaleAmount; ConfigHandler.writeDoubleConfig("scales", "cakeTimerScale", cakeTimerScale); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Cake timer has been scaled to " + TheMod.SECONDARY_COLOUR + cakeTimerScale + "x")); + } else if (arg1[0].equalsIgnoreCase("skilltracker")) { + skillTrackerScale = scaleAmount; + ConfigHandler.writeDoubleConfig("scales", "skillTrackerScale", skillTrackerScale); + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker has been scaled to " + TheMod.SECONDARY_COLOUR + skillTrackerScale + "x")); } else { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/SkillTrackerCommand.java b/src/main/java/me/Danker/commands/SkillTrackerCommand.java new file mode 100644 index 0000000..6e6d742 --- /dev/null +++ b/src/main/java/me/Danker/commands/SkillTrackerCommand.java @@ -0,0 +1,94 @@ +package me.Danker.commands; + +import java.util.List; + +import org.apache.commons.lang3.time.StopWatch; + +import me.Danker.TheMod; +import me.Danker.handlers.ConfigHandler; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; + +public class SkillTrackerCommand extends CommandBase { + + @Override + public String getCommandName() { + return "skilltracker"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return "/" + getCommandName() + " <start/stop/reset>"; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length == 1) { + return getListOfStringsMatchingLastWord(args, "start", "resume", "pause", "stop", "reset", "hide", "show"); + } + return null; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + EntityPlayer player = (EntityPlayer) arg0; + + if (arg1.length < 1) { + player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + return; + } + + switch (arg1[0].toLowerCase()) { + case "start": + case "resume": + if (TheMod.skillStopwatch.isStarted() && TheMod.skillStopwatch.isSuspended()) { + TheMod.skillStopwatch.resume(); + } else if (!TheMod.skillStopwatch.isStarted()) { + TheMod.skillStopwatch.start(); + } + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker started.")); + break; + case "pause": + case "stop": + if (TheMod.skillStopwatch.isStarted() && !TheMod.skillStopwatch.isSuspended()) { + TheMod.skillStopwatch.suspend(); + } else { + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker paused.")); + } + break; + case "reset": + TheMod.skillStopwatch = new StopWatch(); + TheMod.farmingXPGained = 0; + TheMod.miningXPGained = 0; + TheMod.combatXPGained = 0; + TheMod.foragingXPGained = 0; + TheMod.fishingXPGained = 0; + TheMod.enchantingXPGained = 0; + TheMod.alchemyXPGained = 0; + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker reset.")); + break; + case "hide": + TheMod.showSkillTracker = false; + ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false); + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker hidden.")); + break; + case "show": + TheMod.showSkillTracker = true; + ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true); + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill tracker shown.")); + break; + default: + player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + } + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 73db9f0..205dc8b 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -27,6 +27,7 @@ public class DankerGui extends GuiScreen { private GuiButton changeDisplay; private GuiButton onlySlayer; private GuiButton puzzleSolvers; + private GuiButton skillTracker; // Toggles private GuiButton gparty; private GuiButton coords; @@ -78,44 +79,45 @@ public class DankerGui extends GuiScreen { changeDisplay = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Change Display Settings"); onlySlayer = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Set Slayer Quest"); puzzleSolvers = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Toggle Dungeons Puzzle Solvers"); - outlineText = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled)); - splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); - dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); + skillTracker = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Toggle Skill XP/Hour Tracking"); + outlineText = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Outline Displayed Text: " + Utils.getColouredBoolean(ToggleCommand.outlineTextToggled)); + splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); coords = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Coordinate/Angle Display: " + Utils.getColouredBoolean(ToggleCommand.coordsToggled)); // Page 2 - cakeTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Cake Timer: " + Utils.getColouredBoolean(ToggleCommand.cakeTimerToggled)); - skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); - gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); + dungeonTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Display Dungeon Timers: " + Utils.getColouredBoolean(ToggleCommand.dungeonTimerToggled)); + cakeTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Cake Timer: " + Utils.getColouredBoolean(ToggleCommand.cakeTimerToggled)); + skill50Display = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Display Progress To Skill Level 50: " + Utils.getColouredBoolean(ToggleCommand.skill50DisplayToggled)); slayerCount = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Count Total 20% Drops: " + Utils.getColouredBoolean(ToggleCommand.slayerCountTotal)); chatMaddox = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Click On-Screen to Open Maddox: " + Utils.getColouredBoolean(ToggleCommand.chatMaddoxToggled)); aotd = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Disable AOTD Ability: " + Utils.getColouredBoolean(ToggleCommand.aotdToggled)); lividDagger = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Disable Livid Dagger Ability: " + Utils.getColouredBoolean(ToggleCommand.lividDaggerToggled)); // Page 3 - spiritBearAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts)); - sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); - midasStaffMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages)); - healMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages)); - goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); - petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); - expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + gparty = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Guild Party Notifications: " + Utils.getColouredBoolean(ToggleCommand.gpartyToggled)); + spiritBearAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts)); + sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); + midasStaffMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages)); + healMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages)); + goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); // Page 4 - lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); - golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); - rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); + lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); if (page == 1) { this.buttonList.add(changeDisplay); this.buttonList.add(onlySlayer); this.buttonList.add(puzzleSolvers); + this.buttonList.add(skillTracker); this.buttonList.add(outlineText); this.buttonList.add(splitFishing); - this.buttonList.add(dungeonTimer); this.buttonList.add(coords); this.buttonList.add(nextPage); } else if (page == 2) { + this.buttonList.add(dungeonTimer); this.buttonList.add(cakeTimer); this.buttonList.add(skill50Display); - this.buttonList.add(gparty); this.buttonList.add(slayerCount); this.buttonList.add(chatMaddox); this.buttonList.add(aotd); @@ -123,16 +125,17 @@ public class DankerGui extends GuiScreen { this.buttonList.add(nextPage); this.buttonList.add(backPage); } else if (page == 3) { + this.buttonList.add(gparty); this.buttonList.add(spiritBearAlert); this.buttonList.add(sceptreMessages); this.buttonList.add(midasStaffMessages); this.buttonList.add(healMessages); this.buttonList.add(goldenEnch); this.buttonList.add(petColours); - this.buttonList.add(expertiseLore); this.buttonList.add(nextPage); this.buttonList.add(backPage); } else if (page == 4) { + this.buttonList.add(expertiseLore); this.buttonList.add(lividSolver); this.buttonList.add(golemAlerts); this.buttonList.add(rngesusAlert); @@ -179,6 +182,8 @@ public class DankerGui extends GuiScreen { TheMod.guiToOpen = "onlyslayergui"; } else if (button == puzzleSolvers) { TheMod.guiToOpen = "puzzlesolvers"; + } else if (button == skillTracker) { + TheMod.guiToOpen = "skilltracker"; } else if (button == outlineText) { ToggleCommand.outlineTextToggled = !ToggleCommand.outlineTextToggled; ConfigHandler.writeBooleanConfig("toggles", "OutlineText", ToggleCommand.outlineTextToggled); diff --git a/src/main/java/me/Danker/gui/EditLocationsGui.java b/src/main/java/me/Danker/gui/EditLocationsGui.java index 7e67c1e..75caf6a 100644 --- a/src/main/java/me/Danker/gui/EditLocationsGui.java +++ b/src/main/java/me/Danker/gui/EditLocationsGui.java @@ -25,6 +25,7 @@ public class EditLocationsGui extends GuiScreen { private LocationButton skill50; private LocationButton lividHP; private LocationButton cakeTimer; + private LocationButton skillTracker; @Override public boolean doesGuiPauseGame() { @@ -71,17 +72,23 @@ public class EditLocationsGui extends GuiScreen { EnumChatFormatting.YELLOW + 2 + "\n" + EnumChatFormatting.YELLOW + 1; + String skillTrackerText = TheMod.SKILL_TRACKER_COLOUR + "Farming XP Earned: 462,425.3\n" + + TheMod.SKILL_TRACKER_COLOUR + "Time Elapsed: " + Utils.getTimeBetween(0, 3602) + "\n" + + TheMod.SKILL_TRACKER_COLOUR + "XP Per Hour: 462,168"; + display = new LocationButton(0, MoveCommand.displayXY[0], MoveCommand.displayXY[1], 145 * ScaleCommand.displayScale, 102 * ScaleCommand.displayScale, ScaleCommand.displayScale, displayText, displayNums, 110); dungeonTimer = new LocationButton(0, MoveCommand.dungeonTimerXY[0], MoveCommand.dungeonTimerXY[1], 113 * ScaleCommand.dungeonTimerScale, 57 * ScaleCommand.dungeonTimerScale, ScaleCommand.dungeonTimerScale, dungeonTimerText, dungeonTimerNums, 80); coords = new LocationButton(0, MoveCommand.coordsXY[0], MoveCommand.coordsXY[1], 141 * ScaleCommand.coordsScale, 12 * ScaleCommand.coordsScale, ScaleCommand.coordsScale, TheMod.COORDS_COLOUR + "74 / 14 / -26 (141.1 / 6.7)", null, null); skill50 = new LocationButton(0, MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], 233 * ScaleCommand.skill50Scale, 12 * ScaleCommand.skill50Scale, ScaleCommand.skill50Scale, TheMod.SKILL_50_COLOUR + "+3.5 Farming (28,882,117.7/55,172,425) 52.34%", null, null); lividHP = new LocationButton(0, MoveCommand.lividHpXY[0], MoveCommand.lividHpXY[1], 85 * ScaleCommand.lividHpScale, 12 * ScaleCommand.lividHpScale, ScaleCommand.lividHpScale, EnumChatFormatting.WHITE + "﴾ Livid " + EnumChatFormatting.YELLOW + "6.9M" + EnumChatFormatting.RED + "❤ " + EnumChatFormatting.WHITE + "﴿", null, null); cakeTimer = new LocationButton(0, MoveCommand.cakeTimerXY[0], MoveCommand.cakeTimerXY[1] + 5, 85 * ScaleCommand.cakeTimerScale, 18 * ScaleCommand.cakeTimerScale, ScaleCommand.cakeTimerScale, TheMod.CAKE_COLOUR + " 11h16m", null, null); + skillTracker = new LocationButton(0, MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[1], 150 * ScaleCommand.skillTrackerScale, 28 * ScaleCommand.skillTrackerScale, ScaleCommand.skillTrackerScale, skillTrackerText, null, null); this.buttonList.add(coords); this.buttonList.add(dungeonTimer); this.buttonList.add(lividHP); this.buttonList.add(cakeTimer); + this.buttonList.add(skillTracker); this.buttonList.add(display); this.buttonList.add(skill50); } @@ -136,6 +143,11 @@ public class EditLocationsGui extends GuiScreen { MoveCommand.cakeTimerXY[1] += yMoved; cakeTimer.xPosition = MoveCommand.cakeTimerXY[0]; cakeTimer.yPosition = MoveCommand.cakeTimerXY[1]; + } else if (moving.equals("skillTracker")) { + MoveCommand.skillTrackerXY[0] += xMoved; + MoveCommand.skillTrackerXY[1] += yMoved; + skillTracker.xPosition = MoveCommand.skillTrackerXY[0]; + skillTracker.yPosition = MoveCommand.skillTrackerXY[1]; } this.buttonList.clear(); initGui(); @@ -160,6 +172,8 @@ public class EditLocationsGui extends GuiScreen { moving = "lividHP"; } else if (button == cakeTimer) { moving = "cakeTimer"; + } else if (button == skillTracker) { + moving = "skillTracker"; } } } @@ -180,6 +194,8 @@ public class EditLocationsGui extends GuiScreen { ConfigHandler.writeIntConfig("locations", "lividHpY", MoveCommand.lividHpXY[1]); ConfigHandler.writeIntConfig("locations", "cakeTimerX", MoveCommand.cakeTimerXY[0]); ConfigHandler.writeIntConfig("locations", "cakeTimerY", MoveCommand.cakeTimerXY[1]); + ConfigHandler.writeIntConfig("locations", "skillTrackerX", MoveCommand.skillTrackerXY[0]); + ConfigHandler.writeIntConfig("locations", "skillTrackerY", MoveCommand.skillTrackerXY[1]); } } diff --git a/src/main/java/me/Danker/gui/SkillTrackerGui.java b/src/main/java/me/Danker/gui/SkillTrackerGui.java new file mode 100644 index 0000000..9672890 --- /dev/null +++ b/src/main/java/me/Danker/gui/SkillTrackerGui.java @@ -0,0 +1,99 @@ +package me.Danker.gui; + +import org.apache.commons.lang3.time.StopWatch; + +import me.Danker.TheMod; +import me.Danker.handlers.ConfigHandler; +import me.Danker.handlers.TextRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class SkillTrackerGui extends GuiScreen { + + private GuiButton goBack; + private GuiButton start; + private GuiButton stop; + private GuiButton reset; + private GuiButton hide; + private GuiButton show; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); + start = new GuiButton(0, width / 2 - 140, (int) (height * 0.45), 80, 20, "Start"); + stop = new GuiButton(0, width / 2 - 40, (int) (height * 0.45), 80, 20, "Stop"); + reset = new GuiButton(0, width / 2 + 60, (int) (height * 0.45), 80, 20, "Reset"); + hide = new GuiButton(0, width / 2 - 70, (int) (height * 0.55), 60, 20, "Hide"); + show = new GuiButton(0, width / 2 + 10, (int) (height * 0.55), 60, 20, "Show"); + + this.buttonList.add(start); + this.buttonList.add(stop); + this.buttonList.add(reset); + this.buttonList.add(hide); + this.buttonList.add(show); + this.buttonList.add(goBack); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + String stateText = ""; + if (TheMod.skillStopwatch.isStarted() && !TheMod.skillStopwatch.isSuspended()) { + stateText = "Timer: Running"; + } else if (!TheMod.skillStopwatch.isStarted() || TheMod.skillStopwatch.isSuspended()) { + stateText = "Timer: Paused"; + } + if (!TheMod.showSkillTracker) { + stateText += " (Hidden)"; + } + int stateTextWidth = mc.fontRendererObj.getStringWidth(stateText); + new TextRenderer(mc, stateText, width / 2 - stateTextWidth / 2, 10, 1D); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void actionPerformed(GuiButton button) { + if (button == goBack) { + TheMod.guiToOpen = "dankergui1"; + } else if (button == start) { + if (TheMod.skillStopwatch.isStarted() && TheMod.skillStopwatch.isSuspended()) { + TheMod.skillStopwatch.resume(); + } else if (!TheMod.skillStopwatch.isStarted()) { + TheMod.skillStopwatch.start(); + } + } else if (button == stop) { + if (TheMod.skillStopwatch.isStarted() && !TheMod.skillStopwatch.isSuspended()) { + TheMod.skillStopwatch.suspend(); + } + } else if (button == reset) { + TheMod.skillStopwatch = new StopWatch(); + TheMod.farmingXPGained = 0; + TheMod.miningXPGained = 0; + TheMod.combatXPGained = 0; + TheMod.foragingXPGained = 0; + TheMod.fishingXPGained = 0; + TheMod.enchantingXPGained = 0; + TheMod.alchemyXPGained = 0; + } else if (button == hide) { + TheMod.showSkillTracker = false; + ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false); + } else if (button == show) { + TheMod.showSkillTracker = true; + ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true); + } + } + +} diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 6318abb..b9bc860 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -341,6 +341,7 @@ public class ConfigHandler { if (!hasKey("catacombs", "implosion")) writeIntConfig("catacombs", "implosion", 0); if (!hasKey("catacombs", "witherShield")) writeIntConfig("catacombs", "witherShield", 0); if (!hasKey("catacombs", "shadowWarp")) writeIntConfig("catacombs", "shadowWarp", 0); + if (!hasKey("catacombs", "necronsHandle")) writeIntConfig("catacombs", "necronsHandle", 0); if (!hasKey("catacombs", "autoRecomb")) writeIntConfig("catacombs", "autoRecomb", 0); if (!hasKey("catacombs", "witherHelm")) writeIntConfig("catacombs", "witherHelm", 0); if (!hasKey("catacombs", "witherChest")) writeIntConfig("catacombs", "witherChest", 0); @@ -353,6 +354,7 @@ public class ConfigHandler { if (!hasKey("misc", "autoDisplay")) writeBooleanConfig("misc", "autoDisplay", false); if (!hasKey("misc", "skill50Time")) writeIntConfig("misc", "skill50Time", 3); if (!hasKey("misc", "cakeTime")) writeDoubleConfig("misc", "cakeTime", 0); + if (!hasKey("misc", "showSkillTracker")) writeBooleanConfig("misc", "showSkillTracker", false); ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); int height = scaled.getScaledHeight(); @@ -368,12 +370,15 @@ public class ConfigHandler { if (!hasKey("locations", "lividHpY")) writeIntConfig("locations", "lividHpY", 20); if (!hasKey("locations", "cakeTimerX")) writeIntConfig("locations", "cakeTimerX", 40); if (!hasKey("locations", "cakeTimerY")) writeIntConfig("locations", "cakeTimerY", 30); + if (!hasKey("locations", "skillTrackerX")) writeIntConfig("locations", "skillTrackerX", 40); + if (!hasKey("locations", "skillTrackerY")) writeIntConfig("locations", "skillTrackerY", 50); if (!hasKey("scales", "coordsScale")) writeDoubleConfig("scales", "coordsScale", 1); if (!hasKey("scales", "displayScale")) writeDoubleConfig("scales", "displayScale", 1); if (!hasKey("scales", "dungeonTimerScale")) writeDoubleConfig("scales", "dungeonTimerScale", 1); if (!hasKey("scales", "skill50Scale")) writeDoubleConfig("scales", "skill50Scale", 1); if (!hasKey("scales", "lividHpScale")) writeDoubleConfig("scales", "lividHpScale", 1); if (!hasKey("scales", "cakeTimerScale")) writeDoubleConfig("scales", "cakeTimerScale", 1); + if (!hasKey("scales", "skillTrackerScale")) writeDoubleConfig("scales", "skillTrackerScale", 1); if (!hasKey("colors", "main")) writeStringConfig("colors", "main", "" + EnumChatFormatting.GREEN); if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", "" + EnumChatFormatting.DARK_GREEN); @@ -386,6 +391,7 @@ public class ConfigHandler { if (!hasKey("colors", "skill50Display")) writeStringConfig("colors", "skill50Display", "" + EnumChatFormatting.AQUA); if (!hasKey("colors", "coordsDisplay")) writeStringConfig("colors", "coordsDisplay", "" + EnumChatFormatting.WHITE); if (!hasKey("colors", "cakeDisplay")) writeStringConfig("colors", "cakeDisplay", "" + EnumChatFormatting.GOLD); + if (!hasKey("colors", "skillTracker")) writeStringConfig("colors", "skillTracker", "" + EnumChatFormatting.AQUA); ToggleCommand.gpartyToggled = getBoolean("toggles", "GParty"); ToggleCommand.coordsToggled = getBoolean("toggles", "Coords"); @@ -559,6 +565,7 @@ public class ConfigHandler { LootCommand.implosions = getInt("catacombs", "implosion"); LootCommand.witherShields = getInt("catacombs", "witherShield"); LootCommand.shadowWarps = getInt("catacombs", "shadowWarp"); + LootCommand.necronsHandles = getInt("catacombs", "necronsHandle"); LootCommand.autoRecombs = getInt("catacombs", "autoRecomb"); LootCommand.witherHelms = getInt("catacombs", "witherHelm"); LootCommand.witherChests = getInt("catacombs", "witherChest"); @@ -572,6 +579,7 @@ public class ConfigHandler { DisplayCommand.auto = getBoolean("misc", "autoDisplay"); TheMod.SKILL_TIME = getInt("misc", "skill50Time") * 20; TheMod.cakeTime = getDouble("misc", "cakeTime"); + TheMod.showSkillTracker = getBoolean("misc", "showSkillTracker"); MoveCommand.coordsXY[0] = getInt("locations", "coordsX"); MoveCommand.coordsXY[1] = getInt("locations", "coordsY"); @@ -585,6 +593,8 @@ public class ConfigHandler { MoveCommand.lividHpXY[1] = getInt("locations", "lividHpY"); MoveCommand.cakeTimerXY[0] = getInt("locations", "cakeTimerX"); MoveCommand.cakeTimerXY[1] = getInt("locations", "cakeTimerY"); + MoveCommand.skillTrackerXY[0] = getInt("locations", "skillTrackerX"); + MoveCommand.skillTrackerXY[1] = getInt("locations", "skillTrackerY"); ScaleCommand.coordsScale = getDouble("scales", "coordsScale"); ScaleCommand.displayScale = getDouble("scales", "displayScale"); @@ -592,6 +602,7 @@ public class ConfigHandler { ScaleCommand.skill50Scale = getDouble("scales", "skill50Scale"); ScaleCommand.lividHpScale = getDouble("scales", "lividHpScale"); ScaleCommand.cakeTimerScale = getDouble("scales", "cakeTimerScale"); + ScaleCommand.skillTrackerScale = getDouble("scales", "skillTrackerScale"); TheMod.MAIN_COLOUR = getString("colors", "main"); TheMod.SECONDARY_COLOUR = getString("colors", "secondary"); @@ -604,6 +615,7 @@ public class ConfigHandler { TheMod.SKILL_50_COLOUR = getString("colors", "skill50Display"); TheMod.COORDS_COLOUR = getString("colors", "coordsDisplay"); TheMod.CAKE_COLOUR = getString("colors", "cakeDisplay"); + TheMod.SKILL_TRACKER_COLOUR = getString("colors", "skillTracker"); } } diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 7416c8e..4361f8f 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -37,10 +37,10 @@ public class Utils { public static boolean inSkyblock = false; public static boolean inDungeons = false; public static int[] skillXPPerLevel = {0, 50, 125, 200, 300, 500, 750, 1000, 1500, 2000, 3500, 5000, 7500, 10000, 15000, 20000, 30000, 50000, - 75000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 1100000, - 1200000, 1300000, 1400000, 1500000, 1600000, 1700000, 1800000, 1900000, 2000000, 2100000, 2200000, - 2300000, 2400000, 2500000, 2600000, 2750000, 2900000, 3100000, 3400000, 3700000, 4000000, 4300000, - 4600000, 4900000, 5200000, 5500000, 5800000, 6100000, 6400000, 6700000, 7000000}; + 75000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 1100000, + 1200000, 1300000, 1400000, 1500000, 1600000, 1700000, 1800000, 1900000, 2000000, 2100000, 2200000, + 2300000, 2400000, 2500000, 2600000, 2750000, 2900000, 3100000, 3400000, 3700000, 4000000, 4300000, + 4600000, 4900000, 5200000, 5500000, 5800000, 6100000, 6400000, 6700000, 7000000}; static int[] dungeonsXPPerLevel = {0, 50, 75, 110, 160, 230, 330, 470, 670, 950, 1340, 1890, 2665, 3760, 5260, 7380, 10300, 14400, 20000, 27600, 38000, 52500, 71500, 97000, 132000, 180000, 243000, 328000, 445000, 600000, 800000, 1065000, 1410000, 1900000, 2500000, 3300000, 4300000, 5600000, 7200000, 9200000, 12000000, 15000000, |