diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-29 09:05:10 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-29 09:05:10 +0100 |
commit | cc7422d5ccb78516b00198f9f5749a467332ce99 (patch) | |
tree | f881093c3a65297423aefc2d47daf1326b01f2e2 /src/main/java/at/hannibal2 | |
parent | 1b5ad8132117960dcfb374d55ae84fa9aa876252 (diff) | |
download | skyhanni-cc7422d5ccb78516b00198f9f5749a467332ce99.tar.gz skyhanni-cc7422d5ccb78516b00198f9f5749a467332ce99.tar.bz2 skyhanni-cc7422d5ccb78516b00198f9f5749a467332ce99.zip |
Created LorenzRarity.isAtLeast()
Diffstat (limited to 'src/main/java/at/hannibal2')
-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 }
|