Untitled

mail@pastecode.io avatar
unknown
kotlin
a year ago
7.6 kB
2
Indexable
Never
package com.redrazors.pathbuilder2e.backend.export.json

import com.redrazors.pathbuilder2e.backend.BackendConstants
import com.redrazors.pathbuilder2e.backend.data.ancestries.AncestryHuman
import com.redrazors.pathbuilder2e.backend.data.managers.managerequipment.EquipmentContainer
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonPrimitive


@Serializable
class CharacterJson {

    var name = ""
    var className = "" // this is changed to "class" post serialize, as it is protected
    var dualClass : String? = null
    var level = 1
    var ancestry = AncestryHuman.ANCESTRY_HUMAN
    var heritage : String? = null
    var background = ""
    var alignment = ""
    var gender = ""
    var age = ""
    var deity = ""
    var size = 2
    var keyability = BackendConstants.ARRAY_ABILITIES_SHORT[0]
    var languages : ArrayList<String> = ArrayList()


    @Serializable
    class Attributes{
        var ancestryhp = 0
        var classhp = 0
        var bonushp = 0
        var bonushpPerLevel = 0
        var speed = 0
        var speedBonus = 0
    }
    var attributes = Attributes()

    @Serializable
    class Breakdown {
        var ancestryFree = arrayOf("") // array of ability names, eg str dex
        var ancestryBoosts = arrayOf("") // array of ability names, eg str dex
        var ancestryFlaws = arrayOf("") // array of ability names, eg str dex
        var backgroundBoosts = arrayOf("") // array of ability names, eg str dex
        var classBoosts = arrayOf("") // array of ability names, eg str dex
        var mapLevelledBoosts = HashMap<Int, Array<String>>() // map of level and array of abilities selected at that level
    }
    @Serializable
    class Abilities {
        var str = 0
        var dex = 0
        var con = 0
        var intelligence = 0 // this is changed to "int" post serialize, as int is a protected descriptor in kotlin
        var wis = 0
        var cha = 0
        var breakdown = Breakdown()
    }
    val abilities = Abilities()


    @Serializable
    class Proficiencies {
        // these give the trained =2, expert = 4, etc training values
        var classDC = 0
        var perception = 0
        var fortitude = 0
        var reflex = 0
        var will = 0
        var heavy = 0
        var medium = 0
        var light = 0
        var unarmored = 0
        var advanced = 0
        var martial = 0
        var simple = 0
        var unarmed = 0
        var castingArcane = 0
        var castingDivine = 0
        var castingOccult = 0
        var castingPrimal = 0
        var acrobatics = 0
        var arcana = 0
        var athletics = 0
        var crafting = 0
        var deception = 0
        var diplomacy = 0
        var intimidation = 0
        var medicine = 0
        var nature = 0
        var occultism = 0
        var performance = 0
        var religion = 0
        var society = 0
        var stealth = 0
        var survival = 0
        var thievery = 0
    }
    val proficiencies = Proficiencies()

    val mods = HashMap<String, HashMap<String, Int>>()  // map of proficiency to map of bonus type to amount

    val feats = ArrayList<ArrayList<JsonPrimitive>>() // list of feat info (feat name, feat extra, feat choice type, level taken)

    val specials = ArrayList<String>() // name of specials

    val lores = ArrayList<ArrayList<JsonPrimitive>>() // array of lores giving lore name and training level

    val equipmentContainers = HashMap<String, EquipmentContainer>() // equipment container id to object with name, isbagofholding, isbackpack

    val equipment = ArrayList<ArrayList<JsonPrimitive>>() // equipment in array of fields with name, quantity, and incontainerid if relevant

    @Serializable
    class SpecificProficiencies{
        val trained = ArrayList<String>()
        val expert = ArrayList<String>()
        val master = ArrayList<String>()
        val legendary = ArrayList<String>()
    }
    val specificProficiencies = SpecificProficiencies() // arrays of weapons at specific proficiency levels outside of normal proficiencies, eg if Flail is at Master

    @Serializable
    class WeaponObject {
        var name = ""
        var qty = 1
        var prof = "" // the type of proficiency, eg martial, as this can be changed by feats
        var die = ""
        var pot = 0 // potency rune value
        var str = "" // striking rune
        var mat : String? = null // materials
        var display = "" // display name
        var runes = ArrayList<String>() // list of property runes

        var attack = 0 // total attack
        var damageBonus = 0
        var extraDamage = ArrayList<String>()

    }
    val weapons = ArrayList<WeaponObject>()

    @Serializable
    class Money  {
        var cp = 0
        var sp = 0
        var gp = 0
        var pp = 0
    }
    val money = Money()

    @Serializable
    class ArmorObject {
        var name = ""
        var qty = 1
        var prof = "" // armor proficiency, eg light
        var pot = 0
        var res = "" // resilient rune
        var mat : String? = null // material
        var display =""
        var worn = true
        var runes = ArrayList<String>()

    }
    val armor = ArrayList<ArmorObject>()

    @Serializable
    class SpellCasterObject{
        var name = ""
        var magicTradition = "" // eg arcane or divine
        var spellcastingType = "" // prepared or spontaneous
        var ability = "" // spellcasting ability name
        var proficiency = 0 // proficiency level
        var focusPoints = 0 //deprecated do not use
        var innate = false

        var perDay = ArrayList<Int>() // array of spells pert day
        var spells = ArrayList<JsonObjectSpellLevel>() // array of spells known
        var prepared = ArrayList<JsonObjectSpellLevel>() // array of spells prepared, empty for spontaneous casters
    }
    @Serializable
    class JsonObjectSpellLevel{
        var spellLevel = 0
        var list = ArrayList<String>()
    }
    val spellCasters = ArrayList<SpellCasterObject>()

    var focusPoints = 0
    val focus = HashMap<String, HashMap<String, FocusSpellDetails>>()
    @Serializable
    class FocusSpellDetails{
        var abilityBonus = 0
        var proficiency = 0
        var itemBonus = 0
        var focusCantrips = ArrayList<String>()
        var focusSpells = ArrayList<String>()
    }

    @Serializable
    class FormulaCaster {
        var type = ""
        val known = ArrayList<String>() // list of known formula
    }
    val formula = ArrayList<FormulaCaster>()

    @Serializable
    class AcObject{
        var acProfBonus = 0
        var acAbilityBonus = 0
        var acItemBonus = 0
        var acTotal = 0
        var shieldBonus : String? = null
    }
    val acTotal = AcObject()

    @Serializable
    open class PetObject{
        // generic
        var type = ""
        var name : String? = null
        var equipment = ArrayList<ArrayList<JsonPrimitive>>()

    }
    @Serializable
    class AnimalObject: PetObject(){
        // animal companion stuff
        var animal : String? = null
        var mature : Boolean? = null
        var incredible : Boolean? = null
        var incredibleType : String? = null
        var specializations = ArrayList<String>()
        var armor: String? = null

    }
    @Serializable
    class FamiliarObject: PetObject(){
        // familiar stuff
        var specific : String? = null
        var abilities = ArrayList<String>()

    }

    val pets = ArrayList<AnimalObject>()
    val familiars = ArrayList<FamiliarObject>()



}