All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.eu.codlab.lorcana.Configurations.kt Maven / Gradle / Ivy

There is a newer version: 0.13.0
Show newest version
package eu.codlab.lorcana

import eu.codlab.lorcana.cards.Language
import eu.codlab.lorcana.raw.SetDescription
import eu.codlab.lorcana.resources.Resources
import eu.codlab.lorcana.utils.LorcanaConfiguration.github
import eu.codlab.tcgmapper.AbstractLoader
import kotlinx.serialization.Serializable

@Serializable
data class Configuration(
    val images: String,
    val sets: List,
    val langs: List,
    val placeholders: Map
) {
    fun image(
        set: SetDescription,
        lang: Language,
        id: Int,
        suffix: String = ""
    ) = image(set, lang.name.lowercase(), id, suffix)

    fun image(
        set: SetDescription,
        lang: String,
        id: Int,
        suffix: String = ""
    ): String {
        return images
            .replace("{set}", set.name.lowercase())
            .replace("{lang}", lang.lowercase())
            .replace("{id}", "$id")
            .replace("{suffix}", suffix)
    }
}

/**
 * Represents all the possible classifications that are available. It will retrieve
 * a map of name -> TranslationHolder that then can be applied to the cards
 */
object Configurations : AbstractLoader(
    Resources.files.configuration_yml,
    "configuration",
    Configuration.serializer(),
    github
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy