aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"