From 526365859a27d54b7ea5c07c08b301650c15ea0e Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sat, 21 Oct 2023 22:56:53 +1100 Subject: Backend: Serialise all constants and add repo error messages and status (#605) Backend: Serialise all constants and add repo error messages and status #605 --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 7 ++- .../hannibal2/skyhanni/config/commands/Commands.kt | 8 ++- .../java/at/hannibal2/skyhanni/data/BingoAPI.kt | 4 +- .../skyhanni/data/GardenCropMilestones.kt | 13 +++-- .../java/at/hannibal2/skyhanni/data/HypixelData.kt | 2 + .../java/at/hannibal2/skyhanni/data/SackAPI.kt | 1 + .../at/hannibal2/skyhanni/data/repo/RepoManager.kt | 62 ++++++++++++++++++++-- .../skyhanni/events/RepositoryReloadEvent.kt | 4 +- .../features/chat/playerchat/PlayerChatFilter.kt | 11 ++-- .../tabcomplete/GetFromSacksTabComplete.kt | 4 +- .../commands/tabcomplete/PlayerTabComplete.kt | 13 +++-- .../commands/tabcomplete/WarpTabComplete.kt | 9 ++-- .../features/fishing/trophy/TrophyFishFillet.kt | 5 +- .../features/fishing/trophy/TrophyFishInfo.kt | 54 ------------------- .../features/fishing/trophy/TrophyFishManager.kt | 57 ++++++++++++++++---- .../features/fishing/trophy/TrophyFishMessages.kt | 15 ++++-- .../skyhanni/features/garden/GardenAPI.kt | 4 +- .../features/garden/composter/ComposterOverlay.kt | 60 +++++++++++---------- .../features/garden/farming/FarmingArmorDrops.kt | 3 +- .../features/garden/farming/GardenCropSpeed.kt | 35 ++++++------ .../garden/inventory/AnitaExtraFarmingFortune.kt | 11 ++-- .../garden/visitor/GardenVisitorColorNames.kt | 36 ++++++------- .../garden/visitor/GardenVisitorFeatures.kt | 13 ----- .../features/inventory/HideNotClickableItems.kt | 31 ++++++----- .../skyhanni/features/inventory/ItemStars.kt | 16 +++--- .../skyhanni/features/misc/QuickModMenuSwitch.kt | 4 +- .../CrimsonIsleReputationHelper.kt | 34 ++++++------ .../dailykuudra/DailyKuudraBossHelper.kt | 20 ++++--- .../dailyquest/DailyQuestHelper.kt | 2 - .../reputationhelper/dailyquest/QuestLoader.kt | 49 +++++++++-------- .../miniboss/DailyMiniBossHelper.kt | 22 ++++---- .../area/stillgorechateau/RiftBloodEffigies.kt | 3 +- .../skyhanni/test/HighlightMissingRepoItems.kt | 5 +- .../skyhanni/test/command/ErrorManager.kt | 2 +- .../at/hannibal2/skyhanni/utils/MultiFilter.kt | 28 +++++----- .../at/hannibal2/skyhanni/utils/ParkourHelper.kt | 4 +- .../at/hannibal2/skyhanni/utils/StringUtils.kt | 2 + .../utils/jsonobjects/AnitaUpgradeCostsJson.java | 5 +- .../skyhanni/utils/jsonobjects/ArmorDropsJson.java | 3 +- .../skyhanni/utils/jsonobjects/BingoJson.java | 3 +- .../skyhanni/utils/jsonobjects/BingoRanks.java | 10 ---- .../skyhanni/utils/jsonobjects/BingoRanksJson.java | 10 ++++ .../utils/jsonobjects/ContributorListJson.java | 3 +- .../jsonobjects/CrimsonIsleReputationJson.java | 34 ++++++++++++ .../jsonobjects/DanceRoomInstructionsJson.java | 2 +- .../skyhanni/utils/jsonobjects/DicerDropsJson.java | 31 +++++++++++ .../utils/jsonobjects/DisabledFeaturesJson.java | 10 ++++ .../utils/jsonobjects/EnigmaSoulsJson.java | 3 +- .../skyhanni/utils/jsonobjects/GardenJson.java | 13 ++++- .../jsonobjects/HideNotClickableItemsJson.java | 30 +++++++++++ .../skyhanni/utils/jsonobjects/ItemsJson.java | 14 +++++ .../utils/jsonobjects/ModGuiSwitcherJson.java | 25 +++++++++ .../skyhanni/utils/jsonobjects/ModsJson.java | 25 --------- .../utils/jsonobjects/MultiFilterJson.java | 25 +++++++++ .../skyhanni/utils/jsonobjects/ParkourJson.java | 4 +- .../utils/jsonobjects/PlayerChatFilterJson.java | 10 ++++ .../utils/jsonobjects/RiftEffigiesJson.java | 2 +- .../skyhanni/utils/jsonobjects/SackListJson.java | 10 ---- .../skyhanni/utils/jsonobjects/SacksJson.java | 10 ++++ .../jsonobjects/SlayerProfitTrackerItemsJson.java | 2 +- .../skyhanni/utils/jsonobjects/TrophyFishJson.java | 18 ++++++- .../skyhanni/utils/jsonobjects/VipVisitsJson.java | 2 +- .../skyhanni/utils/jsonobjects/WarpsJson.java | 2 +- 63 files changed, 586 insertions(+), 373 deletions(-) delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishInfo.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanks.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanksJson.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/CrimsonIsleReputationJson.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DicerDropsJson.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DisabledFeaturesJson.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/HideNotClickableItemsJson.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ItemsJson.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ModGuiSwitcherJson.java delete mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ModsJson.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/MultiFilterJson.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/PlayerChatFilterJson.java delete mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SackListJson.java create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SacksJson.java (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 174cf38fa..32bd2a252 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -398,14 +398,13 @@ class SkyHanniMod { loadModule(DungeonCleanEnd()) loadModule(DungeonBossMessages()) loadModule(DungeonBossHideDamageSplash()) - loadModule(TrophyFishManager()) + loadModule(TrophyFishManager) loadModule(TrophyFishFillet()) loadModule(TrophyFishMessages()) loadModule(BazaarBestSellMethod()) loadModule(BazaarOpenPriceWebsite()) loadModule(AnvilCombineHelper()) loadModule(SeaCreatureMessageShortener()) - // registerEvent(new GriffinBurrowFinder()); loadModule(AshfangFreezeCooldown()) loadModule(AshfangNextResetCooldown()) loadModule(SummoningSoulsName()) @@ -496,7 +495,7 @@ class SkyHanniMod { loadModule(FarmingArmorDrops()) loadModule(JoinCrystalHollows()) loadModule(CrystalHollowsNamesInCore()) - loadModule(GardenVisitorColorNames()) + loadModule(GardenVisitorColorNames) loadModule(TeleportPadCompactName()) loadModule(AnitaMedalProfit()) loadModule(AnitaExtraFarmingFortune()) @@ -513,7 +512,7 @@ class SkyHanniMod { loadModule(CropSpeedMeter()) loadModule(AshfangMinisNametagHider()) loadModule(TeleportPadInventoryNumber()) - loadModule(ComposterOverlay()) + loadModule(ComposterOverlay) loadModule(DiscordRPCManager) loadModule(GardenCropMilestoneFix()) loadModule(GardenBurrowingSporesNotifier()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 0ba46c155..6c00abb66 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.data.GuiEditManager import at.hannibal2.skyhanni.data.PartyAPI import at.hannibal2.skyhanni.features.bingo.BingoCardDisplay import at.hannibal2.skyhanni.features.bingo.BingoNextStepHelper +import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare import at.hannibal2.skyhanni.features.fame.AccountUpgradeReminder @@ -27,7 +28,6 @@ import at.hannibal2.skyhanni.features.misc.CollectionTracker import at.hannibal2.skyhanni.features.misc.LockMouseLook import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager -import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil import at.hannibal2.skyhanni.features.misc.massconfiguration.DefaultConfigFeatures import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui import at.hannibal2.skyhanni.features.slayer.SlayerItemProfitTracker @@ -209,6 +209,10 @@ object Commands { "shcarrot", "Toggles receiving the 12 fortune from carrots" ) { CaptureFarmingGear.reverseCarrotFortune() } + registerCommand( + "shrepostatus", + "Shows the status of all the mods constants" + ) { SkyHanniMod.repo.displayRepoStatus(false) } } private fun developersDebugFeatures() { @@ -380,4 +384,4 @@ object Commands { function(args.asList().toTypedArray()) } } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/BingoAPI.kt index 857b73d3f..5b32a1d15 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/BingoAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/BingoAPI.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.utils.jsonobjects.BingoRanks +import at.hannibal2.skyhanni.utils.jsonobjects.BingoRanksJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object BingoAPI { @@ -9,7 +9,7 @@ object BingoAPI { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - ranks = event.getConstant("BingoRanks").ranks + ranks = event.getConstant("BingoRanks").ranks } fun getRank(text: String) = ranks.entries.find { text.contains(it.key) }?.value diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt index 02d003398..0b20821f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt @@ -41,7 +41,7 @@ object GardenCropMilestones { CropMilestoneUpdateEvent().postAndCatch() } - private var cropMilestoneData: Map>? = null + private var cropMilestoneData: Map> = emptyMap() val cropCounter: MutableMap? get() = GardenAPI.config?.cropCounter @@ -53,14 +53,14 @@ object GardenCropMilestones { } fun CropType.isMaxed(): Boolean { - val maxValue = cropMilestoneData?.get(this)?.sum() ?: 1_000_000_000 // 1 bil for now + val maxValue = cropMilestoneData[this]?.sum() ?: 1_000_000_000 // 1 bil for now return getCounter() >= maxValue } fun getTierForCropCount(count: Long, crop: CropType): Int { var tier = 0 var totalCrops = 0L - val cropMilestone = cropMilestoneData?.get(crop) ?: return 0 + val cropMilestone = cropMilestoneData[crop] ?: return 0 for (tierCrops in cropMilestone) { totalCrops += tierCrops if (totalCrops > count) { @@ -72,12 +72,12 @@ object GardenCropMilestones { return tier } - fun getMaxTier() = cropMilestoneData?.values?.firstOrNull()?.size ?: 0 + fun getMaxTier() = cropMilestoneData.values.firstOrNull()?.size ?: 0 fun getCropsForTier(requestedTier: Int, crop: CropType): Long { var totalCrops = 0L var tier = 0 - val cropMilestone = cropMilestoneData?.get(crop) ?: return 0 + val cropMilestone = cropMilestoneData[crop] ?: return 0 for (tierCrops in cropMilestone) { totalCrops += tierCrops tier++ @@ -99,7 +99,6 @@ object GardenCropMilestones { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - val data = event.getConstant("Garden") - cropMilestoneData = data.crop_milestones + cropMilestoneData = event.getConstant("Garden").crop_milestones } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index e8ca2ab3b..1d34b7202 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.HypixelJoinEvent import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -102,6 +103,7 @@ class HypixelData { checkHypixel() if (LorenzUtils.onHypixel) { HypixelJoinEvent().postAndCatch() + SkyHanniMod.repo.displayRepoStatus(true) } } if (!LorenzUtils.onHypixel) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index 3e5d5f321..35e664cd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.SackChangeEvent import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getFilletValue import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity import at.hannibal2.skyhanni.features.inventory.SackDisplay import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index 363cbfd7c..593d9a652 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -27,6 +27,20 @@ class RepoManager(private val configLocation: File) { private val repoLocation: File = File(configLocation, "repo") private var error = false + companion object { + val successfulConstants = mutableListOf() + val unsuccessfulConstants = mutableListOf() + + private var lastConstant: String? = null + + fun setlastConstant(constant: String) { + lastConstant?.let { + successfulConstants.add(it) + } + lastConstant = constant + } + } + fun loadRepoInformation() { atomicShouldManuallyReload.set(true) if (SkyHanniMod.feature.dev.repoAutoUpdate) { @@ -66,11 +80,14 @@ class RepoManager(private val configLocation: File) { val file = File(configLocation, "repo") if (file.exists() && currentCommitJSON != null && currentCommitJSON["sha"].asString == latestRepoCommit ) { - if (command) { - LorenzUtils.chat("§e[SkyHanni] §7The repo is already up to date!") - atomicShouldManuallyReload.set(false) + if (unsuccessfulConstants.isEmpty()) { + + if (command) { + LorenzUtils.chat("§e[SkyHanni] §7The repo is already up to date!") + atomicShouldManuallyReload.set(false) + } + return@supplyAsync false } - return@supplyAsync false } RepoUtils.recursiveDelete(repoLocation) repoLocation.mkdirs() @@ -126,8 +143,16 @@ class RepoManager(private val configLocation: File) { ErrorManager.resetCache() Minecraft.getMinecraft().addScheduledTask { error = false + successfulConstants.clear() + unsuccessfulConstants.clear() + lastConstant = null + RepositoryReloadEvent(repoLocation, gson).postAndCatchAndBlock(ignoreErrorCache = true) { error = true + lastConstant?.let { + unsuccessfulConstants.add(it) + } + lastConstant = null } comp.complete(null) if (answerMessage.isNotEmpty() && !error) { @@ -138,11 +163,40 @@ class RepoManager(private val configLocation: File) { "§e[SkyHanni] Error with the repo detected, try /shupdaterepo to fix it!", "shupdaterepo" ) + if (unsuccessfulConstants.isEmpty()) { + unsuccessfulConstants.add("All Constants") + } } } return comp } + fun displayRepoStatus(joinEvent: Boolean) { + if (joinEvent) { + if (unsuccessfulConstants.isNotEmpty()) { + LorenzUtils.chat("§c[SkyHanni] §7Repo Issue! Some features may not work. Please report this error on the Discord!") + LorenzUtils.chat("§7Repo Auto Update Value: §c${SkyHanniMod.feature.dev.repoAutoUpdate}") + LorenzUtils.chat("§7If you have Repo Auto Update turned off, please try turning that on.\n§cUnsuccessful Constants §7(${unsuccessfulConstants.size}):") + for (constant in unsuccessfulConstants) { + LorenzUtils.chat(" §e- §7$constant") + } + } + return + } + if (unsuccessfulConstants.isEmpty() && successfulConstants.isNotEmpty()) { + LorenzUtils.chat("§a[SkyHanni] Repo working fine!") + return + } + if (successfulConstants.isNotEmpty()) LorenzUtils.chat("§a[SkyHanni] Successful Constants §7(${successfulConstants.size}):") + for (constant in successfulConstants) { + LorenzUtils.chat(" §a- §7$constant") + } + LorenzUtils.chat("§c[SkyHanni] Unsuccessful Constants §7(${unsuccessfulConstants.size}):") + for (constant in unsuccessfulConstants) { + LorenzUtils.chat(" §e- §7$constant") + } + } + /** * Parses a file in to a JsonObject. */ diff --git a/src/main/java/at/hannibal2/skyhanni/events/RepositoryReloadEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RepositoryReloadEvent.kt index e0eb01b9b..3b2b426fe 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RepositoryReloadEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RepositoryReloadEvent.kt @@ -1,16 +1,16 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.data.repo.RepoError +import at.hannibal2.skyhanni.data.repo.RepoManager import at.hannibal2.skyhanni.data.repo.RepoUtils import com.google.gson.Gson -import com.google.gson.JsonObject import java.io.File import java.lang.reflect.Type class RepositoryReloadEvent(val repoLocation: File, val gson: Gson) : LorenzEvent() { - fun getConstant(constant: String) = getConstant(constant) inline fun getConstant(constant: String, type: Type? = null): T = try { + RepoManager.setlastConstant(constant) if (!repoLocation.exists()) throw RepoError("Repo folder does not exist!") RepoUtils.getConstant(repoLocation, constant, gson, T::class.java, type) } catch (e: Exception) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt index 6de251af5..e4db8ee3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatFilter.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.chat.playerchat import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.MultiFilter +import at.hannibal2.skyhanni.utils.jsonobjects.PlayerChatFilterJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PlayerChatFilter { @@ -29,18 +30,16 @@ class PlayerChatFilter { var countCategories = 0 var countFilters = 0 - val data = event.getConstant("PlayerChatFilter") - for (category in data["filters"].asJsonArray) { - val jsonObject = category.asJsonObject - val description = jsonObject["description"].asString + val data = event.getConstant("PlayerChatFilter") + for (category in data.filters) { + val description = category.description val filter = MultiFilter() - filter.load(jsonObject) + filter.load(category) filters[description] = filter countCategories++ countFilters += filter.count() } - LorenzUtils.debug("Loaded $countFilters filters in $countCategories categories from repo") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt index 2c1c339dc..97a110508 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/GetFromSacksTabComplete.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.jsonobjects.SackListJson +import at.hannibal2.skyhanni.utils.jsonobjects.SacksJson import net.minecraft.network.play.client.C01PacketChatMessage import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -15,7 +15,7 @@ object GetFromSacksTabComplete { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - sackList = event.getConstant("Sacks").sackList + sackList = event.getConstant("Sacks").sackList } fun handleTabComplete(command: String): List? { diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt index 96bfeb83a..688d6f6b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/PlayerTabComplete.kt @@ -13,11 +13,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object PlayerTabComplete { private val config get() = SkyHanniMod.feature.commands.tabComplete - private var vipVisitsJson: VipVisitsJson? = null + private var vipVisits = listOf() @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - vipVisitsJson = event.getConstant("VipVisits") + val data = event.getConstant("VipVisits") + vipVisits = data.vipVisits } @SubscribeEvent @@ -75,12 +76,10 @@ object PlayerTabComplete { } if (config.vipVisits && command == "visit") { - vipVisitsJson?.let { - for (visit in it.vipVisits) { - add(visit) - } + for (visit in vipVisits) { + add(visit) } } } } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt index 4120ebd9d..ea76e03ea 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/WarpTabComplete.kt @@ -8,19 +8,20 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object WarpTabComplete { private val config get() = SkyHanniMod.feature.commands.tabComplete - private var warpsJson: WarpsJson? = null + private var warps = listOf() @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - warpsJson = event.getConstant("Warps") + val data = event.getConstant("Warps") + warps = data.warpCommands } fun handleTabComplete(command: String): List? { if (!isEnabled()) return null if (command != "warp") return null - return warpsJson?.warpCommands + return warps } fun isEnabled() = LorenzUtils.inSkyBlock && config.warps -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt index 0ae437db7..2775becc7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzToolTipEvent +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getFilletValue import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils @@ -13,7 +14,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard class TrophyFishFillet { - @SubscribeEvent fun onTooltip(event: LorenzToolTipEvent) { if (!isEnabled()) return @@ -36,5 +36,4 @@ class TrophyFishFillet { } private fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.fishing.trophyFishing.filletTooltip - -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishInfo.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishInfo.kt deleted file mode 100644 index aba9f5c5f..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishInfo.kt +++ /dev/null @@ -1,54 +0,0 @@ -package at.hannibal2.skyhanni.features.fishing.trophy - -import at.hannibal2.skyhanni.test.command.ErrorManager -import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.StringUtils.splitLines -import com.google.gson.annotations.Expose -import net.minecraft.event.HoverEvent -import net.minecraft.util.ChatComponentText -import net.minecraft.util.ChatStyle - -data class TrophyFishInfo( - @Expose - val displayName: String, - @Expose - private val description: String, - @Expose - private val rate: Int?, - @Expose - private val fillet: Map -) { - - // Credit to NotEnoughUpdates (Trophy Fish profile viewer page) for the format. - fun getTooltip(counts: Map): ChatStyle { - val bestFishObtained = counts.keys.maxOrNull() ?: TrophyRarity.BRONZE - val rateString = if (rate != null) "§8[§7$rate%§8]" else "" - val display = """ - |$displayName $rateString - |${description.splitLines(150)} - | - |${TrophyRarity.DIAMOND.formattedString}: ${formatCount(counts, TrophyRarity.DIAMOND)} - |${TrophyRarity.GOLD.formattedString}: ${formatCount(counts, TrophyRarity.GOLD)} - |${TrophyRarity.SILVER.formattedString}: ${formatCount(counts, TrophyRarity.SILVER)} - |${TrophyRarity.BRONZE.formattedString}: ${formatCount(counts, TrophyRarity.BRONZE)} - | - |§7Total: ${bestFishObtained.formatCode}${counts.values.sum().addSeparators()} - """.trimMargin() - return ChatStyle().setChatHoverEvent( - HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText(display)) - ) - } - - fun getFilletValue(rarity: TrophyRarity): Int { - if (fillet == null) { - ErrorManager.logError(Error("fillet is null for '$displayName'"), "Error trying to read trophy fish info") - return -1 - } - return fillet.getOrDefault(rarity, -1) - } - - private fun formatCount(counts: Map, rarity: TrophyRarity): String { - val count = counts.getOrDefault(rarity, 0) - return if (count > 0) "§6${count.addSeparators()}" else "§c✖" - } -} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt index 4d8b547a4..6617b31b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt @@ -2,27 +2,62 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.RepositoryReloadEvent -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.StringUtils.splitLines import at.hannibal2.skyhanni.utils.jsonobjects.TrophyFishJson +import at.hannibal2.skyhanni.utils.jsonobjects.TrophyFishJson.TrophyFishInfo +import net.minecraft.event.HoverEvent +import net.minecraft.util.ChatComponentText +import net.minecraft.util.ChatStyle import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class TrophyFishManager { +object TrophyFishManager { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - val json = event.getConstant("TrophyFish") - trophyFishInfo = json.trophy_fish - LorenzUtils.debug("Loaded trophy fish from repo") + val data = event.getConstant("TrophyFish") + trophyFishInfo = data.trophy_fish } - companion object { - val fishes: MutableMap>? - get() = ProfileStorageData.profileSpecific?.crimsonIsle?.trophyFishes + val fishes: MutableMap>? + get() = ProfileStorageData.profileSpecific?.crimsonIsle?.trophyFishes - private var trophyFishInfo = mapOf() + private var trophyFishInfo = mapOf() - fun getInfo(internalName: String) = trophyFishInfo[internalName] + fun getInfo(internalName: String) = trophyFishInfo[internalName] - fun getInfoByName(name: String) = trophyFishInfo.values.find { it.displayName == name } + fun getInfoByName(name: String) = trophyFishInfo.values.find { it.displayName == name } + + private fun formatCount(counts: Map, rarity: TrophyRarity): String { + val count = counts.getOrDefault(rarity, 0) + return if (count > 0) "§6${count.addSeparators()}" else "§c✖" + } + + fun TrophyFishInfo.getFilletValue(rarity: TrophyRarity): Int { + if (fillet == null) { + ErrorManager.logError(Error("fillet is null for '$displayName'"), "Error trying to read trophy fish info") + return -1 + } + return fillet.getOrDefault(rarity, -1) + } + + fun TrophyFishInfo.getTooltip(counts: Map): ChatStyle { + val bestFishObtained = counts.keys.maxOrNull() ?: TrophyRarity.BRONZE + val rateString = if (rate != null) "§8[§7$rate%§8]" else "" + val display = """ + |$displayName $rateString + |${description.splitLines(150)} + | + |${TrophyRarity.DIAMOND.formattedString}: ${formatCount(counts, TrophyRarity.DIAMOND)} + |${TrophyRarity.GOLD.formattedString}: ${formatCount(counts, TrophyRarity.GOLD)} + |${TrophyRarity.SILVER.formattedString}: ${formatCount(counts, TrophyRarity.SILVER)} + |${TrophyRarity.BRONZE.formattedString}: ${formatCount(counts, TrophyRarity.BRONZE)} + | + |§7Total: ${bestFishObtained.formatCode}${counts.values.sum().addSeparators()} + """.trimMargin() + return ChatStyle().setChatHoverEvent( + HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText(display)) + ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt index e6087a5b5..7723617a9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishMessages.kt @@ -3,12 +3,14 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.Companion.fishes +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.fishes +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager.getTooltip import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.ordinal +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.Minecraft import net.minecraft.util.ChatComponentText @@ -16,16 +18,19 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class TrophyFishMessages { private val trophyFishPattern = - Regex("§6§lTROPHY FISH! §r§bYou caught an? §r(?§[0-9a-f](?:§k)?[\\w -]+)§r§r§r §r§l§r(?§[0-9a-f]§l\\w+)§r§b\\.") + "§6§lTROPHY FISH! §r§bYou caught an? §r(?§[0-9a-f](?:§k)?[\\w -]+)§r§r§r §r§l§r(?§[0-9a-f]§l\\w+)§r§b\\.".toPattern() private val config get() = SkyHanniMod.feature.fishing.trophyFishing.chatMessages @SubscribeEvent fun onStatusBar(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return + var displayName = "" + var displayRarity = "" - val match = trophyFishPattern.matchEntire(event.message)?.groups ?: return - val displayName = match["displayName"]!!.value.replace("§k", "") - val displayRarity = match["displayRarity"]!!.value + trophyFishPattern.matchMatcher(event.message) { + displayName = group("displayName").replace("§k", "") + displayRarity = group("displayRarity") + } ?: return val internalName = displayName.replace("Obfuscated", "Obfuscated Fish") .replace("[- ]".toRegex(), "").lowercase().removeColor() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 05b78d047..d114d2455 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.BlockClickEvent @@ -20,6 +21,7 @@ import at.hannibal2.skyhanni.features.garden.farming.GardenBestCropTime import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import at.hannibal2.skyhanni.features.garden.inventory.SkyMartCopperPrice +import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorColorNames import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.utils.BlockUtils.isBabyCrop import at.hannibal2.skyhanni.utils.InventoryUtils @@ -248,5 +250,5 @@ object GardenAPI { } private var gardenExperience = listOf() - private const val gardenOverflowExp = 10000 // can be changed I guess + private const val gardenOverflowExp = 10000 } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 8b0b3d70d..88695da9a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -47,9 +47,10 @@ import kotlin.time.Duration import kotlin.time.Duration.Companion.milliseconds import kotlin.time.DurationUnit -class ComposterOverlay { +object ComposterOverlay { private var organicMatterFactors: Map = emptyMap() private var fuelFactors: Map = emptyMap() + private var organicMatter: Map = emptyMap() private val config get() = SkyHanniMod.feature.garden.composters private var organicMatterDisplay = emptyList>() @@ -68,34 +69,31 @@ class ComposterOverlay { private var lastHovered = 0L private var lastAttemptTime = SimpleTimeMark.farPast() - companion object { - var currentOrganicMatterItem: String? - get() = GardenAPI.config?.composterCurrentOrganicMatterItem - private set(value) { - GardenAPI.config?.composterCurrentOrganicMatterItem = value - } + var inInventory = false - var currentFuelItem: String? - get() = GardenAPI.config?.composterCurrentFuelItem - private set(value) { - GardenAPI.config?.composterCurrentFuelItem = value - } + private var testOffset = 0 - var testOffset = 0 + var currentOrganicMatterItem: String? + get() = GardenAPI.config?.composterCurrentOrganicMatterItem + private set(value) { + GardenAPI.config?.composterCurrentOrganicMatterItem = value + } - fun onCommand(args: Array) { - if (args.size != 1) { - LorenzUtils.chat("§cUsage: /shtestcomposter ") - return - } - testOffset = args[0].toInt() - LorenzUtils.chat("§e[SkyHanni] Composter test offset set to $testOffset.") + var currentFuelItem: String? + get() = GardenAPI.config?.composterCurrentFuelItem + private set(value) { + GardenAPI.config?.composterCurrentFuelItem = value } - var inInventory = false + fun onCommand(args: Array) { + if (args.size != 1) { + LorenzUtils.chat("§cUsage: /shtestcomposter ") + return + } + testOffset = args[0].toInt() + LorenzUtils.chat("§e[SkyHanni] Composter test offset set to $testOffset.") } - var garden: GardenJson? = null @SubscribeEvent fun onInventoryClose(event: InventoryCloseEvent) { @@ -331,6 +329,7 @@ class ComposterOverlay { if (currentTimeType == TimeType.COMPOST) "Compost multiplier" else "Composts per $timeText" newList.addAsSingletonList(" §7$compostPerTitle: §e${multiplier.round(2)}$compostPerTitlePreview") + val organicMatterPrice = getPrice(organicMatterItem) val organicMatterFactor = organicMatterFactors[organicMatterItem]!! @@ -358,6 +357,7 @@ class ComposterOverlay { " §7Material costs per $timeText: §6${NumberUtil.format(totalCost)}$materialCostFormatPreview" newList.addAsSingletonList(materialCostFormat) + val priceCompost = getPrice("COMPOST") val profit = ((priceCompost * multiDropFactor) - (fuelPricePer + organicMatterPricePer)) * timeMultiplier val profitPreview = @@ -460,8 +460,7 @@ class ComposterOverlay { if (sackStatus == SackStatus.MISSING || sackStatus == SackStatus.OUTDATED) { if (sackStatus == SackStatus.OUTDATED) LorenzUtils.sendCommandToServer("gfs $internalName ${itemsNeeded - having}") - val sackType = - if (internalName == "VOLTA" || internalName == "OIL_BARREL") "Mining" else "Enchanted Agronomy" // TODO Add sack type repo data + val sackType = if (internalName == "VOLTA" || internalName == "OIL_BARREL") "Mining" else "Enchanted Agronomy" // TODO Add sack type repo data LorenzUtils.clickableChat( "§e[SkyHanni] Sacks could not be loaded. Click here and open your §9$sackType Sack §eto update the data!", "sax" @@ -506,14 +505,19 @@ class ComposterOverlay { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - garden = event.getConstant("Garden") + val data = event.getConstant("Garden") + organicMatter = data.organic_matter + fuelFactors = data.fuel updateOrganicMatterFactors() } private fun updateOrganicMatterFactors() { - val garden = this.garden ?: return - organicMatterFactors = updateOrganicMatterFactors(garden.organic_matter) - fuelFactors = garden.fuel + try { + organicMatterFactors = updateOrganicMatterFactors(organicMatter) + } catch (e: Exception) { + e.printStackTrace() + LorenzUtils.error("error in RepositoryReloadEvent") + } } private fun updateOrganicMatterFactors(baseValues: Map): Map { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt index fc68546e8..8092ff476 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt @@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.jsonobjects.ArmorDropsJson +import at.hannibal2.skyhanni.utils.jsonobjects.ArmorDropsJson.DropInfo import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds @@ -111,7 +112,7 @@ class FarmingArmorDrops { } companion object { - var armorDropInfo = mapOf() + var armorDropInfo = mapOf() private var currentArmorDropChance = 0.0 private var lastCalculationTime = SimpleTimeMark.farPast() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index 0d9e4409f..a9a2066bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -15,7 +15,8 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy -import com.google.gson.JsonObject +import at.hannibal2.skyhanni.utils.jsonobjects.DicerDropsJson +import at.hannibal2.skyhanni.utils.jsonobjects.DicerDropsJson.DicerType import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.concurrent.fixedRateTimer @@ -129,31 +130,28 @@ object GardenCropSpeed { } } - private fun calculateAverageDicer(dicerList: MutableList, dropsJson: JsonObject) { + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + val data = event.getConstant("DicerDrops") + calculateAverageDicer(melonDicer, data.MELON) + calculateAverageDicer(pumpkinDicer, data.PUMPKIN) + } + + private fun calculateAverageDicer(dicerList: MutableList, data: DicerType) { dicerList.clear() - val totalChance = dropsJson["total chance"].asDouble - val dropTypes = dropsJson["drops"].asJsonArray - for (dropType in dropTypes) { - val dropJson = dropType.asJsonObject - val chance = (dropJson["chance"].asDouble / totalChance) - dropJson["amount"].asJsonArray.forEachIndexed { index, element -> - val amount = element.asInt * chance + for (dropType in data.drops) { + val chance = dropType.chance / data.totalChance.toDouble() + for ((index, amount) in dropType.amount.withIndex()) { + val dropAmount = amount * chance if (index < dicerList.size) { - dicerList[index] += amount + dicerList[index] += dropAmount } else { - dicerList.add(amount) + dicerList.add(dropAmount) } } } } - @SubscribeEvent - fun onRepoReload(event: RepositoryReloadEvent) { - val dicerJson = event.getConstant("DicerDrops") - calculateAverageDicer(melonDicer, dicerJson["MELON"].asJsonObject) - calculateAverageDicer(pumpkinDicer, dicerJson["PUMPKIN"].asJsonObject) - } - fun getRecentBPS(): Double { val size = blocksSpeedList.size return if (size <= 1) { @@ -192,6 +190,5 @@ object GardenCropSpeed { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "garden.blocksBrokenResetTime", "garden.cropMilestones.blocksBrokenResetTime") - } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt index 0a3eabf86..904ec9bb4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt @@ -13,12 +13,13 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.jsonobjects.AnitaUpgradeCostsJson +import at.hannibal2.skyhanni.utils.jsonobjects.AnitaUpgradeCostsJson.Price import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AnitaExtraFarmingFortune { private val config get() = SkyHanniMod.feature.garden.anitaShop - private var levelPrice = emptyMap() + private var levelPrice = mapOf() @SubscribeEvent fun onItemTooltipLow(event: ItemTooltipEvent) { @@ -71,12 +72,8 @@ class AnitaExtraFarmingFortune { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - val upgradeCosts = event.getConstant("AnitaUpgradeCosts") - val map = mutableMapOf() - for ((rawNumber, price) in upgradeCosts.level_price) { - map[rawNumber.toInt()] = price - } - levelPrice = map + val data = event.getConstant("AnitaUpgradeCosts") + levelPrice = data.level_price } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt index 84e8f17d3..16efb90b1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorColorNames.kt @@ -3,36 +3,30 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.jsonobjects.GardenJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class GardenVisitorColorNames { +object GardenVisitorColorNames { + private var visitorColours = mutableMapOf() + var visitorItems = mutableMapOf>() @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - val mapColor = mutableMapOf() - val mapItems = mutableMapOf>() - val garden = event.getConstant("Garden") - for ((name, element) in garden["visitors"].asJsonObject.entrySet()) { - val jsonObject = element.asJsonObject - val rarity = jsonObject["rarity"].asString - mapColor[name] = getColor(rarity) - mapItems[name] = jsonObject["need_items"].asJsonArray.map { it.asString } + val data = event.getConstant("Garden") + visitorColours.clear() + visitorItems.clear() + for ((visitor, visitorData) in data.visitors) { + visitorColours[visitor] = getColor(visitorData.rarity) + visitorItems[visitor] = visitorData.need_items } - visitorColor = mapColor - visitorItems = mapItems } - companion object { - private var visitorColor = mapOf() // name -> color code - var visitorItems = mapOf>() + fun getColoredName(name: String): String { + if (!SkyHanniMod.feature.garden.visitors.coloredName) return name - fun getColoredName(name: String): String { - if (!SkyHanniMod.feature.garden.visitors.coloredName) return name - - val cleanName = name.removeColor() - val color = visitorColor[cleanName] ?: return name - return color + cleanName - } + val cleanName = name.removeColor() + val color = visitorColours[cleanName] ?: return name + return color + cleanName } private fun getColor(rarity: String) = when (rarity) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 37a1ff142..f77a27107 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.PreProfileSwitchEvent -import at.hannibal2.skyhanni.events.TabListLineRenderEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptedEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorArrivalEvent @@ -403,18 +402,6 @@ class GardenVisitorFeatures { } } - @SubscribeEvent - fun onTabListText(event: TabListLineRenderEvent) { - if (!GardenAPI.inGarden()) return - if (!config.coloredName) return - val text = event.text - val replace = VisitorAPI.fromHypixelName(text) - val visitor = VisitorAPI.getVisitor(replace) - visitor?.let { - event.text = " " + GardenVisitorColorNames.getColoredName(it.visitorName) - } - } - @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (config.hypixelArrivedMessage && newVisitorArrivedMessage.matcher(event.message).matches()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 0e8a9fe0b..ddb4645d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -27,7 +27,9 @@ import at.hannibal2.skyhanni.utils.MultiFilter import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftExportable import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftTransferable import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import com.google.gson.JsonObject +import at.hannibal2.skyhanni.utils.jsonobjects.HideNotClickableItemsJson +import at.hannibal2.skyhanni.utils.jsonobjects.HideNotClickableItemsJson.SalvageFilter +import at.hannibal2.skyhanni.utils.jsonobjects.MultiFilterJson import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest @@ -54,21 +56,22 @@ class HideNotClickableItems { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - tradeNpcFilter.load(event.getConstant("TradeNpcs")) - - val hideNotClickableItems = event.getConstant("HideNotClickableItems") ?: return - hideNpcSellFilter.load(hideNotClickableItems["hide_npc_sell"].asJsonObject) - hideInStorageFilter.load(hideNotClickableItems["hide_in_storage"].asJsonObject) - updateSalvageList(hideNotClickableItems) - hidePlayerTradeFilter.load(hideNotClickableItems["hide_player_trade"].asJsonObject) - notAuctionableFilter.load(hideNotClickableItems["not_auctionable"].asJsonObject) + val data = event.getConstant("TradeNpcs") + tradeNpcFilter.load(data) + + val hideNotClickable = event.getConstant("HideNotClickableItems") + hideNpcSellFilter.load(hideNotClickable.hide_npc_sell) + hideInStorageFilter.load(hideNotClickable.hide_in_storage) + hidePlayerTradeFilter.load(hideNotClickable.hide_player_trade) + notAuctionableFilter.load(hideNotClickable.not_auctionable) + updateSalvageList(hideNotClickable.salvage) } - private fun updateSalvageList(hideNotClickableItems: JsonObject) { + private fun updateSalvageList(data: SalvageFilter) { itemsToSalvage.clear() - val salvage = hideNotClickableItems["salvage"].asJsonObject - itemsToSalvage.addAll(salvage.asJsonObject["items"].asJsonArray.map { it.asString }) - for (armor in salvage.asJsonObject["armor"].asJsonArray.map { it.asString }) { + + itemsToSalvage.addAll(data.items) + for (armor in data.armor) { itemsToSalvage.add("$armor Helmet") itemsToSalvage.add("$armor Chestplate") itemsToSalvage.add("$armor Leggings") @@ -128,7 +131,7 @@ class HideNotClickableItems { } else { event.toolTip.add("§c$hideReason") if (config.itemsBypass) { - event.toolTip.add(" §7(Disable with holding the control key)") + event.toolTip.add(" §7(Bypass by holding the control key)") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt index 1e43944f3..f8dd111b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.jsonobjects.ItemsJson import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -39,17 +40,12 @@ class ItemStars { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - val items = event.getConstant("Items") - if (items.has("crimson_armors")) { - armorNames.clear() - armorNames.addAll(items.getAsJsonArray("crimson_armors").map { it.asString }) - } - + val data = event.getConstant("Items") + armorNames.clear() tiers.clear() - if (items.has("crimson_tiers")) { - items.getAsJsonObject("crimson_tiers").entrySet().forEach { - tiers[it.key] = it.value.asInt - } + armorNames.addAll(data.crimson_armors) + for (tier in data.crimson_tiers) { + tiers[tier.key] = tier.value } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index 69991dc76..2890e8593 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems -import at.hannibal2.skyhanni.utils.jsonobjects.ModsJson +import at.hannibal2.skyhanni.utils.jsonobjects.ModGuiSwitcherJson import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.client.Minecraft import net.minecraft.client.renderer.GlStateManager @@ -28,7 +28,7 @@ object QuickModMenuSwitch { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - val modsJar = event.getConstant("ModGuiSwitcher") + val modsJar = event.getConstant("ModGuiSwitcher") mods = buildList { out@ for ((name, mod) in modsJar.mods) { for (path in mod.guiPath) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index 9202be686..7e9690a2e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.DailyKuudraBossHelper import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.DailyQuestHelper +import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.QuestLoader import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.DailyMiniBossHelper import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils @@ -17,7 +18,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.TabListData -import com.google.gson.JsonObject +import at.hannibal2.skyhanni.utils.jsonobjects.CrimsonIsleReputationJson import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -28,7 +29,6 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { val miniBossHelper = DailyMiniBossHelper(this) val kuudraBossHelper = DailyKuudraBossHelper(this) - var repoData: JsonObject? = null var factionType = FactionType.NONE private var display = emptyList>() @@ -42,21 +42,24 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - repoData = event.getConstant("CrimsonIsleReputation") + val data = event.getConstant("CrimsonIsleReputation") + miniBossHelper.onRepoReload(data.MINIBOSS) + kuudraBossHelper.onRepoReload(data.KUUDRA) + + QuestLoader.quests.clear() + QuestLoader.loadQuests(data.FISHING, "FISHING") + QuestLoader.loadQuests(data.RESCUE, "RESCUE") + QuestLoader.loadQuests(data.FETCH, "FETCH") + QuestLoader.loadQuests(data.DOJO, "DOJO") - tryLoadConfig() update() } @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - tryLoadConfig() - } - - private fun tryLoadConfig() { ProfileStorageData.profileSpecific?.crimsonIsle?.let { - miniBossHelper.load(it) - kuudraBossHelper.load(it) + miniBossHelper.loadData(it) + kuudraBossHelper.loadData(it) questHelper.load(it) } } @@ -150,14 +153,9 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { update() } - fun readLocationData(data: JsonObject): LorenzVec? { - val locationData = data["location"]?.asJsonArray ?: return null - if (locationData.size() == 0) return null - - val x = locationData[0].asDouble - 1 - val y = locationData[1].asDouble - val z = locationData[2].asDouble - 1 - return LorenzVec(x, y, z) + fun readLocationData(locations: List): LorenzVec? { + if (locations.isEmpty()) return null + return LorenzVec(locations[0] - 1, locations[1], locations[2] - 1) } fun showLocations() = when (config.showLocation) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt index 34ba68f38..39e888ade 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.jsonobjects.CrimsonIsleReputationJson.ReputationQuest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) { @@ -98,26 +99,23 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH .forEach { storage.kuudraTiersDone.add(it.name) } } - fun load(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { + fun onRepoReload(data: Map) { kuudraTiers.clear() - - //Repo - val repoData = reputationHelper.repoData ?: return - val jsonElement = repoData["KUUDRA"] var tier = 1 - for ((displayName, extraData) in jsonElement.asJsonObject.entrySet()) { - val data = extraData.asJsonObject - val displayItem = data["item"]?.asString - val location = reputationHelper.readLocationData(data) - kuudraTiers.add(KuudraTier(displayName, displayItem, location, tier)) + for ((displayName, kuudraTier) in data) { + val displayItem = kuudraTier.item + val location = reputationHelper.readLocationData(kuudraTier.location) if (location != null) { kuudraLocation = location } + kuudraTiers.add(KuudraTier(displayName, displayItem, location, tier)) tier++ } + } - //Config + fun loadData(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { + if (kuudraTiers.isEmpty()) return for (name in storage.kuudraTiersDone) { getByDisplayName(name)!!.doneToday = true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index 846cc12e1..37b26dce3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -312,9 +312,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { fun load(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { reset() - questLoader.loadConfig(storage) - } fun saveConfig(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt index b7c4c2cbf..a35510196 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt @@ -15,9 +15,19 @@ import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.U import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.TabListData +import at.hannibal2.skyhanni.utils.jsonobjects.CrimsonIsleReputationJson.ReputationQuest class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { + companion object { + val quests = mutableMapOf>() + fun loadQuests(data: Map, questType: String) { + for ((questName, questInfo) in data) { + quests[questName] = Pair(questType, questInfo) + } + } + } + fun loadFromTabList() { var i = -1 for (line in TabListData.getTabList()) { @@ -83,29 +93,26 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { return KuudraQuest(kuudraTier, state) } } + var questName = name + var dojoGoal = "" - val repoData = dailyQuestHelper.reputationHelper.repoData ?: return UnknownQuest(name) - for (entry in repoData.entrySet()) { - val categoryName = entry.key - val category = entry.value.asJsonObject - for ((entryName, extraData) in category.entrySet()) { - val data = extraData.asJsonObject - val displayItem = data["item"]?.asString - val location = dailyQuestHelper.reputationHelper.readLocationData(data) - if (name.startsWith("$entryName Rank ")) { - val split = name.split(" Rank ") - val dojoName = split[0] - val dojoRankGoal = split[1] - return DojoQuest(dojoName, location, displayItem, dojoRankGoal, state) - } + if (name.contains(" Rank ")) { + val split = name.split(" Rank ") + questName = split[0] + dojoGoal = split[1] + } - if (name == entryName) { - when (categoryName) { - "FISHING" -> return TrophyFishQuest(name, location, displayItem, state, needAmount) - "RESCUE" -> return RescueMissionQuest(displayItem, location, state) - "FETCH" -> return FetchQuest(name, location, displayItem, state, needAmount) - } - } + if (questName in quests) { + val questInfo = quests[questName] ?: return UnknownQuest(name) + val locationInfo = questInfo.second.location + val location = dailyQuestHelper.reputationHelper.readLocationData(locationInfo) + val displayItem = questInfo.second.item + + when (questInfo.first) { + "FISHING" -> return TrophyFishQuest(name, location, displayItem, state, needAmount) + "RESCUE" -> return RescueMissionQuest(displayItem, location, state) + "FETCH" -> return FetchQuest(name, location, displayItem, state, needAmount) + "DOJO" -> return DojoQuest(questName, location, displayItem, dojoGoal, state) } } LorenzUtils.chat("§c[SkyHanni] Unknown Crimson Isle quest: '$name'") diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt index 1e1bf98e7..10eae5816 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt @@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.jsonobjects.CrimsonIsleReputationJson.ReputationQuest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) { @@ -104,21 +105,18 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel .forEach { storage.miniBossesDoneToday.add(it.displayName) } } - fun load(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { + fun onRepoReload(data: Map) { miniBosses.clear() - - //Repo - val repoData = reputationHelper.repoData ?: return - val jsonElement = repoData["MINIBOSS"] - for ((displayName, extraData) in jsonElement.asJsonObject.entrySet()) { - val data = extraData.asJsonObject - val displayItem = data["item"]?.asString - val patterns = " *§r§6§l${displayName.uppercase()} DOWN!".toPattern() - val location = reputationHelper.readLocationData(data) - miniBosses.add(CrimsonMiniBoss(displayName, displayItem, location, patterns)) + for ((displayName, quest) in data) { + val displayItem = quest.item + val pattern = " *§r§6§l${displayName.uppercase()} DOWN!".toPattern() + val location = reputationHelper.readLocationData(quest.location) + miniBosses.add(CrimsonMiniBoss(displayName, displayItem, location, pattern)) } + } - //Config + fun loadData(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { + if (miniBosses.isEmpty()) return for (name in storage.miniBossesDoneToday) { getByDisplayName(name)!!.doneToday = true } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt index b2691210e..90e6c32ba 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.rift.area.stillgorechateau +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent @@ -94,7 +95,7 @@ class RiftBloodEffigies { for (entity in EntityUtils.getEntitiesNearby(LocationUtils.playerLocation(), 6.0)) { effigiesTimerPattern.matchMatcher(entity.name) { - val nearest = locations.sortedBy { it.distanceSq(entity.getLorenzVec()) }.firstOrNull() ?: return + val nearest = locations.minByOrNull { it.distanceSq(entity.getLorenzVec()) } ?: return val index = locations.indexOf(nearest) val string = group("time") diff --git a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt index 00ea73570..28e657c1e 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt @@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.MultiFilter import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.highlight +import at.hannibal2.skyhanni.utils.jsonobjects.MultiFilterJson import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.gui.inventory.GuiInventory @@ -53,8 +54,8 @@ class HighlightMissingRepoItems { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { - val ignoredItems = event.getConstant("IgnoredItems") - ignoreItems.load(ignoredItems.asJsonObject) + val ignoredItems = event.getConstant("IgnoredItems") + ignoreItems.load(ignoredItems) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index 84b180cd8..adf8d2637 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -58,8 +58,8 @@ object ErrorManager { fun logError(throwable: Throwable, message: String, ignoreErrorCache: Boolean) { val error = Error(message, throwable) - Minecraft.getMinecraft().thePlayer ?: throw error error.printStackTrace() + Minecraft.getMinecraft().thePlayer ?: return if (!ignoreErrorCache) { val pair = if (throwable.stackTrace.isNotEmpty()) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt index c8ecc2055..ab9817ef4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils -import com.google.gson.JsonObject +import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpace +import at.hannibal2.skyhanni.utils.jsonobjects.MultiFilterJson class MultiFilter { @@ -10,25 +11,23 @@ class MultiFilter { private val contains = mutableListOf() private val containsWord = mutableListOf() - fun load(hideNpcSell: JsonObject) { + fun load(data: MultiFilterJson) { equals.clear() startsWith.clear() endsWith.clear() contains.clear() containsWord.clear() - fill(hideNpcSell, "equals", equals) - fill(hideNpcSell, "exact", equals) - fill(hideNpcSell, "startsWith", startsWith) - fill(hideNpcSell, "endsWith", endsWith) - fill(hideNpcSell, "contains", contains) - fill(hideNpcSell, "containsWord", containsWord) + fill(equals, data.equals) + fill(startsWith, data.startsWith) + fill(endsWith, data.endsWith) + fill(contains, data.contains) + fill(containsWord, data.containsWord) } - private fun fill(jsonObject: JsonObject, key: String, list: MutableList) { - if (jsonObject.has(key)) { - list.addAll(jsonObject[key].asJsonArray.map { it.asString }) - } + private fun fill(list: MutableList, data: List?) { + if (data == null) return + list.addAll(data) } fun match(string: String): Boolean { @@ -50,8 +49,9 @@ class MultiFilter { return null } - private fun containsWord(message: String, word: String): Boolean = - message.startsWith("$word ") || message.endsWith(" $word") || message.contains(" $word ") + private fun containsWord(message: String, word: String): Boolean { + return message.split(" ").any { it.trimWhiteSpace() == word } + } fun count(): Int { return equals.size + startsWith.size + endsWith.size + contains.size + containsWord.size diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt index 416b7dfd3..c9903ffc2 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt @@ -11,14 +11,14 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawFilledBoundingBox_nea import at.hannibal2.skyhanni.utils.RenderUtils.drawString import at.hannibal2.skyhanni.utils.RenderUtils.expandBlock import at.hannibal2.skyhanni.utils.RenderUtils.outlineTopFace -import at.hannibal2.skyhanni.utils.jsonobjects.ParkourJson +import at.hannibal2.skyhanni.utils.jsonobjects.ParkourJson.ShortCut import net.minecraft.client.Minecraft import java.awt.Color import kotlin.time.Duration.Companion.seconds class ParkourHelper( val locations: List, - private val shortCuts: List, + private val shortCuts: List, val platformSize: Double = 1.0, val detectionRange: Double = 1.0 ) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 187407cbf..802decbce 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -18,9 +18,11 @@ object StringUtils { private val playerChatPattern = "(?.*?)(?:§[f7r])*: .*".toPattern() private val chatUsernamePattern = "^(?:§\\w\\[§\\w\\d+§\\w] )?(?:(?:§\\w)+\\S )?(?(?:§\\w\\[\\w.+] )?(?:§\\w)?(?\\w+))(?: (?:§\\w)?\\[.+?])?".toPattern() private val whiteSpaceResetPattern = "^(?:\\s|§r)*|(?:\\s|§r)*$".toPattern() + private val whiteSpacePattern = "^\\s*|\\s*$".toPattern() private val resetPattern = "(?i)§R".toPattern() fun String.trimWhiteSpaceAndResets(): String = whiteSpaceResetPattern.matcher(this).replaceAll("") + fun String.trimWhiteSpace(): String = whiteSpacePattern.matcher(this).replaceAll("") fun String.removeResets(): String = resetPattern.matcher(this).replaceAll("") fun String.firstLetterUppercase(): String { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/AnitaUpgradeCostsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/AnitaUpgradeCostsJson.java index c0fbd0ad0..09a2de7db 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/AnitaUpgradeCostsJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/AnitaUpgradeCostsJson.java @@ -6,12 +6,13 @@ import java.util.Map; public class AnitaUpgradeCostsJson { @Expose - public Map level_price; + public Map level_price; public static class Price { @Expose public Integer gold_medals; + @Expose public Integer jacob_tickets; } -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ArmorDropsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ArmorDropsJson.java index 747a33a13..698bad3db 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ArmorDropsJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ArmorDropsJson.java @@ -12,7 +12,8 @@ public class ArmorDropsJson { public static class DropInfo { @Expose public String armor_type; + @Expose public List chance; } -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoJson.java index 472993c46..810f6d3ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoJson.java @@ -12,7 +12,8 @@ public class BingoJson { public static class BingoTip { @Expose public String difficulty; + @Expose public List note; } -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanks.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanks.java deleted file mode 100644 index 6cac52622..000000000 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanks.java +++ /dev/null @@ -1,10 +0,0 @@ -package at.hannibal2.skyhanni.utils.jsonobjects; - -import com.google.gson.annotations.Expose; - -import java.util.Map; - -public class BingoRanks { - @Expose - public Map ranks; -} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanksJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanksJson.java new file mode 100644 index 000000000..49d7e662f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/BingoRanksJson.java @@ -0,0 +1,10 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.Map; + +public class BingoRanksJson { + @Expose + public Map ranks; +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ContributorListJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ContributorListJson.java index 77e3d639b..6ab663941 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ContributorListJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ContributorListJson.java @@ -2,7 +2,8 @@ package at.hannibal2.skyhanni.utils.jsonobjects; import com.google.gson.annotations.Expose; import java.util.List; + public class ContributorListJson { @Expose public List usernames; -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/CrimsonIsleReputationJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/CrimsonIsleReputationJson.java new file mode 100644 index 000000000..907081611 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/CrimsonIsleReputationJson.java @@ -0,0 +1,34 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.List; +import java.util.Map; + +public class CrimsonIsleReputationJson { + @Expose + public Map FISHING; + + @Expose + public Map RESCUE; + + @Expose + public Map FETCH; + + @Expose + public Map DOJO; + + @Expose + public Map MINIBOSS; + + @Expose + public Map KUUDRA; + + public static class ReputationQuest { + @Expose + public String item; + + @Expose + public List location; + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DanceRoomInstructionsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DanceRoomInstructionsJson.java index 0f4568bbd..9316d8671 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DanceRoomInstructionsJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DanceRoomInstructionsJson.java @@ -7,4 +7,4 @@ import java.util.List; public class DanceRoomInstructionsJson { @Expose public List instructions; -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DicerDropsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DicerDropsJson.java new file mode 100644 index 000000000..996a558ea --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DicerDropsJson.java @@ -0,0 +1,31 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public class DicerDropsJson { + @Expose + public DicerType MELON; + + @Expose + public DicerType PUMPKIN; + + public static class DicerType { + @Expose + @SerializedName("total chance") + public Integer totalChance; + + @Expose + public List drops; + } + + public static class DropInfo { + @Expose + public Integer chance; + + @Expose + public List amount; + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DisabledFeaturesJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DisabledFeaturesJson.java new file mode 100644 index 000000000..45abedfa3 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DisabledFeaturesJson.java @@ -0,0 +1,10 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.Map; + +public class DisabledFeaturesJson { + @Expose + public Map features; +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/EnigmaSoulsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/EnigmaSoulsJson.java index 41c4451e5..5769520f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/EnigmaSoulsJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/EnigmaSoulsJson.java @@ -13,7 +13,8 @@ public class EnigmaSoulsJson { public static class EnigmaPosition { @Expose public String name; + @Expose public LorenzVec position; } -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java index 46fe188b6..87a80d391 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/GardenJson.java @@ -13,9 +13,20 @@ public class GardenJson { @Expose public Map> crop_milestones; + @Expose + public Map visitors; + @Expose public Map organic_matter; @Expose public Map fuel; -} + + public static class GardenVisitor { + @Expose + public String rarity; + + @Expose + public List need_items; + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/HideNotClickableItemsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/HideNotClickableItemsJson.java new file mode 100644 index 000000000..d4ac9c52b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/HideNotClickableItemsJson.java @@ -0,0 +1,30 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.List; + +public class HideNotClickableItemsJson { + @Expose + public MultiFilterJson hide_npc_sell; + + @Expose + public MultiFilterJson hide_in_storage; + + @Expose + public MultiFilterJson hide_player_trade; + + @Expose + public MultiFilterJson not_auctionable; + + @Expose + public SalvageFilter salvage; + + public static class SalvageFilter { + @Expose + public List armor; + + @Expose + public List items; + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ItemsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ItemsJson.java new file mode 100644 index 000000000..f37671913 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ItemsJson.java @@ -0,0 +1,14 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.List; +import java.util.Map; + +public class ItemsJson { + @Expose + public List crimson_armors; + + @Expose + public Map crimson_tiers; +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ModGuiSwitcherJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ModGuiSwitcherJson.java new file mode 100644 index 000000000..078b1f6ad --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ModGuiSwitcherJson.java @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ModGuiSwitcherJson { + + @Expose + public Map mods = new HashMap<>(); + + public static class Mod { + @Expose + public List description = new ArrayList<>(); + + @Expose + public String command = ""; + + @Expose + public List guiPath = new ArrayList<>(); + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ModsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ModsJson.java deleted file mode 100644 index 9e04d55c7..000000000 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ModsJson.java +++ /dev/null @@ -1,25 +0,0 @@ -package at.hannibal2.skyhanni.utils.jsonobjects; - -import com.google.gson.annotations.Expose; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class ModsJson { - - @Expose - public Map mods = new HashMap<>(); - - public static class Mod { - @Expose - public List description = new ArrayList<>(); - - @Expose - public String command = ""; - - @Expose - public List guiPath = new ArrayList<>(); - } -} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/MultiFilterJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/MultiFilterJson.java new file mode 100644 index 000000000..8704f91fb --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/MultiFilterJson.java @@ -0,0 +1,25 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.List; + +public class MultiFilterJson { + @Expose + public List equals; + + @Expose + public List startsWith; + + @Expose + public List endsWith; + + @Expose + public List contains; + + @Expose + public List containsWord; + + @Expose + public String description; +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ParkourJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ParkourJson.java index 71206d18c..5ae2d40ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ParkourJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/ParkourJson.java @@ -9,13 +9,15 @@ import java.util.List; public class ParkourJson { @Expose public List locations; + @Expose public List shortCuts = new ArrayList<>(); public static class ShortCut { @Expose public int from; + @Expose public int to; } -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/PlayerChatFilterJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/PlayerChatFilterJson.java new file mode 100644 index 000000000..a65a2f8a1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/PlayerChatFilterJson.java @@ -0,0 +1,10 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.List; + +public class PlayerChatFilterJson { + @Expose + public List filters; +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/RiftEffigiesJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/RiftEffigiesJson.java index 85453a3bf..d914ef934 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/RiftEffigiesJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/RiftEffigiesJson.java @@ -8,4 +8,4 @@ import java.util.List; public class RiftEffigiesJson { @Expose public List locations; -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SackListJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SackListJson.java deleted file mode 100644 index 11b4f09ed..000000000 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SackListJson.java +++ /dev/null @@ -1,10 +0,0 @@ -package at.hannibal2.skyhanni.utils.jsonobjects; - -import com.google.gson.annotations.Expose; - -import java.util.List; - -public class SackListJson { - @Expose - public List sackList; -} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SacksJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SacksJson.java new file mode 100644 index 000000000..dfd2103ef --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SacksJson.java @@ -0,0 +1,10 @@ +package at.hannibal2.skyhanni.utils.jsonobjects; + +import com.google.gson.annotations.Expose; + +import java.util.List; + +public class SacksJson { + @Expose + public List sackList; +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SlayerProfitTrackerItemsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SlayerProfitTrackerItemsJson.java index cbb6b2899..377582200 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SlayerProfitTrackerItemsJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/SlayerProfitTrackerItemsJson.java @@ -9,4 +9,4 @@ import java.util.Map; public class SlayerProfitTrackerItemsJson { @Expose public Map> slayers; -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/TrophyFishJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/TrophyFishJson.java index 719c0db2d..6303c16be 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/TrophyFishJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/TrophyFishJson.java @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.utils.jsonobjects; -import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishInfo; +import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity; import com.google.gson.annotations.Expose; import java.util.Map; @@ -8,4 +8,18 @@ import java.util.Map; public class TrophyFishJson { @Expose public Map trophy_fish; -} + + public static class TrophyFishInfo { + @Expose + public String displayName; + + @Expose + public String description; + + @Expose + public Integer rate; + + @Expose + public Map fillet; + } +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/VipVisitsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/VipVisitsJson.java index 8f3ffbe0f..c80f4953f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/VipVisitsJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/VipVisitsJson.java @@ -7,4 +7,4 @@ import java.util.List; public class VipVisitsJson { @Expose public List vipVisits; -} +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/WarpsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/WarpsJson.java index c5b1aa3c4..e09bf3c9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/WarpsJson.java +++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/WarpsJson.java @@ -7,4 +7,4 @@ import java.util.List; public class WarpsJson { @Expose public List warpCommands; -} +} \ No newline at end of file -- cgit