diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
3 files changed, 28 insertions, 29 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index bb91289bc..d2c1b2c4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -255,10 +255,10 @@ class FarmingFortuneDisplay { val baseFortune = if (alwaysBaseFortune) 100.0 else baseFortune var carrotFortune = 0.0 - val hidden = GardenAPI.config?.fortune - if (currentCrop != null && hidden != null) { - if (currentCrop == CropType.CARROT) { - if (hidden.carrotFortune) carrotFortune = 12.0 + + if (currentCrop == CropType.CARROT) { + GardenAPI.config?.fortune?.let { + if (it.carrotFortune) carrotFortune = 12.0 } } return baseFortune + upgradeFortune + tabFortune + toolFortune + accessoryFortune + carrotFortune diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index 54f0fa6bd..f90fbd625 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -116,53 +116,53 @@ class CaptureFarmingGear { } if (event.inventoryName.contains("Pets")) { // If they've 2 of same pet, one will be overwritten - if (farmingItems[FarmingItems.ELEPHANT] == null) { - farmingItems[FarmingItems.ELEPHANT] = FFGuideGUI.getFallbackItem(FarmingItems.ELEPHANT) - } - if (farmingItems[FarmingItems.MOOSHROOM_COW] == null) { - farmingItems[FarmingItems.MOOSHROOM_COW] = FFGuideGUI.getFallbackItem(FarmingItems.MOOSHROOM_COW) - } - if (farmingItems[FarmingItems.RABBIT] == null) { - farmingItems[FarmingItems.RABBIT] = FFGuideGUI.getFallbackItem(FarmingItems.RABBIT) - } - if (farmingItems[FarmingItems.BEE] == null) { - farmingItems[FarmingItems.BEE] = FFGuideGUI.getFallbackItem(FarmingItems.BEE) + // optimize + + for (pet in listOf( + FarmingItems.ELEPHANT, + FarmingItems.MOOSHROOM_COW, + FarmingItems.RABBIT, + FarmingItems.BEE + )) { + if (farmingItems[pet] == null) { + farmingItems[pet] = FFGuideGUI.getFallbackItem(pet) + } } // setting to current saved level -1 to stop later pages saving low rarity pets - var highestElephantLvl = ItemUtils.getPetRarityOld(farmingItems[FarmingItems.ELEPHANT]) - var highestMooshroomLvl = ItemUtils.getPetRarityOld(farmingItems[FarmingItems.MOOSHROOM_COW]) - var highestRabbitLvl = ItemUtils.getPetRarityOld(farmingItems[FarmingItems.RABBIT]) - var highestBeeLvl = ItemUtils.getPetRarityOld(farmingItems[FarmingItems.BEE]) + var highestElephantRarity = ItemUtils.getPetRarityOld(farmingItems[FarmingItems.ELEPHANT]) + var highestMooshroomRarity = ItemUtils.getPetRarityOld(farmingItems[FarmingItems.MOOSHROOM_COW]) + var highestRabbitRarity = ItemUtils.getPetRarityOld(farmingItems[FarmingItems.RABBIT]) + var highestBeeRarity = ItemUtils.getPetRarityOld(farmingItems[FarmingItems.BEE]) for ((_, item) in event.inventoryItems) { val split = item.getInternalName_old().split(";") if (split.first() == "ELEPHANT") { - if (split.last().toInt() > highestElephantLvl) { + if (split.last().toInt() > highestElephantRarity) { farmingItems[FarmingItems.ELEPHANT] = item outdatedItems[FarmingItems.ELEPHANT] = false - highestElephantLvl = split.last().toInt() + highestElephantRarity = split.last().toInt() } } if (split.first() == "MOOSHROOM_COW") { - if (split.last().toInt() > highestMooshroomLvl) { + if (split.last().toInt() > highestMooshroomRarity) { farmingItems[FarmingItems.MOOSHROOM_COW] = item outdatedItems[FarmingItems.MOOSHROOM_COW] = false - highestMooshroomLvl = split.last().toInt() + highestMooshroomRarity = split.last().toInt() } } if (split.first() == "RABBIT") { - if (split.last().toInt() > highestRabbitLvl) { + if (split.last().toInt() > highestRabbitRarity) { farmingItems[FarmingItems.RABBIT] = item outdatedItems[FarmingItems.RABBIT] = false - highestRabbitLvl = split.last().toInt() + highestRabbitRarity = split.last().toInt() } } if (split.first() == "BEE") { - if (split.last().toInt() > highestBeeLvl) { + if (split.last().toInt() > highestBeeRarity) { farmingItems[FarmingItems.BEE] = item outdatedItems[FarmingItems.BEE] = false - highestBeeLvl = split.last().toInt() + highestBeeRarity = split.last().toInt() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt index d18c91bb8..2e6ccd5a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt @@ -255,8 +255,7 @@ object FFStats { 0.2 * petLevel } else if (rawInternalName.contains("BEE;3") || rawInternalName.contains("BEE;4")) { 0.3 * petLevel - } - else 0.0 + } else 0.0 } return 0.0 } |