aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt20
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) {