diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt | 7 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt | 19 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 479569961..676c1f492 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -106,9 +106,14 @@ object GardenVisitorFeatures { @SubscribeEvent fun onVisitorOpen(event: VisitorOpenEvent) { val visitor = event.visitor - val offerItem = visitor.offer!!.offerItem + val offerItem = visitor.offer?.offerItem ?: return val lore = offerItem.getLore() + + // TODO make this workaround unnecessary (only read non lore info) + readToolTip(visitor, offerItem, lore.toMutableList()) + visitor.lastLore = emptyList() + for (line in lore) { if (line == "ยง7Items Required:") continue if (line.isEmpty()) break 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 295e3c08e..2a4a8db4b 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 @@ -193,23 +193,22 @@ object VisitorAPI { return visitorsInTab } - fun Visitor.blockReason(): VisitorBlockReason? { - - val visitorHasReward = config.rewardWarning.preventRefusing && this.hasReward() != null + fun Visitor.blockReason(): VisitorBlockReason? = with(config.rewardWarning) { + val visitorHasReward = preventRefusing && hasReward() != null if (visitorHasReward) { return VisitorBlockReason.RARE_REWARD } - else if (config.rewardWarning.preventRefusingNew && this.offersAccepted == 0) { + if (preventRefusingNew && offersAccepted == 0) { return VisitorBlockReason.NEVER_ACCEPTED } - val pricePerCopper = this.pricePerCopper ?: return VisitorBlockReason.EXPENSIVE_COPPER - return if (config.rewardWarning.preventRefusingCopper && pricePerCopper <= config.rewardWarning.coinsPerCopperPrice) { - VisitorBlockReason.CHEAP_COPPER + val pricePerCopper = pricePerCopper ?: error("pricePerCopper is null") + if (preventRefusingCopper && pricePerCopper <= coinsPerCopperPrice) { + return VisitorBlockReason.CHEAP_COPPER } - else if (config.rewardWarning.preventAcceptingCopper && pricePerCopper > config.rewardWarning.coinsPerCopperPrice) { - VisitorBlockReason.EXPENSIVE_COPPER + if (preventAcceptingCopper && pricePerCopper > coinsPerCopperPrice) { + return VisitorBlockReason.EXPENSIVE_COPPER } - else null + return null } enum class VisitorBlockReason(val description: String, val blockRefusing: Boolean) { |