aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-05 12:40:57 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-05 12:40:57 +0100
commit7721be72deb7acb5e3f133482a51e1286f875c47 (patch)
tree031c121d46a3fa085046ff4396b377a3f6d42bd1 /src/main
parent5f6cbe465b0914ac006bb7eac6975205ad4fb29a (diff)
downloadskyhanni-7721be72deb7acb5e3f133482a51e1286f875c47.tar.gz
skyhanni-7721be72deb7acb5e3f133482a51e1286f875c47.tar.bz2
skyhanni-7721be72deb7acb5e3f133482a51e1286f875c47.zip
Resetting parts of the inventory for users with 7-month-old SkyHanni versions that want to migrate into the present.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Features.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/OldHidden.java118
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt77
3 files changed, 1 insertions, 198 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java
index f5916cda8..ce6e0f1b2 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Features.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java
@@ -20,7 +20,6 @@ import at.hannibal2.skyhanni.config.features.MarkedPlayerConfig;
import at.hannibal2.skyhanni.config.features.MiningConfig;
import at.hannibal2.skyhanni.config.features.MinionsConfig;
import at.hannibal2.skyhanni.config.features.MiscConfig;
-import at.hannibal2.skyhanni.config.features.OldHidden;
import at.hannibal2.skyhanni.config.features.RiftConfig;
import at.hannibal2.skyhanni.config.features.SlayerConfig;
import com.google.gson.annotations.Expose;
@@ -145,9 +144,6 @@ public class Features extends Config {
public DevConfig dev = new DevConfig();
@Expose
- public OldHidden hidden = new OldHidden();
-
- @Expose
public Storage storage = new Storage();
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/OldHidden.java b/src/main/java/at/hannibal2/skyhanni/config/features/OldHidden.java
deleted file mode 100644
index a2694210f..000000000
--- a/src/main/java/at/hannibal2/skyhanni/config/features/OldHidden.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package at.hannibal2.skyhanni.config.features;
-
-import at.hannibal2.skyhanni.data.model.ComposterUpgrade;
-import at.hannibal2.skyhanni.features.garden.CropAccessory;
-import at.hannibal2.skyhanni.features.garden.CropType;
-import at.hannibal2.skyhanni.features.garden.farming.FarmingArmorDrops;
-import at.hannibal2.skyhanni.features.garden.visitor.VisitorReward;
-import com.google.gson.annotations.Expose;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class OldHidden {
-
- @Expose
- public String currentPet = "";
-
- @Expose
- public Map<String, Long> minionLastClick = new HashMap<>();
-
- @Expose
- public Map<String, String> minionName = new HashMap<>();
-
- @Expose
- public List<String> crimsonIsleQuests = new ArrayList<>();
-
- @Expose
- public List<String> crimsonIsleMiniBossesDoneToday = new ArrayList<>();
-
- @Expose
- public List<String> crimsonIsleKuudraTiersDone = new ArrayList<>();
-
- @Expose
- public Map<CropType, Long> gardenCropCounter = new HashMap<>();
-
- @Expose
- public Map<CropType, Integer> gardenCropUpgrades = new HashMap<>();
-
- @Expose
- public Map<CropType, Integer> gardenCropsPerSecond = new HashMap<>();
-
- @Expose
- public Map<CropType, Double> gardenLatestBlocksPerSecond = new HashMap<>();
-
- @Expose
- public Map<CropType, Double> gardenLatestTrueFarmingFortune = new HashMap<>();
-
- @Expose
- public int gardenExp = -1;
-
- @Expose
- public CropAccessory savedCropAccessory = null;
-
- @Expose
- public Map<String, Integer> gardenDicerRngDrops = new HashMap<>();
-
- @Expose
- public long informedAboutLowMatter = 0;
-
- @Expose
- public long informedAboutLowFuel = 0;
-
- @Expose
- public long visitorInterval = 15 * 60_000L;
-
- @Expose
- public long nextSixthVisitorArrival = 0;
-
- @Expose
- public Map<Long, List<CropType>> gardenJacobFarmingContestTimes = new HashMap<>();
-
- @Expose
- public Map<FarmingArmorDrops.ArmorDropType, Integer> gardenFarmingArmorDrops = new HashMap<>();
-
- @Expose
- public Map<ComposterUpgrade, Integer> gardenComposterUpgrades = new HashMap<>();
-
- @Expose
- public Map<CropType, Boolean> gardenToolHasBountiful = new HashMap<>();
-
- @Expose
- public String gardenComposterCurrentOrganicMatterItem = "";
-
- @Expose
- public String gardenComposterCurrentFuelItem = "";
-
-
- @Expose
- public VisitorDrops visitorDrops = new VisitorDrops();
-
- public static class VisitorDrops {
- @Expose
- public int acceptedVisitors = 0;
-
- @Expose
- public int deniedVisitors = 0;
-
- @Expose
- public List<Long> visitorRarities = new ArrayList<>();
-
- @Expose
- public int copper = 0;
-
- @Expose
- public long farmingExp = 0;
-
- @Expose
- public long coinsSpent = 0;
-
- @Expose
- public Map<VisitorReward, Integer> rewardsCount = new HashMap<>();
- }
-
- @Expose
- public boolean isMigrated = false;
-}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt
index 63f77f2d2..d14372419 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ProfileStorageData.kt
@@ -12,7 +12,6 @@ import at.hannibal2.skyhanni.events.PreProfileSwitchEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -115,7 +114,6 @@ object ProfileStorageData {
noTabListTime = -1
profileSpecific = playerSpecific.profiles.getOrPut(profileName) { Storage.ProfileSpecific() }
sackProfiles = sackProfile.profiles.getOrPut(profileName) { SackData.ProfileSpecific() }
- tryMigrateProfileSpecific()
loaded = true
ConfigLoadEvent().postAndCatch()
}
@@ -125,79 +123,6 @@ object ProfileStorageData {
val playerUuid = LorenzUtils.getRawPlayerUuid()
playerSpecific = SkyHanniMod.feature.storage.players.getOrPut(playerUuid) { Storage.PlayerSpecific() }
sackPlayers = SkyHanniMod.sackData.players.getOrPut(playerUuid) { SackData.PlayerSpecific() }
- migratePlayerSpecific()
ConfigLoadEvent().postAndCatch()
}
-
- private fun migratePlayerSpecific() {
- val oldHidden = SkyHanniMod.feature.hidden
- if (oldHidden.isMigrated) return
-
- SkyHanniMod.feature.storage?.let {
- it.gardenJacobFarmingContestTimes = oldHidden.gardenJacobFarmingContestTimes
- }
- }
-
- private fun tryMigrateProfileSpecific() {
- val oldHidden = SkyHanniMod.feature.hidden
- if (oldHidden.isMigrated) return
-
- profileSpecific?.let {
- it.currentPet = oldHidden.currentPet
-
- for ((rawLocation, minionName) in oldHidden.minionName) {
- val lastClick = oldHidden.minionLastClick[rawLocation] ?: -1
- val location = LorenzVec.decodeFromString(rawLocation)
- val minionConfig = Storage.ProfileSpecific.MinionConfig()
- minionConfig.displayName = minionName
- minionConfig.lastClicked = lastClick
- it.minions[location] = minionConfig
- }
- }
-
- profileSpecific?.crimsonIsle?.let {
- it.quests = oldHidden.crimsonIsleQuests
- it.miniBossesDoneToday = oldHidden.crimsonIsleMiniBossesDoneToday
- it.kuudraTiersDone = oldHidden.crimsonIsleKuudraTiersDone
- }
-
- profileSpecific?.garden?.let {
- it.experience = oldHidden.gardenExp.toLong()
- it.cropCounter = oldHidden.gardenCropCounter
- it.cropUpgrades = oldHidden.gardenCropUpgrades
-
- for ((crop, speed) in oldHidden.gardenCropsPerSecond) {
- if (speed != -1) {
- it.cropsPerSecond[crop] = speed
- }
- }
-
- it.latestBlocksPerSecond = oldHidden.gardenLatestBlocksPerSecond
- it.latestTrueFarmingFortune = oldHidden.gardenLatestTrueFarmingFortune
- it.savedCropAccessory = oldHidden.savedCropAccessory
- it.dicerRngDrops = oldHidden.gardenDicerRngDrops
- it.informedAboutLowMatter = oldHidden.informedAboutLowMatter
- it.informedAboutLowFuel = oldHidden.informedAboutLowFuel
- it.visitorInterval = oldHidden.visitorInterval
- it.nextSixthVisitorArrival = oldHidden.nextSixthVisitorArrival
- it.farmArmorDrops = oldHidden.gardenFarmingArmorDrops
- it.composterUpgrades = oldHidden.gardenComposterUpgrades
- it.toolWithBountiful = oldHidden.gardenToolHasBountiful
- it.composterCurrentOrganicMatterItem = oldHidden.gardenComposterCurrentOrganicMatterItem
- it.composterCurrentFuelItem = oldHidden.gardenComposterCurrentFuelItem
- }
-
- profileSpecific?.garden?.visitorDrops?.let {
- val old = oldHidden.visitorDrops
- it.acceptedVisitors = old.acceptedVisitors
- it.deniedVisitors = old.deniedVisitors
- it.visitorRarities = old.visitorRarities
- it.copper = old.copper
- it.farmingExp = old.farmingExp
- it.coinsSpent = old.coinsSpent
- it.rewardsCount = old.rewardsCount
- }
-
- oldHidden.isMigrated = true
- }
-} \ No newline at end of file
+}