diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-04-10 11:21:23 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-04-10 11:21:23 +0200 |
commit | 1670e49c1b3650ac16a8bac98c43faf580a88434 (patch) | |
tree | 976b4cf7697956da39a57723549567cf88ea3dab /src/main/java/at/hannibal2/skyhanni | |
parent | c5c4886ac28d3ed40413ecf88cc26dd72cdc28fe (diff) | |
download | skyhanni-1670e49c1b3650ac16a8bac98c43faf580a88434.tar.gz skyhanni-1670e49c1b3650ac16a8bac98c43faf580a88434.tar.bz2 skyhanni-1670e49c1b3650ac16a8bac98c43faf580a88434.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt index 2a4a8db4b..b89981257 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt @@ -194,21 +194,15 @@ object VisitorAPI { } fun Visitor.blockReason(): VisitorBlockReason? = with(config.rewardWarning) { - val visitorHasReward = preventRefusing && hasReward() != null - if (visitorHasReward) { - return VisitorBlockReason.RARE_REWARD - } - if (preventRefusingNew && offersAccepted == 0) { - return VisitorBlockReason.NEVER_ACCEPTED - } val pricePerCopper = pricePerCopper ?: error("pricePerCopper is null") - if (preventRefusingCopper && pricePerCopper <= coinsPerCopperPrice) { - return VisitorBlockReason.CHEAP_COPPER - } - if (preventAcceptingCopper && pricePerCopper > coinsPerCopperPrice) { - return VisitorBlockReason.EXPENSIVE_COPPER + return when { + preventRefusing && hasReward() != null -> VisitorBlockReason.RARE_REWARD + preventRefusingNew && offersAccepted == 0 -> VisitorBlockReason.NEVER_ACCEPTED + preventRefusingCopper && pricePerCopper <= coinsPerCopperPrice -> VisitorBlockReason.CHEAP_COPPER + preventAcceptingCopper && pricePerCopper > coinsPerCopperPrice -> VisitorBlockReason.EXPENSIVE_COPPER + + else -> null } - return null } enum class VisitorBlockReason(val description: String, val blockRefusing: Boolean) { |