diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt | 10 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 5288baf13..dffb6f0ef 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -29,9 +29,7 @@ import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside -import at.hannibal2.skyhanni.utils.LorenzRarity.EPIC -import at.hannibal2.skyhanni.utils.LorenzRarity.LEGENDARY -import at.hannibal2.skyhanni.utils.LorenzRarity.RARE +import at.hannibal2.skyhanni.utils.LorenzRarity import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec @@ -50,8 +48,10 @@ object GardenAPI { var toolInHand: String? = null var itemInHand: ItemStack? = null var cropInHand: CropType? = null - val mushroomCowPet get() = PetAPI.isCurrentPet("Mooshroom Cow") && - GardenAPI.storage?.fortune?.farmingItems[FarmingItems.MOOSHROOM_COW]?.getItemRarityOrNull() in listOf(RARE, EPIC, LEGENDARY) + val mushroomCowPet + get() = PetAPI.isCurrentPet("Mooshroom Cow") && + storage?.fortune?.farmingItems?.get(FarmingItems.MOOSHROOM_COW) + ?.let { it.getItemRarityOrNull()?.isAtLeast(LorenzRarity.RARE) } ?: false private var inBarn = false val onBarnPlot get() = inBarn && inGarden() val storage get() = ProfileStorageData.profileSpecific?.garden diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt index b0aca2439..64d5f8538 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt @@ -51,6 +51,8 @@ enum class LorenzRarity(val color: LorenzColor, val id: Int) { return rarityBelow
}
+ fun isAtLeast(other: LorenzRarity): Boolean = this.ordinal >= other.ordinal
+
companion object {
fun getById(id: Int) = entries.firstOrNull { it.ordinal == id }
fun getByName(name: String) = entries.firstOrNull { it.name == name }
|