aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorNetheriteMiner <88792142+NetheriteMiner@users.noreply.github.com>2023-11-05 04:46:45 -0500
committerGitHub <noreply@github.com>2023-11-05 10:46:45 +0100
commitdfa6c8e5304b36dc9de9c177934d6cbddbd9868d (patch)
tree2d524c256f0846f26a2d55e39951f7417b76c1b0 /src/main/java/at/hannibal2
parent95e0487b3515c93acf3b28cbbda7b7d0bfd659c0 (diff)
downloadskyhanni-dfa6c8e5304b36dc9de9c177934d6cbddbd9868d.tar.gz
skyhanni-dfa6c8e5304b36dc9de9c177934d6cbddbd9868d.tar.bz2
skyhanni-dfa6c8e5304b36dc9de9c177934d6cbddbd9868d.zip
Make Quest Item Helper only get amount needed and add Pablo Helper (#615)
Added Pablo NPC Helper. #615
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt39
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/QuestItemHelper.kt3
4 files changed, 50 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 9185f9c57..6765e67be 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -235,6 +235,7 @@ import at.hannibal2.skyhanni.features.misc.trevor.TrevorSolver
import at.hannibal2.skyhanni.features.misc.trevor.TrevorTracker
import at.hannibal2.skyhanni.features.misc.update.UpdateManager
import at.hannibal2.skyhanni.features.misc.visualwords.ModifyVisualWords
+import at.hannibal2.skyhanni.features.nether.PabloHelper
import at.hannibal2.skyhanni.features.nether.QuestItemHelper
import at.hannibal2.skyhanni.features.nether.ashfang.AshfangBlazes
import at.hannibal2.skyhanni.features.nether.ashfang.AshfangBlazingSouls
@@ -619,6 +620,7 @@ class SkyHanniMod {
loadModule(ShiftClickEquipment())
loadModule(LockMouseLook)
loadModule(DungeonFinderFeatures())
+ loadModule(PabloHelper())
init()
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java
index b9d00f8cd..7dc558b15 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/CrimsonIsleConfig.java
@@ -148,4 +148,10 @@ public class CrimsonIsleConfig {
@ConfigEditorBoolean
@FeatureToggle
public boolean questItemHelper = false;
+
+ @Expose
+ @ConfigOption(name = "Pablo NPC Helper", desc = "Similar to Quest Item Helper, shows a clickable message that grabs the flower needed from sacks.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean pabloHelper = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt
new file mode 100644
index 000000000..f34931eb5
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt
@@ -0,0 +1,39 @@
+package at.hannibal2.skyhanni.features.nether
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.SimpleTimeMark
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.minutes
+
+// https://wiki.hypixel.net/Pablo
+class PabloHelper {
+
+ // There is a different message if the player asks Pablo with an item in their hand, but I don't think it's necessary
+ // I'll add it if requested
+ private val pabloMessagePattern = "\\[NPC] Pablo: Could you bring me an (?<flower>[\\w ]+).*".toPattern()
+ private var lastSentMessage = SimpleTimeMark.farPast()
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!isEnabled()) return
+ if (lastSentMessage.passedSince() < 5.minutes) return
+ val pabloMatcher = pabloMessagePattern.matcher(event.message.removeColor())
+
+ if (!pabloMatcher.matches()) return
+ val item = pabloMatcher.group("flower")
+
+ if (InventoryUtils.countItemsInLowerInventory { it.name?.contains(item) == true } > 0) return
+
+ LorenzUtils.clickableChat("§e[SkyHanni] Click here to grab an $item from sacks!", "gfs $item 1")
+ lastSentMessage = SimpleTimeMark.now()
+ }
+
+ fun isEnabled() =
+ LorenzUtils.skyBlockIsland == IslandType.CRIMSON_ISLE && SkyHanniMod.feature.crimsonIsle.pabloHelper
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/QuestItemHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/QuestItemHelper.kt
index 9c23ce8e3..24d47c317 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/QuestItemHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/QuestItemHelper.kt
@@ -3,6 +3,8 @@ package at.hannibal2.skyhanni.features.nether
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.SimpleTimeMark
@@ -29,6 +31,7 @@ class QuestItemHelper {
if (!matches()) continue@items
questItem = group("name")
questAmount = group("amount").toInt()
+ questAmount -= InventoryUtils.countItemsInLowerInventory { it.name?.contains(questItem) == true }
LorenzUtils.clickableChat(
"§e[SkyHanni] Click here to grab x$questAmount $questItem from sacks!",
"gfs $questItem $questAmount"