aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorErymanthus | RayDeeUx <51521765+RayDeeUx@users.noreply.github.com>2024-01-22 13:56:13 -0500
committerGitHub <noreply@github.com>2024-01-22 19:56:13 +0100
commit822913b506c63f8a322af76d3460a961e22b845c (patch)
tree3ff42b679f08cfc2786ad2c73b83570b6b3d8eac /src/main/java/at/hannibal2/skyhanni/utils
parentb75ba0014350e4cf6880e481a24398da906b978d (diff)
downloadskyhanni-822913b506c63f8a322af76d3460a961e22b845c.tar.gz
skyhanni-822913b506c63f8a322af76d3460a961e22b845c.tar.bz2
skyhanni-822913b506c63f8a322af76d3460a961e22b845c.zip
Feature: Atmospheric Filter Display (#916)
Added Atmospheric Filter Display. #916
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/Season.kt29
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt5
2 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/Season.kt b/src/main/java/at/hannibal2/skyhanni/utils/Season.kt
new file mode 100644
index 000000000..ef139c15c
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/utils/Season.kt
@@ -0,0 +1,29 @@
+package at.hannibal2.skyhanni.utils
+
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.UtilsPatterns.seasonPattern
+import io.github.moulberry.notenoughupdates.util.SkyBlockTime
+
+enum class Season(
+ val season: String,
+ val abbreviatedPerk: String,
+ val perk: String,
+) {
+
+ SPRING("§dSpring", "§6+25☘", "§7Gain §6+25☘ Farming Fortune§7."),
+ SUMMER("§6Summer", "§3+20☯", "§7Gain §3+20☯ Farming Wisdom§7."),
+ AUTUMN("§eAutumn", "§a15%+§4ൠ", "§4Pests §7spawn §a15% §7more often."),
+ WINTER("§9Winter", "§a5%+§cC", "§7Visitors give §a5% §7more §cCopper."),
+ ;
+
+ fun getPerk(abbreviate: Boolean): String = if (abbreviate) abbreviatedPerk else perk
+ fun getSeason(abbreviate: Boolean): String = if (abbreviate) season.take(4) else season
+
+ companion object {
+
+ fun getCurrentSeason(): Season? = getSeasonByName(SkyBlockTime.now().monthName)
+
+ private fun getSeasonByName(name: String): Season? = seasonPattern.matchMatcher(name) { entries.find { it.season.endsWith(group("season")) } }
+ }
+
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
index 05bb4620b..abd5a940e 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
@@ -39,4 +39,9 @@ object UtilsPatterns {
"item.petlevel",
"(?:§f§f)?§7\\[Lvl (?<level>\\d+)] .*"
)
+
+ val seasonPattern by RepoPattern.pattern(
+ "skyblocktime.season",
+ "(?:Early |Late )?(?<season>Spring|Summer|Autumn|Winter)"
+ )
}