aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-01-01 16:36:56 +0100
committerGitHub <noreply@github.com>2024-01-01 16:36:56 +0100
commitbc22141e6f7528b3987e02263b8d3a8a34dd7918 (patch)
treeb649f68898d54bc6dbd7305848897a3bf9157a89
parentf1ec96a3da092d93973d600bee74bb4b5108e703 (diff)
downloadskyhanni-bc22141e6f7528b3987e02263b8d3a8a34dd7918.tar.gz
skyhanni-bc22141e6f7528b3987e02263b8d3a8a34dd7918.tar.bz2
skyhanni-bc22141e6f7528b3987e02263b8d3a8a34dd7918.zip
Fix: TiaHelper chatmessage (#867)
Maybe fixed Tia Relay Helper. #867
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/Relay.kt27
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt18
2 files changed, 26 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/Relay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/Relay.kt
index f634fffa9..505898460 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/Relay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/Relay.kt
@@ -2,47 +2,52 @@ package at.hannibal2.skyhanni.features.inventory.tiarelay
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.utils.LorenzVec
+import at.hannibal2.skyhanni.utils.StringUtils.matches
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
enum class Relay(
val relayName: String,
val waypoint: LorenzVec,
val island: IslandType,
- val chatMessage: String
+ chatMessage: String,
) {
RELAY_1(
"1st Relay", LorenzVec(143.5, 108.0, 93.0), IslandType.HUB,
- "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe first relay is on a branch of the large tree on the north-east of the fairy pond."
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fThe first relay is on a branch of the large tree on the north-east of the fairy pond."
),
RELAY_2(
"2nd Relay", LorenzVec(-246.5, 123.0, 55.5), IslandType.HUB,
- "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is in the castle ruins!"
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fThe next relay is in the castle ruins!"
),
RELAY_3(
"3rd Relay", LorenzVec(128.5, 232.0, 200.5), IslandType.DWARVEN_MINES,
- "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is in the §bRoyal Palace §rwithin the Dwarven Mines."
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fThe next relay is in the §bRoyal Palace §rwithin the Dwarven Mines."
),
RELAY_4(
"4th Relay", LorenzVec(-560, 164, -287), IslandType.THE_END,
- "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is on the highest spike of §dThe End§r."
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fThe next relay is on the highest spike of §dThe End§r."
),
RELAY_5(
"5th Relay", LorenzVec(-375, 207, -799), IslandType.CRIMSON_ISLE,
- "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay was placed by our consultant, Odger."
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fThe next relay was placed by our consultant, Odger."
),
RELAY_6(
"6th Relay", LorenzVec(-69, 157, -879), IslandType.CRIMSON_ISLE,
- "§e[NPC] §dTia the Fairy§f: §b✆ §f§rScarleton itself has one of the most robust connection to the 9f™ Network."
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fScarleton itself has one of the most robust connection to the 9f™ Network."
),
RELAY_7(
"7th Relay", LorenzVec(93, 86, 187), IslandType.HUB,
- "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is on top of the shack next to the shady inn right here close to the pond."
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fThe next relay is on top of the shack next to the shady inn right here close to the pond."
),
RELAY_8(
"8th Relay", LorenzVec(0, 146, -75), IslandType.DUNGEON_HUB,
- "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is on top of a statue in the dungeon hub."
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fThe next relay is on top of a statue in the dungeon hub."
),
RELAY_9(
"9th Relay", LorenzVec(-19.0, 88.5, -91.0), IslandType.HUB,
- "§e[NPC] §dTia the Fairy§f: §b✆ §f§rThe next relay is on top of the Auction House."
- ),
+ "§e[NPC] §dTia the Fairy§f: §b✆ §f§r§fThe next relay is on top of the Auction House."
+ );
+
+ val chatPattern by RepoPattern.pattern("relay.chat." + relayName.takeWhile { it != ' ' }, chatMessage)
+ fun checkChatMessage(string: String) = chatPattern.matches(string)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt
index 5b9e8fa6f..4fa33ad2b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/tiarelay/TiaRelayWaypoints.kt
@@ -17,19 +17,21 @@ class TiaRelayWaypoints {
private var waypointName: String? = null
private var island = IslandType.NONE
+ init {
+ Relay.entries.forEach { it.chatPattern }
+ }
+
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config.nextWaypoint) return
val message = event.message
- for (relay in Relay.entries) {
- if (relay.chatMessage == message) {
- waypoint = relay.waypoint
- waypointName = relay.relayName
- island = relay.island
- return
- }
+ Relay.entries.firstOrNull { it.checkChatMessage(message) }?.let { relay ->
+ waypoint = relay.waypoint
+ waypointName = relay.relayName
+ island = relay.island
+ return
}
if (message == "§aYou completed the maintenance on the relay!") {
@@ -60,4 +62,4 @@ class TiaRelayWaypoints {
event.drawDynamicText(it, "§d" + waypointName!!, 1.5)
}
}
-} \ No newline at end of file
+}