From 222c9082b80e151c467e2ae14a2dd704e77e954c Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 7 Aug 2023 11:48:58 +0200 Subject: code cleanup --- .../features/garden/farming/CropMoneyDisplay.kt | 30 +++++++++++++--------- .../features/garden/farming/GardenCropSpeed.kt | 2 +- .../garden/farming/GardenCustomKeybinds.kt | 3 +-- 3 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 730306c6b..1adbdf498 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -106,16 +106,18 @@ object CropMoneyDisplay { return newDisplay } - var extraMushroomCowPerk = 0.0 - var extraDicerDrops = 0.0 + var extraMushroomCowPerkCoins = 0.0 + var extraDicerCoins = 0.0 GardenAPI.getCurrentlyFarmedCrop()?.let { val reforgeName = InventoryUtils.getItemInHand()?.getReforgeName() toolHasBountiful?.put(it, reforgeName == "bountiful") if (GardenAPI.mushroomCowPet && it != CropType.MUSHROOM && config.moneyPerHourMooshroom) { val (redPrice, brownPrice) = if (LorenzUtils.noTradeMode) { - val redPrice = (BazaarApi.getBazaarDataByInternalName("ENCHANTED_RED_MUSHROOM")?.npcPrice ?: 160.0) / 160 - val brownPrice = (BazaarApi.getBazaarDataByInternalName("ENCHANTED_BROWN_MUSHROOM")?.npcPrice ?: 160.0) / 160 + val redPrice = + (BazaarApi.getBazaarDataByInternalName("ENCHANTED_RED_MUSHROOM")?.npcPrice ?: 160.0) / 160 + val brownPrice = + (BazaarApi.getBazaarDataByInternalName("ENCHANTED_BROWN_MUSHROOM")?.npcPrice ?: 160.0) / 160 redPrice to brownPrice } else { val redPrice = NEUItems.getPrice("ENCHANTED_RED_MUSHROOM") / 160 @@ -125,10 +127,12 @@ object CropMoneyDisplay { val mushroomPrice = (redPrice + brownPrice) / 2 val perSecond = GardenCropSpeed.getRecentBPS() * it.multiplier * mushroomPrice - extraMushroomCowPerk = perSecond * 60 * 60 + extraMushroomCowPerkCoins = perSecond * 60 * 60 } - if (InventoryUtils.getItemInHand()?.getInternalName()?.contains("DICER") == true && config.moneyPerHourDicer) { + if (InventoryUtils.getItemInHand()?.getInternalName() + ?.contains("DICER") == true && config.moneyPerHourDicer + ) { var dicerDrops = 0.0 var bazaarData: BazaarData? = null if (it == CropType.MELON) { @@ -140,8 +144,9 @@ object CropMoneyDisplay { bazaarData = BazaarApi.getBazaarDataByInternalName("ENCHANTED_PUMPKIN") } if (bazaarData != null) { - val price = if (LorenzUtils.noTradeMode) bazaarData.npcPrice / 160 else (bazaarData.sellPrice + bazaarData.buyPrice) / 320 - extraDicerDrops = 60 * 60 * GardenCropSpeed.getRecentBPS() * dicerDrops * price + val price = + if (LorenzUtils.noTradeMode) bazaarData.npcPrice / 160 else (bazaarData.sellPrice + bazaarData.buyPrice) / 320 + extraDicerCoins = 60 * 60 * GardenCropSpeed.getRecentBPS() * dicerDrops * price } } } @@ -203,12 +208,12 @@ object CropMoneyDisplay { val moneyArray = moneyPerHourData[internalName]!! for (price in moneyArray) { - val finalPrice = price + extraMushroomCowPerk + extraDicerDrops + val finalPrice = price + extraMushroomCowPerkCoins + extraDicerCoins val format = format(finalPrice) if (debug) { newDisplay.addAsSingletonList(" price: ${price.addSeparators()}") - newDisplay.addAsSingletonList(" extraMushroomCowPerk: ${extraMushroomCowPerk.addSeparators()}") - newDisplay.addAsSingletonList(" extraDicerDrops: ${extraDicerDrops.addSeparators()}") + newDisplay.addAsSingletonList(" extraMushroomCowPerkCoins: ${extraMushroomCowPerkCoins.addSeparators()}") + newDisplay.addAsSingletonList(" existing extraDicerCoins: ${extraDicerCoins.addSeparators()}") newDisplay.addAsSingletonList(" finalPrice: ${finalPrice.addSeparators()}") } list.add("$coinsColor$format") @@ -335,7 +340,8 @@ object CropMoneyDisplay { } } - val bountifulMoney = if (toolHasBountiful?.get(crop) == true && config.moneyPerHourBountiful) speedPerHour * 0.2 else 0.0 + val bountifulMoney = + if (toolHasBountiful?.get(crop) == true && config.moneyPerHourBountiful) speedPerHour * 0.2 else 0.0 if (debug && bountifulMoney > 0.0) { debugList.addAsSingletonList(" bountifulCoins: ${bountifulMoney.addSeparators()}") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index dd911b723..bcf8e7811 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -114,7 +114,7 @@ object GardenCropSpeed { if (tier != -1 && melonDicer.size > 0 && pumpkinDicer.size > 0) { if (it == CropType.MELON) { latestMelonDicer = melonDicer[tier] - } else if (it == CropType.PUMPKIN){ + } else if (it == CropType.PUMPKIN) { latestPumpkinDicer = pumpkinDicer[tier] } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt index b920cdba6..41d88190f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt @@ -1,7 +1,6 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.features.Garden import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.mixins.transformers.AccessorKeyBinding import net.minecraft.client.Minecraft @@ -14,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable import java.util.* object GardenCustomKeybinds { - private val shConfig: Garden get() = SkyHanniMod.feature.garden + private val shConfig get() = SkyHanniMod.feature.garden private val mcSettings get() = Minecraft.getMinecraft().gameSettings private val map: MutableMap Int> = IdentityHashMap() -- cgit