From aeca29914fd8995c575d847c97376a49b0481e10 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 3 Feb 2023 00:53:18 +0100 Subject: Highlight stuff that is missing in the skyblock level guide inventory. --- CHANGELOG.md | 3 ++ FEATURES.md | 1 + .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 1 + .../skyhanni/config/features/Inventory.java | 6 ++++ .../at/hannibal2/skyhanni/data/ApiDataLoader.kt | 2 +- .../at/hannibal2/skyhanni/data/SkillExperience.kt | 10 ++++-- .../features/inventory/SkyBLockLevelGuideHelper.kt | 40 ++++++++++++++++++++++ .../skyhanni/features/misc/CollectionCounter.kt | 6 ++++ 8 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/inventory/SkyBLockLevelGuideHelper.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 68a4a1951..a9614ac53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Version 0.16.UNRELEASED (UNRELEASED) +## Features ++ Added highlight for stuff that is missing in the skyblock level guide inventory. + ## Version 0.15.1 (2023-01-25) ## Features diff --git a/FEATURES.md b/FEATURES.md index adbc20179..fa5b5f182 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -56,6 +56,7 @@ + Highlight the selected template in the stats tuning inventory. + Show the type of stats for the tuning point templates. + Highlight depleted Bonzo's Masks in your inventory. ++ Highlight stuff that is missing in the skyblock level guide inventory. ## Item Abilities - Show the cooldown of items in the inventory. diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index f623b22a4..b2361b399 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -175,6 +175,7 @@ public class SkyHanniMod { loadModule(new BarnFishingTimer()); loadModule(new CrimsonIsleReputationHelper(this)); loadModule(new SharkFishCounter()); + loadModule(new SkyBLockLevelGuideHelper()); loadModule(new OdgerWaypoint()); loadModule(new TiaRelayHelper()); loadModule(new TiaRelayWaypoints()); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java index 61b11da6c..6c4496af3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java @@ -128,4 +128,10 @@ public class Inventory { desc = "Highlights used Bonzo's Masks with a background") @ConfigEditorBoolean public boolean highlightDepletedBonzosMasks = false; + + @Expose + @ConfigOption(name = "Highlight Missing SkyBlock Level Guide", + desc = "Highlight stuff that is missing in the skyblock level guide inventory.") + @ConfigEditorBoolean + public boolean highlightMissingSkyBlockLevelGuide = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/data/ApiDataLoader.kt b/src/main/java/at/hannibal2/skyhanni/data/ApiDataLoader.kt index bea039212..17cb04d35 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ApiDataLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ApiDataLoader.kt @@ -52,7 +52,7 @@ class ApiDataLoader { } @SubscribeEvent - fun onStatusBar(event: ProfileJoinEvent) { + fun onProfileJoin(event: ProfileJoinEvent) { currentProfileName = event.name updateApiData() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt index 7b5df45df..0312342da 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.LorenzActionBarEvent import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -16,6 +17,7 @@ import java.util.regex.Pattern class SkillExperience { private val actionBarPattern = Pattern.compile("(?:.*)§3\\+(?:.*) (.*) \\((.*)\\/(.*)\\)(?:.*)") + private val inventoryPattern = Pattern.compile("(?:.*) §e(.*)§6\\/(?:.*)") @SubscribeEvent fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { @@ -29,6 +31,11 @@ class SkillExperience { } } + @SubscribeEvent + fun onProfileJoin(event: ProfileJoinEvent) { + skillExp.clear() + } + @SubscribeEvent fun onActionBar(event: LorenzActionBarEvent) { if (!LorenzUtils.inSkyBlock) return @@ -76,8 +83,7 @@ class SkillExperience { val skillName = split[0].lowercase() val level = split[1].romanToDecimal() val baseExp = getExpForLevel(level) - val pattern = Pattern.compile("(?:.*) §e(.*)§6\\/(?:.*)") - val matcher = pattern.matcher(line) + val matcher = inventoryPattern.matcher(line) if (matcher.matches()) { val rawNumber = matcher.group(1) val overflow = rawNumber.formatNumber() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyBLockLevelGuideHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyBLockLevelGuideHelper.kt new file mode 100644 index 000000000..634aa5758 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SkyBLockLevelGuideHelper.kt @@ -0,0 +1,40 @@ +package at.hannibal2.skyhanni.features.inventory + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.highlight +import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.inventory.ContainerChest +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class SkyBLockLevelGuideHelper { + + @SubscribeEvent + fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniMod.feature.inventory.highlightMissingSkyBlockLevelGuide) return + + if (InventoryUtils.openInventoryName().contains("Guide ➜")) { + + if (event.gui !is GuiChest) return + val guiChest = event.gui + val chest = guiChest.inventorySlots as ContainerChest + + for (slot in chest.inventorySlots) { + if (slot == null) continue + if (slot.slotNumber != slot.slotIndex) continue + val name = slot.stack?.name ?: continue + + if (name.startsWith("§a✔")) { +// slot highlight LorenzColor.GREEN + } else if (name.startsWith("§c✖")) { + slot highlight LorenzColor.RED + } + } + } + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt index 088836401..275e7173d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionCounter.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent +import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.bazaar.BazaarData import at.hannibal2.skyhanni.utils.InventoryUtils @@ -156,6 +157,11 @@ class CollectionCounter { updateDisplay() } + @SubscribeEvent + fun onProfileJoin(event: ProfileJoinEvent) { + apiCollectionData.clear() + } + @SubscribeEvent fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) { val profileData = event.profileData -- cgit