aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-08-16 11:17:31 +0200
committerGitHub <noreply@github.com>2024-08-16 11:17:31 +0200
commita40a0f52410d2caf5901c666431851640e0ba542 (patch)
tree0387f91d7cc8025e8d4eae84522386fe4808c81c
parent27b8ca2f81a6f9b7f99980236209acb5985a23b3 (diff)
downloadskyhanni-a40a0f52410d2caf5901c666431851640e0ba542.tar.gz
skyhanni-a40a0f52410d2caf5901c666431851640e0ba542.tar.bz2
skyhanni-a40a0f52410d2caf5901c666431851640e0ba542.zip
Fix max barn space error (#2356)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt
index 31762ab2e..20d752e35 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.features.event.hoppity.HoppityCollectionData
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsCompactChat
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
@@ -77,10 +78,14 @@ object ChocolateFactoryBarnManager {
val profileStorage = profileStorage ?: return
+ // TODO rename maxRabbits to maxUnlockedBarnSpace
if (profileStorage.maxRabbits >= ChocolateFactoryAPI.maxRabbits) return
+ // when the unlocked barn space has already surpassed the total amount of rabbits
+ val alreadyBigEnough = profileStorage.maxRabbits >= HoppityCollectionData.knownRabbitCount
+
val remainingSpace = profileStorage.maxRabbits - profileStorage.currentRabbits
- barnFull = remainingSpace <= config.barnCapacityThreshold
+ barnFull = remainingSpace <= config.barnCapacityThreshold && !alreadyBigEnough
if (!barnFull) return
if (inventory && sentBarnFullWarning) return