From 379b7ee6e42f758284e6871072cd52149ecb7d34 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 00:22:10 +0100 Subject: [PATCH 01/22] 0.21 Beta 17 --- CHANGELOG.md | 23 ++++++++++++++++--- FEATURES.md | 6 +++++ build.gradle.kts | 2 +- .../java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 +- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e86f8588c3c..ccf1ba1cea24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,10 @@ + E.g. inside the SkyBlock leveling guide. + Added Chat **Translator** - NetheriteMiner + After enabling, click on any chat message sent by another player to translate it to English. ++ Added Highlight Visitors in SkyBlock. - nea + + Highlights Visitors outside the Garden. ++ Block Interacting with Visitors. - nea + + Blocks you from interacting with / unlocking Visitors to allow for Dedication Cycling. #### Events @@ -82,7 +86,8 @@ + Help with the 2023 Halloween visitor challenge (ephemeral dingsibumsi or something) - nea + New Visitor Ping: Pings you when you are less than 10 seconds away from getting a new visitor. + Accept Hotkey: Accept a visitor when you press this keybind while in the visitor GUI. - ++ Added support for showing the primal fear data from tab list as GUI elements. - Erymanthus ++ Play warning sound when the next Primal Fear can spawn. - thunderblade73 ### Changes @@ -119,9 +124,11 @@ + Only items with recipes are tab completed. + Added option to set the size of highlighted motes orbs in rift and make them smaller by default. - cimbraien + Disabled clicks on SkyHanni GUIs while inside NEU's or Skytils profile viewer. - hannibal2 -+ Removed armor stand checks for Trevor Solver. This fixes or nerfs the feature to not highlight mobs behind blocks sometimes. - hannibal2 ++ Removed armor stand checks for Trevor Solver. This fixes or nerfs the feature to not highlight mobs behind blocks + sometimes. - hannibal2 + Added diamond and gold essence support to PowderTracker. - walker -+ Change the fandom wiki search engine (under the /wiki command) from Google to the fandom wiki's built-in search engine - Erymanthus ++ Change the fandom wiki search engine (under the /wiki command) from Google to the fandom wiki's built-in search + engine - Erymanthus + Added option to hide Chest Value while the Estimated Item Value display is showing. - hannibal2 + No longer merging same items with different prices in Chest Value together. - hannibal2 + Adding Great Spook support for Non God Pot Effect display. - hannibal2 @@ -129,6 +136,8 @@ + Added support for detecting refreshed farming fortune century cake effect. - alexia + Show key to press below burrow warp. - hannibal2 + Makes the Compact Potion message open the Potion effects menu on click. - jani ++ Added option to show King Talisman Helper outside Dwarven Mines. - hannibal2 ++ In-Game Date: Adds support for reading the in-game scoreboard, and also allow sun/moon symbol customization. - Erymanthus ### Bug Fixes @@ -191,6 +200,13 @@ + SkyHanni Keybinds no longer work inside SkyHanni config. - hannibal2 + Fixed Great Spook potion not working in Non God Pot Effect feature. - jani + Fixed wrong Rhys (Deep Caverns NPC) items needed for Dwarven Mines unlock in Bingo Step Helper. - ReyMaratov ++ Fixed King Talisman Helper once again. - hannibal2 ++ Made the ESC -> Mod Options -> SkyHanni -> Config button not crash you. - hannibal2 ++ Disabled Diana Warp key and Inquis Share key while inside any GUI. - hannibal2 ++ Removed Diana warp data on world switch. - hannibal2 ++ Reset mouse sensitivity back to 100% if you log off with lock mouse look enabled. - hannibal2 ++ Fixed mouse sensitivity stuck after restarting by storing old sensitivity. - CalMWolfs ++ Fixed tool fortune. - CalMWolfs #### Config @@ -216,6 +232,7 @@ java config files (names, description, orderings and stuff). + Adding 100 lines to MobFinder.kt and making it better readable in the process. - walker + Making ChatFiler.kt way better, storing regex objects for reuse and preparing future repo support. - walker ++ Added command /shkingfix to reset the internal King Talisman Helper offset. - hannibal2 ## Version 0.20 diff --git a/FEATURES.md b/FEATURES.md index 459ac958a833..527f7ed7a580 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -480,6 +480,10 @@ Use `/sh` or `/skyhanni` to open the SkyHanni config in game. + **Visual garden plot borders** - VixidDev + Press F3 + G to enable/disable the view. + /shmouselock command to lock mouse rotation for farming. - Cad ++ Added Highlight Visitors in SkyBlock. - nea + + Highlights Visitors outside the Garden. ++ Block Interacting with Visitors. - nea + + Blocks you from interacting with / unlocking Visitors to allow for Dedication Cycling.
@@ -582,6 +586,8 @@ Use `/sh` or `/skyhanni` to open the SkyHanni config in game. + Help with the 2023 Halloween visitor challenge (ephemeral dingsibumsi or something) - nea + New Visitor Ping: Pings you when you are less than 10 seconds away from getting a new visitor. + Accept Hotkey: Accept a visitor when you press this keybind while in the visitor GUI. ++ Added support for showing the primal fear data from tab list as GUI elements. - Erymanthus ++ Play warning sound when the next Primal Fear can spawn. - thunderblade73
diff --git a/build.gradle.kts b/build.gradle.kts index cc4fdc04b213..7e3e98c548bb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ plugins { } group = "at.hannibal2.skyhanni" -version = "0.21.Beta.16" +version = "0.21.Beta.17" // Toolchains: java { diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 0ef31132352d..ab2915ca849d 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -322,7 +322,7 @@ import org.apache.logging.log4j.Logger clientSideOnly = true, useMetadata = true, guiFactory = "at.hannibal2.skyhanni.config.ConfigGuiForgeInterop", - version = "0.21.Beta.16", + version = "0.21.Beta.17", ) class SkyHanniMod { @Mod.EventHandler From 3b2b937b9dc78295a183b3772ea8889c9132280c Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:23:57 +1100 Subject: [PATCH 02/22] changed a few .toString to .asString to fix stuff (#678) changed a few .toString to .asString to fix stuff #678 --- .../at/hannibal2/skyhanni/features/fishing/FishingAPI.kt | 4 ++-- .../skyhanni/features/garden/FarmingFortuneDisplay.kt | 9 ++++----- .../skyhanni/features/garden/visitor/VisitorReward.kt | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt index 973d7ac1e5b6..bfe3cb5bbae0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt @@ -3,5 +3,5 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.utils.InventoryUtils object FishingAPI { - fun hasFishingRodInHand() = InventoryUtils.itemInHandId.toString().contains("ROD") -} \ No newline at end of file + fun hasFishingRodInHand() = InventoryUtils.itemInHandId.asString().contains("ROD") +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index d9161c69290f..17fc083fa1e9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -21,7 +21,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments @@ -174,10 +173,10 @@ class FarmingFortuneDisplay { return 0.0 } return if (internalName.startsWith("THEORETICAL_HOE")) { - listOf(10.0, 25.0, 50.0)[internalName.toString().last().digitToInt() - 1] - } else when (internalName) { - "FUNGI_CUTTER".asInternalName() -> 30.0 - "COCO_CHOPPER".asInternalName() -> 20.0 + listOf(10.0, 25.0, 50.0)[internalName.asString().last().digitToInt() - 1] + } else when (internalName.asString()) { + "FUNGI_CUTTER" -> 30.0 + "COCO_CHOPPER" -> 20.0 else -> 0.0 } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorReward.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorReward.kt index d21ffebe7f7e..d6aabd3b5326 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorReward.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorReward.kt @@ -18,9 +18,9 @@ enum class VisitorReward(private val rawInternalName: String) { private val internalName by lazy { rawInternalName.asInternalName() } val itemStack by lazy { internalName.getItemStack() } - val displayName by lazy { itemStack.nameWithEnchantment ?: internalName.toString() } + val displayName by lazy { itemStack.nameWithEnchantment ?: internalName.asString() } companion object { fun getByInternalName(internalName: NEUInternalName) = entries.firstOrNull { it.internalName == internalName } } -} \ No newline at end of file +} From 6d3b19227177702b6c809dc305b496f68878d474 Mon Sep 17 00:00:00 2001 From: NetheriteMiner <88792142+NetheriteMiner@users.noreply.github.com> Date: Fri, 3 Nov 2023 09:27:07 -0400 Subject: [PATCH 03/22] Internal change: Remove malware false positive (#679) Stopped malware #679 --- CONTRIBUTING.md | 2 +- build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 50fb6b668ecf..25124fffa367 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -131,7 +131,7 @@ folder for how to properly do this. You also may have to disable repo auto updat ### Discord IPC DiscordIPC is a service that SkyHanni uses to send information from SkyBlock to Discord in Rich Presence.
-Specifically, we use [TirelessTraveler's Fork](https://github.com/ILikePlayingGames/DiscordIPC) of a fork of a fork of +Specifically, we use [NetheriteMiner's Fork](https://github.com/NetheriteMiner/DiscordIPC) of a fork of a fork of a fork of the [original](https://github.com/jagrosh/DiscordIPC). For info on usage, look at [DiscordRPCManager.kt](https://github.com/hannibal002/SkyHanni/blob/beta/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt) diff --git a/build.gradle.kts b/build.gradle.kts index 7e3e98c548bb..cea2e04e1351 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -57,7 +57,7 @@ dependencies { forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") // Discord RPC client - shadowImpl("com.github.ILikePlayingGames:DiscordIPC:f91ed4b") { + shadowImpl("com.github.NetheriteMiner:DiscordIPC:3106be5") { exclude(module = "log4j") because("Different version conflicts with Minecraft's Log4J") exclude(module = "gson") From 915229c4bd5621ba3e2118f723797fa16846c827 Mon Sep 17 00:00:00 2001 From: HiZe_ Date: Fri, 3 Nov 2023 19:07:00 +0100 Subject: [PATCH 04/22] Import VisualWords from SBE (#609) Added support to import SBE Visual Words into SkyHanni. #609 --- .../at/hannibal2/skyhanni/config/Storage.java | 3 + .../skyhanni/config/commands/Commands.kt | 3 +- .../misc/visualwords/VisualWordGui.kt | 60 ++++++++++++++++++- 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index a63477a07168..951e80ebf865 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -43,6 +43,9 @@ public class Storage { @Expose public List modifiedWords = new ArrayList<>(); + @Expose + public boolean visualWordsImported = false; + @Expose public Boolean contestSendingAsked = false; diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 82318656ab52..da75c9cc6419 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -368,6 +368,7 @@ object Commands { if (!LorenzUtils.onHypixel) { LorenzUtils.chat("§cYou need to join Hypixel to use this feature!") } else { + if (VisualWordGui.sbeConfigPath.exists()) VisualWordGui.drawImport = true SkyHanniMod.screenToOpen = VisualWordGui() } } @@ -388,7 +389,7 @@ object Commands { name: String, description: String, function: (Array) -> Unit, - autoComplete: ((Array) -> List) = { listOf() } + autoComplete: ((Array) -> List) = { listOf() }, ) { val command = SimpleCommand( name, diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index 6e9ef14ccc92..4e845a313350 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -1,8 +1,12 @@ package at.hannibal2.skyhanni.features.misc.visualwords import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.LorenzUtils.chat import at.hannibal2.skyhanni.utils.StringUtils.convertToFormatted +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import com.google.gson.JsonObject import kotlinx.coroutines.launch import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiScreen @@ -12,6 +16,8 @@ import net.minecraft.item.ItemStack import net.minecraft.util.MathHelper import org.lwjgl.input.Keyboard import org.lwjgl.input.Mouse +import java.io.File +import java.io.FileReader import java.io.IOException open class VisualWordGui : GuiScreen() { @@ -44,8 +50,12 @@ open class VisualWordGui : GuiScreen() { private var modifiedWords = mutableListOf() + private val shouldDrawImport get() = drawImport && !SkyHanniMod.feature.storage.visualWordsImported + companion object { fun isInGui() = Minecraft.getMinecraft().currentScreen is VisualWordGui + var sbeConfigPath = File("." + File.separator + "config" + File.separator + "SkyblockExtras.cfg") + var drawImport = false } override fun drawScreen(unusedX: Int, unusedY: Int, partialTicks: Float) { @@ -75,6 +85,15 @@ open class VisualWordGui : GuiScreen() { if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 drawRect(x - 30, y - 10, x + 30, y + 10, colour) + if (shouldDrawImport){ + val importX = guiLeft + sizeX - 45 + val importY = guiTop + sizeY - 10 + GuiRenderUtils.drawStringCentered("§aImport from SBE", importX, importY) + val importColor = + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, importX - 45, importY - 10, 90, 20)) 0x50828282 else 0x50303030 + drawRect(importX - 45, importY - 10, importX + 45, importY + 10, importColor) + } + GlStateManager.scale(scale, scale, 1f) drawUnmodifiedStringCentered( @@ -346,6 +365,14 @@ open class VisualWordGui : GuiScreen() { } currentlyEditing = !currentlyEditing } + if (shouldDrawImport){ + val importX = guiLeft + sizeX - 45 + val importY = guiTop + sizeY - 10 + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, importX - 45, importY - 10, 90, 20)) { + SoundUtils.playClickSound() + tryImport() + } + } } @Throws(IOException::class) @@ -452,6 +479,37 @@ open class VisualWordGui : GuiScreen() { SkyHanniMod.feature.storage.modifiedWords = modifiedWords } + private fun tryImport() { + if (drawImport) { + val json = ConfigManager.gson.fromJson( + FileReader(sbeConfigPath), + JsonObject::class.java + ) + var importedWords = 0 + var skippedWords = 0 + val lists = json["custom"].asJsonObject["visualWords"].asJsonArray + loop@ for (line in lists) { + "(?.*)@-(?.*)@:-(?false|true)".toPattern().matchMatcher(line.asString) { + val from = group("from") + val to = group("to") + val state = group("state").toBoolean() + + if (modifiedWords.any { it.phrase == from }) { + skippedWords++ + continue@loop + } + + modifiedWords.add(VisualWord(from.replace("&", "&&"), to.replace("&", "&&"), state, false)) + importedWords++ + } + } + if (importedWords > 0 || skippedWords > 0) { + chat("§e[SkyHanni] §aSuccessfully imported §e$importedWords §aand skipped §e$skippedWords §aVisualWords from SkyBlockExtras !") + SkyHanniMod.feature.storage.visualWordsImported = true + drawImport = false + } + } + } private fun drawUnmodifiedString(str: String, x: Float, y: Float) { GuiRenderUtils.drawString("§§$str", x, y) } @@ -479,4 +537,4 @@ private enum class SelectedTextBox { PHRASE, REPLACEMENT, NONE -} \ No newline at end of file +} From 27b12a2521bf9f3576814d600589f1e31e0975d8 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:08:15 +0100 Subject: [PATCH 05/22] fixed check if an existing word already exists with color codes, added support for malformed sbe config and code cleanup. --- .../misc/visualwords/VisualWordGui.kt | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index 4e845a313350..97aae1260dd1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc.visualwords import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager +import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.LorenzUtils.chat import at.hannibal2.skyhanni.utils.StringUtils.convertToFormatted @@ -85,7 +86,7 @@ open class VisualWordGui : GuiScreen() { if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 drawRect(x - 30, y - 10, x + 30, y + 10, colour) - if (shouldDrawImport){ + if (shouldDrawImport) { val importX = guiLeft + sizeX - 45 val importY = guiTop + sizeY - 10 GuiRenderUtils.drawStringCentered("§aImport from SBE", importX, importY) @@ -365,12 +366,12 @@ open class VisualWordGui : GuiScreen() { } currentlyEditing = !currentlyEditing } - if (shouldDrawImport){ + if (shouldDrawImport) { val importX = guiLeft + sizeX - 45 val importY = guiTop + sizeY - 10 if (GuiRenderUtils.isPointInRect(mouseX, mouseY, importX - 45, importY - 10, 90, 20)) { SoundUtils.playClickSound() - tryImport() + tryImportFromSBE() } } } @@ -479,19 +480,18 @@ open class VisualWordGui : GuiScreen() { SkyHanniMod.feature.storage.modifiedWords = modifiedWords } - private fun tryImport() { - if (drawImport) { - val json = ConfigManager.gson.fromJson( - FileReader(sbeConfigPath), - JsonObject::class.java - ) + private fun tryImportFromSBE() { + if (!drawImport) return + try { + val json = ConfigManager.gson.fromJson(FileReader(sbeConfigPath), JsonObject::class.java) var importedWords = 0 var skippedWords = 0 val lists = json["custom"].asJsonObject["visualWords"].asJsonArray + val pattern = "(?.*)@-(?.*)@:-(?false|true)".toPattern() loop@ for (line in lists) { - "(?.*)@-(?.*)@:-(?false|true)".toPattern().matchMatcher(line.asString) { - val from = group("from") - val to = group("to") + pattern.matchMatcher(line.asString) { + val from = group("from").replace("&", "&&") + val to = group("to").replace("&", "&&") val state = group("state").toBoolean() if (modifiedWords.any { it.phrase == from }) { @@ -499,7 +499,7 @@ open class VisualWordGui : GuiScreen() { continue@loop } - modifiedWords.add(VisualWord(from.replace("&", "&&"), to.replace("&", "&&"), state, false)) + modifiedWords.add(VisualWord(from, to, state, false)) importedWords++ } } @@ -508,8 +508,11 @@ open class VisualWordGui : GuiScreen() { SkyHanniMod.feature.storage.visualWordsImported = true drawImport = false } + } catch (t: Throwable) { + ErrorManager.logError(t, "Failed to load visual words from SBE") } } + private fun drawUnmodifiedString(str: String, x: Float, y: Float) { GuiRenderUtils.drawString("§§$str", x, y) } From c65404209dbd59f8444dc34a35012716d68276c6 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:21:56 +0100 Subject: [PATCH 06/22] code cleanup --- .../skyhanni/config/commands/Commands.kt | 6 +- .../misc/visualwords/VisualWordGui.kt | 62 ++++++++++--------- .../skyhanni/utils/GuiRenderUtils.kt | 7 +-- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index da75c9cc6419..69e8e5933b93 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -167,9 +167,9 @@ object Commands { registerCommand( "shcopytranslation", " \n" + - "Requires the Chat > Translator feature to be enabled.\n" + - "Copies the translation for a given message to your clipboard. " + - "Language codes are at the end of the translation when you click on a message." + "Requires the Chat > Translator feature to be enabled.\n" + + "Copies the translation for a given message to your clipboard. " + + "Language codes are at the end of the translation when you click on a message." ) { Translator.fromEnglish(it) } registerCommand( "shmouselock", diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index 97aae1260dd1..ef8fb173e14c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -82,16 +82,14 @@ open class VisualWordGui : GuiScreen() { val y = guiTop + 170 drawUnmodifiedStringCentered("§aAdd New", x, y) - val colour = - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + val colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 drawRect(x - 30, y - 10, x + 30, y + 10, colour) if (shouldDrawImport) { val importX = guiLeft + sizeX - 45 val importY = guiTop + sizeY - 10 GuiRenderUtils.drawStringCentered("§aImport from SBE", importX, importY) - val importColor = - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, importX - 45, importY - 10, 90, 20)) 0x50828282 else 0x50303030 + val importColor = if (isPointInMousePos(importX - 45, importY - 10, 90, 20)) 0x50828282 else 0x50303030 drawRect(importX - 45, importY - 10, importX + 45, importY + 10, importColor) } @@ -114,31 +112,31 @@ open class VisualWordGui : GuiScreen() { } var inBox = false - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft, adjustedY + 30 * index, sizeX, 30)) inBox = true + if (isPointInMousePos(guiLeft, adjustedY + 30 * index, sizeX, 30)) { + inBox = true + } drawUnmodifiedString("${index + 1}.", (guiLeft + 5) * inverseScale, (adjustedY + 10 + 30 * index) * inverseScale) - if (GuiRenderUtils.isPointInRect(lastClickedWidth, lastClickedHeight, guiLeft + 335, adjustedY + 30 * index + 7, 16, 16)) { + if (isPointInLastClicked(guiLeft + 335, adjustedY + 30 * index + 7, 16, 16)) { lastClickedWidth = 0 lastClickedHeight = 0 phrase.enabled = !phrase.enabled saveChanges() SoundUtils.playClickSound() - } else if (GuiRenderUtils.isPointInRect(lastClickedWidth, lastClickedHeight, guiLeft + 295, - adjustedY + 30 * index + 7, 16, 16) && index != 0) { + } else if (isPointInLastClicked(guiLeft + 295, adjustedY + 30 * index + 7, 16, 16) && index != 0) { lastClickedWidth = 0 lastClickedHeight = 0 SoundUtils.playClickSound() changedIndex = index changedAction = ActionType.UP - } else if (GuiRenderUtils.isPointInRect(lastClickedWidth, lastClickedHeight, guiLeft + 315, - adjustedY + 30 * index + 7, 16, 16) && index != modifiedWords.size - 1) { + } else if (isPointInLastClicked(guiLeft + 315, adjustedY + 30 * index + 7, 16, 16) && index != modifiedWords.size - 1) { lastClickedWidth = 0 lastClickedHeight = 0 SoundUtils.playClickSound() changedIndex = index changedAction = ActionType.DOWN - } else if (GuiRenderUtils.isPointInRect(lastClickedWidth, lastClickedHeight, guiLeft, adjustedY + 30 * index, sizeX, 30)) { + } else if (isPointInLastClicked(guiLeft, adjustedY + 30 * index, sizeX, 30)) { lastClickedWidth = 0 lastClickedHeight = 0 SoundUtils.playClickSound() @@ -192,16 +190,15 @@ open class VisualWordGui : GuiScreen() { GlStateManager.scale(inverseScale, inverseScale, 1f) scrollScreen() - } - else { + } else { var x = guiLeft + 180 var y = guiTop + 140 drawUnmodifiedStringCentered("§cDelete", x, y) - var colour = if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + var colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 drawRect(x - 30, y - 10, x + 30, y + 10, colour) y += 30 drawUnmodifiedStringCentered("§eBack", x, y) - colour = if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 drawRect(x - 30, y - 10, x + 30, y + 10, colour) if (currentIndex < modifiedWords.size && currentIndex != -1) { @@ -211,26 +208,26 @@ open class VisualWordGui : GuiScreen() { drawUnmodifiedStringCentered("§bReplacement Enabled", x, y - 20) var status = if (currentPhrase.enabled) "§2Enabled" else "§4Disabled" drawUnmodifiedStringCentered(status, x, y) - colour = if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 drawRect(x - 30, y - 10, x + 30, y + 10, colour) x += 200 drawUnmodifiedStringCentered("§bCase Sensitive", x, y - 20) status = if (!currentPhrase.isCaseSensitive()) "§2True" else "§4False" drawUnmodifiedStringCentered(status, x, y) - colour = if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 drawRect(x - 30, y - 10, x + 30, y + 10, colour) drawUnmodifiedString("§bIs replaced by:", guiLeft + 30, guiTop + 75) - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft, guiTop + 35, sizeX, 30)) { + if (isPointInMousePos(guiLeft, guiTop + 35, sizeX, 30)) { drawRect(guiLeft, guiTop + 35, guiLeft + sizeX, guiTop + 35 + 30, 0x50303030) } if (currentTextBox == SelectedTextBox.PHRASE) { drawRect(guiLeft, guiTop + 35, guiLeft + sizeX, guiTop + 35 + 30, 0x50828282) } - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft, guiTop + 90, sizeX, 30)) { + if (isPointInMousePos(guiLeft, guiTop + 90, sizeX, 30)) { drawRect(guiLeft, guiTop + 90, guiLeft + sizeX, guiTop + 90 + 30, 0x50303030) } if (currentTextBox == SelectedTextBox.REPLACEMENT) { @@ -262,8 +259,7 @@ open class VisualWordGui : GuiScreen() { modifiedWords[changedIndex] = modifiedWords[changedIndex - 1] modifiedWords[changedIndex - 1] = temp } - } - else if (changedAction == ActionType.DOWN) { + } else if (changedAction == ActionType.DOWN) { if (changedIndex < modifiedWords.size - 1) { val temp = modifiedWords[changedIndex] modifiedWords[changedIndex] = modifiedWords[changedIndex + 1] @@ -279,6 +275,12 @@ open class VisualWordGui : GuiScreen() { GlStateManager.popMatrix() } + private fun isPointInMousePos(left: Int, top: Int, width: Int, height: Int) = + GuiRenderUtils.isPointInRect(mouseX, mouseY, left, top, width, height) + + private fun isPointInLastClicked(left: Int, top: Int, width: Int, height: Int) = + GuiRenderUtils.isPointInRect(lastClickedWidth, lastClickedHeight, left, top, width, height) + override fun handleMouseInput() { super.handleMouseInput() @@ -296,7 +298,7 @@ open class VisualWordGui : GuiScreen() { @Throws(IOException::class) fun mouseClickEvent() { if (!currentlyEditing) { - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft, guiTop, sizeX, sizeY - 25)) { + if (isPointInMousePos(guiLeft, guiTop, sizeX, sizeY - 25)) { lastClickedWidth = mouseX lastClickedHeight = mouseY } @@ -304,7 +306,7 @@ open class VisualWordGui : GuiScreen() { var x = guiLeft + 180 var y = guiTop + 140 if (currentlyEditing) { - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) { + if (isPointInMousePos(x - 30, y - 10, 60, 20)) { SoundUtils.playClickSound() currentlyEditing = false modifiedWords.removeAt(currentIndex) @@ -315,21 +317,21 @@ open class VisualWordGui : GuiScreen() { if (currentIndex < modifiedWords.size && currentIndex != -1) { x -= 100 y += 30 - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) { + if (isPointInMousePos(x - 30, y - 10, 60, 20)) { SoundUtils.playClickSound() modifiedWords[currentIndex].enabled = !modifiedWords[currentIndex].enabled saveChanges() } x += 200 - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) { + if (isPointInMousePos(x - 30, y - 10, 60, 20)) { SoundUtils.playClickSound() modifiedWords[currentIndex].setCaseSensitive(!modifiedWords[currentIndex].isCaseSensitive()) saveChanges() - } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft, guiTop + 35, sizeX, 30)) { + } else if (isPointInMousePos(guiLeft, guiTop + 35, sizeX, 30)) { SoundUtils.playClickSound() currentTextBox = SelectedTextBox.PHRASE currentText = modifiedWords[currentIndex].phrase - } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft, guiTop + 90, sizeX, 30)) { + } else if (isPointInMousePos(guiLeft, guiTop + 90, sizeX, 30)) { SoundUtils.playClickSound() currentTextBox = SelectedTextBox.REPLACEMENT currentText = modifiedWords[currentIndex].replacement @@ -343,7 +345,7 @@ open class VisualWordGui : GuiScreen() { } y = guiTop + 170 x = guiLeft + 180 - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - 30, y - 10, 60, 20)) { + if (isPointInMousePos(x - 30, y - 10, 60, 20)) { SoundUtils.playClickSound() if (currentlyEditing) { val currentVisualWord = modifiedWords.elementAt(currentIndex) @@ -356,7 +358,7 @@ open class VisualWordGui : GuiScreen() { currentIndex = -1 currentTextBox = SelectedTextBox.NONE } else { - modifiedWords.add(VisualWord("", "", true, false)) + modifiedWords.add(VisualWord("", "", true, caseSensitive = false)) currentTextBox = SelectedTextBox.PHRASE currentText = "" currentIndex = modifiedWords.size - 1 @@ -369,7 +371,7 @@ open class VisualWordGui : GuiScreen() { if (shouldDrawImport) { val importX = guiLeft + sizeX - 45 val importY = guiTop + sizeY - 10 - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, importX - 45, importY - 10, 90, 20)) { + if (isPointInMousePos(importX - 45, importY - 10, 90, 20)) { SoundUtils.playClickSound() tryImportFromSBE() } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt index 1269ec00501e..c485ec20bb8e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt @@ -164,9 +164,8 @@ object GuiRenderUtils { drawTooltip(textLines, mouseX, mouseY, screenHeight, Minecraft.getMinecraft().fontRendererObj) } - fun isPointInRect(x: Int, y: Int, left: Int, top: Int, width: Int, height: Int): Boolean { - return left <= x && x < left + width && top <= y && y < top + height - } + fun isPointInRect(x: Int, y: Int, left: Int, top: Int, width: Int, height: Int) = + left <= x && x < left + width && top <= y && y < top + height fun drawProgressBar(x: Int, y: Int, barWidth: Int, progress: Float) { GuiScreen.drawRect(x, y, x + barWidth, y + 6, 0xFF43464B.toInt()) @@ -285,4 +284,4 @@ object GuiRenderUtils { renderItemStack(item, x, y) GuiScreen.drawRect(x, y, x + 16, y + 16, colour) } -} \ No newline at end of file +} From 61c3b8ab7c4e107b3a7ea19339976deb0a011137 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:27:00 +0100 Subject: [PATCH 07/22] code cleanup --- .../misc/visualwords/VisualWordGui.kt | 52 +++++++++++++------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index ef8fb173e14c..7c4fb0dfc944 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -57,6 +57,25 @@ open class VisualWordGui : GuiScreen() { fun isInGui() = Minecraft.getMinecraft().currentScreen is VisualWordGui var sbeConfigPath = File("." + File.separator + "config" + File.separator + "SkyblockExtras.cfg") var drawImport = false + + val itemUp by lazy { + ItemUtils.createSkull( + "§§Up", + "7f68dd73-1ff6-4193-b246-820975d6fab1", + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzczMzRjZGRmY" + + "WI0NWQ3NWFkMjhlMWE0N2JmOGNmNTAxN2QyZjA5ODJmNjczN2RhMjJkNDk3Mjk1MjUxMDY2MSJ9fX0=" + ) + } + + val itemDown by lazy { + ItemUtils.createSkull( + "§§Down", + "e4ace6de-0629-4719-aea3-3e113314dd3f", + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTc3NDIwMz" + + "RmNTlkYjg5MGM4MDA0MTU2YjcyN2M3N2NhNjk1YzQzOTlkOGUwZGE1Y2U5MjI3Y2Y4MzZiYjhlMiJ9fX0=" + ) + } + } override fun drawScreen(unusedX: Int, unusedY: Int, partialTicks: Float) { @@ -74,6 +93,8 @@ open class VisualWordGui : GuiScreen() { val scale = 0.75f val inverseScale = 1 / scale + val colorA = 0x50828282 + val colorB = 0x50303030 if (!currentlyEditing) { val adjustedY = guiTop + 30 + pageScroll var toRemove: VisualWord? = null @@ -82,14 +103,14 @@ open class VisualWordGui : GuiScreen() { val y = guiTop + 170 drawUnmodifiedStringCentered("§aAdd New", x, y) - val colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + val colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) colorA else colorB drawRect(x - 30, y - 10, x + 30, y + 10, colour) if (shouldDrawImport) { val importX = guiLeft + sizeX - 45 val importY = guiTop + sizeY - 10 GuiRenderUtils.drawStringCentered("§aImport from SBE", importX, importY) - val importColor = if (isPointInMousePos(importX - 45, importY - 10, 90, 20)) 0x50828282 else 0x50303030 + val importColor = if (isPointInMousePos(importX - 45, importY - 10, 90, 20)) colorA else colorB drawRect(importX - 45, importY - 10, importX + 45, importY + 10, importColor) } @@ -145,7 +166,8 @@ open class VisualWordGui : GuiScreen() { } if (inBox) { - GuiRenderUtils.drawScaledRec(guiLeft, adjustedY + 30 * index, guiLeft + sizeX, adjustedY + 30 * index + 30, 0x50303030, inverseScale) + GuiRenderUtils.drawScaledRec(guiLeft, adjustedY + 30 * index, guiLeft + sizeX, adjustedY + 30 * index + 30, + colorB, inverseScale) } val statusBlock = if (phrase.enabled) { @@ -157,15 +179,13 @@ open class VisualWordGui : GuiScreen() { GlStateManager.scale(inverseScale, inverseScale, 1f) if (index != 0) { - val skullItem = ItemUtils.createSkull("§§Up", "7f68dd73-1ff6-4193-b246-820975d6fab1", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzczMzRjZGRmYWI0NWQ3NWFkMjhlMWE0N2JmOGNmNTAxN2QyZjA5ODJmNjczN2RhMjJkNDk3Mjk1MjUxMDY2MSJ9fX0=") - GuiRenderUtils.renderItemAndBackground(skullItem, guiLeft + 295, adjustedY + 30 * index + 7, 0x50828282) + GuiRenderUtils.renderItemAndBackground(itemUp, guiLeft + 295, adjustedY + 30 * index + 7, colorA) } if (index != modifiedWords.size - 1) { - val skullItem = ItemUtils.createSkull("§§Down", "e4ace6de-0629-4719-aea3-3e113314dd3f", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTc3NDIwMzRmNTlkYjg5MGM4MDA0MTU2YjcyN2M3N2NhNjk1YzQzOTlkOGUwZGE1Y2U5MjI3Y2Y4MzZiYjhlMiJ9fX0=") - GuiRenderUtils.renderItemAndBackground(skullItem, guiLeft + 315, adjustedY + 30 * index + 7, 0x50828282) + GuiRenderUtils.renderItemAndBackground(itemDown, guiLeft + 315, adjustedY + 30 * index + 7, colorA) } - GuiRenderUtils.renderItemAndBackground(statusBlock, guiLeft + 335, adjustedY + 30 * index + 7, 0x50828282) + GuiRenderUtils.renderItemAndBackground(statusBlock, guiLeft + 335, adjustedY + 30 * index + 7, colorA) GlStateManager.scale(scale, scale, 1f) @@ -194,11 +214,11 @@ open class VisualWordGui : GuiScreen() { var x = guiLeft + 180 var y = guiTop + 140 drawUnmodifiedStringCentered("§cDelete", x, y) - var colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + var colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) colorA else colorB drawRect(x - 30, y - 10, x + 30, y + 10, colour) y += 30 drawUnmodifiedStringCentered("§eBack", x, y) - colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) colorA else colorB drawRect(x - 30, y - 10, x + 30, y + 10, colour) if (currentIndex < modifiedWords.size && currentIndex != -1) { @@ -208,30 +228,30 @@ open class VisualWordGui : GuiScreen() { drawUnmodifiedStringCentered("§bReplacement Enabled", x, y - 20) var status = if (currentPhrase.enabled) "§2Enabled" else "§4Disabled" drawUnmodifiedStringCentered(status, x, y) - colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) colorA else colorB drawRect(x - 30, y - 10, x + 30, y + 10, colour) x += 200 drawUnmodifiedStringCentered("§bCase Sensitive", x, y - 20) status = if (!currentPhrase.isCaseSensitive()) "§2True" else "§4False" drawUnmodifiedStringCentered(status, x, y) - colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) 0x50828282 else 0x50303030 + colour = if (isPointInMousePos(x - 30, y - 10, 60, 20)) colorA else colorB drawRect(x - 30, y - 10, x + 30, y + 10, colour) drawUnmodifiedString("§bIs replaced by:", guiLeft + 30, guiTop + 75) if (isPointInMousePos(guiLeft, guiTop + 35, sizeX, 30)) { - drawRect(guiLeft, guiTop + 35, guiLeft + sizeX, guiTop + 35 + 30, 0x50303030) + drawRect(guiLeft, guiTop + 35, guiLeft + sizeX, guiTop + 35 + 30, colorB) } if (currentTextBox == SelectedTextBox.PHRASE) { - drawRect(guiLeft, guiTop + 35, guiLeft + sizeX, guiTop + 35 + 30, 0x50828282) + drawRect(guiLeft, guiTop + 35, guiLeft + sizeX, guiTop + 35 + 30, colorA) } if (isPointInMousePos(guiLeft, guiTop + 90, sizeX, 30)) { - drawRect(guiLeft, guiTop + 90, guiLeft + sizeX, guiTop + 90 + 30, 0x50303030) + drawRect(guiLeft, guiTop + 90, guiLeft + sizeX, guiTop + 90 + 30, colorB) } if (currentTextBox == SelectedTextBox.REPLACEMENT) { - drawRect(guiLeft, guiTop + 90, guiLeft + sizeX, guiTop + 90 + 30, 0x50828282) + drawRect(guiLeft, guiTop + 90, guiLeft + sizeX, guiTop + 90 + 30, colorA) } GlStateManager.scale(0.75f, 0.75f, 1f) From c33d4666232cd21a5585f36120944a8fca05e58e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:29:52 +0100 Subject: [PATCH 08/22] code cleanup --- .../features/misc/visualwords/VisualWordGui.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index 7c4fb0dfc944..deafe3cb302a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -139,19 +139,20 @@ open class VisualWordGui : GuiScreen() { drawUnmodifiedString("${index + 1}.", (guiLeft + 5) * inverseScale, (adjustedY + 10 + 30 * index) * inverseScale) - if (isPointInLastClicked(guiLeft + 335, adjustedY + 30 * index + 7, 16, 16)) { + val top = adjustedY + 30 * index + 7 + if (isPointInLastClicked(guiLeft + 335, top, 16, 16)) { lastClickedWidth = 0 lastClickedHeight = 0 phrase.enabled = !phrase.enabled saveChanges() SoundUtils.playClickSound() - } else if (isPointInLastClicked(guiLeft + 295, adjustedY + 30 * index + 7, 16, 16) && index != 0) { + } else if (isPointInLastClicked(guiLeft + 295, top, 16, 16) && index != 0) { lastClickedWidth = 0 lastClickedHeight = 0 SoundUtils.playClickSound() changedIndex = index changedAction = ActionType.UP - } else if (isPointInLastClicked(guiLeft + 315, adjustedY + 30 * index + 7, 16, 16) && index != modifiedWords.size - 1) { + } else if (isPointInLastClicked(guiLeft + 315, top, 16, 16) && index != modifiedWords.size - 1) { lastClickedWidth = 0 lastClickedHeight = 0 SoundUtils.playClickSound() @@ -166,8 +167,7 @@ open class VisualWordGui : GuiScreen() { } if (inBox) { - GuiRenderUtils.drawScaledRec(guiLeft, adjustedY + 30 * index, guiLeft + sizeX, adjustedY + 30 * index + 30, - colorB, inverseScale) + GuiRenderUtils.drawScaledRec(guiLeft, adjustedY + 30 * index, guiLeft + sizeX, adjustedY + 30 * index + 30, colorB, inverseScale) } val statusBlock = if (phrase.enabled) { @@ -179,13 +179,13 @@ open class VisualWordGui : GuiScreen() { GlStateManager.scale(inverseScale, inverseScale, 1f) if (index != 0) { - GuiRenderUtils.renderItemAndBackground(itemUp, guiLeft + 295, adjustedY + 30 * index + 7, colorA) + GuiRenderUtils.renderItemAndBackground(itemUp, guiLeft + 295, top, colorA) } if (index != modifiedWords.size - 1) { - GuiRenderUtils.renderItemAndBackground(itemDown, guiLeft + 315, adjustedY + 30 * index + 7, colorA) + GuiRenderUtils.renderItemAndBackground(itemDown, guiLeft + 315, top, colorA) } - GuiRenderUtils.renderItemAndBackground(statusBlock, guiLeft + 335, adjustedY + 30 * index + 7, colorA) + GuiRenderUtils.renderItemAndBackground(statusBlock, guiLeft + 335, top, colorA) GlStateManager.scale(scale, scale, 1f) From ba60af15b9f3ac89209a57b850f5f3a8488ceb56 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:32:17 +0100 Subject: [PATCH 09/22] code cleanup --- .../config/features/InventoryConfig.java | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java index c0906d512b7e..9a5f4759cd43 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java @@ -36,13 +36,13 @@ public static class HideNotClickableConfig { @Expose @ConfigOption( - name = "Opacity", - desc = "How strong should the items be grayed out?" + name = "Opacity", + desc = "How strong should the items be grayed out?" ) @ConfigEditorSlider( - minValue = 0, - maxValue = 255, - minStep = 5 + minValue = 0, + maxValue = 255, + minStep = 5 ) public int opacity = 180; @@ -134,7 +134,7 @@ public static class JacobFarmingContestConfig { @Expose @ConfigOption(name = "Medal Icon", desc = "Adds a symbol that shows what medal you received in this Contest. " + - "§eIf you use a texture pack this may cause conflicting icons.") + "§eIf you use a texture pack this may cause conflicting icons.") @ConfigEditorBoolean @FeatureToggle public boolean medalIcon = true; @@ -180,9 +180,9 @@ public static class SackDisplayConfig { @Expose @ConfigOption(name = "Extra space", desc = "Space between each line of text.") @ConfigEditorSlider( - minValue = 0, - maxValue = 10, - minStep = 1) + minValue = 0, + maxValue = 10, + minStep = 1) public int extraSpace = 1; @Expose @@ -192,11 +192,11 @@ public static class SackDisplayConfig { @Expose @ConfigOption(name = "Item To Show", desc = "Choose how many items are displayed. (Some sacks have too many items to fit\n" + - "in larger GUI scales, like the nether sack.)") + "in larger GUI scales, like the nether sack.)") @ConfigEditorSlider( - minValue = 0, - maxValue = 45, - minStep = 1 + minValue = 0, + maxValue = 45, + minStep = 1 ) public int itemToShow = 15; @@ -212,8 +212,8 @@ public static class SackDisplayConfig { @Expose @ConfigOption(name = "Price Format", desc = "Format of the price displayed.\n" + - "§eFormatted: §7(12k)\n" + - "§eUnformatted: §7(12,421)") + "§eFormatted: §7(12k)\n" + + "§eUnformatted: §7(12,421)") @ConfigEditorDropdown(values = {"Formatted", "Unformatted"}) public int priceFormat = 0; @@ -286,21 +286,21 @@ public static class ChestValueConfig { @Expose @ConfigOption(name = "Item To Show", desc = "Choose how many items are displayed.\n" + - "All items in the chest are still counted for the total value.") + "All items in the chest are still counted for the total value.") @ConfigEditorSlider( - minValue = 0, - maxValue = 54, - minStep = 1 + minValue = 0, + maxValue = 54, + minStep = 1 ) public int itemToShow = 15; @Expose @ConfigOption(name = "Hide below", desc = "Item item value below configured amount.\n" + - "Items are still counted for the total value.") + "Items are still counted for the total value.") @ConfigEditorSlider( - minValue = 50_000, - maxValue = 10_000_000, - minStep = 50_000 + minValue = 50_000, + maxValue = 10_000_000, + minStep = 50_000 ) public int hideBelow = 100_000; @@ -367,34 +367,34 @@ public static class TiaRelayConfig { @Expose @ConfigOption( - name = "Item Number", - desc = "Showing the item number as a stack size for these items." + name = "Item Number", + desc = "Showing the item number as a stack size for these items." ) @ConfigEditorDraggableList( - exampleText = { - "§bMaster Star Tier", - "§bMaster Skull Tier", - "§bDungeon Head Floor Number", - "§bNew Year Cake", - "§bPet Level", - "§bMinion Tier", - "§bCrimson Armor", - "§7(Removed)", - "§bKuudra Key", - "§bSkill Level", - "§bCollection Level", - "§bRancher's Boots speed", - "§bLarva Hook", - "§bDungeon Potion Level" - } + exampleText = { + "§bMaster Star Tier", + "§bMaster Skull Tier", + "§bDungeon Head Floor Number", + "§bNew Year Cake", + "§bPet Level", + "§bMinion Tier", + "§bCrimson Armor", + "§7(Removed)", + "§bKuudra Key", + "§bSkill Level", + "§bCollection Level", + "§bRancher's Boots speed", + "§bLarva Hook", + "§bDungeon Potion Level" + } ) public List itemNumberAsStackSize = new ArrayList<>(Arrays.asList(3, 9, 11, 12)); @Expose @ConfigOption( - name = "Quick Craft Confirmation", - desc = "Require Ctrl+Click to craft items that aren't often quick crafted " + - "(e.g. armor, weapons, accessories). Sack items can be crafted normally." + name = "Quick Craft Confirmation", + desc = "Require Ctrl+Click to craft items that aren't often quick crafted " + + "(e.g. armor, weapons, accessories). Sack items can be crafted normally." ) @ConfigEditorBoolean @FeatureToggle @@ -414,21 +414,21 @@ public static class TiaRelayConfig { @Expose @ConfigOption(name = "Item Stars", - desc = "Show a compact star count in the item name for all items.") + desc = "Show a compact star count in the item name for all items.") @ConfigEditorBoolean @FeatureToggle public boolean itemStars = false; @Expose @ConfigOption(name = "Missing Tasks", - desc = "Highlight missing tasks in the SkyBlock Level Guide inventory.") + desc = "Highlight missing tasks in the SkyBlock Level Guide inventory.") @ConfigEditorBoolean @FeatureToggle public boolean highlightMissingSkyBlockLevelGuide = true; @Expose @ConfigOption(name = "Highlight Auctions", - desc = "Highlight own items that are sold in green and that are expired in red.") + desc = "Highlight own items that are sold in green and that are expired in red.") @ConfigEditorBoolean @FeatureToggle public boolean highlightAuctions = true; From b3426297169836aceee7486bab89035c35c6d126 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Fri, 3 Nov 2023 20:26:08 +0100 Subject: [PATCH 10/22] Change: Custom Keybinds for Harp Helper (#612) Add custom keybinds for Harp Helper. #612 --- .../java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 +- .../config/features/InventoryConfig.java | 38 +++++++++++++++ .../features/inventory/HarpFeatures.kt | 46 +++++++++++++------ 3 files changed, 70 insertions(+), 16 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index ab2915ca849d..54408971100a 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -591,7 +591,7 @@ class SkyHanniMod { loadModule(GriffinPetWarning()) loadModule(BestiaryData) loadModule(KingTalismanHelper()) - loadModule(HarpFeatures()) + loadModule(HarpFeatures) loadModule(EnderNodeTracker()) loadModule(CompactBestiaryChatMessage()) loadModule(WatchdogHider()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java index 9a5f4759cd43..50128e85eef9 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java @@ -8,8 +8,10 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; +import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; import io.github.moulberry.moulconfig.annotations.ConfigOption; +import org.lwjgl.input.Keyboard; import java.util.ArrayList; import java.util.Arrays; @@ -331,6 +333,42 @@ public static class HarpConfig { @ConfigOption(name = "Show Numbers", desc = "In the Harp, show buttons as stack size (intended to be used with the Keybinds).") @ConfigEditorBoolean public boolean showNumbers = false; + + @Expose + @ConfigOption(name = "Keybinds", desc = "") + @Accordion + public HarpConfigKeyBinds harpKeybinds = new HarpConfigKeyBinds(); + + public static class HarpConfigKeyBinds { + @Expose + @ConfigOption(name = "Key 1", desc = "Key for the first Node") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_1) + public int key1 = Keyboard.KEY_1; + @Expose + @ConfigOption(name = "Key 2", desc = "Key for the second Node") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_2) + public int key2 = Keyboard.KEY_2; + @Expose + @ConfigOption(name = "Key 3", desc = "Key for the third Node") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_3) + public int key3 = Keyboard.KEY_3; + @Expose + @ConfigOption(name = "Key 4", desc = "Key for the fourth Node") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_4) + public int key4 = Keyboard.KEY_4; + @Expose + @ConfigOption(name = "Key 5", desc = "Key for the fifth Node") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_5) + public int key5 = Keyboard.KEY_5; + @Expose + @ConfigOption(name = "Key 6", desc = "Key for the sixth Node") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_6) + public int key6 = Keyboard.KEY_6; + @Expose + @ConfigOption(name = "Key 7", desc = "Key for the seventh Node") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_7) + public int key7 = Keyboard.KEY_7; + } } @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt index e793cd6155a7..3c0a40870a64 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -12,23 +12,39 @@ import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.item.Item import net.minecraftforge.client.event.GuiScreenEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import org.lwjgl.input.Keyboard import kotlin.time.Duration.Companion.milliseconds // Delaying key presses by 300ms comes from NotEnoughUpdates -class HarpFeatures { - private val config get() = SkyHanniMod.feature.inventory.helper.harp +object HarpFeatures { + val config get() = SkyHanniMod.feature.inventory.helper.harp private var lastClick = SimpleTimeMark.farPast() - private val keys = listOf( - Keyboard.KEY_1, - Keyboard.KEY_2, - Keyboard.KEY_3, - Keyboard.KEY_4, - Keyboard.KEY_5, - Keyboard.KEY_6, - Keyboard.KEY_7 - ) + private object keys : + Iterable { + override fun iterator(): Iterator { + return object : Iterator { + private var currentIndex = 0 + + override fun hasNext(): Boolean { + return currentIndex < 7 + } + + override fun next(): Int { + return when (currentIndex++) { + 0 -> HarpFeatures.config.harpKeybinds.key1 + 1 -> HarpFeatures.config.harpKeybinds.key2 + 2 -> HarpFeatures.config.harpKeybinds.key3 + 3 -> HarpFeatures.config.harpKeybinds.key4 + 4 -> HarpFeatures.config.harpKeybinds.key5 + 5 -> HarpFeatures.config.harpKeybinds.key6 + 6 -> HarpFeatures.config.harpKeybinds.key7 + else -> throw NoSuchElementException() + } + } + } + } + + } private val buttonColors = listOf('d', 'e', 'a', '2', '5', '9', 'b') @@ -39,12 +55,12 @@ class HarpFeatures { if (!openInventoryName().startsWith("Harp")) return val chest = event.gui as? GuiChest ?: return - for (key in keys) { + for ((index, key) in keys.withIndex()) { if (key.isKeyHeld()) { if (lastClick.passedSince() > 200.milliseconds) { Minecraft.getMinecraft().playerController.windowClick( chest.inventorySlots.windowId, - 35 + key, + 37 + index, 2, 3, Minecraft.getMinecraft().thePlayer @@ -75,4 +91,4 @@ class HarpFeatures { event.move(2, "misc.harpKeybinds", "inventory.helper.harp.keybinds") event.move(2, "misc.harpNumbers", "inventory.helper.harp.showNumbers") } -} \ No newline at end of file +} From 3d1b6f71080f2cfc48a36db8880da64073f023bb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 20:28:51 +0100 Subject: [PATCH 11/22] code cleanup --- .../features/inventory/HarpFeatures.kt | 62 ++++++++----------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt index 3c0a40870a64..f2b17d79d698 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -19,31 +19,24 @@ object HarpFeatures { val config get() = SkyHanniMod.feature.inventory.helper.harp private var lastClick = SimpleTimeMark.farPast() - private object keys : - Iterable { - override fun iterator(): Iterator { - return object : Iterator { - private var currentIndex = 0 + private object KeyIterable : Iterable { + override fun iterator() = object : Iterator { + private var currentIndex = 0 - override fun hasNext(): Boolean { - return currentIndex < 7 - } + override fun hasNext() = currentIndex < 7 - override fun next(): Int { - return when (currentIndex++) { - 0 -> HarpFeatures.config.harpKeybinds.key1 - 1 -> HarpFeatures.config.harpKeybinds.key2 - 2 -> HarpFeatures.config.harpKeybinds.key3 - 3 -> HarpFeatures.config.harpKeybinds.key4 - 4 -> HarpFeatures.config.harpKeybinds.key5 - 5 -> HarpFeatures.config.harpKeybinds.key6 - 6 -> HarpFeatures.config.harpKeybinds.key7 - else -> throw NoSuchElementException() - } - } + override fun next() = when (currentIndex++) { + 0 -> config.harpKeybinds.key1 + 1 -> config.harpKeybinds.key2 + 2 -> config.harpKeybinds.key3 + 3 -> config.harpKeybinds.key4 + 4 -> config.harpKeybinds.key5 + 5 -> config.harpKeybinds.key6 + 6 -> config.harpKeybinds.key7 + + else -> throw NoSuchElementException("currentIndex: $currentIndex") } } - } private val buttonColors = listOf('d', 'e', 'a', '2', '5', '9', 'b') @@ -55,20 +48,19 @@ object HarpFeatures { if (!openInventoryName().startsWith("Harp")) return val chest = event.gui as? GuiChest ?: return - for ((index, key) in keys.withIndex()) { - if (key.isKeyHeld()) { - if (lastClick.passedSince() > 200.milliseconds) { - Minecraft.getMinecraft().playerController.windowClick( - chest.inventorySlots.windowId, - 37 + index, - 2, - 3, - Minecraft.getMinecraft().thePlayer - ) // middle clicks > left clicks - lastClick = SimpleTimeMark.now() - } - break - } + for ((index, key) in KeyIterable.withIndex()) { + if (!key.isKeyHeld()) continue + if (lastClick.passedSince() < 200.milliseconds) break + + Minecraft.getMinecraft().playerController.windowClick( + chest.inventorySlots.windowId, + 37 + index, + 2, + 3, + Minecraft.getMinecraft().thePlayer + ) // middle clicks > left clicks + lastClick = SimpleTimeMark.now() + break } } From 1618ea0aeb9118c4e12dc0837c8d77226fa7d8a9 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 20:32:12 +0100 Subject: [PATCH 12/22] Show the custom hotkey name in the harp inventory. --- .../features/inventory/HarpFeatures.kt | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt index f2b17d79d698..f210f857c3ef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils.openInventoryName +import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -25,17 +26,7 @@ object HarpFeatures { override fun hasNext() = currentIndex < 7 - override fun next() = when (currentIndex++) { - 0 -> config.harpKeybinds.key1 - 1 -> config.harpKeybinds.key2 - 2 -> config.harpKeybinds.key3 - 3 -> config.harpKeybinds.key4 - 4 -> config.harpKeybinds.key5 - 5 -> config.harpKeybinds.key6 - 6 -> config.harpKeybinds.key7 - - else -> throw NoSuchElementException("currentIndex: $currentIndex") - } + override fun next() = getKey(currentIndex++) ?: throw NoSuchElementException("currentIndex: $currentIndex") } } @@ -64,6 +55,18 @@ object HarpFeatures { } } + fun getKey(index: Int) = when (index) { + 0 -> config.harpKeybinds.key1 + 1 -> config.harpKeybinds.key2 + 2 -> config.harpKeybinds.key3 + 3 -> config.harpKeybinds.key4 + 4 -> config.harpKeybinds.key5 + 5 -> config.harpKeybinds.key6 + 6 -> config.harpKeybinds.key7 + + else -> null + } + @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { if (!LorenzUtils.inSkyBlock) return @@ -75,7 +78,8 @@ object HarpFeatures { val index = buttonColors.indexOfFirst { it == event.stack.displayName[1] } if (index == -1) return // this should never happen unless there's an update - event.stackTip = (index + 1).toString() + val keyCode = getKey(index) ?: return + event.stackTip = KeyboardManager.getKeyName(keyCode) } @SubscribeEvent From 667fd43324e5610ec16a12ef42d4e4d3aff75419 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sat, 4 Nov 2023 07:03:19 +1100 Subject: [PATCH 13/22] add expired pumpkin to farming fortune (#673) Added command /shpumpkin to toggle include/exclude Expired Pumpkin farming fortune in the /ff gui and in the true ff display. #673 --- .../java/at/hannibal2/skyhanni/config/Storage.java | 3 +++ .../at/hannibal2/skyhanni/config/commands/Commands.kt | 4 ++++ .../skyhanni/features/garden/FarmingFortuneDisplay.kt | 11 ++++++++--- .../garden/fortuneguide/CaptureFarmingGear.kt | 5 +++++ .../skyhanni/features/garden/fortuneguide/FFStats.kt | 7 ++++++- .../features/garden/fortuneguide/FortuneStats.kt | 5 +++-- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index 951e80ebf865..173b48fa4580 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -250,6 +250,9 @@ public static class Fortune { @Expose public boolean carrotFortune = false; + @Expose + public boolean pumpkinFortune = false; + @Expose public Map farmingItems = new HashMap<>(); } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 69e8e5933b93..4a7e6cdcbf22 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -215,6 +215,10 @@ object Commands { "shcarrot", "Toggles receiving the 12 fortune from carrots" ) { CaptureFarmingGear.reverseCarrotFortune() } + registerCommand( + "shpumpkin", + "Toggles receiving the 12 fortune from pumpkins" + ) { CaptureFarmingGear.reversePumpkinFortune() } registerCommand( "shrepostatus", "Shows the status of all the mods constants" diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 17fc083fa1e9..5bf5bbe8fc6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -270,14 +270,19 @@ class FarmingFortuneDisplay { val accessoryFortune = accessoryFortune ?: 0.0 val baseFortune = if (alwaysBaseFortune) 100.0 else baseFortune - var carrotFortune = 0.0 + var otherFortune = 0.0 if (currentCrop == CropType.CARROT) { GardenAPI.config?.fortune?.let { - if (it.carrotFortune) carrotFortune = 12.0 + if (it.carrotFortune) otherFortune = 12.0 } } - return baseFortune + upgradeFortune + tabFortune + toolFortune + accessoryFortune + carrotFortune + if (currentCrop == CropType.PUMPKIN) { + GardenAPI.config?.fortune?.let { + if (it.pumpkinFortune) otherFortune = 12.0 + } + } + return baseFortune + upgradeFortune + tabFortune + toolFortune + accessoryFortune + otherFortune } fun CropType.getLatestTrueFarmingFortune() = latestFF?.get(this) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index 3a4844f2d75e..b4d0fa3722aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -84,6 +84,11 @@ class CaptureFarmingGear { hidden.carrotFortune = !hidden.carrotFortune LorenzUtils.chat("§2Toggled exportable carrot fortune to: ${hidden.carrotFortune}") } + fun reversePumpkinFortune() { + val hidden = GardenAPI.config?.fortune ?: return + hidden.pumpkinFortune = !hidden.pumpkinFortune + LorenzUtils.chat("§2Toggled expired pumpkin fortune to: ${hidden.pumpkinFortune}") + } } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt index 7e9c9399a1a2..8765bd19bd7d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt @@ -155,6 +155,11 @@ object FFStats { val carrotFortune = if (hidden.carrotFortune) 12.0 else 0.0 cropPage[FortuneStats.EXPORTED_CARROT] = Pair(carrotFortune, 12.0) } + if (crop == CropType.PUMPKIN) { + val hidden = GardenAPI.config?.fortune ?: return + val pumpkinFortune = if (hidden.pumpkinFortune) 12.0 else 0.0 + cropPage[FortuneStats.EXPIRED_PUMPKIN] = Pair(pumpkinFortune, 12.0) + } cropPage[FortuneStats.CROP_TOTAL] = Pair( cropPage.toList().sumOf { it.second.first }, @@ -257,4 +262,4 @@ object FFStats { } return 0.0 } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt index 77c2759737bf..fc759ac0471f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt @@ -19,5 +19,6 @@ enum class FortuneStats(val label: String, val tooltip: String) { CULTIVATING("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n§2You get 2☘ per level"), TURBO("§2Turbo-Crop Enchantment", "§7§2Fortune for each enchantment level\n§2You get 5☘ per level"), DEDICATION("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n§2and crop milestone"), - EXPORTED_CARROT("§2Exported Carrot", "§7§2Gain 12☘ from exporting Carrots in the Rift!\n§eRun /shcarrot to toggle the stat") -} \ No newline at end of file + EXPORTED_CARROT("§2Exported Carrot", "§7§2Gain 12☘ from exporting Carrots in the Rift!\n§eRun /shcarrot to toggle the stat"), + EXPIRED_PUMPKIN("§2Expired Pumpkin", "§7§2Gain 12☘ from letting Pumpkins expire!\n§eRun /shpumpkin to toggle the stat") +} From 26879e9ff88c2a6e3bcd665606aef47ea97cdb5a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 21:04:17 +0100 Subject: [PATCH 14/22] code cleanup --- .../at/hannibal2/skyhanni/config/Storage.java | 38 +++++++++---------- .../features/garden/FarmingFortuneDisplay.kt | 30 ++++++++------- .../garden/fortuneguide/CaptureFarmingGear.kt | 13 ++++--- .../features/garden/fortuneguide/FFStats.kt | 8 ++-- .../garden/fortuneguide/FortuneStats.kt | 14 +++++-- 5 files changed, 57 insertions(+), 46 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index 173b48fa4580..ad17625fd67f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -92,9 +92,9 @@ public static class MinionConfig { @Override public String toString() { return "MinionConfig{" + - "displayName='" + displayName + '\'' + - ", lastClicked=" + lastClicked + - '}'; + "displayName='" + displayName + '\'' + + ", lastClicked=" + lastClicked + + '}'; } } @@ -380,22 +380,22 @@ public static class SlayerItemProfit { @Override public String toString() { return "SlayerItemProfit{" + - "internalName='" + internalName + '\'' + - ", timesDropped=" + timesDropped + - ", totalAmount=" + totalAmount + - ", hidden=" + hidden + - '}'; + "internalName='" + internalName + '\'' + + ", timesDropped=" + timesDropped + + ", totalAmount=" + totalAmount + + ", hidden=" + hidden + + '}'; } } @Override public String toString() { return "SlayerProfitList{" + - "items=" + items + - ", mobKillCoins=" + mobKillCoins + - ", slayerSpawnCost=" + slayerSpawnCost + - ", slayerCompletedCount=" + slayerCompletedCount + - '}'; + "items=" + items + + ", mobKillCoins=" + mobKillCoins + + ", slayerSpawnCost=" + slayerSpawnCost + + ", slayerCompletedCount=" + slayerCompletedCount + + '}'; } } @@ -419,11 +419,11 @@ public static class SlayerRngMeterStorage { @Override public String toString() { return "SlayerRngMeterStorage{" + - "currentMeter=" + currentMeter + - ", gainPerBoss=" + gainPerBoss + - ", goalNeeded=" + goalNeeded + - ", itemGoal='" + itemGoal + '\'' + - '}'; + "currentMeter=" + currentMeter + + ", gainPerBoss=" + gainPerBoss + + ", goalNeeded=" + goalNeeded + + ", itemGoal='" + itemGoal + '\'' + + '}'; } } @@ -454,7 +454,7 @@ public static class TrapperData { public int selfKillingAnimals; @Expose - public Map animalRarities= new HashMap<>(); + public Map animalRarities = new HashMap<>(); } @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 5bf5bbe8fc6d..6cdf64ca62e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -140,7 +140,6 @@ class FarmingFortuneDisplay { private fun isEnabled(): Boolean = GardenAPI.inGarden() && config.display - companion object { private val config get() = SkyHanniMod.feature.garden.farmingFortunes private val latestFF: MutableMap? get() = GardenAPI.config?.latestTrueFarmingFortune @@ -251,17 +250,20 @@ class FarmingFortuneDisplay { itemBaseFortune = 0.0 greenThumbFortune = 0.0 for (line in tool?.getLore()!!) { - val match = tooltipFortunePattern.matchEntire(line)?.groups - if (match != null) { - displayedFortune = match[1]!!.value.toDouble() - reforgeFortune = match[2]?.value?.toDouble() ?: 0.0 - - itemBaseFortune = if (tool.getInternalName().contains("LOTUS")) 5.0 - else displayedFortune - reforgeFortune - enchantmentFortune - (tool.getFarmingForDummiesCount() ?: 0 ) * 1.0 - greenThumbFortune = if (tool.getInternalName().contains("LOTUS")) { - displayedFortune - reforgeFortune - itemBaseFortune - } else 0.0 + val match = tooltipFortunePattern.matchEntire(line)?.groups ?: continue + + displayedFortune = match[1]!!.value.toDouble() + reforgeFortune = match[2]?.value?.toDouble() ?: 0.0 + + itemBaseFortune = if (tool.getInternalName().contains("LOTUS")) { + 5.0 + } else { + val dummiesFF = (tool.getFarmingForDummiesCount() ?: 0) * 1.0 + displayedFortune - reforgeFortune - enchantmentFortune - dummiesFF } + greenThumbFortune = if (tool.getInternalName().contains("LOTUS")) { + displayedFortune - reforgeFortune - itemBaseFortune + } else 0.0 } } @@ -290,8 +292,8 @@ class FarmingFortuneDisplay { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { - event.move(3,"garden.farmingFortuneDisplay", "garden.farmingFortunes.display") - event.move(3,"garden.farmingFortuneDropMultiplier", "garden.farmingFortunes.dropMultiplier") - event.move(3,"garden.farmingFortunePos", "garden.farmingFortunes.pos") + event.move(3, "garden.farmingFortuneDisplay", "garden.farmingFortunes.display") + event.move(3, "garden.farmingFortuneDropMultiplier", "garden.farmingFortunes.dropMultiplier") + event.move(3, "garden.farmingFortunePos", "garden.farmingFortunes.pos") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index b4d0fa3722aa..47c64032c015 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -80,14 +80,15 @@ class CaptureFarmingGear { } fun reverseCarrotFortune() { - val hidden = GardenAPI.config?.fortune ?: return - hidden.carrotFortune = !hidden.carrotFortune - LorenzUtils.chat("§2Toggled exportable carrot fortune to: ${hidden.carrotFortune}") + val storage = GardenAPI.config?.fortune ?: return + storage.carrotFortune = !storage.carrotFortune + LorenzUtils.chat("§2Toggled exportable carrot fortune to: ${storage.carrotFortune}") } + fun reversePumpkinFortune() { - val hidden = GardenAPI.config?.fortune ?: return - hidden.pumpkinFortune = !hidden.pumpkinFortune - LorenzUtils.chat("§2Toggled expired pumpkin fortune to: ${hidden.pumpkinFortune}") + val storage = GardenAPI.config?.fortune ?: return + storage.pumpkinFortune = !storage.pumpkinFortune + LorenzUtils.chat("§2Toggled expired pumpkin fortune to: ${storage.pumpkinFortune}") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt index 8765bd19bd7d..24d125d56476 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt @@ -151,13 +151,13 @@ object FFStats { else -> {} } if (crop == CropType.CARROT) { - val hidden = GardenAPI.config?.fortune ?: return - val carrotFortune = if (hidden.carrotFortune) 12.0 else 0.0 + val storage = GardenAPI.config?.fortune ?: return + val carrotFortune = if (storage.carrotFortune) 12.0 else 0.0 cropPage[FortuneStats.EXPORTED_CARROT] = Pair(carrotFortune, 12.0) } if (crop == CropType.PUMPKIN) { - val hidden = GardenAPI.config?.fortune ?: return - val pumpkinFortune = if (hidden.pumpkinFortune) 12.0 else 0.0 + val storage = GardenAPI.config?.fortune ?: return + val pumpkinFortune = if (storage.pumpkinFortune) 12.0 else 0.0 cropPage[FortuneStats.EXPIRED_PUMPKIN] = Pair(pumpkinFortune, 12.0) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt index fc759ac0471f..af02f7577847 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt @@ -4,7 +4,7 @@ enum class FortuneStats(val label: String, val tooltip: String) { BASE( "§2Universal Farming Fortune", "§7§2Farming fortune in that is\n§2applied to every crop\n§eNot the same as tab FF\n" + - "§eSee on the grass block page" + "§eSee on the grass block page" ), CROP_TOTAL("§6Crop Farming Fortune", "§7§2Farming fortune for this crop"), ACCESSORY("§2Talisman Bonus", "§7§2Fortune from your talisman\n§2You get 10☘ per talisman tier"), @@ -19,6 +19,14 @@ enum class FortuneStats(val label: String, val tooltip: String) { CULTIVATING("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n§2You get 2☘ per level"), TURBO("§2Turbo-Crop Enchantment", "§7§2Fortune for each enchantment level\n§2You get 5☘ per level"), DEDICATION("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n§2and crop milestone"), - EXPORTED_CARROT("§2Exported Carrot", "§7§2Gain 12☘ from exporting Carrots in the Rift!\n§eRun /shcarrot to toggle the stat"), - EXPIRED_PUMPKIN("§2Expired Pumpkin", "§7§2Gain 12☘ from letting Pumpkins expire!\n§eRun /shpumpkin to toggle the stat") + EXPORTED_CARROT( + "§2Exported Carrot", + "§7§2Gain 12☘ from exporting Carrots in the Rift!\n" + + "§eRun /shcarrot to toggle the stat" + ), + EXPIRED_PUMPKIN( + "§2Expired Pumpkin", + "§7§2Gain 12☘ from letting Pumpkins expire!\n" + + "§eRun /shpumpkin to toggle the stat" + ) } From 3c764298d747ba13f40c1f5cfb4329b62c91baaa Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 21:07:33 +0100 Subject: [PATCH 15/22] code cleanup --- .../java/at/hannibal2/skyhanni/config/features/MiscConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 86f60a8f7f46..39694637300a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -40,7 +40,7 @@ public static class PetConfig { public static class PetExperienceToolTipConfig { @Expose - @ConfigOption(name = "Enabled", desc = "Show the full pet exp and the progress to level 100 (ignoring rarity) when hovering over a pet while pressing shift key.") + @ConfigOption(name = "Enabled", desc = "Show the full pet exp and the progress to level 100 (ignoring rarity) when hovering over a pet while pressing shift key.") @ConfigEditorBoolean @FeatureToggle public boolean petDisplay = true; From a645741ceb9a407acba9b9fa116334943207824f Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sat, 4 Nov 2023 07:12:52 +1100 Subject: [PATCH 16/22] show a gui when mouse is locked (#677) Added a gui element to remind you while /shmouselock is enabled. #677 --- .../at/hannibal2/skyhanni/config/features/MiscConfig.java | 3 +++ .../at/hannibal2/skyhanni/features/misc/LockMouseLook.kt | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 39694637300a..ec9c8dd61f69 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -822,6 +822,9 @@ public static class KickDurationConfig { @Expose public Position showTimeInLimboPosition = new Position(400, 200, 1.3f); + @Expose + public Position lockedMouseDisplay = new Position(400, 200, 0.8f); + @Expose public Position inventoryLoadPos = new Position(394, 124, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt index b4ab08459886..d9887a26e718 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt @@ -1,8 +1,10 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -33,4 +35,10 @@ object LockMouseLook { LorenzUtils.chat("§e[SkyHanni] §bMouse rotation is now unlocked.") } } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { + if (!lockedMouse) return + SkyHanniMod.feature.misc.lockedMouseDisplay.renderString("§eMouse Locked", posLabel = "Mouse Locked") + } } From cd244fd5969be832de68eb47ec7c3fda963c998e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 21:13:22 +0100 Subject: [PATCH 17/22] code cleanup --- .../skyhanni/config/features/MiscConfig.java | 168 +++++++++--------- 1 file changed, 86 insertions(+), 82 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index ec9c8dd61f69..2fc113216cd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -25,6 +25,7 @@ public class MiscConfig { @ConfigOption(name = "Pet", desc = "") @Accordion public PetConfig pets = new PetConfig(); + public static class PetConfig { @Expose @ConfigOption(name = "Pet Display", desc = "Show the currently active pet.") @@ -84,6 +85,7 @@ public static class HideArmor { @ConfigOption(name = "Potion Effects", desc = "") @Accordion public PotionEffectsConfig potionEffect = new PotionEffectsConfig(); + public static class PotionEffectsConfig { @Expose @ConfigOption(name = "Non God Pot Effects", desc = "Display the active potion effects that are not part of the God Pot.") @@ -105,6 +107,7 @@ public static class PotionEffectsConfig { @ConfigOption(name = "Particle Hider", desc = "") @Accordion public ParticleHiderConfig particleHiders = new ParticleHiderConfig(); + public static class ParticleHiderConfig { @Expose @ConfigOption(name = "Blaze Particles", desc = "Hide Blaze particles.") @@ -153,6 +156,7 @@ public static class ParticleHiderConfig { @ConfigOption(name = "Estimated Item Value", desc = "(Prices for Enchantments, Reforge Stones, Gemstones, Drill Parts and more)") @Accordion public EstimatedItemValueConfig estimatedItemValues = new EstimatedItemValueConfig(); + public static class EstimatedItemValueConfig { @Expose @ConfigOption(name = "Enable Estimated Price", desc = "Displays an Estimated Item Value for the item you hover over.") @@ -173,9 +177,9 @@ public static class EstimatedItemValueConfig { @Expose @ConfigOption(name = "Enchantments Cap", desc = "Only show the top # most expensive enchantments.") @ConfigEditorSlider( - minValue = 1, - maxValue = 30, - minStep = 1 + minValue = 1, + maxValue = 30, + minStep = 1 ) public Property enchantmentsCap = Property.of(7); @@ -210,38 +214,38 @@ public static class DiscordRPC { @Expose @ConfigOption(name = "First Line", desc = "Decide what to show in the first line.") @ConfigEditorDropdown(values = { - "Nothing", - "Location", - "Purse", - "Bits", - "Stats", - "Held Item", - "SkyBlock Date", - "Profile", - "Slayer", - "Custom", - "Dynamic", - "Crop Milestone", - "Current Pet" + "Nothing", + "Location", + "Purse", + "Bits", + "Stats", + "Held Item", + "SkyBlock Date", + "Profile", + "Slayer", + "Custom", + "Dynamic", + "Crop Milestone", + "Current Pet" }) public Property firstLine = Property.of(0); @Expose @ConfigOption(name = "Second Line", desc = "Decide what to show in the second line.") @ConfigEditorDropdown(values = { - "Nothing", - "Location", - "Purse", - "Bits", - "Stats", - "Held Item", - "SkyBlock Date", - "Profile", - "Slayer", - "Custom", - "Dynamic", - "Crop Milestone", - "Current Pet" + "Nothing", + "Location", + "Purse", + "Bits", + "Stats", + "Held Item", + "SkyBlock Date", + "Profile", + "Slayer", + "Custom", + "Dynamic", + "Crop Milestone", + "Current Pet" }) public Property secondLine = Property.of(0); @@ -253,31 +257,31 @@ public static class DiscordRPC { @Expose @ConfigOption(name = "Dynamic Priority", desc = "Disable certain dynamic statuses, or change the priority in case two are triggered at the same time (higher up means higher priority).") @ConfigEditorDraggableList( - exampleText = { - "Crop Milestones", - "Slayer", - "Stacking Enchantment", - "Dungeon", - "AFK Indicator" - } + exampleText = { + "Crop Milestones", + "Slayer", + "Stacking Enchantment", + "Dungeon", + "AFK Indicator" + } ) public List autoPriority = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4)); @Expose @ConfigOption(name = "Dynamic Fallback", desc = "What to show when none of your \"Dynamic Priority\" statuses are active.") @ConfigEditorDropdown(values = { - "Nothing", - "Location", - "Purse", - "Bits", - "Stats", - "Held Item", - "SkyBlock Date", - "Profile", - "Slayer", - "Custom", - "Crop Milestone", - "Current Pet" + "Nothing", + "Location", + "Purse", + "Bits", + "Stats", + "Held Item", + "SkyBlock Date", + "Profile", + "Slayer", + "Custom", + "Crop Milestone", + "Current Pet" }) public Property auto = Property.of(0); } @@ -291,9 +295,9 @@ public static class TrevorTheTrapper { @Expose @ConfigOption( - name = "Enable Data Tracker", - desc = "Tracks all of your data from doing Trevor Quests.\n" + - "Shows based on the setting below." + name = "Enable Data Tracker", + desc = "Tracks all of your data from doing Trevor Quests.\n" + + "Shows based on the setting below." ) @ConfigEditorBoolean @FeatureToggle @@ -301,33 +305,33 @@ public static class TrevorTheTrapper { @Expose @ConfigOption( - name = "Show Between Quests", - desc = "Shows the tracker during and between quests otherwise it will only show during them." + - "Will show in the Trapper's Den regardless. §cToggle 'Enable Data Tracker' above." + name = "Show Between Quests", + desc = "Shows the tracker during and between quests otherwise it will only show during them." + + "Will show in the Trapper's Den regardless. §cToggle 'Enable Data Tracker' above." ) @ConfigEditorBoolean public boolean displayType = true; @Expose @ConfigOption( - name = "Text Format", - desc = "Drag text to change the appearance of the overlay." + name = "Text Format", + desc = "Drag text to change the appearance of the overlay." ) @ConfigEditorDraggableList( - exampleText = { - "§b§lTrevor Data Tracker", - "§b1,428 §9Quests Started", - "§b11,281 §5Total Pelts Gained", - "§b2,448 §5Pelts Per Hour", - "", - "§b850 §cKilled Animals", - "§b153 §cSelf Killing Animals", - "§b788 §fTrackable Animals", - "§b239 §aUntrackable Animals", - "§b115 §9Undetected Animals", - "§b73 §5Endangered Animals", - "§b12 §6Elusive Animals" - } + exampleText = { + "§b§lTrevor Data Tracker", + "§b1,428 §9Quests Started", + "§b11,281 §5Total Pelts Gained", + "§b2,448 §5Pelts Per Hour", + "", + "§b850 §cKilled Animals", + "§b153 §cSelf Killing Animals", + "§b788 §fTrackable Animals", + "§b239 §aUntrackable Animals", + "§b115 §9Undetected Animals", + "§b73 §5Endangered Animals", + "§b12 §6Elusive Animals" + } ) public List textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11)); @@ -336,7 +340,7 @@ public static class TrevorTheTrapper { @Expose @ConfigOption(name = "Trapper Solver", desc = "Assists you in finding Trevor's mobs. §eNote: May not always work as expected. " + - "§cWill not help you to find rabbits or sheep in the Oasis!") + "§cWill not help you to find rabbits or sheep in the Oasis!") @ConfigEditorBoolean @FeatureToggle public boolean trapperSolver = true; @@ -360,7 +364,7 @@ public static class TrevorTheTrapper { @Expose @ConfigOption(name = "Trapper Hotkey", desc = "Press this key to warp to Trevor's Den or to accept the quest. " + - "§eRequires the relevant above settings to be toggled") + "§eRequires the relevant above settings to be toggled") @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) public int keyBindWarpTrapper = Keyboard.KEY_NONE; @@ -373,8 +377,8 @@ public static class TrevorTheTrapper { @Expose @ConfigOption( - name = "Trapper Cooldown GUI", - desc = "Show the cooldown on screen in an overlay (intended for Abiphone users)." + name = "Trapper Cooldown GUI", + desc = "Show the cooldown on screen in an overlay (intended for Abiphone users)." ) @ConfigEditorBoolean public boolean trapperCooldownGui = false; @@ -577,8 +581,8 @@ public static class HighlightPartyMembers { @Expose @ConfigOption( - name = "Outline Color", - desc = "The color to outline party members in." + name = "Outline Color", + desc = "The color to outline party members in." ) @ConfigEditorColour public String outlineColor = "0:245:85:255:85"; @@ -594,7 +598,7 @@ public static class HighlightPartyMembers { public static class CompactTabListConfig { @Expose @ConfigOption(name = "Enabled", desc = "Compacts the tablist to make it look much nicer like SBA did. Also " + - "doesn't break god-pot detection and shortens some other lines.") + "doesn't break god-pot detection and shortens some other lines.") //made tablist one word here so both searches will pick it up @ConfigEditorBoolean @FeatureToggle @@ -669,9 +673,9 @@ public static class AdvancedPlayerList { @Expose @ConfigOption( - name = "Mark SkyHanni Devs", - desc = "Adds a §c:O §7behind the tablist name of §cSkyHanni's contributors§7. " + - "§eThose are the folks that coded the mod for you for free :)" + name = "Mark SkyHanni Devs", + desc = "Adds a §c:O §7behind the tablist name of §cSkyHanni's contributors§7. " + + "§eThose are the folks that coded the mod for you for free :)" ) @ConfigEditorBoolean public boolean markSkyHanniContributors = false; @@ -813,8 +817,8 @@ public static class KickDurationConfig { @Expose @ConfigOption( - name = "Time In Limbo", - desc = "Show the time since you entered the limbo.") + name = "Time In Limbo", + desc = "Show the time since you entered the limbo.") @ConfigEditorBoolean @FeatureToggle public boolean showTimeInLimbo = true; From e578369625f800200e5a4606fb162f41ebf0311a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 21:19:18 +0100 Subject: [PATCH 18/22] Fixed item ability cooldown not activating for Sword of Bad Health. --- .../itemabilities/abilitycooldown/ItemAbilityCooldown.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index 4bf1d38ff0c8..974deb26e70c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -185,11 +185,13 @@ class ItemAbilityCooldown { ItemAbility.RAGNAROCK_AXE.activate(LorenzColor.WHITE, 3_000) } } + message.contains("§lCASTING") -> { if (ItemAbility.RAGNAROCK_AXE.specialColor != LorenzColor.DARK_PURPLE) { ItemAbility.RAGNAROCK_AXE.activate(LorenzColor.DARK_PURPLE, 10_000) } } + message.contains("§c§lCANCELLED") -> { ItemAbility.RAGNAROCK_AXE.activate(null, 17_000) } @@ -273,7 +275,7 @@ class ItemAbilityCooldown { val guiOpen = Minecraft.getMinecraft().currentScreen != null val uuid = stack.getIdentifier() ?: return val list = items.filter { (it.key.getIdentifier()) == uuid } - .firstNotNullOfOrNull { it.value } ?: return + .firstNotNullOfOrNull { it.value } ?: return for (itemText in list) { if (guiOpen && !itemText.onCooldown) continue @@ -324,6 +326,9 @@ class ItemAbilityCooldown { if (message == "§cRagnarock was cancelled due to being hit!") { ItemAbility.RAGNAROCK_AXE.activate(null, 17_000) } + "§aYou buffed yourself for §r§c\\+\\d+❁ Strength".toPattern().matchMatcher(message) { + ItemAbility.SWORD_OF_BAD_HEALTH.activate() + } } private fun hasAbility(stack: ItemStack): MutableList { From e3dfb7daffde3dd7f47e2c6dba79669eb669ad34 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 21:24:53 +0100 Subject: [PATCH 19/22] code cleanup --- .../itemabilities/abilitycooldown/ItemAbilityCooldown.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index 974deb26e70c..a547c14b41c6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -35,6 +35,7 @@ class ItemAbilityCooldown { private var items = mapOf>() private var abilityItems = mapOf>() private val youAlignedOthersPattern = "§eYou aligned §r§a.* §r§eother player(s)?!".toPattern() + private val youBuffedYourselfPattern = "§aYou buffed yourself for §r§c\\+\\d+❁ Strength".toPattern() private val WEIRD_TUBA = "WEIRD_TUBA".asInternalName() private val WEIRDER_TUBA = "WEIRDER_TUBA".asInternalName() private val VOODOO_DOLL_WILTED = "VOODOO_DOLL_WILTED".asInternalName() @@ -326,7 +327,7 @@ class ItemAbilityCooldown { if (message == "§cRagnarock was cancelled due to being hit!") { ItemAbility.RAGNAROCK_AXE.activate(null, 17_000) } - "§aYou buffed yourself for §r§c\\+\\d+❁ Strength".toPattern().matchMatcher(message) { + youBuffedYourselfPattern.matchMatcher(message) { ItemAbility.SWORD_OF_BAD_HEALTH.activate() } } From 67a7b2b59b09b49d1fe9ea18611d42cac2667547 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 21:43:34 +0100 Subject: [PATCH 20/22] code cleanup --- .../skyhanni/features/misc/items/EstimatedItemValue.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index 5671822cbe2f..e9ec914ee327 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -63,6 +63,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.gson.JsonObject import com.google.gson.reflect.TypeToken import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent +import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer import io.github.moulberry.notenoughupdates.recipes.Ingredient import io.github.moulberry.notenoughupdates.util.Constants import net.minecraft.init.Items @@ -119,7 +120,6 @@ object EstimatedItemValue { cache.clear() } - @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { config.enchantmentsCap.onToggle { @@ -584,7 +584,6 @@ object EstimatedItemValue { val enrichmentName = stack.getEnrichment() ?: return 0.0 val internalName = "TALISMAN_ENRICHMENT_$enrichmentName".asInternalName() - val price = internalName.getPrice() val name = internalName.getItemName() list.add("§7Enrichment: $name §7(§6" + NumberUtil.format(price) + "§7)") @@ -695,7 +694,6 @@ object EstimatedItemValue { val itemStack = enchantmentName.getItemStackOrNull() ?: continue val singlePrice = enchantmentName.getPriceOrNull() ?: continue - var name = itemStack.getLore()[0] if (multiplier > 1) { name = "§8${multiplier}x $name" @@ -803,8 +801,8 @@ object EstimatedItemValue { // eg. SAPPHIRE_1 -> Sapphire Slot 2 val displayName = splitSlot[0].lowercase(Locale.ENGLISH).replaceFirstChar(Char::uppercase) + " Slot" + - // If the slot index is 0, we don't need to specify - if (splitSlot[1] != "0") " " + (splitSlot[1].toInt() + 1) else "" + // If the slot index is 0, we don't need to specify + if (splitSlot[1] != "0") " " + (splitSlot[1].toInt() + 1) else "" priceMap[" §$colorCode $displayName §7(§6$formattedPrice§7)"] = totalPrice - previousTotal } @@ -821,6 +819,6 @@ object EstimatedItemValue { event.move(3, "misc.estimatedIemValueAlwaysEnabled", "misc.estimatedItemValues.alwaysEnabled") event.move(3, "misc.estimatedIemValueEnchantmentsCap", "misc.estimatedItemValues.enchantmentsCap") event.move(3, "misc.estimatedIemValueExactPrice", "misc.estimatedItemValues.exactPrice") - event.move(3,"misc.itemPriceDataPos", "misc.estimatedItemValues.itemPriceDataPos") + event.move(3, "misc.itemPriceDataPos", "misc.estimatedItemValues.itemPriceDataPos") } } From a6a8d13e007237568747e9dfd5d5b6795cfbb5de Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 22:14:45 +0100 Subject: [PATCH 21/22] Added Estimated Item Value support to NEU Profile Viewer --- .../hannibal2/skyhanni/data/GuiEditManager.kt | 5 ++-- .../features/misc/items/EstimatedItemValue.kt | 24 +++++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 4f31107891c8..2f7617924ca8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign import at.hannibal2.skyhanni.utils.NEUItems +import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.gui.inventory.GuiEditSign @@ -26,7 +27,7 @@ class GuiEditManager { if (isInGui()) return Minecraft.getMinecraft().currentScreen?.let { - if (it !is GuiInventory && it !is GuiChest && it !is GuiEditSign) return + if (it !is GuiInventory && it !is GuiChest && it !is GuiEditSign && it !is GuiProfileViewer) return if (it is GuiEditSign && !it.isRancherSign()) return } @@ -95,4 +96,4 @@ class GuiEditManager { } } -class Vector2i(val x: Int, val y: Int) \ No newline at end of file +class Vector2i(val x: Int, val y: Int) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index e9ec914ee327..7dfd5656aafe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -66,8 +66,10 @@ import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer import io.github.moulberry.notenoughupdates.recipes.Ingredient import io.github.moulberry.notenoughupdates.util.Constants +import net.minecraft.client.Minecraft import net.minecraft.init.Items import net.minecraft.item.ItemStack +import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.io.File import java.util.Locale @@ -97,13 +99,28 @@ object EstimatedItemValue { } @SubscribeEvent - fun onRenderOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { + fun onTooltip(event: ItemTooltipEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!config.enabled) return + + if (Minecraft.getMinecraft().currentScreen is GuiProfileViewer) { + updateItem(event.itemStack) + tryRendering() + } + } + + private fun tryRendering() { currentlyShowing = checkCurrentlyVisible() if (!currentlyShowing) return config.itemPriceDataPos.renderStringsAndItems(display, posLabel = "Estimated Item Value") } + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { + tryRendering() + } + private fun checkCurrentlyVisible(): Boolean { if (!LorenzUtils.inSkyBlock) return false if (!config.enabled) return false @@ -132,7 +149,10 @@ object EstimatedItemValue { if (!LorenzUtils.inSkyBlock) return if (!config.enabled) return - val item = event.stack + updateItem(event.stack) + } + + private fun updateItem(item: ItemStack) { val oldData = cache[item] if (oldData != null) { display = oldData From dedbe709684dde6fa8e0c490bf1f97374c83e222 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Nov 2023 22:27:50 +0100 Subject: [PATCH 22/22] code cleanup --- src/main/java/at/hannibal2/skyhanni/data/RenderData.kt | 2 +- src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt index f109ea01b897..9a57f87cccfe 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderData.kt @@ -48,4 +48,4 @@ class RenderData { if (!SkyHanniDebugsAndTests.globalRender) return LorenzRenderWorldEvent(event.partialTicks).postAndCatch() } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 3fa8a09add39..79b74399666d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -310,8 +310,8 @@ object NEUItems { val name = group("name").trim { it <= ' ' } val ultimate = group("format").lowercase().contains("§l") ((if (ultimate && name != "Ultimate Wise") "ULTIMATE_" else "") - + turboCheck(name).replace(" ", "_").replace("-", "_").uppercase() - + ";" + group("level").romanToDecimal()) + + turboCheck(name).replace(" ", "_").replace("-", "_").uppercase() + + ";" + group("level").romanToDecimal()) } //Uses NEU