From fda50f2ecd79498b8cb155025807d018cf86279e Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 5 Oct 2024 00:08:45 +0200 Subject: [PATCH 01/64] Fix: Delay Pablo GfS message (#2662) --- .../hannibal2/skyhanni/features/nether/PabloHelper.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt index 04f5e6113576..eb4962549f70 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.GetFromSackAPI import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -51,10 +52,12 @@ object PabloHelper { if (InventoryUtils.countItemsInLowerInventory { it.name.contains(itemName) } > 0) return - GetFromSackAPI.getFromChatMessageSackItems( - itemName.asInternalName().makePrimitiveStack(), - "Click here to grab an $itemName from sacks!", - ) + DelayedRun.runNextTick { + GetFromSackAPI.getFromChatMessageSackItems( + itemName.asInternalName().makePrimitiveStack(), + "Click here to grab an $itemName from sacks!", + ) + } lastSentMessage = SimpleTimeMark.now() } From c636d88309279ec458f96c6e6eadd93a39a6c912 Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Sat, 5 Oct 2024 16:16:18 +1000 Subject: [PATCH 02/64] Fix: repo getting redownloaded on the same commit (#2669) --- src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index ec6f0cbd9ebe..b3109c9ee4d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -36,7 +36,7 @@ class RepoManager(private val configLocation: File) { private var latestRepoCommit: String? = null val repoLocation: File = File(configLocation, "repo") private var error = false - private var lastRepoUpdate = SimpleTimeMark.farPast() + private var lastRepoUpdate = SimpleTimeMark.now() companion object { From 5a77e28bf9bd7f9d10eb561212ea5f68512892b7 Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:55:52 +1000 Subject: [PATCH 03/64] Fix: error punctuation (#2651) --- .../java/at/hannibal2/skyhanni/api/event/EventHandler.kt | 4 +++- src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt | 4 +++- .../java/at/hannibal2/skyhanni/test/command/ErrorManager.kt | 6 +++++- src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 5 +++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt b/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt index 4b4c008523e2..d164e0e774d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.inAnyIsland +import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.chat.Text import java.lang.invoke.LambdaMetafactory import java.lang.invoke.MethodHandles @@ -91,7 +92,8 @@ class EventHandler private constructor(val name: String, priv errors++ if (errors <= 3) { val errorName = throwable::class.simpleName ?: "error" - val message = "Caught an $errorName in ${listener.name} at $name: ${throwable.message}" + val aOrAn = StringUtils.optionalAn(errorName) + val message = "Caught $aOrAn $errorName in ${listener.name} at $name: ${throwable.message}" ErrorManager.logErrorWithData(throwable, message, ignoreErrorCache = onError != null) } onError?.invoke(throwable) diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt index 4a294a6779ca..b567d9ae6d06 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzEvent.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.mixins.hooks.setValue import at.hannibal2.skyhanni.mixins.transformers.AccessorEventBus import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.chat.Text import at.hannibal2.skyhanni.utils.system.PlatformUtils import net.minecraftforge.common.MinecraftForge @@ -57,7 +58,8 @@ abstract class LorenzEvent : Event() { if (printError && errors <= visibleErrors) { val callerName = listener.toString().split(" ")[1].split("@")[0].split(".").last() val errorName = throwable::class.simpleName ?: "error" - val message = "Caught an $errorName in $callerName at $eventName: ${throwable.message}" + val aOrAn = StringUtils.optionalAn(errorName) + val message = "Caught $aOrAn $errorName in $callerName at $eventName: ${throwable.message}" ErrorManager.logErrorWithData(throwable, message, ignoreErrorCache = ignoreErrorCache) } onError(throwable) diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index df3d85267677..56a50ecebd06 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -154,8 +154,12 @@ object ErrorManager { fullErrorMessages[randomId] = "```\nSkyHanni ${SkyHanniMod.version}: $rawMessage\n(full stack trace)\n \n$fullStackTrace\n$extraDataString```" + var finalMessage = message + if (finalMessage.last() !in ".?!") { + finalMessage += "§c." + } ChatUtils.clickableChat( - "§c[SkyHanni-${SkyHanniMod.version}]: $message§c. Click here to copy the error into the clipboard.", + "§c[SkyHanni-${SkyHanniMod.version}]: $finalMessage Click here to copy the error into the clipboard.", onClick = { copyError(randomId) }, "§eClick to copy!", prefix = false, diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index f118d5d665c0..c6de8c13fced 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -569,4 +569,9 @@ object StringUtils { false } } + + fun optionalAn(string: String): String { + if (string.isEmpty()) return "" + return if (string[0] in "aeiou") "an" else "a" + } } From 168372b0be062dff2bf17d661ab4adfa4492e91d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 5 Oct 2024 10:01:05 +0200 Subject: [PATCH 04/64] renamed Bug Fix --- .github/workflows/label-bug-fix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label-bug-fix.yml b/.github/workflows/label-bug-fix.yml index dae2980de630..4730d6194468 100644 --- a/.github/workflows/label-bug-fix.yml +++ b/.github/workflows/label-bug-fix.yml @@ -14,7 +14,7 @@ jobs: - name: label env: TITLE: ${{ github.event.pull_request.title }} - LABEL: Bug Fix - Sooner than Very Soon + LABEL: Bug Fix uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN}} From 9f9e11b88620047e98d12b609d6aca7d57760e31 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 5 Oct 2024 10:09:14 +0200 Subject: [PATCH 05/64] code cleanup --- src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index 18519a364b1e..3a3ffead303c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -260,7 +260,7 @@ object ChatUtils { fun clickToActionOrDisable(message: String, option: KMutableProperty0<*>, actionName: String, action: () -> Unit) { - ChatUtils.clickableChat( + clickableChat( "$message\n§e[CLICK to $actionName or disable this feature]", onClick = { if (KeyboardManager.isShiftKeyDown() || KeyboardManager.isModifierKeyDown()) { From 524df8b718cad70c7a7fc02e323721c85385d41b Mon Sep 17 00:00:00 2001 From: martimavocado <39881008+martimavocado@users.noreply.github.com> Date: Sat, 5 Oct 2024 08:31:56 +0000 Subject: [PATCH 06/64] Fix: Stop king talisman tracker on finish (#2663) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/mining/KingTalismanHelper.kt | 47 ++++++++++++++++--- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt index 057d2f476948..b9f205984f38 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt @@ -2,9 +2,11 @@ package at.hannibal2.skyhanni.features.mining import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.MiningAPI import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils @@ -16,6 +18,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher +import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.SkyBlockTime import at.hannibal2.skyhanni.utils.TimeUtils.format @@ -31,11 +34,27 @@ object KingTalismanHelper { private val config get() = SkyHanniMod.feature.mining.kingTalisman private val storage get() = ProfileStorageData.profileSpecific?.mining - private val kingPattern by RepoPattern.pattern( - "mining.kingtalisman.king", + private val patternGroup = RepoPattern.group("mining.kingtalisman") + + /** + * REGEX-TEST: §6§lKing Brammor + * REGEX-TEST: §6§lKing Emkam + * REGEX-TEST: §6§lKing Kevin + * REGEX-TEST: §6§lKing Redros + */ + private val kingPattern by patternGroup.pattern( + "king", "§6§lKing (?.*)" ) + /** + * REGEX-TEST: §7You have received a §r§fKing Talisman§r§7! + */ + private val talismanPattern by patternGroup.pattern( + "talisman", + "§7You have received a §r§fKing Talisman§r§7!" + ) + private var currentOffset: Int? = null private var skyblockYear = 0 @@ -66,7 +85,8 @@ object KingTalismanHelper { private var farDisplay = "" private var display = emptyList() - private fun isNearby() = IslandType.DWARVEN_MINES.isInIsland() && LorenzUtils.skyBlockArea == "Royal Palace" && + private fun isNearby() = IslandType.DWARVEN_MINES.isInIsland() && + LorenzUtils.skyBlockArea == "Royal Palace" && kingLocation.distanceToPlayer() < 10 @SubscribeEvent @@ -86,7 +106,7 @@ object KingTalismanHelper { return } - update(kingsTalkedTo) + update() display = if (nearby) allKingsDisplay else Collections.singletonList(farDisplay) } @@ -103,7 +123,8 @@ object KingTalismanHelper { skyblockYear = SkyBlockTime.now().year } - fun isEnabled() = config.enabled && LorenzUtils.inSkyBlock && + fun isEnabled() = config.enabled && + LorenzUtils.inSkyBlock && (IslandType.DWARVEN_MINES.isInIsland() || config.outsideMines) @SubscribeEvent @@ -118,12 +139,13 @@ object KingTalismanHelper { val kingsTalkedTo = storage.kingsTalkedTo if (currentKing !in kingsTalkedTo) { kingsTalkedTo.add(currentKing) - update(kingsTalkedTo) + update() display = allKingsDisplay } } - private fun update(kingsTalkedTo: MutableList) { + private fun update() { + val kingsTalkedTo = storage?.kingsTalkedTo ?: return if (kingsTalkedTo.size == kingCircles.size) { allKingsDisplay = Collections.singletonList("§eAll Kings found.") farDisplay = "" @@ -198,4 +220,15 @@ object KingTalismanHelper { config.position.renderStrings(display, posLabel = "King Talisman Helper") } + + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!isEnabled()) return + if (!MiningAPI.inDwarvenMines) return + + if (talismanPattern.matches(event.message)) { + storage?.kingsTalkedTo = kingCircles.toMutableList() + update() + } + } } From e83d5b432a54d53253bcf6f2828fb41767ad17e1 Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Sat, 5 Oct 2024 18:39:05 +1000 Subject: [PATCH 07/64] Fix: Made it so you can shift click to disable features like it says (#2650) --- .../skyhanni/mixins/transformers/gui/MixinGuiScreen.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiScreen.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiScreen.java index b3338acf5032..3f0371f07f7f 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiScreen.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiScreen.java @@ -8,6 +8,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @@ -33,4 +34,9 @@ public void getTooltip(ItemStack stack, int x, int y, CallbackInfo ci, List Date: Sat, 5 Oct 2024 18:50:42 +1000 Subject: [PATCH 08/64] Fix: chroma disabling patchers font renderer for no reason (#2666) --- .../config/features/chroma/ChromaConfig.java | 4 ++-- .../skyhanni/mixins/hooks/FontRendererHook.kt | 2 +- .../hooks/MixinPatcherFontRendererHookHook.kt | 20 +++++++++++++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java index 6a02e2ed3061..b3f8577f0c0f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/chroma/ChromaConfig.java @@ -20,7 +20,7 @@ public class ChromaConfig { public boolean chromaPreview = false; @Expose - @ConfigOption(name = "Enabled", desc = "Toggle SkyHanni's chroma. §e(Disables Patcher's Optimized Font Renderer while enabled)") + @ConfigOption(name = "Enabled", desc = "Toggle SkyHanni's chroma.") @ConfigEditorBoolean @FeatureToggle public Property enabled = Property.of(false); @@ -80,7 +80,7 @@ public String toString() { public Runnable resetSettings = ChromaManager::resetChromaSettings; @Expose - @ConfigOption(name = "Everything Chroma", desc = "Render §4§l§oALL §r§7text in chroma. §e(Some enchants may appear white with SBA enchant parsing)") + @ConfigOption(name = "Everything Chroma", desc = "Render §4§l§oALL §r§7text in chroma. §e(Disables Patcher's Optimized Font Renderer while enabled)") @ConfigEditorBoolean public boolean allChroma = false; diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt index db9c1c07e1c2..b52407b65233 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/FontRendererHook.kt @@ -28,7 +28,7 @@ object FontRendererHook { private var currentDrawState: ChromaFontRenderer? = null private var previewChroma = false - private var chromaPreviewText: String + var chromaPreviewText: String var cameFromChat = false diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt index 25d415889b0d..25697e0ee633 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/MixinPatcherFontRendererHookHook.kt @@ -11,9 +11,25 @@ class MixinPatcherFontRendererHookHook { fun overridePatcherFontRenderer(string: String, shadow: Boolean, cir: CallbackInfoReturnable) { if (!LorenzUtils.onHypixel) return - if (ChromaManager.config.enabled.get()) { - cir.cancel() + if (ChromaManager.config.allChroma) { cir.returnValue = false + return + } + + if (string == FontRendererHook.chromaPreviewText) { + cir.returnValue = false + return + } + + if (string.contains("§#§")) { + cir.returnValue = false + return + } + if (ChromaManager.config.enabled.get()) { + if (string.contains("§z") || string.contains("§Z")) { + cir.returnValue = false + return + } } } } From 96599f69ea7f22289a74c5c5e931d1001d73e42f Mon Sep 17 00:00:00 2001 From: MTOnline69 <97001154+MTOnline69@users.noreply.github.com> Date: Sat, 5 Oct 2024 09:59:13 +0100 Subject: [PATCH 09/64] Improvement: Option to hide other players while in Gunther's Race (#2655) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../rift/area/westvillage/GunthersRaceConfig.java | 6 ++++++ .../rift/area/westvillage/RiftGunthersRace.kt | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/westvillage/GunthersRaceConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/westvillage/GunthersRaceConfig.java index beb4acc9e3a0..10d18fa85c05 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/westvillage/GunthersRaceConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/westvillage/GunthersRaceConfig.java @@ -30,4 +30,10 @@ public class GunthersRaceConfig { @ConfigOption(name = "Monochrome Color", desc = "Set a boring monochrome color for the guide waypoints.") @ConfigEditorColour public Property monochromeColor = Property.of("0:60:0:0:255"); + + @Expose + @ConfigOption(name = "Hide Other Players", desc = "Hide other players while in the race.") + @ConfigEditorBoolean + @FeatureToggle + public boolean hidePlayers = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt index cf729453fcb6..5a3638101a71 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/RiftGunthersRace.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.rift.area.westvillage import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson +import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -11,9 +12,11 @@ import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor import at.hannibal2.skyhanni.utils.ConditionalUtils +import at.hannibal2.skyhanni.utils.EntityUtils.isNPC import at.hannibal2.skyhanni.utils.ParkourHelper import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraft.client.entity.EntityOtherPlayerMP import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -105,6 +108,18 @@ object RiftGunthersRace { } } + @SubscribeEvent + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (!isEnabled()) return + if (!config.hidePlayers) return + if (!RiftAPI.inRiftRace) return + + val entity = event.entity + if (entity is EntityOtherPlayerMP && !entity.isNPC()) { + event.cancel() + } + } + @SubscribeEvent fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!isEnabled() || !RiftAPI.inRiftRace) return From 2db5f13d4f5e7f004006c438dbf5a7f20b34e084 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 5 Oct 2024 11:01:30 +0200 Subject: [PATCH 10/64] Remove: Mithril Powder from Powder Tracker (#2656) --- .../skyhanni/config/ConfigUpdaterMigrator.kt | 2 +- .../features/mining/PowderTrackerConfig.java | 3 --- .../mining/powdertracker/PowderChestReward.kt | 4 ---- .../mining/powdertracker/PowderTracker.kt | 15 ++++++++++++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index aa15461f5af2..7c41245fc7f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { val logger = LorenzLogger("ConfigMigration") - const val CONFIG_VERSION = 60 + const val CONFIG_VERSION = 61 fun JsonElement.at(chain: List, init: Boolean): JsonElement? { if (chain.isEmpty()) return this if (this !is JsonObject) return null diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java index 1c32cabc2e95..247da9b546d3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java @@ -24,7 +24,6 @@ import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.GOLD_ESSENCE; import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.HARD_STONE; import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.JADE; -import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.MITHRIL_POWDER; import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.ROBOTRON; import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.RUBY; import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SAPPHIRE; @@ -56,7 +55,6 @@ public class PowderTrackerConfig { public Property> textFormat = Property.of(new ArrayList<>(Arrays.asList( TOTAL_CHESTS, DOUBLE_POWDER, - MITHRIL_POWDER, GEMSTONE_POWDER, SPACER_1, DIAMOND_ESSENCE, @@ -78,7 +76,6 @@ public class PowderTrackerConfig { public enum PowderDisplayEntry implements HasLegacyId { TOTAL_CHESTS("§d852 Total chests Picked §7(950/h)", 2), DOUBLE_POWDER("§bx2 Powder: §aActive!", 3), - MITHRIL_POWDER("§b250,420 §aMithril Powder §7(350,000/h)", 4), GEMSTONE_POWDER("§b250,420 §dGemstone Powder §7(350,000/h)", 5), SPACER_1("", 6), DIAMOND_ESSENCE("§b129 §bDiamond Essence §7(600/h)", 7), diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt index b2b449563a5f..1a48a661a926 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt @@ -4,10 +4,6 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern enum class PowderChestReward(val displayName: String, pattern: String) { - MITHRIL_POWDER( - "§aMithril Powder", - " {4}§r§2Mithril Powder(?: §r§8x(?.*))?", - ), GEMSTONE_POWDER( "§dGemstone Powder", " {4}§r§dGemstone Powder(?: §r§8x(?.*))?", diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt index da9dbb2fbdab..38779224cf90 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt @@ -199,7 +199,7 @@ object PowderTracker { } for (reward in PowderChestReward.entries) { - if (reward == PowderChestReward.MITHRIL_POWDER || reward == PowderChestReward.GEMSTONE_POWDER) continue + if (reward == PowderChestReward.GEMSTONE_POWDER) continue reward.chatPattern.matchMatcher(msg) { tracker.modify { val count = it.rewards[reward] ?: 0 @@ -217,7 +217,6 @@ object PowderTracker { tracker.modify { val reward = when (event.powder) { HotmAPI.PowderType.GEMSTONE -> PowderChestReward.GEMSTONE_POWDER - HotmAPI.PowderType.MITHRIL -> PowderChestReward.MITHRIL_POWDER else -> return@modify } it.rewards.addOrPut(reward, event.amount) @@ -275,6 +274,17 @@ object PowderTracker { } newList } + + event.transform(61, "mining.powderTracker.textFormat") { element -> + val newList = JsonArray() + for (entry in element.asJsonArray) { + if (entry is JsonNull) continue + if (entry.asString.let { it != "MITHRIL_POWDER" }) { + newList.add(entry) + } + } + newList + } } @SubscribeEvent @@ -297,7 +307,6 @@ object PowderTracker { private fun drawDisplay(data: Data): List = buildList { calculate(data, gemstoneInfo, PowderChestReward.GEMSTONE_POWDER) - calculate(data, mithrilInfo, PowderChestReward.MITHRIL_POWDER) calculate(data, diamondEssenceInfo, PowderChestReward.DIAMOND_ESSENCE) calculate(data, goldEssenceInfo, PowderChestReward.GOLD_ESSENCE) calculateChest(data) From b3cb37f5459afce7c6234b5ab3a8891447eb587a Mon Sep 17 00:00:00 2001 From: martimavocado <39881008+martimavocado@users.noreply.github.com> Date: Sat, 5 Oct 2024 09:07:15 +0000 Subject: [PATCH 11/64] Improvement: Make visitor GUI clickable to tp to barn (#2658) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/garden/visitor/TimerConfig.java | 1 + .../garden/visitor/GardenVisitorTimer.kt | 26 ++++++++++++------- .../hannibal2/skyhanni/utils/RenderUtils.kt | 3 ++- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/TimerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/TimerConfig.java index 32bff02debbe..a6b7e509e610 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/TimerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/TimerConfig.java @@ -34,5 +34,6 @@ public class TimerConfig { @Expose @ConfigLink(owner = TimerConfig.class, field = "enabled") + // TODO rename to position public Position pos = new Position(-200, 40, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index 3a69f2ece3b8..af31448d66e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -11,15 +11,17 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst -import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderable import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.TimeUtils import at.hannibal2.skyhanni.utils.TimeUtils.format +import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration @@ -36,10 +38,10 @@ object GardenVisitorTimer { private val timePattern by RepoPattern.pattern( "garden.visitor.timer.time.new", - " Next Visitor: §r(?.*)" + " Next Visitor: §r(?.*)", ) - private var display = "" + private var display: Renderable? = null private var lastMillis = 0.seconds private var sixthVisitorArrivalTime = SimpleTimeMark.farPast() private var visitorJustArrived = false @@ -65,7 +67,7 @@ object GardenVisitorTimer { @SubscribeEvent fun onProfileJoin(event: ProfileJoinEvent) { - display = "" + display = null lastMillis = 0.seconds sixthVisitorArrivalTime = SimpleTimeMark.farPast() visitorJustArrived = false @@ -84,7 +86,7 @@ object GardenVisitorTimer { TabListData.getTabList().matchFirst(timePattern) { val timeInfo = group("info").removeColor() if (timeInfo == "Not Unlocked!") { - display = "§cVisitors not unlocked!" + display = Renderable.string("§cVisitors not unlocked!") return } if (timeInfo == "Queue Full!") { @@ -97,7 +99,7 @@ object GardenVisitorTimer { millis = TimeUtils.getDuration(timeInfo) } } ?: run { - display = "§cVisitor time info not in tab list" + display = createDisplayText("§cVisitor time info not in tab list") return } @@ -140,7 +142,7 @@ object GardenVisitorTimer { if (lastMillis == Duration.INFINITE) { ErrorManager.logErrorStateWithData( "Found Visitor Timer bug, reset value", "lastMillis was infinite", - "lastMillis" to lastMillis + "lastMillis" to lastMillis, ) lastMillis = 0.seconds } @@ -168,14 +170,20 @@ object GardenVisitorTimer { "Next in §$formatColor$formatDuration$extraSpeed" } val visitorLabel = if (visitorsAmount == 1) "visitor" else "visitors" - display = "§b$visitorsAmount $visitorLabel §7($next§7)" + display = createDisplayText("§b$visitorsAmount $visitorLabel §7($next§7)") } + private fun createDisplayText(text: String) = Renderable.clickAndHover( + text, + listOf("§eClick to teleport to the barn!"), + onClick = { HypixelCommands.teleportToPlot("barn") }, + ) + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return - config.pos.renderString(display, posLabel = "Garden Visitor Timer") + config.pos.renderRenderable(display, posLabel = "Garden Visitor Timer") } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index cf2339bf3c42..309f17f686e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -591,10 +591,11 @@ object RenderUtils { } fun Position.renderRenderable( - renderable: Renderable, + renderable: Renderable?, posLabel: String, addToGuiManager: Boolean = true, ) { + if (renderable == null) return GlStateManager.pushMatrix() val (x, y) = transform() Renderable.withMousePosition(x, y) { From 153f5e3895783397e01281218ab2218525c5da62 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 5 Oct 2024 11:20:37 +0200 Subject: [PATCH 12/64] code cleanup --- src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt | 2 +- .../skyhanni/features/commands/WikiManager.kt | 12 +++++++----- .../hannibal2/skyhanni/features/misc/TpsCounter.kt | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt index b40255449226..0e35e602fc61 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt @@ -392,7 +392,7 @@ object SkillAPI { ChatUtils.chat("§bSkill Custom Goal Level") val map = storage?.filter { it.value.customGoalLevel != 0 } ?: return if (map.isEmpty()) { - ChatUtils.chat("§cYou haven't set any custom goals yet!") + ChatUtils.userError("You haven't set any custom goals yet!") } map.forEach { (skill, data) -> ChatUtils.chat("§e${skill.displayName}: §b${data.customGoalLevel}") diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt index af56be8e7ba4..e72ad09c5481 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt @@ -50,7 +50,7 @@ object WikiManager { } if (message == ("/wikithis")) { val itemInHand = InventoryUtils.getItemInHand() ?: run { - ChatUtils.chat("§cYou must be holding an item to use this command!") + ChatUtils.userError("You must be holding an item to use this command!") return } wikiTheItem(itemInHand, config.autoOpenWiki) @@ -79,7 +79,7 @@ object WikiManager { fun otherWikiCommands(args: Array, useFandom: Boolean, wikithis: Boolean = false) { if (wikithis && !LorenzUtils.inSkyBlock) { - ChatUtils.chat("§cYou must be in SkyBlock to do this!") + ChatUtils.userError("You must be in SkyBlock to do this!") return } @@ -88,7 +88,7 @@ object WikiManager { if (wikithis) { val itemInHand = InventoryUtils.getItemInHand() ?: run { - ChatUtils.chat("§cYou must be holding an item to use this command!") + ChatUtils.userError("You must be holding an item to use this command!") return } wikiTheItem(itemInHand, false, useFandom = useFandom) @@ -102,8 +102,10 @@ object WikiManager { } fun sendWikiMessage( - search: String = "", displaySearch: String = search, - autoOpen: Boolean = config.autoOpenWiki, useFandom: Boolean = config.useFandom + search: String = "", + displaySearch: String = search, + autoOpen: Boolean = config.autoOpenWiki, + useFandom: Boolean = config.useFandom, ) { val wiki = if (useFandom) "SkyBlock Fandom Wiki" else "Official SkyBlock Wiki" val urlPrefix = if (useFandom) FANDOM_URL_PREFIX else OFFICIAL_URL_PREFIX diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt index 01d84daa3fdc..1515ee3dcbd1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt @@ -74,7 +74,7 @@ object TpsCounter { fun tpsCommand() { if (display.isEmpty()) { - ChatUtils.chat("§cNo tps data available, make sure you have the setting on.") + ChatUtils.userError("No tps data available, make sure you have the setting on.") return } ChatUtils.chat(display) @@ -101,7 +101,8 @@ object TpsCounter { config.tpsDisplayPosition.renderString(display, posLabel = "Tps Display") } - private fun isEnabled() = LorenzUtils.onHypixel && config.tpsDisplay && + private fun isEnabled() = LorenzUtils.onHypixel && + config.tpsDisplay && (LorenzUtils.inSkyBlock || OutsideSbFeature.TPS_DISPLAY.isSelected()) @SubscribeEvent From b755ffe1a288282f9b29bf7b6c048d5e94c48e37 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sat, 5 Oct 2024 11:24:08 +0200 Subject: [PATCH 13/64] Fixed trophy fish title (#2670) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/fishing/trophy/TrophyFishMessages.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt index 66ddde50b939..4a23e84e5d52 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt @@ -96,7 +96,7 @@ object TrophyFishMessages { } private fun sendTitle(displayName: String, displayRarity: String?, amount: Int) { - val text = "$displayName\n$displayRarity $amount!" + val text = "$displayName $displayRarity §8$amount§c!" LorenzUtils.sendTitle(text, 3.seconds, 2.8, 7f) } From 1c9fd3f55529461e32a341a71318b9b4664ef816 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sat, 5 Oct 2024 11:27:30 +0200 Subject: [PATCH 14/64] Improvement: Mining Event Error Format (#2671) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../mining/eventtracker/MiningEventTracker.kt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt index a076ba68f0c3..d5ee14ec92e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt @@ -200,7 +200,8 @@ object MiningEventTracker { canRequestAt = SimpleTimeMark.now() + 20.minutes if (LorenzUtils.debug) { ErrorManager.logErrorWithData( - e, "Receiving mining event data was unsuccessful", + e, + "Failed to load Mining Event data!", ) } return@launch @@ -208,11 +209,17 @@ object MiningEventTracker { val miningEventData = ConfigManager.gson.fromJson(data, MiningEventDataReceive::class.java) if (!miningEventData.success) { - ErrorManager.logErrorWithData( - Exception("PostFailure"), "Receiving mining event data was unsuccessful", - "cause" to miningEventData.cause, - "recievedData" to data - ) + if (data.toString() == "{}") { + ChatUtils.chat("§cFailed loading Mining Event data!\n" + + "Please wait until the server problem fixes itself! There is nothing else to do at the moment.") + } else { + ErrorManager.logErrorWithData( + Exception("miningEventData.success = false"), + "Failed to load Mining Event data!", + "cause" to miningEventData.cause, + "recievedData" to data + ) + } return@launch } apiErrorCount = 0 From 4b6789f6eb4bb40720bc0e445d701935d0cafdcb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:18:59 +0200 Subject: [PATCH 15/64] Backend: /shdebug + bz fetch (#2675) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../data/bazaar/HypixelBazaarFetcher.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt index 13044b7c3151..c1a7af2890b4 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.data.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager +import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarData import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -29,10 +30,29 @@ object HypixelBazaarFetcher { private const val HIDDEN_FAILED_ATTEMPTS = 3 var latestProductInformation = mapOf() + private var lastSuccessfulFetch = SimpleTimeMark.farPast() private var nextFetchTime = SimpleTimeMark.farPast() private var failedAttempts = 0 private var nextFetchIsManual = false + @SubscribeEvent + fun onDebugDataCollect(event: DebugDataCollectEvent) { + event.title("Bazaar Fetching") + + val data = listOf( + "failedAttempts: $failedAttempts", + "nextFetchIsManual: $nextFetchIsManual", + "nextFetchTime: ${nextFetchTime.timeUntil()}", + "lastSuccessfulFetch: ${lastSuccessfulFetch.passedSince()}", + ) + + if (failedAttempts == 0) { + event.addIrrelevant(data) + } else { + event.addData(data) + } + } + @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!canFetch()) return @@ -51,6 +71,7 @@ object HypixelBazaarFetcher { if (response.success) { latestProductInformation = process(response.products) failedAttempts = 0 + lastSuccessfulFetch = SimpleTimeMark.now() } else { val rawResponse = jsonResponse.toString() onError(fetchType, Exception("success=false, cause=${response.cause}"), rawResponse) From 79f8298760e1d9fb982106296f39352bdddc03ad Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:30:42 +0200 Subject: [PATCH 16/64] Improvement: Add Search Tag to the Account Upgrade Reminder (#2676) --- .../at/hannibal2/skyhanni/config/features/misc/MiscConfig.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java index df1ae1da5c04..0869262959c0 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java @@ -15,6 +15,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList; import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; +import io.github.notenoughupdates.moulconfig.annotations.SearchTag; import io.github.notenoughupdates.moulconfig.observer.Property; import java.util.ArrayList; @@ -226,6 +227,7 @@ public class MiscConfig { @Expose @ConfigOption(name = "Account Upgrade Reminder", desc = "Remind you to claim community shop account and profile upgrades when complete.") @ConfigEditorBoolean + @SearchTag("Elizabeth Community Center") @FeatureToggle public boolean accountUpgradeReminder = true; From 86c3700cfd11ba53da18bff1987c69d19de17b81 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 5 Oct 2024 17:45:37 +0200 Subject: [PATCH 17/64] Version 0.27 Beta 15 --- docs/CHANGELOG.md | 19 +++++++++++++++++++ root.gradle.kts | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ce469091517f..050f6c9bd7af 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -183,6 +183,7 @@ + Added support for using the Pickobulus ability for the Mineshaft Pity Display. - Empa (https://github.com/hannibal002/SkyHanni/pull/2540) + Added Area Navigation support to Glacite Tunnels. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2544) + Updated wording in mineshaft pity breakdown ("efficient miner" -> "spread"). - luna (https://github.com/hannibal002/SkyHanni/pull/2633) ++ Improved the wording of the Mining Event data error chat message. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2671) #### Diana Improvements @@ -234,6 +235,7 @@ + Added the required chocolate amount to the tooltip of milestone rabbits in Hoppity's Collection. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2523) + Improved the responsiveness of Hoppity Chat Compacting. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2488) + Added the ability to see how many duplicates you have previously found in Hoppity messages. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2556) ++ Improved the formatting of the Hoppity Event Stats card. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2638) #### Combat Improvements @@ -256,12 +258,14 @@ + Made the waypoint to the middle of the plot for Pest Waypoint optional (off by default). - Luna (https://github.com/hannibal002/SkyHanni/pull/2469) + Reduced one click for supercrafting visitor materials by using `/viewrecipe` instead of `/recipe` when using the Shopping List button. - Miestiek (https://github.com/hannibal002/SkyHanni/pull/2505) + Added ignored crops for the Farming Lane feature. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/2622) ++ Made the Visitor Timer GUI clickable to teleport to the Barn. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/2658) #### Rift Improvements + Updated the description of the config for Enigma Soul Waypoints to help find the Rift Guide in the game. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2433) + Added Path Finder to Enigma Soul waypoints in the Rift. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2515) + Added the option to choose the color of the Living Metal Helper highlight. - MTOnline (https://github.com/hannibal002/SkyHanni/pull/2616) ++ Added an option to hide players while in Gunther's Rift Race. - MTOnline (https://github.com/hannibal002/SkyHanni/pull/2655) #### Dungeon Improvements @@ -287,6 +291,7 @@ + Added a warning in chat when the computer's time is inaccurate, along with a tutorial on how to fix it. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2623) + Improved the way pathfinding lines are rendered. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2634) + Automatically starts pathfinding after clicking on SkyHanni reminder chat messages about Carnival Reminder, Hoppity NPC, City Project, and account/profile upgrades. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2635) ++ Greatly improved performance by optimizing SkyHanni Chroma support for Patcher Font Renderer. - nopo (https://github.com/hannibal002/SkyHanni/pull/2666) ### Fixes @@ -329,6 +334,7 @@ + Fixed pair detection. + Fixed enchanting XP detection. + Fixed Minister in Calendar Perk description sometimes not using the gray color. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2632) ++ Fixed highlighting items in one's own inventory for some Bazaar features, e.g., in the "click to re-order" feature. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2640) #### Mining Fixes @@ -355,6 +361,8 @@ + Fixed the Mineshaft Pity Counter not working in the Great Glacite Lake. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/2565) + Fixed Powder Tracker inaccuracies. - Empa (https://github.com/hannibal002/SkyHanni/pull/2591) + Fixed Jasper gemstones not being addressed in the Powder Mining filter. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2618) ++ Fixed the King Talisman Tracker sometimes not displaying the correct data. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/2663) ++ Fixed the Powder Tracker not tracking items correctly. - HiZe (https://github.com/hannibal002/SkyHanni/pull/2645) #### Scoreboard Fixes @@ -394,6 +402,7 @@ + Fixed an error with Patcher Coordinate Detection from chat. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2410) + Fixed ultimate enchants not showing in `/show`. - Vixid (https://github.com/hannibal002/SkyHanni/pull/2465) ++ Fixed being unable to shift-click on chat messages. - nopo (https://github.com/hannibal002/SkyHanni/pull/2650) #### Commands Fixes @@ -409,6 +418,7 @@ + Fixed the reputation helper not updating after a sack update. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2439) + Fixed Heavy Pearls sometimes not being highlighted. - Luna (https://github.com/hannibal002/SkyHanni/pull/2479) ++ Added a delay to the Pablo helper message so it appears after he finishes his dialogue. - Luna (https://github.com/hannibal002/SkyHanni/pull/2662) #### Garden Fixes @@ -422,6 +432,9 @@ + Fixed a case where the Broodmother countdown could be wildly inaccurate. - MTOnline (https://github.com/hannibal002/SkyHanni/pull/2513) + Fixed Flare Display spamming chat with negative values when the server is lagging. - Stella (https://github.com/hannibal002/SkyHanni/pull/2567) + Fixed a case where the Imminent stage did not update the Broodmother countdown. - MTOnline (https://github.com/hannibal002/SkyHanni/pull/2602)v ++ Fixed some Islands Dummy mob types not being detected by the Damage Indicator. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2646) ++ Fixed the Ender Node Tracker not detecting some items. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2644) ++ Fixed Flare Expiration warnings not appearing in chat or as a title. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2643) #### The Carnival Fixes @@ -431,6 +444,7 @@ #### Fishing Fixes + Fixed error messages while using the Chum Bucket Hider feature. - nea89 (https://github.com/hannibal002/SkyHanni/pull/2587) ++ Fixed the Trophy Fish Title displaying an undefined character in the format. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2670) #### Rift Fixes @@ -459,6 +473,7 @@ + Fixed Area Navigation distances to player being incorrect. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2634) + Fixed item trackers displaying removed item names incorrectly. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/2620) + Fixed some messages from Pablo NPC not being detected. - Luna (https://github.com/hannibal002/SkyHanni/pull/2636) ++ Fixed SkyHanni re-downloading the repository on every launch. - nopo (https://github.com/hannibal002/SkyHanni/pull/2669) ### Technical Details @@ -530,6 +545,9 @@ + Added `detekt` runner to the build process. - Daveed & nea (https://github.com/hannibal002/SkyHanni/pull/2547) + Added Clock Offset Millis using an NTP server. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2623) + Added `EntityMovementData.onNextTeleport()` logic, which triggers a runnable after the world has changed or the player has teleported. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2635) ++ Added Bazaar Fetch information to `/shdebug`. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2675) ++ Removed the password from the download source check. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2649) ++ Added a missing SkyBlock check for debug commands `/shtrackparticles` and `/shtracksounds`. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2641) ### Removed Features @@ -539,6 +557,7 @@ + Replaced then with a draggable list of different Hoppity collection highlight options. + Removed "Forge GfS". - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2564) + Hypixel now pulls directly from sacks when using the forge. ++ Removed Mithril Powder from the Powder Tracker. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2656) ## Version 0.26 diff --git a/root.gradle.kts b/root.gradle.kts index 9346a78f9f92..58285a7012c2 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -14,7 +14,7 @@ plugins { allprojects { group = "at.hannibal2.skyhanni" - version = "0.27.Beta.14" + version = "0.27.Beta.15" repositories { mavenCentral() mavenLocal() From df1bff9338410828ec566f28483dee0938463165 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sun, 6 Oct 2024 10:54:42 +0200 Subject: [PATCH 18/64] Improvement: Working on scoreboard errors again (#2672) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/combat/SpidersDenAPI.kt | 5 +- .../gui/customscoreboard/CustomScoreboard.kt | 18 ++--- .../customscoreboard/CustomScoreboardUtils.kt | 11 +-- .../customscoreboard/ScoreboardElements.kt | 69 +++++++------------ .../gui/customscoreboard/ScoreboardEvent.kt | 3 +- .../customscoreboard/UnknownLinesHandler.kt | 60 +++++++++++++--- 6 files changed, 88 insertions(+), 78 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/SpidersDenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/SpidersDenAPI.kt index 7986c55e9d3a..af1dd8430186 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/SpidersDenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/SpidersDenAPI.kt @@ -1,12 +1,11 @@ package at.hannibal2.skyhanni.features.combat -import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard +import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.RegexUtils.matches @SkyHanniModule object SpidersDenAPI { - private fun getSbLines(): List = CustomScoreboard.activeLines - fun isAtTopOfNest(): Boolean = getSbLines().any { ScoreboardPattern.broodmotherPattern.matches(it) } + fun isAtTopOfNest(): Boolean = ScoreboardData.sidebarLinesFormatted.any { ScoreboardPattern.broodmotherPattern.matches(it) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt index c9fb4b15f821..8a1d7b50de45 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt @@ -50,11 +50,6 @@ object CustomScoreboard { private var cache = emptyList() private const val GUI_NAME = "Custom Scoreboard" - // Cached scoreboard data, only update after no change for 300ms - var activeLines = emptyList() - - // Most recent scoreboard state, not in use until cached - private var mostRecentLines = emptyList() private var lastScoreboardUpdate = SimpleTimeMark.farFuture() @SubscribeEvent @@ -115,14 +110,13 @@ object CustomScoreboard { // We want to update the scoreboard as soon as we have new data, not 5 ticks delayed var dirty = false - if (lastScoreboardUpdate.passedSince() > 300.milliseconds) { - activeLines = mostRecentLines + if (lastScoreboardUpdate.passedSince() > 250.milliseconds) { lastScoreboardUpdate = SimpleTimeMark.farFuture() dirty = true } // Creating the lines - if (event.isMod(5) || dirty) { + if (dirty) { display = createLines().removeEmptyLinesFromEdges() if (TabListData.fullyLoaded) { cache = display.toList() @@ -135,7 +129,6 @@ object CustomScoreboard { @SubscribeEvent fun onScoreboardChange(event: ScoreboardUpdateEvent) { - mostRecentLines = event.scoreboard lastScoreboardUpdate = SimpleTimeMark.now() } @@ -160,12 +153,12 @@ object CustomScoreboard { private fun addAllNonSkyBlockLines() = buildList { addAll(ScoreboardElement.TITLE.getVisiblePair()) - addAll(activeLines.map { it to HorizontalAlignment.LEFT }) + addAll(ScoreboardData.sidebarLinesFormatted.map { it to HorizontalAlignment.LEFT }) } private fun addDefaultSkyBlockLines() = buildList { add(ScoreboardData.objectiveTitle to displayConfig.titleAndFooter.alignTitleAndFooter) - addAll(activeLines.map { it to HorizontalAlignment.LEFT }) + addAll(ScoreboardData.sidebarLinesFormatted.map { it to HorizontalAlignment.LEFT }) } private fun addCustomSkyBlockLines() = buildList { @@ -175,7 +168,8 @@ object CustomScoreboard { if ( informationFilteringConfig.hideConsecutiveEmptyLines && - lines.first().first == "" && lastOrNull()?.first?.isEmpty() == true + lines.first().first == "" && + lastOrNull()?.first?.isEmpty() == true ) { continue } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt index 4cfc403c421f..99fdc4f3fcf6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard import at.hannibal2.skyhanni.config.features.gui.customscoreboard.DisplayConfig import at.hannibal2.skyhanni.data.BitsAPI import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.displayConfig import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -27,7 +28,7 @@ object CustomScoreboardUtils { fun getProfileTypeSymbol() = when { HypixelData.ironman -> "§7♲ " HypixelData.stranded -> "§a☀ " - HypixelData.bingo -> CustomScoreboard.activeLines.firstNotNullOfOrNull { + HypixelData.bingo -> ScoreboardData.sidebarLinesFormatted.firstNotNullOfOrNull { BingoAPI.getIconFromScoreboard(it)?.plus(" ") } ?: "§e❤ " @@ -43,7 +44,7 @@ object CustomScoreboardUtils { internal fun String.formatNum() = this.formatDouble().formatNum() - internal fun getMotes() = getGroupFromPattern(CustomScoreboard.activeLines, ScoreboardPattern.motesPattern, "motes") + internal fun getMotes() = getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, ScoreboardPattern.motesPattern, "motes") internal fun getBank() = getGroupFromPattern(TabListData.getTabList(), ScoreboardPattern.bankPattern, "bank") internal fun getBits() = BitsAPI.bits.coerceAtLeast(0).formatNum() @@ -57,15 +58,15 @@ object CustomScoreboardUtils { } internal fun getCopper() = - getGroupFromPattern(CustomScoreboard.activeLines, ScoreboardPattern.copperPattern, "copper") + getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, ScoreboardPattern.copperPattern, "copper") internal fun getGems() = getGroupFromPattern(TabListData.getTabList(), ScoreboardPattern.gemsPattern, "gems") internal fun getHeat() = - getGroupFromPattern(CustomScoreboard.activeLines, ScoreboardPattern.heatPattern, "heat") + getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, ScoreboardPattern.heatPattern, "heat") internal fun getNorthStars() = - getGroupFromPattern(CustomScoreboard.activeLines, ScoreboardPattern.northstarsPattern, "northstars") + getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, ScoreboardPattern.northstarsPattern, "northstars") class UndetectedScoreboardLines(message: String) : Exception(message) diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 0289a3c81862..769184077b09 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -39,8 +39,6 @@ import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.getHeat import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.getMotes import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.getNorthStars -import at.hannibal2.skyhanni.test.command.ErrorManager -import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.inAdvancedMiningIsland @@ -50,41 +48,25 @@ import at.hannibal2.skyhanni.utils.NumberUtil.percentageColor import at.hannibal2.skyhanni.utils.RegexUtils.anyMatches import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SkyBlockTime import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.StringUtils.pluralize import at.hannibal2.skyhanni.utils.TabListData -import at.hannibal2.skyhanni.utils.TimeLimitedSet import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.TimeUtils.formatted import kotlin.time.Duration.Companion.seconds -internal var confirmedUnknownLines = listOf() -internal var unconfirmedUnknownLines = listOf() -internal var unknownLinesSet = TimeLimitedSet(1.seconds) { onRemoval(it) } - -private fun onRemoval(line: String) { - if (!LorenzUtils.inSkyBlock) return - if (!unconfirmedUnknownLines.contains(line)) return - if (line !in unconfirmedUnknownLines) return - unconfirmedUnknownLines = unconfirmedUnknownLines.filterNot { it == line } - confirmedUnknownLines = confirmedUnknownLines.editCopy { add(line) } - if (!config.unknownLinesWarning) return - val pluralize = pluralize(confirmedUnknownLines.size, "unknown line", withNumber = true) - val message = "CustomScoreboard detected $pluralize" - ErrorManager.logErrorWithData( - CustomScoreboardUtils.UndetectedScoreboardLines(message), - message, - "Unknown Lines" to confirmedUnknownLines, - "Island" to LorenzUtils.skyBlockIsland, - "Area" to HypixelData.skyBlockArea, - "Full Scoreboard" to CustomScoreboard.activeLines, - noStackTrace = true, - betaOnly = true, - ) -} +internal var allUnknownLines = listOf() +internal var lastRecentAlarmWarning = SimpleTimeMark.farPast() + +internal fun recentUnknownLines() = allUnknownLines.filter { it.lastFound.passedSince() < 3.seconds } -internal var amountOfUnknownLines = 0 +internal class UnknownLine(val line: String) { + val firstFound = SimpleTimeMark.now() + var lastFound = SimpleTimeMark.now() + var lastWarned = SimpleTimeMark.farPast() +} enum class ScoreboardElement( private val displayPair: () -> List, @@ -389,7 +371,7 @@ private fun getPurseDisplayPair(): List { var purse = PurseAPI.currentPurse.formatNum() if (!displayConfig.hideCoinsDifference) { - val earned = getGroupFromPattern(CustomScoreboard.activeLines, PurseAPI.coinsPattern, "earned") + val earned = getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, PurseAPI.coinsPattern, "earned") if (earned != null) purse += " §7(§e+$earned§7)§6" } @@ -492,7 +474,7 @@ private fun getHeatDisplayPair(): List { } private fun getHeatShowWhen() = inAnyIsland(IslandType.CRYSTAL_HOLLOWS) && - CustomScoreboard.activeLines.any { ScoreboardPattern.heatPattern.matches(it) } + ScoreboardData.sidebarLinesFormatted.any { ScoreboardPattern.heatPattern.matches(it) } private fun getColdDisplayPair(): List { val cold = -MiningAPI.cold @@ -507,7 +489,7 @@ private fun getColdDisplayPair(): List { } private fun getColdShowWhen() = inAnyIsland(IslandType.DWARVEN_MINES, IslandType.MINESHAFT) && - CustomScoreboard.activeLines.any { ScoreboardPattern.coldPattern.matches(it) } + ScoreboardData.sidebarLinesFormatted.any { ScoreboardPattern.coldPattern.matches(it) } private fun getNorthStarsDisplayPair(): List { val northStars = getNorthStars()?.formatNum() ?: "0" @@ -550,7 +532,7 @@ private fun getIslandDisplayPair() = private fun getLocationDisplayPair() = buildList { HypixelData.skyBlockAreaWithSymbol?.let { add(it to HorizontalAlignment.LEFT) } - CustomScoreboard.activeLines.firstOrNull { ScoreboardPattern.plotPattern.matches(it) } + ScoreboardData.sidebarLinesFormatted.firstOrNull { ScoreboardPattern.plotPattern.matches(it) } ?.let { add(it to HorizontalAlignment.LEFT) } } @@ -568,12 +550,12 @@ fun getPlayerAmountDisplayPair() = buildList { private fun getVisitDisplayPair() = listOf( - CustomScoreboard.activeLines.first { ScoreboardPattern.visitingPattern.matches(it) } to + ScoreboardData.sidebarLinesFormatted.first { ScoreboardPattern.visitingPattern.matches(it) } to HorizontalAlignment.LEFT, ) private fun getVisitShowWhen() = - CustomScoreboard.activeLines.any { ScoreboardPattern.visitingPattern.matches(it) } + ScoreboardData.sidebarLinesFormatted.any { ScoreboardPattern.visitingPattern.matches(it) } private fun getDateDisplayPair() = listOf( @@ -582,7 +564,7 @@ private fun getDateDisplayPair() = private fun getTimeDisplayPair(): List { val symbol = - getGroupFromPattern(CustomScoreboard.activeLines, ScoreboardPattern.timePattern, "symbol") ?: "" + getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, ScoreboardPattern.timePattern, "symbol") ?: "" return listOf( "§7" + SkyBlockTime.now() .formatted( @@ -671,7 +653,7 @@ private fun getCookieShowWhen(): Boolean { } private fun getObjectiveDisplayPair() = buildList { - val formattedLines = CustomScoreboard.activeLines + val formattedLines = ScoreboardData.sidebarLinesFormatted val objective = formattedLines.firstOrNull { ScoreboardPattern.objectivePattern.matches(it) } if (objective != null) { add(objective to HorizontalAlignment.LEFT) @@ -690,7 +672,7 @@ private fun getObjectiveDisplayPair() = buildList { } private fun getObjectiveShowWhen(): Boolean = - ScoreboardPattern.objectivePattern.anyMatches(CustomScoreboard.activeLines) + ScoreboardPattern.objectivePattern.anyMatches(ScoreboardData.sidebarLinesFormatted) private fun getSlayerDisplayPair(): List = buildList { add((if (SlayerAPI.hasActiveSlayerQuest()) "Slayer Quest" else "") to HorizontalAlignment.LEFT) @@ -860,15 +842,10 @@ private fun getFooterDisplayPair(): List = listOf( ).flatten() private fun getExtraDisplayPair(): List { - if (unconfirmedUnknownLines.isEmpty()) return listOf("" to HorizontalAlignment.LEFT) - amountOfUnknownLines = unconfirmedUnknownLines.size + val lines = recentUnknownLines() + if (lines.isEmpty()) return listOf("" to HorizontalAlignment.LEFT) - return listOf("§cUndetected Lines:" to HorizontalAlignment.LEFT) + unconfirmedUnknownLines.map { it to HorizontalAlignment.LEFT } + return listOf("§cUndetected Lines:" to HorizontalAlignment.LEFT) + lines.map { it.line to HorizontalAlignment.LEFT } } -private fun getExtraShowWhen(): Boolean { - if (unconfirmedUnknownLines.isEmpty()) { - amountOfUnknownLines = 0 - } - return unconfirmedUnknownLines.isNotEmpty() -} +private fun getExtraShowWhen(): Boolean = recentUnknownLines().isNotEmpty() diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt index 6531d5158d75..3d8251dfbb63 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.features.combat.SpidersDenAPI.isAtTopOfNest import at.hannibal2.skyhanni.features.dungeon.DungeonAPI @@ -29,7 +30,7 @@ import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern as * because they are visible for a maximum of like 1 minute every 5 days and ~12 hours. */ -private fun getSbLines(): List = CustomScoreboard.activeLines +private fun getSbLines(): List = ScoreboardData.sidebarLinesFormatted enum class ScoreboardEvent( private val displayLine: () -> List, diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt index 38612f29703b..0dff1f4933dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/UnknownLinesHandler.kt @@ -1,15 +1,22 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard import at.hannibal2.skyhanni.data.BitsAPI +import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.PurseAPI +import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.misc.ServerRestartTitle import at.hannibal2.skyhanni.features.rift.area.stillgorechateau.RiftBloodEffigies +import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RegexUtils.matches +import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.removeResets import java.util.regex.Pattern +import kotlin.time.Duration.Companion.minutes +import kotlin.time.Duration.Companion.seconds import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern as SbPattern object UnknownLinesHandler { @@ -133,7 +140,7 @@ object UnknownLinesHandler { private var remoteOnlyPatternsAdded = false fun handleUnknownLines() { - val sidebarLines = CustomScoreboard.activeLines + val sidebarLines = ScoreboardData.sidebarLinesFormatted var unknownLines = sidebarLines.map { it.removeResets() }.filter { it.isNotBlank() }.filter { it.trim().length > 3 } @@ -205,19 +212,50 @@ object UnknownLinesHandler { /* * Handle broken scoreboard lines */ - confirmedUnknownLines = confirmedUnknownLines.filter { it in unknownLines } + if (unknownLines.isEmpty()) return - unknownLines = unknownLines.filter { it !in confirmedUnknownLines } - - unconfirmedUnknownLines = unknownLines - - unknownLines = unknownLines.filter { it !in unknownLinesSet } + for (line in unknownLines) { + val unknownLine = allUnknownLines.firstOrNull { it.line == line } + if (unknownLine == null) { + if (LorenzUtils.inSkyBlock) { + ChatUtils.debug("Unknown Scoreboard line: '$line'") + } + allUnknownLines = allUnknownLines.editCopy { + add(UnknownLine(line)) + } + } else { + unknownLine.lastFound = SimpleTimeMark.now() + val firstFoundSince = unknownLine.firstFound.passedSince() + val lastWarnedSince = unknownLine.lastWarned.passedSince() + if (firstFoundSince > 3.seconds && lastWarnedSince > 30.minutes) { + unknownLine.lastWarned = SimpleTimeMark.now() + warn(line, "same line active for 3 seconds") + continue + } + } + } - unknownLines.forEach { - if (LorenzUtils.inSkyBlock) { - ChatUtils.debug("Unknown Scoreboard line: '$it'") + if (lastRecentAlarmWarning.passedSince() > 30.minutes) { + val recentAlarms = allUnknownLines.filter { it.firstFound.passedSince() < 6.seconds } + if (recentAlarms.size >= 5) { + warn(recentAlarms.first().line, "5 different lines in 5 seconds") } - unknownLinesSet.add(it) } } + + private fun warn(line: String, reason: String) { + ErrorManager.logErrorWithData( + // line inclucded in chat message to not cache a previous message + CustomScoreboardUtils.UndetectedScoreboardLines(line), + "CustomScoreboard detected a unknown line: '$line'", + "Unknown Line" to line, + "reason" to reason, + "Island" to LorenzUtils.skyBlockIsland, + "Area" to HypixelData.skyBlockArea, + "Full Scoreboard" to ScoreboardData.sidebarLinesFormatted, + noStackTrace = true, + betaOnly = true, + ) + + } } From a07ad3ee5b80d214fa62583817309f1ddc1c2c64 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 6 Oct 2024 10:58:03 +0200 Subject: [PATCH 19/64] Fix: Powder Tracker IndexOutOfBoundsException (#2678) --- .../mining/powdertracker/PowderChestReward.kt | 2 ++ .../mining/powdertracker/PowderTracker.kt | 32 +++++++++++++------ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt index 1a48a661a926..ac824abd38f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderChestReward.kt @@ -115,6 +115,8 @@ enum class PowderChestReward(val displayName: String, pattern: String) { "§9FTX 3070", " {4}§r§9FTX 3070(?: §r§8x(?.*))?", ), + + // TODO: Fix typo ELECTRON_TRANSIMTTER( "§9Electron Transmitter", " {4}§r§9Electron Transmitter(?: §r§8x(?.*))?", diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt index 38779224cf90..4c27f195a895 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt @@ -140,8 +140,7 @@ object PowderTracker { } } - private val tracker = - SkyHanniTracker("Powder Tracker", { Data() }, { it.powderTracker }) { formatDisplay(drawDisplay(it)) } + private val tracker = SkyHanniTracker("Powder Tracker", { Data() }, { it.powderTracker }) { formatDisplay(drawDisplay(it)) } class Data : TrackerData() { @@ -316,13 +315,11 @@ object PowderTracker { addSearchString("§d${data.totalChestPicked.addSeparators()} Total Chests Picked §7($chestPerHour/h)") addSearchString("§bDouble Powder: ${if (doublePowder) "§aActive! §7($powderTimer)" else "§cInactive!"}") - val entries = PowderChestReward.entries val rewards = data.rewards - addPerHour(rewards, entries[0], mithrilInfo) - addPerHour(rewards, entries[1], gemstoneInfo) + addPerHour(rewards, PowderChestReward.GEMSTONE_POWDER, gemstoneInfo) addSearchString("") - addPerHour(rewards, entries[46], diamondEssenceInfo) - addPerHour(rewards, entries[47], goldEssenceInfo) + addPerHour(rewards, PowderChestReward.DIAMOND_ESSENCE, diamondEssenceInfo) + addPerHour(rewards, PowderChestReward.GOLD_ESSENCE, goldEssenceInfo) addSearchString("") val hardStonePerHour = format(hardStoneInfo.perHour) addSearchString("§b${data.totalHardStoneCompacted.addSeparators()} §fHard Stone §bCompacted §7($hardStonePerHour/h)", "Hard Stone") @@ -347,7 +344,14 @@ object PowderTracker { } var totalParts = 0L - for (reward in entries.subList(26, 32)) { // robots part + for (reward in listOf( + PowderChestReward.FTX_3070, + PowderChestReward.ELECTRON_TRANSIMTTER, + PowderChestReward.ROBOTRON_REFLECTOR, + PowderChestReward.SUPERLITE_MOTOR, + PowderChestReward.CONTROL_SWITCH, + PowderChestReward.SYNTHETIC_HEART, + )) { val count = rewards.getOrDefault(reward, 0) totalParts += count val name = reward.displayName @@ -362,7 +366,17 @@ object PowderTracker { val blueEgg = rewards.getOrDefault(PowderChestReward.BLUE_GOBLIN_EGG, 0) addSearchString("§3$blueEgg§7-§c$redEgg§7-§e$yellowEgg§f-§a$greenEgg§f-§9$goblinEgg §fGoblin Egg") - for (reward in entries.subList(37, 46)) { + for (reward in listOf( + PowderChestReward.WISHING_COMPASS, + PowderChestReward.SLUDGE_JUICE, + PowderChestReward.ASCENSION_ROPE, + PowderChestReward.TREASURITE, + PowderChestReward.JUNGLE_HEART, + PowderChestReward.PICKONIMBUS_2000, + PowderChestReward.YOGGIE, + PowderChestReward.PREHISTORIC_EGG, + PowderChestReward.OIL_BARREL, + )) { val count = rewards.getOrDefault(reward, 0).addSeparators() val name = reward.displayName addSearchString("§b$count $name", name) From 9dd04711a4e3ca577ad3b41891aaa5eb7c403197 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sun, 6 Oct 2024 13:28:54 +0200 Subject: [PATCH 20/64] Fix: Account upgrade warning (#2674) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/fame/UpgradeReminder.kt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/UpgradeReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/UpgradeReminder.kt index d22151c1b014..b55aa8f11e7f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/UpgradeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/UpgradeReminder.kt @@ -96,6 +96,36 @@ object UpgradeReminder { fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return inInventory = event.inventoryName == "Community Shop" + if (!inInventory) return + + if (currentProfileUpgrade == null && currentAccountUpgrade == null) return + detectWrongAccountUpgradeData(event.inventoryItems) + } + + private fun detectWrongAccountUpgradeData(items: Map) { + val hasProfileUpgrade = foundActiveUpgrade(items, 27..35) + if (!hasProfileUpgrade && currentProfileUpgrade != null) { + ChatUtils.chat("§eRemoved invalid Profile Upgrade information.") + currentProfileUpgrade = null + } + + val hasAccountUpgrade = foundActiveUpgrade(items, 36..44) + if (!hasAccountUpgrade && currentAccountUpgrade != null) { + ChatUtils.chat("§eRemoved invalid Account Upgrade information.") + currentAccountUpgrade = null + } + } + + private fun foundActiveUpgrade(items: Map, slots: IntRange): Boolean { + for (slot in slots) { + val item = items[slot] ?: continue + val isUpgrading = item.getLore().any { it == "§aCurrently upgrading!" } + val isDone = item.getLore().any { it == "§cClick to claim!" } + val isReadyForUpgrade = item.getLore().any { it == "§eClick to start upgrade!" } + if (isUpgrading || isDone) return true + if (isReadyForUpgrade) return false + } + return false } @SubscribeEvent From 1e786d98c20a022e2c11c11a2cd55cc4efd6a499 Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Sun, 6 Oct 2024 13:33:27 +0200 Subject: [PATCH 21/64] Improvement: Add Mining Effects to Non God Pot Effect Display (#2677) --- .../skyhanni/features/misc/NonGodPotEffectDisplay.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index 61f9a344923f..83f45e535d5c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -76,6 +76,10 @@ object NonGodPotEffectDisplay { CURSE_OF_GREED("§4Curse of Greed I"), COLD_RESISTANCE_4("§bCold Resistance IV"), + + POWDER_PUMPKIN("§fPowder Pumpkin I"), + FILET_O_FORTUNE("§fFilet O' Fortune I"), + CHILLED_PRISTINE_POTATO("§fChilled Pristine Potato I"), } private val effectsCountPattern by RepoPattern.pattern( From cbaae605593df9ce1edf1675f0ef6d4e560fc6ff Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sun, 6 Oct 2024 16:30:33 +0200 Subject: [PATCH 22/64] Improvement: Better bz errors (#2681) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../data/bazaar/HypixelBazaarFetcher.kt | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt index c1a7af2890b4..7a97fca1d19d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt @@ -37,7 +37,7 @@ object HypixelBazaarFetcher { @SubscribeEvent fun onDebugDataCollect(event: DebugDataCollectEvent) { - event.title("Bazaar Fetching") + event.title("Bazaar Data Fetcher from API") val data = listOf( "failedAttempts: $failedAttempts", @@ -119,13 +119,20 @@ object HypixelBazaarFetcher { e.printStackTrace() } else { nextFetchTime = SimpleTimeMark.now() + 15.minutes - ErrorManager.logErrorWithData( - e, - userMessage, - "fetchType" to fetchType, - "failedAttempts" to failedAttempts, - "rawResponse" to rawResponse, - ) + if (rawResponse == null || rawResponse.toString() == "{}") { + ChatUtils.chat( + "§cFailed loading Bazaar Price data!\n" + + "Please wait until the Hypixel API is sending correct data again! There is nothing else to do at the moment.", + ) + } else { + ErrorManager.logErrorWithData( + e, + userMessage, + "fetchType" to fetchType, + "failedAttempts" to failedAttempts, + "rawResponse" to rawResponse, + ) + } } } From 41d59a6888a8e1132e57dfab279efa8426853970 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sun, 6 Oct 2024 21:58:51 +0200 Subject: [PATCH 23/64] Improvement: Fewer Server id errors (#2680) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../at/hannibal2/skyhanni/data/HypixelData.kt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 039bd7d28afd..f34dafb3b95c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.event.HandleEvent import at.hannibal2.skyhanni.config.ConfigManager.Companion.gson import at.hannibal2.skyhanni.data.model.TabWidget +import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.HypixelJoinEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -119,6 +120,9 @@ object HypixelData { var skyBlock = false var skyBlockIsland = IslandType.UNKNOWN var serverId: String? = null + private var lastSuccessfulServerIdFetchTime = SimpleTimeMark.farPast() + private var lastSuccessfulServerIdFetchType: String? = null + private var failedServerIdFetchCounter = 0 // Ironman, Stranded and Bingo var noTrade = false @@ -159,24 +163,56 @@ object HypixelData { TabWidget.SERVER.matchMatcherFirstLine { serverId = group("serverid") + lastSuccessfulServerIdFetchTime = SimpleTimeMark.now() + lastSuccessfulServerIdFetchType = "tab list" + failedServerIdFetchCounter = 0 return } ScoreboardData.sidebarLinesFormatted.matchFirst(serverIdScoreboardPattern) { val serverType = if (group("servertype") == "M") "mega" else "mini" serverId = "$serverType${group("serverid")}" + lastSuccessfulServerIdFetchTime = SimpleTimeMark.now() + lastSuccessfulServerIdFetchType = "scoreboard" + failedServerIdFetchCounter = 0 return } + failedServerIdFetchCounter++ + if (failedServerIdFetchCounter < 3) return ErrorManager.logErrorWithData( Exception("NoServerId"), "Could not find server id", + "failedServerIdFetchCounter" to failedServerIdFetchCounter, + "lastSuccessfulServerIdFetchTime" to lastSuccessfulServerIdFetchTime, + "lastSuccessfulServerIdFetchType" to lastSuccessfulServerIdFetchType, "islandType" to LorenzUtils.skyBlockIsland, "tablist" to TabListData.getTabList(), "scoreboard" to ScoreboardData.sidebarLinesFormatted, ) } + @SubscribeEvent + fun onDebugDataCollect(event: DebugDataCollectEvent) { + event.title("Server ID") + val id = serverId + if (id == null) { + event.addData { + add("server id is null!") + add("failedServerIdFetchCounter: $failedServerIdFetchCounter") + add("") + add("last successful fetch time: $lastSuccessfulServerIdFetchTime") + add("last successful fetch type: $lastSuccessfulServerIdFetchType") + } + } else { + event.addIrrelevant { + add("Server id: '$id'") + add("fetch time: $lastSuccessfulServerIdFetchTime") + add("fetch type: $lastSuccessfulServerIdFetchType") + } + } + } + fun getPlayersOnCurrentServer(): Int { var amount = 0 val playerPatternList = mutableListOf( From 3326753f29824791df28a941e2f4fc239992c9f1 Mon Sep 17 00:00:00 2001 From: MTOnline69 <97001154+MTOnline69@users.noreply.github.com> Date: Sun, 6 Oct 2024 21:01:37 +0100 Subject: [PATCH 24/64] Fix: Wiki keybind searching for (#2682) --- .../config/features/commands/BetterWikiCommandConfig.java | 2 +- .../at/hannibal2/skyhanni/features/commands/WikiManager.kt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/commands/BetterWikiCommandConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/commands/BetterWikiCommandConfig.java index fc6d0be06fc2..df0468226e77 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/commands/BetterWikiCommandConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/commands/BetterWikiCommandConfig.java @@ -53,7 +53,7 @@ public class BetterWikiCommandConfig { public boolean menuOpenWiki = false; @Expose - @ConfigOption(name = "Fandom Wiki Key", desc = "Search for an item on Wiki with this keybind.\n" + + @ConfigOption(name = "Wiki Key", desc = "Search for an item's wiki page with this keybind.\n" + "§cFor an optimal experience, do §lNOT §cbind this to a mouse button.") @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) public int wikiKeybind = Keyboard.KEY_NONE; diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt index e72ad09c5481..e6a1ef4e955e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt @@ -8,7 +8,6 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName -import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems @@ -70,7 +69,7 @@ object WikiManager { private fun wikiTheItem(item: ItemStack, autoOpen: Boolean, useFandom: Boolean = config.useFandom) { val itemDisplayName = - item.itemName.replace("§a✔ ", "").replace("§c✖ ", "") + item.displayName.replace("§a✔ ", "").replace("§c✖ ", "") val internalName = item.getInternalName().asString() val wikiUrlSearch = if (internalName != "NONE") internalName else itemDisplayName.removeColor() From 4df35d062a41f0e8fed82caf2249c2e71f5b4058 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sun, 6 Oct 2024 22:02:48 +0200 Subject: [PATCH 25/64] Fix: Unknown Perkpocalypse Mayor Chat Spam (#2683) --- src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt | 2 +- .../features/gui/customscoreboard/ScoreboardElements.kt | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt index 469c48489245..a07960231bdf 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt @@ -170,7 +170,7 @@ object MayorAPI { } ?: false } ?: return - val perk = stack.getLore().nextAfter({ perkpocalypsePerksPattern.matches(it) }) ?: return + val perk = stack.getLore().nextAfter({ perkpocalypsePerksPattern.matches(it) }, 2) ?: return // This is the first Perk of the Perkpocalypse Mayor val jerryMayor = getMayorFromPerk(getPerkFromName(perk.removeColor()) ?: return)?.addAllPerks() ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 769184077b09..e1c5d3f845d1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -784,6 +784,11 @@ private fun getMayorDisplayPair() = buildList { } if (!mayorConfig.showExtraMayor) return@buildList + addAll(addMinister()) + addAll(addPerkpocalypseMayor()) +} + +private fun addMinister() = buildList { val ministerName = MayorAPI.currentMinister?.mayorName?.let { MayorAPI.mayorNameWithColorCode(it) } ?: return@buildList add(ministerName to HorizontalAlignment.LEFT) @@ -792,7 +797,9 @@ private fun getMayorDisplayPair() = buildList { add(" §7- §e${perk.perkName}" to HorizontalAlignment.LEFT) } } +} +private fun addPerkpocalypseMayor() = buildList { val jerryExtraMayor = MayorAPI.jerryExtraMayor val extraMayor = jerryExtraMayor.first ?: return@buildList From 023b44c71ea7739716ebd010cea2841e5336a69b Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Mon, 7 Oct 2024 07:43:06 +1100 Subject: [PATCH 26/64] Added the ability to disable chat errors via the repo (#2668) Co-authored-by: Cal --- .../data/jsonobjects/repo/RepoErrorData.kt | 10 +++ .../skyhanni/test/command/ErrorManager.kt | 64 +++++++++++++++++-- 2 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt new file mode 100644 index 000000000000..4866176516c3 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt @@ -0,0 +1,10 @@ +package at.hannibal2.skyhanni.data.jsonobjects.repo + +import com.google.gson.annotations.Expose + +data class RepoErrorData( + @Expose var messageExact: List?, + @Expose var messageStartsWith: List?, + @Expose var replaceMessage: String?, + @Expose var affectedVersions: List = listOf(), +) diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index 56a50ecebd06..e0fcf8fcbdc3 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -1,6 +1,10 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigManager +import at.hannibal2.skyhanni.data.jsonobjects.repo.RepoErrorData +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzUtils @@ -8,9 +12,12 @@ import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeLimitedSet +import at.hannibal2.skyhanni.utils.json.fromJson import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes +@SkyHanniModule object ErrorManager { // random id -> error message @@ -158,12 +165,57 @@ object ErrorManager { if (finalMessage.last() !in ".?!") { finalMessage += "§c." } - ChatUtils.clickableChat( - "§c[SkyHanni-${SkyHanniMod.version}]: $finalMessage Click here to copy the error into the clipboard.", - onClick = { copyError(randomId) }, - "§eClick to copy!", - prefix = false, - ) + + var hideError = false + for (repoError in repoErrors) { + for (s in repoError.messageStartsWith ?: listOf()) { + if (rawMessage.startsWith(s)) { + hideError = true + } + } + for (s in repoError.messageExact ?: listOf()) { + if (rawMessage == s) { + hideError = true + } + } + if (hideError) { + if (repoError.replaceMessage != null) { + finalMessage = repoError.replaceMessage!! + hideError = false + } + break + } + } + + if (!hideError) { + ChatUtils.clickableChat( + "§c[SkyHanni-${SkyHanniMod.version}]: $finalMessage Click here to copy the error into the clipboard.", + onClick = { copyError(randomId) }, + "§eClick to copy!", + prefix = false, + ) + } + + } + + private var repoErrors: List = listOf() + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + val chatErrors = event.repoLocation.resolve("chat_errors") + repoErrors = if (chatErrors.exists()) { + chatErrors.listFiles() + .filter { + it != null && it.isFile && it.canRead() + } + .map { + ConfigManager.gson.fromJson(it.readText()) + }.filter { + SkyHanniMod.version in it.affectedVersions + } + } else { + listOf() + } } private fun buildExtraDataString(extraData: Array>): String { From 497d652aa83ed81e04f9400ae84362642585dfca Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 6 Oct 2024 22:48:31 +0200 Subject: [PATCH 27/64] code cleanup in the chat error repo logic --- .../data/jsonobjects/repo/RepoErrorData.kt | 18 ++++-- .../skyhanni/test/command/ErrorManager.kt | 60 ++++++++----------- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt index 4866176516c3..3ec529db3e3f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt @@ -1,10 +1,18 @@ package at.hannibal2.skyhanni.data.jsonobjects.repo import com.google.gson.annotations.Expose +import com.google.gson.annotations.SerializedName -data class RepoErrorData( - @Expose var messageExact: List?, - @Expose var messageStartsWith: List?, - @Expose var replaceMessage: String?, - @Expose var affectedVersions: List = listOf(), +data class RepoErrorJson( + @Expose @SerializedName("changed_error_messages") val changedErrorMessages: List, ) + +data class RepoErrorData( + @Expose @SerializedName("message_exact") private var rawMessageExact: List?, + @Expose @SerializedName("message_starts_with") private var rawMessageStartsWith: List?, + @Expose @SerializedName("replace_message") var replaceMessage: String?, + @Expose @SerializedName("affected_versions") var affectedVersions: List = listOf(), +) { + val messageExact by lazy { rawMessageExact ?: emptyList() } + val messageStartsWith by lazy { rawMessageStartsWith ?: emptyList() } +} diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index e0fcf8fcbdc3..7fed3ad028f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -1,8 +1,8 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.jsonobjects.repo.RepoErrorData +import at.hannibal2.skyhanni.data.jsonobjects.repo.RepoErrorJson import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils @@ -12,7 +12,6 @@ import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeLimitedSet -import at.hannibal2.skyhanni.utils.json.fromJson import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.minutes @@ -24,6 +23,7 @@ object ErrorManager { private val errorMessages = mutableMapOf() private val fullErrorMessages = mutableMapOf() private var cache = TimeLimitedSet>(10.minutes) + private var repoErrors: List = emptyList() private val breakAfter = listOf( "at at.hannibal2.skyhanni.config.commands.Commands\$createCommand", @@ -156,66 +156,56 @@ object ErrorManager { val extraDataString = buildExtraDataString(extraData) val rawMessage = message.removeColor() - errorMessages[randomId] = - "```\nSkyHanni ${SkyHanniMod.version}: $rawMessage\n \n$stackTrace\n$extraDataString```" + errorMessages[randomId] = "```\nSkyHanni ${SkyHanniMod.version}: $rawMessage\n \n$stackTrace\n$extraDataString```" fullErrorMessages[randomId] = "```\nSkyHanni ${SkyHanniMod.version}: $rawMessage\n(full stack trace)\n \n$fullStackTrace\n$extraDataString```" + val finalMessage = buildFinalMessage(message) ?: return + ChatUtils.clickableChat( + "§c[SkyHanni-${SkyHanniMod.version}]: $finalMessage Click here to copy the error into the clipboard.", + onClick = { copyError(randomId) }, + "§eClick to copy!", + prefix = false, + ) + } + + private fun buildFinalMessage(message: String): String? { var finalMessage = message if (finalMessage.last() !in ".?!") { finalMessage += "§c." } + val rawMessage = message.removeColor() var hideError = false for (repoError in repoErrors) { - for (s in repoError.messageStartsWith ?: listOf()) { - if (rawMessage.startsWith(s)) { + for (string in repoError.messageStartsWith) { + if (rawMessage.startsWith(string)) { hideError = true } } - for (s in repoError.messageExact ?: listOf()) { - if (rawMessage == s) { + for (string in repoError.messageExact) { + if (rawMessage == string) { hideError = true } } if (hideError) { - if (repoError.replaceMessage != null) { - finalMessage = repoError.replaceMessage!! + repoError.replaceMessage?.let { + finalMessage = it hideError = false } break } } - if (!hideError) { - ChatUtils.clickableChat( - "§c[SkyHanni-${SkyHanniMod.version}]: $finalMessage Click here to copy the error into the clipboard.", - onClick = { copyError(randomId) }, - "§eClick to copy!", - prefix = false, - ) - } - + return if (hideError) null else finalMessage } - private var repoErrors: List = listOf() - @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - val chatErrors = event.repoLocation.resolve("chat_errors") - repoErrors = if (chatErrors.exists()) { - chatErrors.listFiles() - .filter { - it != null && it.isFile && it.canRead() - } - .map { - ConfigManager.gson.fromJson(it.readText()) - }.filter { - SkyHanniMod.version in it.affectedVersions - } - } else { - listOf() - } + val data = event.getConstant("ChangedChatErrors") + val version = SkyHanniMod.version + + repoErrors = data.changedErrorMessages.filter { version in it.affectedVersions } } private fun buildExtraDataString(extraData: Array>): String { From ff119419cce3e192012aee9e438911ffeb8d8519 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sun, 6 Oct 2024 22:49:45 +0200 Subject: [PATCH 28/64] Fixed /viewrecipe replace breaking pages (#2679) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/commands/ViewRecipeCommand.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt index e3d6a5713297..dbaf037ca363 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils.senderIsSkyhanni import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NumberUtil.isInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -30,12 +31,20 @@ object ViewRecipeCommand { if (!config.viewRecipeLowerCase) return if (event.senderIsSkyhanni()) return - val item = pattern.matchMatcher(event.message.lowercase()) { - group("item").uppercase().replace(" ", "_") + val input = pattern.matchMatcher(event.message.lowercase()) { + group("item").uppercase() } ?: return + val args = input.split(" ") + val endsWithPageNumber = args.last().isInt() + val finalCommand = if (endsWithPageNumber) { + "${args.dropLast(1).joinToString("_")} ${args.last()}" + } else { + input.replace(" ", "_") + } + event.cancel() - HypixelCommands.viewRecipe(item) + HypixelCommands.viewRecipe(finalCommand) } val list by lazy { From c4077a9aa597ddec23f8d4649c07f6615d0ecfc2 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 6 Oct 2024 23:33:32 +0200 Subject: [PATCH 29/64] fixed serialized names not liking lazy --- .../skyhanni/data/jsonobjects/repo/RepoErrorData.kt | 4 ++-- .../java/at/hannibal2/skyhanni/test/command/ErrorManager.kt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt index 3ec529db3e3f..0fe893723580 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt @@ -13,6 +13,6 @@ data class RepoErrorData( @Expose @SerializedName("replace_message") var replaceMessage: String?, @Expose @SerializedName("affected_versions") var affectedVersions: List = listOf(), ) { - val messageExact by lazy { rawMessageExact ?: emptyList() } - val messageStartsWith by lazy { rawMessageStartsWith ?: emptyList() } + val messageExact get() = rawMessageExact ?: emptyList() + val messageStartsWith get() = rawMessageStartsWith ?: emptyList() } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index 7fed3ad028f5..fecdb6cdd7e3 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -171,9 +171,6 @@ object ErrorManager { private fun buildFinalMessage(message: String): String? { var finalMessage = message - if (finalMessage.last() !in ".?!") { - finalMessage += "§c." - } val rawMessage = message.removeColor() var hideError = false @@ -197,6 +194,9 @@ object ErrorManager { } } + if (finalMessage.last() !in ".?!") { + finalMessage += "§c." + } return if (hideError) null else finalMessage } From dc2ea3ff0b449489ee32bf066b9c8854791f5d86 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 6 Oct 2024 23:50:57 +0200 Subject: [PATCH 30/64] added support for custom_message --- .../hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt | 1 + .../java/at/hannibal2/skyhanni/test/command/ErrorManager.kt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt index 0fe893723580..41d0f701cb15 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt @@ -11,6 +11,7 @@ data class RepoErrorData( @Expose @SerializedName("message_exact") private var rawMessageExact: List?, @Expose @SerializedName("message_starts_with") private var rawMessageStartsWith: List?, @Expose @SerializedName("replace_message") var replaceMessage: String?, + @Expose @SerializedName("custom_message") var customMessage: String?, @Expose @SerializedName("affected_versions") var affectedVersions: List = listOf(), ) { val messageExact get() = rawMessageExact ?: emptyList() diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index fecdb6cdd7e3..25b485c5a0f1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -190,6 +190,10 @@ object ErrorManager { finalMessage = it hideError = false } + repoError.customMessage?.let { + ChatUtils.userError(it) + return null + } break } } From 8a1591748ac661c6f61776e25592ee879bbcdd72 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 7 Oct 2024 00:52:59 +0200 Subject: [PATCH 31/64] removed unnecessary check --- .../features/fishing/tracker/SeaCreatureTracker.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt index ca8a73ce9d5f..5ba50c2b74f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -79,16 +79,8 @@ object SeaCreatureTracker { val realAmount = data.amount.filter { filter(it.key) } val total = realAmount.sumAllValues() - for ((name, amount) in realAmount.entries.sortedByDescending { it.value }) { - val displayName = SeaCreatureManager.allFishingMobs[name]?.displayName ?: run { - ErrorManager.logErrorStateWithData( - "Sea Creature Tracker can not display a name correctly", - "Could not find sea creature by name", - "SeaCreatureManager.allFishingMobs.keys" to SeaCreatureManager.allFishingMobs.keys, - "name" to name - ) - name - } + for ((displayName, amount) in realAmount.entries.sortedByDescending { it.value }) { + val percentageSuffix = if (config.showPercentage.get()) { val percentage = LorenzUtils.formatPercentage(amount.toDouble() / total) From 71f6d7e18627a04e5d80d8f5951cdb3b2bc5d44d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 7 Oct 2024 01:11:28 +0200 Subject: [PATCH 32/64] reverted old removal --- .../features/fishing/tracker/SeaCreatureTracker.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt index 5ba50c2b74f6..ca8a73ce9d5f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -79,8 +79,16 @@ object SeaCreatureTracker { val realAmount = data.amount.filter { filter(it.key) } val total = realAmount.sumAllValues() - for ((displayName, amount) in realAmount.entries.sortedByDescending { it.value }) { - + for ((name, amount) in realAmount.entries.sortedByDescending { it.value }) { + val displayName = SeaCreatureManager.allFishingMobs[name]?.displayName ?: run { + ErrorManager.logErrorStateWithData( + "Sea Creature Tracker can not display a name correctly", + "Could not find sea creature by name", + "SeaCreatureManager.allFishingMobs.keys" to SeaCreatureManager.allFishingMobs.keys, + "name" to name + ) + name + } val percentageSuffix = if (config.showPercentage.get()) { val percentage = LorenzUtils.formatPercentage(amount.toDouble() / total) From edbbe1e61afe600b9d111c7bf74db70f07befd2f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Mon, 7 Oct 2024 01:32:30 +0200 Subject: [PATCH 33/64] Backend: Migrate Plhlegblast (#2684) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../fishing/tracker/SeaCreatureTracker.kt | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt index ca8a73ce9d5f..e106858012de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -4,11 +4,13 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.FishingBobberCastEvent import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.features.fishing.FishingAPI import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString import at.hannibal2.skyhanni.utils.CollectionUtils.sumAllValues @@ -25,6 +27,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object SeaCreatureTracker { + private var needMigration = true private val config get() = SkyHanniMod.feature.fishing.seaCreatureTracker @@ -72,7 +75,15 @@ object SeaCreatureTracker { return map } + @SubscribeEvent + fun onProfileJoin(event: ProfileJoinEvent) { + needMigration = true + } + private fun drawDisplay(data: Data): List = buildList { + // manually migrating from "Phlhlegblast" to "Plhlegblast" when the new name is in the repo + tryToMigrate(data.amount) + addSearchString("§7Sea Creature Tracker:") val filter: (String) -> Boolean = addCategories(data) @@ -85,7 +96,7 @@ object SeaCreatureTracker { "Sea Creature Tracker can not display a name correctly", "Could not find sea creature by name", "SeaCreatureManager.allFishingMobs.keys" to SeaCreatureManager.allFishingMobs.keys, - "name" to name + "name" to name, ) name } @@ -100,6 +111,25 @@ object SeaCreatureTracker { addSearchString(" §7- §e${total.addSeparators()} §7Total Sea Creatures") } + private fun tryToMigrate( + data: MutableMap, + ) { + if (!needMigration) return + needMigration = false + + val oldName = "Phlhlegblast" + val newName = "Plhlegblast" + + // only migrate once the repo contains the new name + if (SeaCreatureManager.allFishingMobs.containsKey(newName)) { + data[oldName]?.let { + ChatUtils.debug("Sea Creature Tracker migrated $it $oldName to $newName") + data[newName] = it + data.remove(oldName) + } + } + } + private fun MutableList.addCategories(data: Data): (String) -> Boolean { val amounts = getCurrentCategories(data) val list = amounts.keys.toList() @@ -115,7 +145,7 @@ object SeaCreatureTracker { val id = list.indexOf(currentCategory) currentCategory = list[(id + 1) % list.size] tracker.update() - } + }, ) } @@ -161,6 +191,5 @@ object SeaCreatureTracker { tracker.resetCommand() } - private fun isEnabled() = - LorenzUtils.inSkyBlock && config.enabled && !FishingAPI.wearingTrophyArmor && !LorenzUtils.inKuudraFight + private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && !FishingAPI.wearingTrophyArmor && !LorenzUtils.inKuudraFight } From 82ea42e7dfe989c75eebc072f1cebe0b6c000492 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 7 Oct 2024 01:52:48 +0200 Subject: [PATCH 34/64] Version 0.27 Beta 16 --- docs/CHANGELOG.md | 14 ++++++++++++++ root.gradle.kts | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 050f6c9bd7af..72032222eff6 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -184,6 +184,7 @@ + Added Area Navigation support to Glacite Tunnels. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2544) + Updated wording in mineshaft pity breakdown ("efficient miner" -> "spread"). - luna (https://github.com/hannibal002/SkyHanni/pull/2633) + Improved the wording of the Mining Event data error chat message. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2671) ++ Added Mining Effects (Powder Pumpkin, Filet O' Fortune, and Chilled Pristine Potato) to the Non-God Effect Display. - jani (https://github.com/hannibal002/SkyHanni/pull/2677) #### Diana Improvements @@ -201,6 +202,7 @@ + Added an opacity slider for the Custom Background Image in the Custom Scoreboard. - Empa (https://github.com/hannibal002/SkyHanni/pull/1837) + Added an Undo message when auto alignment inCustom Scoreboard gets disabled. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2402) + Added an option to show SkyBlock time on the custom scoreboard rounded to 10 minutes, similar to the vanilla scoreboard. - Luna (https://github.com/hannibal002/SkyHanni/pull/2443) ++ Reduced the frequency of scoreboard errors being displayed. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2672) #### Inventory Improvements @@ -292,6 +294,8 @@ + Improved the way pathfinding lines are rendered. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2634) + Automatically starts pathfinding after clicking on SkyHanni reminder chat messages about Carnival Reminder, Hoppity NPC, City Project, and account/profile upgrades. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2635) + Greatly improved performance by optimizing SkyHanni Chroma support for Patcher Font Renderer. - nopo (https://github.com/hannibal002/SkyHanni/pull/2666) ++ "Could not find server id" errors are now less common. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2680) ++ Clarified the wording of Bazaar Data Loading error messages. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2681) ### Fixes @@ -335,6 +339,7 @@ + Fixed enchanting XP detection. + Fixed Minister in Calendar Perk description sometimes not using the gray color. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2632) + Fixed highlighting items in one's own inventory for some Bazaar features, e.g., in the "click to re-order" feature. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2640) ++ Automatically remove incorrect Account/Profile Upgrade warnings by talking to Elizabeth. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2674) #### Mining Fixes @@ -363,6 +368,7 @@ + Fixed Jasper gemstones not being addressed in the Powder Mining filter. - Daveed (https://github.com/hannibal002/SkyHanni/pull/2618) + Fixed the King Talisman Tracker sometimes not displaying the correct data. - martimavocado (https://github.com/hannibal002/SkyHanni/pull/2663) + Fixed the Powder Tracker not tracking items correctly. - HiZe (https://github.com/hannibal002/SkyHanni/pull/2645) ++ Fixed an error in Powder Tracker. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2678) #### Scoreboard Fixes @@ -386,6 +392,8 @@ + Fixed a Custom Scoreboard error during M7 Dragons. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2510) + Fixed Custom Scoreboard error during the Raffle Event. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2545) + Fixed both the Custom Scoreboard Active and Starting Soon Tab List events being active simultaneously in the Garden. - Empa, j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2592) ++ Fixed Custom Scoreboard not showing the Perkpocalypse Mayor. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2683) ++ Fixed some scoreboard error messages appearing in chat. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2672) #### Hoppity Fixes @@ -407,6 +415,7 @@ #### Commands Fixes + Fixed the command `/shtps` printing nothing if the TPS display was currently showing nothing. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/2446) ++ Fixed "/viewrecipe command replace" breaking pages. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2679) #### Dungeon Fixes @@ -474,6 +483,8 @@ + Fixed item trackers displaying removed item names incorrectly. - CalMWolfs (https://github.com/hannibal002/SkyHanni/pull/2620) + Fixed some messages from Pablo NPC not being detected. - Luna (https://github.com/hannibal002/SkyHanni/pull/2636) + Fixed SkyHanni re-downloading the repository on every launch. - nopo (https://github.com/hannibal002/SkyHanni/pull/2669) ++ Fixed unknown Perkpocalypse Mayor chat spam. - j10a1n15 (https://github.com/hannibal002/SkyHanni/pull/2683) ++ Fixed the wiki keybind searching for "null" on items with no internal name. - MTOnline (https://github.com/hannibal002/SkyHanni/pull/2682) ### Technical Details @@ -548,6 +559,9 @@ + Added Bazaar Fetch information to `/shdebug`. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2675) + Removed the password from the download source check. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2649) + Added a missing SkyBlock check for debug commands `/shtrackparticles` and `/shtracksounds`. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2641) ++ Prepared for later migration of correct config name of Plhlegblast. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2684) ++ Added the ability to disable SkyHanni errors via repo configuration. - nopo (https://github.com/hannibal002/SkyHanni/pull/2668) ++ Added current server ID and fetch data to the `/shdebug` command. - hannibal2 (https://github.com/hannibal002/SkyHanni/pull/2680) ### Removed Features diff --git a/root.gradle.kts b/root.gradle.kts index 58285a7012c2..33a21442e6f0 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -14,7 +14,7 @@ plugins { allprojects { group = "at.hannibal2.skyhanni" - version = "0.27.Beta.15" + version = "0.27.Beta.16" repositories { mavenCentral() mavenLocal() From df210dceb42d76597272b066854fa39209f6d353 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:21:31 +0200 Subject: [PATCH 35/64] Fix: Custom Scoreboard Update time (#2685) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../gui/customscoreboard/CustomScoreboard.kt | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt index 8a1d7b50de45..4a86519c374e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt @@ -30,6 +30,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment import at.hannibal2.skyhanni.utils.RenderUtils.VerticalAlignment import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderable import at.hannibal2.skyhanni.utils.SimpleTimeMark +import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.fromNow import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.renderables.Renderable @@ -50,7 +51,7 @@ object CustomScoreboard { private var cache = emptyList() private const val GUI_NAME = "Custom Scoreboard" - private var lastScoreboardUpdate = SimpleTimeMark.farFuture() + private var nextScoreboardUpdate = SimpleTimeMark.farFuture() @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { @@ -82,9 +83,7 @@ object CustomScoreboard { fun onGuiPositionMoved(event: GuiPositionMovedEvent) { if (event.guiName == GUI_NAME) { with(alignmentConfig) { - if (horizontalAlignment != HorizontalAlignment.DONT_ALIGN || - verticalAlignment != VerticalAlignment.DONT_ALIGN - ) { + if (horizontalAlignment != HorizontalAlignment.DONT_ALIGN || verticalAlignment != VerticalAlignment.DONT_ALIGN) { val tempHori = horizontalAlignment val tempVert = verticalAlignment @@ -108,15 +107,9 @@ object CustomScoreboard { fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return - // We want to update the scoreboard as soon as we have new data, not 5 ticks delayed - var dirty = false - if (lastScoreboardUpdate.passedSince() > 250.milliseconds) { - lastScoreboardUpdate = SimpleTimeMark.farFuture() - dirty = true - } - - // Creating the lines - if (dirty) { + if (dirty || nextScoreboardUpdate.isInPast()) { + nextScoreboardUpdate = 250.milliseconds.fromNow() + dirty = false display = createLines().removeEmptyLinesFromEdges() if (TabListData.fullyLoaded) { cache = display.toList() @@ -129,10 +122,9 @@ object CustomScoreboard { @SubscribeEvent fun onScoreboardChange(event: ScoreboardUpdateEvent) { - lastScoreboardUpdate = SimpleTimeMark.now() + dirty = true } - internal val config get() = SkyHanniMod.feature.gui.customScoreboard internal val displayConfig get() = config.display internal val alignmentConfig get() = displayConfig.alignment From 3b61c48e2e1545bcf009bcbb563de5fbb63277ab Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:24:20 +0200 Subject: [PATCH 36/64] Fix: Hoppity wrong amount (#2686) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/event/hoppity/HoppityCollectionStats.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt index 7d2a6a457c28..6d201e57edcd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt @@ -505,7 +505,11 @@ object HoppityCollectionStats { val found = !rabbitNotFoundPattern.anyMatches(itemLore) - if (!found) continue + if (!found) { + // if the config has wrong data, remove it + loggedRabbits.remove(itemName) + continue + } val duplicates = duplicatesFoundPattern.firstMatcher(itemLore) { group("duplicates").formatInt() From 129bc896df29ed5cedd915b094365058b19137a1 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Mon, 7 Oct 2024 21:08:50 +1100 Subject: [PATCH 37/64] Backend: Update pr template (#2687) --- pull_request_template.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pull_request_template.md b/pull_request_template.md index b004c1c13866..dba81f46b91c 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -1,4 +1,6 @@ - + + ## Dependencies - pr_number_or_link_here From 1de910a9ae9ab96fa75044367f9546d671fbcba1 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:09:22 +0200 Subject: [PATCH 38/64] Fix: Hoppity > max (#2688) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../config/storage/ProfileSpecificStorage.java | 3 +++ .../inventory/chocolatefactory/ChocolateAmount.kt | 1 + .../inventory/chocolatefactory/ChocolateFactoryAPI.kt | 4 ++++ .../chocolatefactory/ChocolateFactoryDataLoader.kt | 11 +++++++++++ .../chocolatefactory/ChocolateFactoryStats.kt | 5 ++++- 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java index 754eea3bba59..4ccb0823d512 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java @@ -102,6 +102,9 @@ public static class ChocolateFactoryStorage { @Expose public long currentChocolate = 0; + @Expose + public long maxChocolate = 0; + @Expose public long chocolateThisPrestige = 0; diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt index 7f0694e2a779..1f1f6d0c0969 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateAmount.kt @@ -31,6 +31,7 @@ enum class ChocolateAmount(val chocolate: () -> Long) { companion object { fun chocolateSinceUpdate(): Long { + if (ChocolateFactoryAPI.isMax()) return 0L val lastUpdate = profileStorage?.lastDataSave ?: return 0 val currentTime = SimpleTimeMark.now() val secondsSinceUpdate = (currentTime - lastUpdate).inWholeSeconds diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt index 112e8a7a7383..195ea51d32f9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryAPI.kt @@ -239,4 +239,8 @@ object ChocolateFactoryAPI { it.rabbit.removeColor() == rabbitName.removeColor() } } + + fun isMax(): Boolean = profileStorage?.let { + it.maxChocolate == it.currentChocolate + } ?: false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt index eebbb19e93a7..64a99a8c911f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryDataLoader.kt @@ -51,6 +51,14 @@ object ChocolateFactoryDataLoader { "chocolate.thisprestige", "§7Chocolate this Prestige: §6(?[\\d,]+)", ) + + /** + * REGEX-TEST: §7Max Chocolate: §660B + */ + private val maxChocolatePattern by ChocolateFactoryAPI.patternGroup.pattern( + "chocolate.max", + "§7Max Chocolate: §6(?.*)", + ) private val chocolateForPrestigePattern by ChocolateFactoryAPI.patternGroup.pattern( "chocolate.forprestige", "§7§cRequires (?\\w+) Chocolate this.*", @@ -230,6 +238,9 @@ object ChocolateFactoryDataLoader { chocolateThisPrestigePattern.matchMatcher(line) { profileStorage.chocolateThisPrestige = group("amount").formatLong() } + maxChocolatePattern.matchMatcher(line) { + profileStorage.maxChocolate = group("max").formatLong() + } chocolateForPrestigePattern.matchMatcher(line) { ChocolateFactoryAPI.chocolateForPrestige = group("amount").formatLong() prestigeCost = ChocolateFactoryAPI.chocolateForPrestige diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt index 8d08e485e16f..36c79728cd39 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryStats.kt @@ -76,7 +76,10 @@ object ChocolateFactoryStats { val map = buildMap { put(ChocolateFactoryStat.HEADER, "§6§lChocolate Factory ${ChocolateFactoryAPI.currentPrestige.toRoman()}") - put(ChocolateFactoryStat.CURRENT, "§eCurrent Chocolate: §6${ChocolateAmount.CURRENT.formatted}") + val maxSuffix = if (ChocolateFactoryAPI.isMax()) { + " §cMax!" + } else "" + put(ChocolateFactoryStat.CURRENT, "§eCurrent Chocolate: §6${ChocolateAmount.CURRENT.formatted}$maxSuffix") put(ChocolateFactoryStat.THIS_PRESTIGE, "§eThis Prestige: §6${ChocolateAmount.PRESTIGE.formatted}") put(ChocolateFactoryStat.ALL_TIME, "§eAll-time: §6${ChocolateAmount.ALL_TIME.formatted}") From 266d007da9f23b19f8e815da3005451195a33a5e Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Mon, 7 Oct 2024 21:16:35 +1100 Subject: [PATCH 39/64] its actually a plus (#2689) --- pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pull_request_template.md b/pull_request_template.md index dba81f46b91c..02769a0f8470 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -1,6 +1,6 @@