aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-03-26 19:14:10 +0100
committerGitHub <noreply@github.com>2024-03-26 19:14:10 +0100
commit9a769c7dc4e759854dd25be135635c8fea2b6fbb (patch)
treef87d1a0e99d1ffe5facc58732979d53f6891860d /src/main/java/at
parent5c2e918513df867425b133f53de3df6cd41b67f2 (diff)
downloadskyhanni-9a769c7dc4e759854dd25be135635c8fea2b6fbb.tar.gz
skyhanni-9a769c7dc4e759854dd25be135635c8fea2b6fbb.tar.bz2
skyhanni-9a769c7dc4e759854dd25be135635c8fea2b6fbb.zip
Improvement: Show Foxy's extra event in Custom Scoreboard (#1270)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/Mayors.kt23
2 files changed, 27 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt
index bc937a5a2..2a5fcb0c9 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt
@@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.put
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import io.github.moulberry.notenoughupdates.util.SkyBlockTime
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -20,6 +21,12 @@ import kotlin.time.Duration
import kotlin.time.Duration.Companion.minutes
object MayorAPI {
+
+ val foxyExtraEventPattern by RepoPattern.pattern(
+ "mayorapi.foxy.extraevent",
+ "Schedules an extra §.(?<event>.*) §.event during the year\\."
+ )
+
var lastUpdate = SimpleTimeMark.farPast()
private var dispatcher = Dispatchers.IO
diff --git a/src/main/java/at/hannibal2/skyhanni/data/Mayors.kt b/src/main/java/at/hannibal2/skyhanni/data/Mayors.kt
index cd6205c7a..b956da0fd 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/Mayors.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/Mayors.kt
@@ -1,6 +1,8 @@
package at.hannibal2.skyhanni.data
+import at.hannibal2.skyhanni.data.MayorAPI.foxyExtraEventPattern
import at.hannibal2.skyhanni.data.jsonobjects.local.MayorJson
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
enum class Mayor(
val mayorName: String,
@@ -12,7 +14,7 @@ enum class Mayor(
DIANA("Diana", "§2", Perk.LUCKY, Perk.MYTHOLOGICAL_RITUAL, Perk.PET_XP_BUFF),
DIAZ("Diaz", "§6", Perk.BARRIER_STREET, Perk.SHOPPING_SPREE),
FINNEGAN("Finnegan", "§c", Perk.FARMING_SIMULATOR, Perk.PELT_POCALYPSE, Perk.GOATED),
- FOXY("Foxy", "§d", Perk.SWEET_TOOTH, Perk.BENEVOLENCE, Perk.EXTRA_EVENT),
+ FOXY("Foxy", "§d", Perk.SWEET_TOOTH, Perk.BENEVOLENCE, Perk.EXTRA_EVENT_MINING, Perk.EXTRA_EVENT_FISHING, Perk.EXTRA_EVENT_SPOOKY),
MARINA("Marina", "§b", Perk.FISHING_XP_BUFF, Perk.LUCK_OF_THE_SEA, Perk.FISHING_FESTIVAL),
PAUL("Paul", "§c", Perk.MARAUDER, Perk.EZPZ, Perk.BENEDICTION),
@@ -33,7 +35,7 @@ enum class Mayor(
mayor.perks.forEach { it.isActive = false }
mayor.activePerks.clear()
- perks.mapNotNull { perk -> Perk.entries.firstOrNull { it.perkName == perk.name } }
+ perks.mapNotNull { perk -> Perk.entries.firstOrNull { it.perkName == perk.renameIfFoxyExtraEventPerkFound() } }
.filter { mayor.perks.contains(it) }.forEach {
it.isActive = true
mayor.activePerks.add(it)
@@ -41,6 +43,19 @@ enum class Mayor(
return mayor
}
+
+ private fun MayorJson.Perk.renameIfFoxyExtraEventPerkFound(): String? {
+ val foxyExtraEventPairs = mapOf(
+ "Spooky Festival" to "Extra Event (Spooky)",
+ "Mining Fiesta" to "Extra Event (Mining)",
+ "Fishing Festival" to "Extra Event (Fishing)"
+ )
+
+ foxyExtraEventPattern.matchMatcher(this.description) {
+ return foxyExtraEventPairs.entries.firstOrNull { it.key == group("event") }?.value
+ }
+ return this.name
+ }
}
}
@@ -72,7 +87,9 @@ enum class Perk(val perkName: String) {
// Foxy
SWEET_TOOTH("Sweet Tooth"),
BENEVOLENCE("Benevolence"),
- EXTRA_EVENT("Extra Event"),
+ EXTRA_EVENT_MINING("Extra Event (Mining)"),
+ EXTRA_EVENT_FISHING("Extra Event (Fishing)"),
+ EXTRA_EVENT_SPOOKY("Extra Event (Spooky)"),
// Marina
FISHING_XP_BUFF("Fishing XP Buff"),