aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/GardenDataJson.kt
blob: 54212ca074f42b2f5e1895ad6e166aa21515f13a (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * Copyright (C) 2024 NotEnoughUpdates contributors
 *
 * This file is part of NotEnoughUpdates.
 *
 * NotEnoughUpdates is free software: you can redistribute it
 * and/or modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * NotEnoughUpdates is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
 */

package io.github.moulberry.notenoughupdates.miscfeatures.profileviewer

import com.google.gson.annotations.SerializedName

data class GardenDataJson(
    val success: Boolean,
    val garden: GardenData,
)

data class GardenData(
    @SerializedName("unlocked_plots_ids") val unlockedPlotIds: List<String>,
    @SerializedName("commission_data") val commissionData: VisitorCommissions,
    @SerializedName("resources_collected") val resourcesCollected: Map<CropType, Long>,
    @SerializedName("garden_experience") val gardenExperience: Int,
    @SerializedName("composter_data") val composterData: ComposterData,
    @SerializedName("selected_barn_skin") val selectedBarnSkin: String,
    @SerializedName("crop_upgrade_levels") val cropUpgradeLevels: Map<CropType, Int>,
)

data class VisitorCommissions(
    val visits: Map<String, Int>,
    val completed: Map<String, Int>,
    @SerializedName("total_completed") val totalCompleted: Int,
    @SerializedName("unique_npcs_served") val uniqueNpcsServed: Int,
)

data class ComposterData(
    val upgrades: APIComposterUpgrades,
)

data class APIComposterUpgrades(
    val speed: Int,
    @SerializedName("multi_drop") val multiDrop: Int,
    @SerializedName("fuel_cap") val fuelCap: Int,
    @SerializedName("organic_matter_cap") val organicMatterCap: Int,
    @SerializedName("cost_reduction") val costReduction: Int,
)

data class ComposterUpgrade(
    val upgrade: Int,
    val items: Map<String, Int>,
    val copper: Int,
)

data class GardenRepoJson(
    @SerializedName("garden_exp") val gardenExperience: List<Int>,
    @SerializedName("crop_milestones") val cropMilestones: Map<CropType, List<Int>>,
    @SerializedName("visitors") val visitors: Map<String, VisitorRarity>,
    val plots: Map<String, PlotData>,
    @SerializedName("plot_costs") val plotCosts: Map<String, List<PlotCost>>,
    @SerializedName("barn") val barn: Map<String, BarnSkin>,
    @SerializedName("crop_upgrades") val cropUpgrades: List<Int>,
    @SerializedName("composter_upgrades") val composterUpgrades: Map<String, Map<Int, ComposterUpgrade>>,
    @SerializedName("composter_tooltips") val composterTooltips: Map<String, String>,
)

data class PlotData(
    val name: String,
    val x: Int,
    val y: Int,
)

data class PlotCost(
    val item: String,
    val amount: Int,
)

data class BarnSkin(
    val name: String,
    val item: String,
)

data class EliteWeightJson(
    val totalWeight: Double,
    val cropWeight: Map<CropType, Double>,
    val bonusWeight: Map<String, Double>,
)

enum class CropType(val itemId: String, val apiName: String, val displayName: String) {
    WHEAT("ENCHANTED_HAY_BLOCK", "WHEAT", "Wheat"),
    NETHER_WART("ENCHANTED_NETHER_STALK", "NETHER_STALK", "Nether Wart"),
    SUGAR_CANE("ENCHANTED_SUGAR", "SUGAR_CANE", "Sugar Cane"),
    CARROT("ENCHANTED_CARROT", "CARROT_ITEM", "Carrot"),
    POTATO("ENCHANTED_POTATO", "POTATO_ITEM", "Potato"),
    COCOA_BEANS("ENCHANTED_COCOA", "INK_SACK:3", "Cocoa Beans"),
    PUMPKIN("ENCHANTED_PUMPKIN", "PUMPKIN", "Pumpkin"),
    MELON("ENCHANTED_MELON", "MELON", "Melon"),
    CACTUS("ENCHANTED_CACTUS_GREEN", "CACTUS", "Cactus"),
    MUSHROOM("ENCHANTED_BROWN_MUSHROOM", "MUSHROOM_COLLECTION", "Mushroom"),
    ;

    companion object {
        fun fromApiName(apiName: String): CropType? {
            val fixedInput = apiName.uppercase().replace(" ", "_")
            val fromApiName = values().firstOrNull { it.apiName == fixedInput }
            if (fromApiName != null) return fromApiName
            return values().firstOrNull { it.name == fixedInput }
        }
    }
}

enum class VisitorRarity(val displayName: String) {
    UNCOMMON("§aUncommon"),
    RARE("§9Rare"),
    LEGENDARY("§6Legendary"),
    MYTHIC("§dMythic"),
    SPECIAL("§cSpecial"),
    TOTAL("§7Total"),
    ;
}