diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-04-25 09:59:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-25 09:59:45 +0200 |
commit | ec1e6bfd635311d940ee9e0dc80832c64021aa3e (patch) | |
tree | 7b94f1f59ea2ccbe66554d7ec787998a4d7b508d /src/main | |
parent | f3b3b44296b8a6ac77ecad433ca28e7a03a9eaf2 (diff) | |
download | skyhanni-ec1e6bfd635311d940ee9e0dc80832c64021aa3e.tar.gz skyhanni-ec1e6bfd635311d940ee9e0dc80832c64021aa3e.tar.bz2 skyhanni-ec1e6bfd635311d940ee9e0dc80832c64021aa3e.zip |
Fix: Command to clear kismet (#1539)
Diffstat (limited to 'src/main')
3 files changed, 16 insertions, 6 deletions
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 e4a09e54e..36494c359 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil import at.hannibal2.skyhanni.features.commands.PartyCommands import at.hannibal2.skyhanni.features.commands.WikiManager +import at.hannibal2.skyhanni.features.dungeon.CroesusChestTracker import at.hannibal2.skyhanni.features.event.diana.AllBurrowsList import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper import at.hannibal2.skyhanni.features.event.diana.DianaProfitTracker @@ -359,6 +360,10 @@ object Commands { "Shows the status of all the mods constants" ) { SkyHanniMod.repo.displayRepoStatus(false) } registerCommand( + "shclearksimet", + "Cleares the saved values of the applied kismet feathers in Croesus" + ) { CroesusChestTracker.resetChest() } + registerCommand( "shkingfix", "Reseting the local King Talisman Helper offset." ) { KingTalismanHelper.kingFix() } diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java index e1f0a23c8..f70d530e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java @@ -40,8 +40,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; public class ProfileSpecificStorage { @@ -434,10 +432,7 @@ public class ProfileSpecificStorage { public Map<DungeonFloor, Integer> bosses = new HashMap<>(); @Expose - public List<DungeonStorage.DungeonRunInfo> runs = Stream.generate(DungeonStorage.DungeonRunInfo::new) - .limit(CroesusChestTracker.Companion.getMaxChests()) - .collect(Collectors.toCollection(ArrayList::new)); - + public List<DungeonStorage.DungeonRunInfo> runs = CroesusChestTracker.Companion.generateMaxChestAsList(); public static class DungeonRunInfo { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt index 176a40f59..a8a440617 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI.DungeonChest import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.InventoryUtils.getAmountInInventory import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -261,6 +262,15 @@ class CroesusChestTracker { private val croesusChests get() = ProfileStorageData.profileSpecific?.dungeons?.runs + fun resetChest() = croesusChests?.let { + it.clear() + it.addAll(generateMaxChest()) + ChatUtils.chat("Kismet State was cleared!") + } + + fun generateMaxChest() = generateSequence { DungeonRunInfo() }.take(maxChests) + fun generateMaxChestAsList() = generateMaxChest().toList() + fun getLastActiveChest(includeDungeonKey: Boolean = false) = (croesusChests?.indexOfLast { it.floor != null && |