diff options
| author | bowser0000 <bowser0000@gmail.com> | 2020-11-23 09:57:06 -0500 |
|---|---|---|
| committer | bowser0000 <bowser0000@gmail.com> | 2020-11-23 09:57:06 -0500 |
| commit | ea9c0616fd3406c3a93995f6ab28309fe6cd8e05 (patch) | |
| tree | 7b70a262a6be2b72205ce27da02cb7d3bda2dbf7 | |
| parent | b89d16855374a3e75c4c1279226d23d923821084 (diff) | |
| download | SkyblockMod-ea9c0616fd3406c3a93995f6ab28309fe6cd8e05.tar.gz SkyblockMod-ea9c0616fd3406c3a93995f6ab28309fe6cd8e05.tar.bz2 SkyblockMod-ea9c0616fd3406c3a93995f6ab28309fe6cd8e05.zip | |
Add skill xp/hour tracker, add Necron's Handle and bug fixes
Fix F7 loot not saving to config
Fix water puzzle variant 3 solution
| -rw-r--r-- | README.md | 17 | ||||
| -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 | ||||
| -rw-r--r-- | src/main/resources/mcmod.info | 3 |
13 files changed, 486 insertions, 57 deletions
@@ -28,6 +28,7 @@ Discord Server: https://discord.gg/QsEkNQS - Find correct Livid (with graphic display of HP) (toggleable) - Pet background colors based on level - Golem spawning alerts (toggleable) +- Skill xp/hour tracker - Show total skill xp instead of progress to next level - Show time until century cakes run out - API commands @@ -42,8 +43,8 @@ Discord Server: https://discord.gg/QsEkNQS - /loot <zombie/spider/wolf/fishing/catacombs> [winter/spooky/f(1-7)/session] - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead. - /display <zombie/spider/wolf/fishing/catacombs/auto/off> [winter/spooky/f(1-7)/session] - 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. - /resetloot <zombie/spider/wolf/fishing/catacombs/confirm/cancel> - - Resets loot for trackers. /resetloot confirm confirms the reset. -- /move <coords/display/dungeontimer/skill50/lividhp/caketimer> <x> <y> - Moves text display to specified X and Y coordinates. -- /scale <coords/display/dungeontimer/skill50/lividhp/caketimer> <scale (0.1 - 10)> - Scales text display to a specified multipler between 0.1x and 10x. +- /move <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <x> <y> - Moves text display to specified X and Y coordinates. +- /scale <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker> <scale (0.1 - 10)> - Scales text display to a specified multipler between 0.1x and 10x. - /slayer [player] - Uses API to get slayer xp of a person. If no name is provided, it checks yours. - /skills [player] - Uses API to get skill levels of a person. If no name is provided, it checks yours. - /lobbyskills - Uses API to find the average skills of the lobby, as well the three players with the highest skill average. @@ -55,12 +56,24 @@ Discord Server: https://discord.gg/QsEkNQS - /importfishing - Imports your fishing stats from your latest profile to your fishing tracker using the API. - /sbplayers - Uses API to find how many players are on each Skyblock island. - /onlyslayer <zombie/spider/wolf> <1/2/3/4> - Stops you from starting a slayer quest other than the one specified. +- /skilltracker <start/stop/reset> - Text display for skill xp/hour. ## Keybinds - Open Maddox menu - M by default. +- Start/Stop Skill Tracker - Numpad 5 by default. ### Notes - Slayer tracker for token drops and 20% chance drops uses a 12x12x12 bounding box centered on the player to detect the drops. If you are out of the range of the item drop, it will not count on the tracker. - API commands may take a while depending on your internet connection. The API may also go down. - If you use too many API commands too fast, you can and will get rate-limited. - Importing fishing uses your sea creature kills, which may not always be exactly correct (e.x. someone else kills your sea creature). + +### Credits to Open Source Software +Credit to all the following open source software used in this mod. + +Software | License +------------ | ------------- +[SkyblockAddons](https://github.com/BiscuitDevelopment/SkyblockAddons/) | [MIT License](https://github.com/BiscuitDevelopment/SkyblockAddons/blob/master/LICENSE) +[Zealot Counter](https://github.com/symt/zealot-counter/) | No License +[NotEnoughUpdates](https://github.com/Moulberry/NotEnoughUpdates/) | [Creative Commons Public License](https://github.com/Moulberry/NotEnoughUpdates/blob/master/LICENSE) +[ForgeHax](https://github.com/fr1kin/ForgeHax) | [MIT License](https://github.com/fr1kin/ForgeHax/blob/1.16/LICENSE)
\ No newline at end of file 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; + Co |
