aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/SkyblockSeason.kt
blob: 2e06ba423fb13a58265b0bec07a91cdab66e0d0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package at.hannibal2.skyhanni.utils

import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.UtilsPatterns.seasonPattern

enum class SkyblockSeason(
    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(): SkyblockSeason? = getSeasonByName(SkyBlockTime.now().monthName)

        private fun getSeasonByName(name: String): SkyblockSeason? =
            seasonPattern.matchMatcher(name) { entries.find { it.season.endsWith(group("season")) } }
    }
}