diff options
Diffstat (limited to 'src/main/java/at')
8 files changed, 76 insertions, 33 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index 5e84daaf1..797f8d941 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -47,7 +47,25 @@ public class Storage { } @Expose - public GardenStorage garden = new GardenStorage(); + public CrimsonIsleStorage crimsonIsle = new CrimsonIsleStorage(); + + public static class CrimsonIsleStorage { + + @Expose + public List<String> quests = new ArrayList<>(); + + @Expose + public int latestTrophyFishInInventory = 0; + + @Expose + public List<String> miniBossesDoneToday = new ArrayList<>(); + + @Expose + public List<String> kuudraTiersDone = new ArrayList<>(); + } + + @Expose + public ProfileSpecific.GardenStorage garden = new ProfileSpecific.GardenStorage(); public static class GardenStorage { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/OldHidden.java b/src/main/java/at/hannibal2/skyhanni/config/features/OldHidden.java index 1feb80bbc..fbb59156d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/OldHidden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/OldHidden.java @@ -26,16 +26,16 @@ public class OldHidden { public Map<String, String> minionName = new HashMap<>(); @Expose - public List<String> crimsonIsleQuests = new ArrayList<>(); // TODO migration needed + public List<String> crimsonIsleQuests = new ArrayList<>(); @Expose - public int crimsonIsleLatestTrophyFishInInventory = 0; // TODO migration needed + public int crimsonIsleLatestTrophyFishInInventory = 0; @Expose - public List<String> crimsonIsleMiniBossesDoneToday = new ArrayList<>(); // TODO migration needed + public List<String> crimsonIsleMiniBossesDoneToday = new ArrayList<>(); @Expose - public List<String> crimsonIsleKuudraTiersDone = new ArrayList<>(); // TODO migration needed + public List<String> crimsonIsleKuudraTiersDone = new ArrayList<>(); @Expose public Map<CropType, Long> gardenCropCounter = new HashMap<>(); diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt index eeab991ea..46c06560e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt @@ -99,7 +99,14 @@ object ProfileStorageData { } } - profileSpecific?.garden?.let { + profileSpecific?.crimsonIsle?.let { + it.quests = oldHidden.crimsonIsleQuests + it.latestTrophyFishInInventory = oldHidden.crimsonIsleLatestTrophyFishInInventory + it.miniBossesDoneToday = oldHidden.crimsonIsleMiniBossesDoneToday + it.kuudraTiersDone = oldHidden.crimsonIsleKuudraTiersDone + } + + profileSpecific?.garden?.let { it.experience = oldHidden.gardenExp it.cropCounter = oldHidden.gardenCropCounter it.cropUpgrades = oldHidden.gardenCropUpgrades 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 ef9541d9f..e5acfeab1 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 @@ -2,6 +2,8 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.DailyKuudraBossHelper @@ -40,14 +42,24 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { fun onRepoReload(event: RepositoryReloadEvent) { repoData = event.getConstant("CrimsonIsleReputation")!! - miniBossHelper.load() - kuudraBossHelper.load() - - questHelper.load() + tryLoadConfig() update() } @SubscribeEvent + fun onConfigLoad(event: ConfigLoadEvent) { + tryLoadConfig() + } + + private fun tryLoadConfig() { + ProfileStorageData.profileSpecific?.crimsonIsle?.let { + miniBossHelper.load(it) + kuudraBossHelper.load(it) + questHelper.load(it) + } + } + + @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return @@ -100,9 +112,11 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { } fun update() { - questHelper.saveConfig() - miniBossHelper.saveConfig() - kuudraBossHelper.saveConfig() + ProfileStorageData.profileSpecific?.crimsonIsle?.let { + questHelper.saveConfig(it) + miniBossHelper.saveConfig(it) + kuudraBossHelper.saveConfig(it) + } dirty = true } 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 6b8da38e4..3bcf0d5b9 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -93,14 +94,14 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH updateAllKuudraDone() } - fun saveConfig() { - SkyHanniMod.feature.hidden.crimsonIsleKuudraTiersDone.clear() + fun saveConfig(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { + storage.kuudraTiersDone.clear() kuudraTiers.filter { it.doneToday } - .forEach { SkyHanniMod.feature.hidden.crimsonIsleKuudraTiersDone.add(it.name) } + .forEach { storage.kuudraTiersDone.add(it.name) } } - fun load() { + fun load(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { kuudraTiers.clear() //Repo @@ -120,7 +121,7 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH } //Config - for (name in SkyHanniMod.feature.hidden.crimsonIsleKuudraTiersDone) { + for (name in storage.kuudraTiersDone) { getByDisplayName(name)!!.doneToday = true } updateAllKuudraDone() 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 1c47b65c5..c686ede33 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper @@ -319,15 +320,16 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { latestTrophyFishInInventory = 0 } - fun load() { + fun load(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { reset() - questLoader.loadConfig() - latestTrophyFishInInventory = SkyHanniMod.feature.hidden.crimsonIsleLatestTrophyFishInInventory + questLoader.loadConfig(storage) + latestTrophyFishInInventory = storage.latestTrophyFishInInventory + } - fun saveConfig() { - SkyHanniMod.feature.hidden.crimsonIsleQuests.clear() + fun saveConfig(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { + storage.quests.clear() for (quest in quests) { val builder = StringBuilder() val internalName = quest.internalName @@ -347,10 +349,10 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } else { builder.append(":0") } - SkyHanniMod.feature.hidden.crimsonIsleQuests.add(builder.toString()) + storage.quests.add(builder.toString()) } - SkyHanniMod.feature.hidden.crimsonIsleLatestTrophyFishInInventory = latestTrophyFishInInventory + storage.latestTrophyFishInInventory = latestTrophyFishInInventory } private fun isEnabled() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.CRIMSON_ISLE && 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 22b1523d9..65bbce484 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 @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest -import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.* import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -138,8 +138,8 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { } } - fun loadConfig() { - for (text in SkyHanniMod.feature.hidden.crimsonIsleQuests) { + fun loadConfig(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { + for (text in storage.quests) { val split = text.split(":") val name = split[0] val state = QuestState.valueOf(split[1]) 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 56ba49a4d..63983f102 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager @@ -101,14 +102,14 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel } } - fun saveConfig() { - SkyHanniMod.feature.hidden.crimsonIsleMiniBossesDoneToday.clear() + fun saveConfig(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { + storage.miniBossesDoneToday.clear() miniBosses.filter { it.doneToday } - .forEach { SkyHanniMod.feature.hidden.crimsonIsleMiniBossesDoneToday.add(it.displayName) } + .forEach { storage.miniBossesDoneToday.add(it.displayName) } } - fun load() { + fun load(storage: Storage.ProfileSpecific.CrimsonIsleStorage) { miniBosses.clear() //Repo @@ -123,7 +124,7 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel } //Config - for (name in SkyHanniMod.feature.hidden.crimsonIsleMiniBossesDoneToday) { + for (name in storage.miniBossesDoneToday) { getByDisplayName(name)!!.doneToday = true } } |