Skip to content

Commit

Permalink
Fix: Command to clear kismet (#1539)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunderblade73 authored Apr 25, 2024
1 parent f3b3b44 commit ec1e6bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -358,6 +359,10 @@ object Commands {
"shrepostatus",
"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."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
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 {

Expand Down Expand Up @@ -434,10 +432,7 @@ public static class DungeonStorage {
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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 &&
Expand Down

0 comments on commit ec1e6bf

Please sign in to comment.