diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-25 16:15:20 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-25 16:15:20 +0100 |
commit | ddebaf47900dfab41590c97c202984142ae5b9f6 (patch) | |
tree | 498859e320b19d3bc7559f5585174afb78e132b4 /src/main/kotlin/repo/Reforge.kt | |
parent | e16c60169bf192b79991176b5f9cee66b5b16e7d (diff) | |
download | Firmament-ddebaf47900dfab41590c97c202984142ae5b9f6.tar.gz Firmament-ddebaf47900dfab41590c97c202984142ae5b9f6.tar.bz2 Firmament-ddebaf47900dfab41590c97c202984142ae5b9f6.zip |
WIP: Reforge Recipes
Diffstat (limited to 'src/main/kotlin/repo/Reforge.kt')
-rw-r--r-- | src/main/kotlin/repo/Reforge.kt | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/kotlin/repo/Reforge.kt b/src/main/kotlin/repo/Reforge.kt index ea01818..b52adc6 100644 --- a/src/main/kotlin/repo/Reforge.kt +++ b/src/main/kotlin/repo/Reforge.kt @@ -108,6 +108,8 @@ data class Reforge( @Serializable(with = RarityMapped.Serializer::class) sealed interface RarityMapped<T> { + fun get(rarity: Rarity): T? + class Serializer<T>( val values: KSerializer<T> ) : KSerializer<RarityMapped<T>> { @@ -137,10 +139,18 @@ data class Reforge( } @Serializable - data class Direct<T>(val value: T) : RarityMapped<T> + data class Direct<T>(val value: T) : RarityMapped<T> { + override fun get(rarity: Rarity): T { + return value + } + } @Serializable - data class PerRarity<T>(val values: Map<Rarity, T>) : RarityMapped<T> + data class PerRarity<T>(val values: Map<Rarity, T>) : RarityMapped<T> { + override fun get(rarity: Rarity): T? { + return values[rarity] + } + } } } |