diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-30 10:32:51 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-30 10:32:51 +0200 |
commit | 1ccc29090f5e711759a2daebed87ab05f13e7580 (patch) | |
tree | ad1e99ec62a1e53bda4f85ad9fa5faad223ab457 /src/main/java/at/hannibal2 | |
parent | b0b17ca60ce4296b247079152c3899a167fcf59e (diff) | |
download | skyhanni-1ccc29090f5e711759a2daebed87ab05f13e7580.tar.gz skyhanni-1ccc29090f5e711759a2daebed87ab05f13e7580.tar.bz2 skyhanni-1ccc29090f5e711759a2daebed87ab05f13e7580.zip |
Fixed bits and powder not saving in the visitor drop statistics.
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/Storage.java | 9 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt | 42 |
2 files changed, 25 insertions, 26 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index 231202367..c495eb9fa 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -188,6 +188,15 @@ public class Storage { public long coinsSpent = 0; @Expose + public long bits = 0; + + @Expose + public long mithrilPowder = 0; + + @Expose + public long gemstonePowder = 0; + + @Expose public Map<VisitorReward, Integer> rewardsCount = new HashMap<>(); } 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 5c456e53a..d5f493467 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 @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.Storage import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -27,12 +28,6 @@ object GardenVisitorDropStatistics { var deniedVisitors = 0 private var totalVisitors = 0 private var visitorRarities = mutableListOf<Long>() - private var copper = 0 - private var gardenExp = 0 - private var farmingExp = 0L - private var bits = 0 - private var mithrilPowder = 0 - private var gemstonePowder = 0 var coinsSpent = 0L var lastAccept = 0L @@ -65,36 +60,37 @@ object GardenVisitorDropStatistics { if (!ProfileStorageData.loaded) return if (lastAccept - System.currentTimeMillis() <= 0 && lastAccept - System.currentTimeMillis() > -1000) { val message = event.message.removeColor().trim() + val hidden = GardenAPI.config?.visitorDrops ?: return copperPattern.matchMatcher(message) { val amount = group("amount").formatNumber().toInt() - copper += amount + hidden.copper += amount saveAndUpdate() } farmingExpPattern.matchMatcher(message) { val amount = group("amount").formatNumber() - farmingExp += amount + hidden.farmingExp += amount saveAndUpdate() } gardenExpPattern.matchMatcher(message) { val amount = group("amount").formatNumber().toInt() if (amount > 80) return // some of the low visitor milestones will get through but will be minimal - gardenExp += amount + hidden.gardenExp += amount saveAndUpdate() } bitsPattern.matchMatcher(message) { val amount = group("amount").formatNumber().toInt() - bits += amount + hidden.bits += amount saveAndUpdate() } mithrilPowderPattern.matchMatcher(message) { val amount = group("amount").formatNumber().toInt() - mithrilPowder += amount + hidden.mithrilPowder += amount saveAndUpdate() } gemstonePowderPattern.matchMatcher(message) { val amount = group("amount").formatNumber().toInt() - gemstonePowder += amount + hidden.gemstonePowder += amount saveAndUpdate() } acceptPattern.matchMatcher(message) { @@ -120,7 +116,7 @@ object GardenVisitorDropStatistics { saveAndUpdate() } - private fun drawVisitorStatsDisplay() = buildList<List<Any>> { + private fun drawVisitorStatsDisplay(hidden: Storage.ProfileSpecific.GardenStorage.VisitorDrops) = buildList<List<Any>> { //0 addAsSingletonList("§e§lVisitor Statistics") //1 @@ -144,9 +140,9 @@ object GardenVisitorDropStatistics { //5 addAsSingletonList("") //6 - addAsSingletonList(format(copper, "Copper", "§c", "")) + addAsSingletonList(format(hidden.copper, "Copper", "§c", "")) //7 - addAsSingletonList(format(farmingExp, "Farming EXP", "§3", "§7")) + addAsSingletonList(format(hidden.farmingExp, "Farming EXP", "§3", "§7")) //8 addAsSingletonList(format(coinsSpent, "Coins Spent", "§6", "")) @@ -165,13 +161,13 @@ object GardenVisitorDropStatistics { //17 addAsSingletonList("") //18 - addAsSingletonList(format(gardenExp, "Garden EXP", "§2", "§7")) + addAsSingletonList(format(hidden.gardenExp, "Garden EXP", "§2", "§7")) //19 - addAsSingletonList(format(bits, "Bits", "§b", "§b")) + addAsSingletonList(format(hidden.bits, "Bits", "§b", "§b")) //20 - addAsSingletonList(format(mithrilPowder, "Mithril Powder", "§2", "§2")) + addAsSingletonList(format(hidden.mithrilPowder, "Mithril Powder", "§2", "§2")) //21 - addAsSingletonList(format(gemstonePowder, "Gemstone Powder", "§d", "§d")) + addAsSingletonList(format(hidden.gemstonePowder, "Gemstone Powder", "§d", "§d")) } fun format(amount: Number, name: String, color: String, amountColor: String = color) = @@ -193,12 +189,9 @@ object GardenVisitorDropStatistics { hidden.deniedVisitors = deniedVisitors totalVisitors = acceptedVisitors + deniedVisitors hidden.visitorRarities = visitorRarities - hidden.copper = copper - hidden.farmingExp = farmingExp - hidden.gardenExp = gardenExp hidden.coinsSpent = coinsSpent hidden.rewardsCount = rewardsCount - display = formatDisplay(drawVisitorStatsDisplay()) + display = formatDisplay(drawVisitorStatsDisplay(hidden)) } @SubscribeEvent @@ -214,9 +207,6 @@ object GardenVisitorDropStatistics { deniedVisitors = hidden.deniedVisitors totalVisitors = acceptedVisitors + deniedVisitors visitorRarities = hidden.visitorRarities - copper = hidden.copper - farmingExp = hidden.farmingExp - gardenExp = hidden.gardenExp coinsSpent = hidden.coinsSpent rewardsCount = hidden.rewardsCount saveAndUpdate() |