From 409fca56ba79f3ff4c4ed51c2a8361dbc1ffd296 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 30 Sep 2023 09:26:26 +0200 Subject: Fixed NEU Heavy Pearl detection. --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 ++ .../skyhanni/config/features/MiscConfig.java | 6 +++++ .../skyhanni/features/misc/FixNEUHeavyPearls.kt | 29 ++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 30c310110..f3ef5b0fd 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -168,6 +168,7 @@ import at.hannibal2.skyhanni.features.misc.CurrentPetDisplay import at.hannibal2.skyhanni.features.misc.CustomTextBox import at.hannibal2.skyhanni.features.misc.EnderNodeTracker import at.hannibal2.skyhanni.features.misc.ExpOrbsOnGroundHider +import at.hannibal2.skyhanni.features.misc.FixNEUHeavyPearls import at.hannibal2.skyhanni.features.misc.FrozenTreasureTracker import at.hannibal2.skyhanni.features.misc.HarpFeatures import at.hannibal2.skyhanni.features.misc.HideArmor @@ -570,6 +571,7 @@ class SkyHanniMod { loadModule(GlowingDroppedItems()) loadModule(DungeonTeammateOutlines()) loadModule(DungeonRankTabListColor()) + loadModule(FixNEUHeavyPearls()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index 53914713e..9ba4c0f40 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -632,6 +632,12 @@ public class MiscConfig { @FeatureToggle public boolean superpairsClicksAlert = false; + @Expose + @ConfigOption(name = "NEU Heavy Pearls", desc = "Fixing NEU Heavy Pearl detection.") + @ConfigEditorBoolean + @FeatureToggle + public boolean fixNeuHeavyPearls = true; + @Expose public Position inventoryLoadPos = new Position(394, 124, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt new file mode 100644 index 000000000..1608bb147 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/FixNEUHeavyPearls.kt @@ -0,0 +1,29 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.SackChangeEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import io.github.moulberry.notenoughupdates.NotEnoughUpdates +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class FixNEUHeavyPearls { + private val config get() = SkyHanniMod.feature.misc + private val heavyPearl = "HEAVY_PEARL".asInternalName() + + @SubscribeEvent + fun onSackChange(event: SackChangeEvent) { + if (!isEnabled()) return + + for (change in event.sackChanges) { + if (change.internalName == heavyPearl && change.delta == 3) { + LorenzUtils.chat("§e[SkyHanni] Mark NEU Heavy Pearls as done.") + NotEnoughUpdates.INSTANCE.config.getProfileSpecific().dailyHeavyPearlCompleted = + System.currentTimeMillis() + } + } + } + + fun isEnabled() = LorenzUtils.inSkyBlock && config.fixNeuHeavyPearls + +} -- cgit