aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-28 12:21:39 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-28 12:21:39 +0200
commit6eb301f7170bdb67caca797623e8880f71b90791 (patch)
treee9e21db95f82678cc58d3c9b5d3deb51b898d9be /src/main/java
parent1053fb5ebf83d1a75ade1b0fba0a4eeb6ec59f4f (diff)
downloadskyhanni-6eb301f7170bdb67caca797623e8880f71b90791.tar.gz
skyhanni-6eb301f7170bdb67caca797623e8880f71b90791.tar.bz2
skyhanni-6eb301f7170bdb67caca797623e8880f71b90791.zip
code cleanup in ff
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt46
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt3
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
}