From f093523b7cc083c70d8060df3614db6145e75a16 Mon Sep 17 00:00:00 2001 From: HiZe Date: Sun, 24 Mar 2024 00:39:34 +0100 Subject: Improvement: Visitor Drops Statistics reset command (#1135) Co-authored-by: superhize --- .../hannibal2/skyhanni/config/commands/Commands.kt | 5 +++++ .../garden/visitor/GardenVisitorDropStatistics.kt | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'src/main') 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 2290b8eac..28261296d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -44,6 +44,7 @@ import at.hannibal2.skyhanni.features.garden.farming.GardenStartLocation import at.hannibal2.skyhanni.features.garden.farming.lane.FarmingLaneCreator import at.hannibal2.skyhanni.features.garden.fortuneguide.CaptureFarmingGear import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorDropStatistics import at.hannibal2.skyhanni.features.mining.KingTalismanHelper import at.hannibal2.skyhanni.features.mining.powdertracker.PowderTracker import at.hannibal2.skyhanni.features.minion.MinionFeatures @@ -211,6 +212,10 @@ object Commands { "shresetfishingtracker", "Resets the Fishing Profit Tracker" ) { FishingProfitTracker.resetCommand(it) } + registerCommand( + "shresetvisitordrops", + "Reset the Visitors Drop Statistics" + ) { GardenVisitorDropStatistics.reset() } registerCommand("shbingotoggle", "Toggle the bingo card display mode") { BingoCardDisplay.toggleCommand() } registerCommand( "shfarmingprofile", diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index 994146d7b..3f9fc83b1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy @@ -233,6 +234,26 @@ object GardenVisitorDropStatistics { display = formatDisplay(drawDisplay(storage)) } + fun reset() { + val storage = GardenAPI.storage?.visitorDrops ?: return + ChatUtils.clickableChat("Click here to reset Visitor Drops Statistics.", onClick = { + acceptedVisitors = 0 + deniedVisitors = 0 + totalVisitors = 0 + coinsSpent = 0 + storage.copper = 0 + storage.bits = 0 + storage.farmingExp = 0 + storage.gardenExp = 0 + storage.gemstonePowder = 0 + storage.mithrilPowder = 0 + storage.visitorRarities = arrayListOf(0, 0, 0, 0, 0) + storage.rewardsCount = mapOf() + ChatUtils.chat("Visitor Drop Statistics reset!") + saveAndUpdate() + }) + } + @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { val storage = GardenAPI.storage?.visitorDrops ?: return -- cgit