From c4997e21053c8671ed4c5474fb70df6ae58dae06 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Wed, 25 Dec 2024 16:55:33 +0100 Subject: feat: Add reforge recipes --- src/main/kotlin/repo/Reforge.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/main/kotlin/repo/Reforge.kt') diff --git a/src/main/kotlin/repo/Reforge.kt b/src/main/kotlin/repo/Reforge.kt index b52adc6..dc0d93d 100644 --- a/src/main/kotlin/repo/Reforge.kt +++ b/src/main/kotlin/repo/Reforge.kt @@ -36,6 +36,10 @@ data class Reforge( ) { val eligibleItems get() = allowOn ?: itemTypes ?: listOf() + val statUniverse: Set = Rarity.entries.flatMapTo(mutableSetOf()) { + reforgeStats?.get(it)?.keys ?: emptySet() + } + @Serializable(with = ReforgeEligibilityFilter.Serializer::class) sealed interface ReforgeEligibilityFilter { object ItemTypesSerializer : KSerializer> { @@ -108,7 +112,7 @@ data class Reforge( @Serializable(with = RarityMapped.Serializer::class) sealed interface RarityMapped { - fun get(rarity: Rarity): T? + fun get(rarity: Rarity?): T? class Serializer( val values: KSerializer @@ -140,14 +144,14 @@ data class Reforge( @Serializable data class Direct(val value: T) : RarityMapped { - override fun get(rarity: Rarity): T { + override fun get(rarity: Rarity?): T { return value } } @Serializable data class PerRarity(val values: Map) : RarityMapped { - override fun get(rarity: Rarity): T? { + override fun get(rarity: Rarity?): T? { return values[rarity] } } -- cgit