From e933913ebe88f6b465ee862374bbd26c57906cae Mon Sep 17 00:00:00 2001 From: inglettronald Date: Fri, 7 Apr 2023 18:40:31 -0500 Subject: i don't even remember --- README.md | 5 ++ src/main/kotlin/dulkirmod/DulkirMod.kt | 2 +- src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt | 28 ++++++++++ src/main/kotlin/dulkirmod/Huds/KeyHud.kt | 16 ++++++ src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt | 29 ++++++++++ .../kotlin/dulkirmod/command/JoinDungeonCommand.kt | 6 +-- src/main/kotlin/dulkirmod/config/DulkirConfig.kt | 61 +++++++++++++++++++++- src/main/kotlin/dulkirmod/config/KeyHud.kt | 16 ------ src/main/kotlin/dulkirmod/features/chat/Bridge.kt | 6 +-- src/main/kotlin/dulkirmod/utils/TablistUtils.kt | 53 +++++++++++-------- 10 files changed, 177 insertions(+), 45 deletions(-) create mode 100644 src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt create mode 100644 src/main/kotlin/dulkirmod/Huds/KeyHud.kt create mode 100644 src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt delete mode 100644 src/main/kotlin/dulkirmod/config/KeyHud.kt diff --git a/README.md b/README.md index 8bb5268..d94af75 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ Massive thanks to Soopyboo32, Nopo, Aton, and many others for the invaluable tea They were instrumental to the design and debugging process, and I'm thankful that I've learned as much from this as I have. +[![discord badge](https://img.shields.io/discord/819011720001224735?label=discord&color=9089DA&logo=discord&style=for-the-badge)](https://discord.gg/WnJwrNZQSn) +[![twitch](https://img.shields.io/twitch/status/dulkir?style=for-the-badge)](https://www.twitch.tv/dulkir) +[![downloads](https://img.shields.io/github/downloads/inglettronald/DulkirMod/total?style=for-the-badge)](https://github.com/inglettronald/DulkirMod) + + NEU and Skytils were great example mods to look for guidance from specifically, as well. Settings Command: /dulkir diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt index 1c46e08..b685b2d 100644 --- a/src/main/kotlin/dulkirmod/DulkirMod.kt +++ b/src/main/kotlin/dulkirmod/DulkirMod.kt @@ -1,8 +1,8 @@ package dulkirmod +import dulkirmod.Huds.KeyHud import dulkirmod.command.* import dulkirmod.config.DulkirConfig -import dulkirmod.config.KeyHud import dulkirmod.events.ChatEvent import dulkirmod.features.* import dulkirmod.features.chat.AbiphoneDND diff --git a/src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt b/src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt new file mode 100644 index 0000000..f4d1afb --- /dev/null +++ b/src/main/kotlin/dulkirmod/Huds/GardenInfoHud.kt @@ -0,0 +1,28 @@ +package dulkirmod.Huds + +import cc.polyfrost.oneconfig.hud.TextHud +import dulkirmod.config.DulkirConfig +import dulkirmod.utils.TabListUtils +import dulkirmod.utils.Utils + +class GardenInfoHud : TextHud(true) { + override fun getLines(lines: MutableList?, example: Boolean) { + if (!Utils.isInSkyblock()) return + if (TabListUtils.area != "Garden") return + var i = 0 + if (DulkirConfig.gardenMilestoneDisplay) { + lines?.add(i, TabListUtils.gardenMilestone) + ++i + } + if (DulkirConfig.visitorInfo) { + lines?.add(i, "Visitors: ${TabListUtils.numVisitors} - ${TabListUtils.timeTillNextVisitor}") + ++i + } + if (DulkirConfig.composterAlert) { + if (TabListUtils.emptyComposter) { + lines?.add(i, "Empty Composter!") + ++i + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/Huds/KeyHud.kt b/src/main/kotlin/dulkirmod/Huds/KeyHud.kt new file mode 100644 index 0000000..5b0c1df --- /dev/null +++ b/src/main/kotlin/dulkirmod/Huds/KeyHud.kt @@ -0,0 +1,16 @@ +package dulkirmod.Huds +import cc.polyfrost.oneconfig.hud.TextHud +import dulkirmod.features.chat.DungeonKeyDisplay + + +class KeyHud : TextHud(true) { + + override fun getLines(lines: MutableList?, example: Boolean) { + if (example) { + lines?.add(0, "Wither Key Display") + return + } + if (DungeonKeyDisplay.hasKey) + lines?.add(0, "Key Obtained") + } +} \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt b/src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt new file mode 100644 index 0000000..610ee08 --- /dev/null +++ b/src/main/kotlin/dulkirmod/Huds/YawDisplayHud.kt @@ -0,0 +1,29 @@ +package dulkirmod.Huds + +import cc.polyfrost.oneconfig.hud.TextHud +import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.config.DulkirConfig +import dulkirmod.utils.TabListUtils +import dulkirmod.utils.Utils + +class YawDisplayHud : TextHud(true) { + override fun getLines(lines: MutableList?, example: Boolean) { + if (!Utils.isInSkyblock()) return + if (TabListUtils.area != "Garden") return + val pitch = mc.thePlayer.rotationPitch + var yaw = mc.thePlayer.rotationYaw % 360f + + if (yaw < -180.0f) { + yaw += 360.0f; + } else if (yaw > 180.0f) { + yaw -= 360.0f; + } + if (DulkirConfig.yaw3Decimals) { + lines?.add(0, String.format("Yaw: %.3f", yaw)) + } else { + lines?.add(0, String.format("Yaw: %.2f", yaw)) + } + if (DulkirConfig.showPitch) + lines?.add(1, String.format("Pitch: %.2f", pitch)) + } +} \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt b/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt index d5e58c4..2470d99 100644 --- a/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt +++ b/src/main/kotlin/dulkirmod/command/JoinDungeonCommand.kt @@ -8,12 +8,12 @@ import net.minecraft.command.ICommandSender class JoinDungeonCommand : ClientCommandBase("joindungeon") { @Throws(CommandException::class) override fun processCommand(sender: ICommandSender, args: Array) { - var arguments = args.contentToString().replace("[", "").replace("]", "").replace(",", "") + val arguments = args.contentToString().replace("[", "").replace("]", "").replace(",", "") var type = "" var num = "" - if (args[0] == "master_catacombs") { + if (args[0].lowercase() == "master_catacombs") { type = "M" - } else if (args[0] == "catacombs") { + } else if (args[0].lowercase() == "catacombs") { type = "F" } diff --git a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt index 6af452b..cd914ff 100644 --- a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt +++ b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt @@ -5,6 +5,9 @@ import cc.polyfrost.oneconfig.config.annotations.* import cc.polyfrost.oneconfig.config.data.Mod import cc.polyfrost.oneconfig.config.data.ModType import dulkirmod.DulkirMod +import dulkirmod.Huds.GardenInfoHud +import dulkirmod.Huds.KeyHud +import dulkirmod.Huds.YawDisplayHud import dulkirmod.utils.Utils @@ -175,7 +178,7 @@ object DulkirConfig : Config(Mod("DulkirMod", ModType.SKYBLOCK), "dulkirmod-conf name = "Size", description = "Scales the size of your currently held item. Default: 0", category = "Animations", - subcategory = "Dungeons", + subcategory = "Animations", min = -1.5f, max = 1.5f, step = 0 @@ -601,6 +604,62 @@ object DulkirConfig : Config(Mod("DulkirMod", ModType.SKYBLOCK), "dulkirmod-conf ) var witherKeyDisplayHUD: KeyHud = KeyHud() + @HUD( + name = "Pitch/Yaw Display", + category = "HUD", + subcategory = "Farming" + ) + var YawDisplayHud: YawDisplayHud = YawDisplayHud() + + @Switch( + name = "Display Pitch as well", + description = "useful for some slime launcher stuff", + category = "HUD", + subcategory = "Farming" + ) + var showPitch = false + + @Switch( + name = "3 Decimals on Yaw", + description = "are u ok bro", + category = "HUD", + subcategory = "Farming" + ) + var yaw3Decimals = false + + @HUD( + name = "Garden Info Display", + category = "HUD", + subcategory = "Garden" + ) + var GardenInfoHud: GardenInfoHud = GardenInfoHud() + + @Switch( + name = "Empty Composter Notif", + description = "Will display in HUD instead of giga-alert", + category = "HUD", + subcategory = "Garden" + ) + var composterAlert = true + + @Switch( + name = "Farming Milestone Display", + description = "Increasing number go brr", + category = "HUD", + subcategory = "Garden" + ) + var gardenMilestoneDisplay = true + + @Switch( + name = "Visitor Info", + description = "Show number present and time until next", + category = "HUD", + subcategory = "Garden" + ) + var visitorInfo = true + + + fun init() { initialize() addDependency("customMessage", "throttleNotifier") diff --git a/src/main/kotlin/dulkirmod/config/KeyHud.kt b/src/main/kotlin/dulkirmod/config/KeyHud.kt deleted file mode 100644 index ca7b2e4..0000000 --- a/src/main/kotlin/dulkirmod/config/KeyHud.kt +++ /dev/null @@ -1,16 +0,0 @@ -package dulkirmod.config -import cc.polyfrost.oneconfig.hud.TextHud -import dulkirmod.features.chat.DungeonKeyDisplay - - -class KeyHud : TextHud(true) { - - override fun getLines(lines: MutableList?, example: Boolean) { - if (example) { - lines?.add(0, "Wither Key Display") - return - } - if (DungeonKeyDisplay.hasKey) - lines?.add(0, "Key Obtained") - } -} \ No newline at end of file diff --git a/src/main/kotlin/dulkirmod/features/chat/Bridge.kt b/src/main/kotlin/dulkirmod/features/chat/Bridge.kt index 1c4e288..245fe22 100644 --- a/src/main/kotlin/dulkirmod/features/chat/Bridge.kt +++ b/src/main/kotlin/dulkirmod/features/chat/Bridge.kt @@ -8,11 +8,11 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent object Bridge { private val guildFormat = - "^(§2Guild|§3Officer|§2G|§3O) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^>]+) > .+".toRegex() + "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^>]+) > .+".toRegex() private val alternateFormat = - "^(§2Guild|§3Officer|§2G|§3O) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^:]+): .+".toRegex() + "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^:]+): .+".toRegex() private val otherAltFormat = - "^(§2Guild|§3Officer|§2G|§3O) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^»]+) » .+".toRegex() + "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: ([^»]+) » .+".toRegex() fun handle(event: ClientChatReceivedEvent) { val message = event.message.unformattedText diff --git a/src/main/kotlin/dulkirmod/utils/TablistUtils.kt b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt index da07f0b..af4512b 100644 --- a/src/main/kotlin/dulkirmod/utils/TablistUtils.kt +++ b/src/main/kotlin/dulkirmod/utils/TablistUtils.kt @@ -15,6 +15,10 @@ object TabListUtils { var explosivity: Boolean = false var isInDungeons: Boolean = false var maxVisitors: Boolean = false + var emptyComposter: Boolean = false + var gardenMilestone: String = "" + var timeTillNextVisitor: String = "" + var numVisitors: Int = 0 private val playerInfoOrdering = object : Ordering() { override fun compare(p_compare_1_: NetworkPlayerInfo?, p_compare_2_: NetworkPlayerInfo?): Int { @@ -55,33 +59,40 @@ object TabListUtils { it.displayName?.unformattedText } + for (line in scoreboardList) { - if (line.startsWith("Area: ")) - area = line.substring(6) - else if (line == "Volcano Explosivity:") { - exploFlag = true - } - else if (exploFlag) { - explosivity = line != " INACTIVE" - exploFlag = false - } - else if (line == " Dungeon Stats") { - isInDungeons = true - dungeonFlag = true + when { + line.startsWith("Area: ") -> area = line.substring(6) + line == "Volcano Explosivity:" -> exploFlag = true + exploFlag -> { + exploFlag = false + if (line != " INACTIVE") { + explosivity = true + } + } + line == " Dungeon Stats" -> { + isInDungeons = true + } + line == " Time Left: INACTIVE" -> emptyComposter = true + line.startsWith(" Milestone") -> gardenMilestone = line.substring(1) + line.startsWith(" Next Visitor:") -> { + timeTillNextVisitor = line.substring(15) + maxVisitors = (timeTillNextVisitor == "Queue Full!") + } + line.startsWith("Visitors:") -> { + numVisitors = line.substring(11, 12).toInt() // TODO: FIX WHEN THEY ADD THE TENTH VISITOR + } } - // Here is some scuffed code that basically makes sure maxVisitors is assigned appropriately. - // It's awful and I do not care to fix it lol. - else if (line == " Next Visitor: Queue Full!") - maxVisitors = true - else if (line.startsWith(" Next Visitor:")) - maxVisitors = false } - if (area != "Crimson Isle") + if (area != "Crimson Isle") { explosivity = false - if (area != "Garden") + } + if (area != "Garden") { maxVisitors = false - if (!dungeonFlag) + } + if (!isInDungeons) { isInDungeons = false + } } } \ No newline at end of file -- cgit