diff options
author | Max <max.bodifee@gmail.com> | 2024-05-17 02:15:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-17 11:15:09 +0200 |
commit | 467048e077446db815a148d9d0a886d17f3dff66 (patch) | |
tree | 423cd6e28c0f63ace446aa56d47ae88ee8274f27 /src/main/java/at/hannibal2 | |
parent | d0d601984ece1185a3a15c78819c3d35c132e036 (diff) | |
download | skyhanni-467048e077446db815a148d9d0a886d17f3dff66.tar.gz skyhanni-467048e077446db815a148d9d0a886d17f3dff66.tar.bz2 skyhanni-467048e077446db815a148d9d0a886d17f3dff66.zip |
Fix: FF Guide GUI not displaying because of new farming content (#1817)
Diffstat (limited to 'src/main/java/at/hannibal2')
9 files changed, 68 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 647e0dbe6..b8fa95d85 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -378,6 +378,10 @@ object Commands { "Toggles receiving the 12 fortune from pumpkins" ) { CaptureFarmingGear.reversePumpkinFortune() } registerCommand( + "shcocoabeans", + "Toggles receiving the 12 fortune from cocoa beans" + ) { CaptureFarmingGear.reverseCocoaBeansFortune() } + registerCommand( "shrepostatus", "Shows the status of all the mods constants" ) { SkyHanniMod.repo.displayRepoStatus(false) } diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java index a533edcdc..f08ffddd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java @@ -346,6 +346,9 @@ public class ProfileSpecificStorage { public boolean pumpkinFortune = false; @Expose + public boolean cocoaBeansFortune = false; + + @Expose public Map<FarmingItems, ItemStack> farmingItems = new HashMap<>(); } 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 92ebceccd..367ce5a55 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -53,7 +53,7 @@ object FarmingFortuneDisplay { ) private val tooltipFortunePattern by patternGroup.pattern( "tooltip", - "^§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?\$" + "^§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?(?: §d\\(\\+(\\d+)\\))?\$" ) private val armorAbilityPattern by patternGroup.pattern( "armorability", @@ -63,7 +63,6 @@ object FarmingFortuneDisplay { "lotusability", "§7Piece Bonus: §6+(?<bonus>.*)☘" ) - // todo make pattern work on Melon and Cropie armor private val armorAbilityFortunePattern by patternGroup.pattern( "armorabilityfortune", @@ -83,8 +82,10 @@ object FarmingFortuneDisplay { var displayedFortune = 0.0 var reforgeFortune = 0.0 + var gemstoneFortune = 0.0 var itemBaseFortune = 0.0 var greenThumbFortune = 0.0 + var pesterminatorFortune = 0.0 private var foundTabUniversalFortune = false private var foundTabCropFortune = false @@ -305,6 +306,7 @@ object FarmingFortuneDisplay { fun getSunderFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("sunder") ?: 0) * 12.5 fun getHarvestingFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("harvesting") ?: 0) * 12.5 fun getCultivatingFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("cultivating") ?: 0) * 2.0 + fun getPesterminatorFortune(tool: ItemStack?) = (tool?.getEnchantments()?.get("pesterminator") ?: 0) * 1.0 fun getAbilityFortune(item: ItemStack?) = item?.let { getAbilityFortune(it.getInternalName(), it.getLore()) @@ -334,22 +336,25 @@ object FarmingFortuneDisplay { fun loadFortuneLineData(tool: ItemStack?, enchantmentFortune: Double) { displayedFortune = 0.0 reforgeFortune = 0.0 + gemstoneFortune = 0.0 itemBaseFortune = 0.0 greenThumbFortune = 0.0 + pesterminatorFortune = getPesterminatorFortune(tool) - //TODO code cleanup + // TODO code cleanup (after ff rework) for (line in tool?.getLore()!!) { tooltipFortunePattern.matchMatcher(line) { displayedFortune = group(1)!!.toDouble() reforgeFortune = group(2)?.toDouble() ?: 0.0 + gemstoneFortune = group(3)?.toDouble() ?: 0.0 } ?: continue itemBaseFortune = if (tool.getInternalName().contains("LOTUS")) { 5.0 } else { val dummiesFF = (tool.getFarmingForDummiesCount() ?: 0) * 1.0 - displayedFortune - reforgeFortune - enchantmentFortune - dummiesFF + displayedFortune - reforgeFortune - gemstoneFortune - pesterminatorFortune - enchantmentFortune - dummiesFF } greenThumbFortune = if (tool.getInternalName().contains("LOTUS")) { displayedFortune - reforgeFortune - itemBaseFortune diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt index 70dbcb1e8..be5bde924 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt @@ -71,8 +71,10 @@ class ToolTooltipTweaks { val displayedFortune = FarmingFortuneDisplay.displayedFortune val reforgeFortune = FarmingFortuneDisplay.reforgeFortune + val gemstoneFortune = FarmingFortuneDisplay.gemstoneFortune val baseFortune = FarmingFortuneDisplay.itemBaseFortune val greenThumbFortune = FarmingFortuneDisplay.greenThumbFortune + val pesterminatorFortune = FarmingFortuneDisplay.pesterminatorFortune val totalFortune = displayedFortune + hiddenFortune @@ -91,8 +93,10 @@ class ToolTooltipTweaks { iterator.addStat(" §7Base: §6+", baseFortune) iterator.addStat(" §7Tool: §6+", toolFortune) iterator.addStat(" §7${reforgeName?.removeColor()}: §9+", reforgeFortune) + iterator.addStat(" §7Gemstone: §d+", gemstoneFortune) iterator.addStat(" §7Ability: §2+", abilityFortune) iterator.addStat(" §7Green Thumb: §a+", greenThumbFortune) + iterator.addStat(" §7Pesterminator: §a+", pesterminatorFortune) iterator.addStat(" §7Sunder: §a+", sunderFortune) iterator.addStat(" §7Harvesting: §a+", harvestingFortune) iterator.addStat(" §7Cultivating: §a+", cultivatingFortune) 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 4d3cc3ae1..111fa58df 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 @@ -125,6 +125,12 @@ object CaptureFarmingGear { ChatUtils.chat("Toggled expired pumpkin fortune to: ${storage.pumpkinFortune}") } + fun reverseCocoaBeansFortune() { + val storage = GardenAPI.storage?.fortune ?: return + storage.cocoaBeansFortune = !storage.cocoaBeansFortune + ChatUtils.chat("Toggled supreme chocolate bar fortune to: ${storage.cocoaBeansFortune}") + } + private fun getUniqueVisitorsForTier(tier: Int): Int { return when { tier == 0 -> 0 @@ -353,6 +359,9 @@ object CaptureFarmingGear { if (msg == "PUMPKINS EXPORTATION COMPLETE!") { storage.pumpkinFortune = true } + if (msg == "CHOCOLATE BARS EXPORTATION COMPLETE!") { + storage.cocoaBeansFortune = true + } if (msg == "[NPC] Carrolyn: Thank you for the carrots.") { storage.carrotFortune = true ChatUtils.chat("§aYou have already given Carrolyn enough Exportable Carrots.") @@ -361,5 +370,9 @@ object CaptureFarmingGear { storage.pumpkinFortune = true ChatUtils.chat("§aYou have already given Carrolyn enough Expired Pumpkins.") } + if (msg == "[NPC] Carrolyn: Thank you for the chocolate.") { + storage.cocoaBeansFortune = true + ChatUtils.chat("§aYou have already given Carrolyn enough Supreme Chocolate Bars.") + } } } 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 c7b38164e..0b27856fd 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 @@ -86,7 +86,7 @@ object FFStats { fun getCropStats(crop: CropType, tool: ItemStack) { cropPage.clear() - cropPage[FortuneStats.BASE] = Pair(totalBaseFF[FFTypes.TOTAL] ?: 100.0, 1277.0) + cropPage[FortuneStats.BASE] = Pair(totalBaseFF[FFTypes.TOTAL] ?: 100.0, if (usingSpeedBoots) 1373.0 else 1377.0) cropPage[FortuneStats.CROP_UPGRADE] = Pair((crop.getUpgradeLevel()?.toDouble() ?: 0.0) * 5.0, 45.0) cropPage[FortuneStats.ACCESSORY] = Pair(CropAccessoryData.cropAccessory?.getFortune(crop) ?: 0.0, 30.0) cropPage[FortuneStats.FFD] = Pair((tool.getFarmingForDummiesCount() ?: 0).toDouble(), 5.0) @@ -103,28 +103,33 @@ object FFStats { cropPage[FortuneStats.HARVESTING] = Pair(FarmingFortuneDisplay.getHarvestingFortune(tool), 75.0) cropPage[FortuneStats.COLLECTION] = Pair(FarmingFortuneDisplay.getCollectionFortune(tool), 48.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 20.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 30.0) } in dicerCrops -> { cropPage[FortuneStats.SUNDER] = Pair(FarmingFortuneDisplay.getSunderFortune(tool), 75.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 20.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 20.0) } CropType.MUSHROOM -> { cropPage[FortuneStats.BASE_TOOL] = Pair(FarmingFortuneDisplay.getToolFortune(tool), 30.0) cropPage[FortuneStats.HARVESTING] = Pair(FarmingFortuneDisplay.getHarvestingFortune(tool), 75.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 16.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 16.0) } CropType.COCOA_BEANS -> { cropPage[FortuneStats.BASE_TOOL] = Pair(FarmingFortuneDisplay.getToolFortune(tool), 20.0) cropPage[FortuneStats.SUNDER] = Pair(FarmingFortuneDisplay.getSunderFortune(tool), 75.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 16.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 16.0) } CropType.CACTUS -> { cropPage[FortuneStats.HARVESTING] = Pair(FarmingFortuneDisplay.getHarvestingFortune(tool), 75.0) cropPage[FortuneStats.REFORGE] = Pair(FarmingFortuneDisplay.reforgeFortune, 16.0) + cropPage[FortuneStats.GEMSTONE] = Pair(FarmingFortuneDisplay.gemstoneFortune, 16.0) } else -> {} @@ -139,6 +144,11 @@ object FFStats { val pumpkinFortune = if (storage.pumpkinFortune) 12.0 else 0.0 cropPage[FortuneStats.EXPIRED_PUMPKIN] = Pair(pumpkinFortune, 12.0) } + if (crop == CropType.COCOA_BEANS) { + val storage = GardenAPI.storage?.fortune ?: return + val cocoaBeansFortune = if (storage.cocoaBeansFortune) 12.0 else 0.0 + cropPage[FortuneStats.SUPREME_CHOCOLATE_BAR] = Pair(cocoaBeansFortune, 12.0) + } cropPage[FortuneStats.CROP_TOTAL] = Pair( cropPage.toList().sumOf { it.second.first }, @@ -156,10 +166,12 @@ object FFStats { } private fun getArmorFFData(item: ItemStack, out: MutableMap<FFTypes, Double>) { - out[FFTypes.TOTAL] = 0.0 FarmingFortuneDisplay.loadFortuneLineData(item, 0.0) + out[FFTypes.TOTAL] = 0.0 out[FFTypes.BASE] = FarmingFortuneDisplay.itemBaseFortune out[FFTypes.REFORGE] = FarmingFortuneDisplay.reforgeFortune + out[FFTypes.GEMSTONE] = FarmingFortuneDisplay.gemstoneFortune + out[FFTypes.PESTERMINATOR] = FarmingFortuneDisplay.pesterminatorFortune out[FFTypes.ABILITY] = FarmingFortuneDisplay.getAbilityFortune(item) out[FFTypes.TOTAL] = out.values.sum() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFTypes.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFTypes.kt index 16d2e7594..fdbe4635f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFTypes.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFTypes.kt @@ -4,8 +4,10 @@ enum class FFTypes { TOTAL, BASE, REFORGE, + GEMSTONE, ABILITY, GREEN_THUMB, + PESTERMINATOR, BASE_FF, ANITA, FARMING_LVL, diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt index 2f438e726..863bc9518 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneStats.kt @@ -11,6 +11,7 @@ enum class FortuneStats(val label: String, val tooltip: String) { CROP_UPGRADE("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n§2You get 5☘ per level"), BASE_TOOL("§2Base tool fortune", "§7§2Crop specific fortune from your tool"), REFORGE("§2Tool reforge", "§7§2Fortune from reforging your tool"), + GEMSTONE("§2Tool gemstone", "§7§2Fortune from gemstones on your tool"), FFD("§2Farming for Dummies", "§7§2Fortune for each applied book\n§2You get 1☘ per applied book"), COUNTER("§2Logarithmic Counter", "§7§2Fortune from increasing crop counter\n§2You get 16☘ per digit - 4"), COLLECTION("§2Collection Analyst", "§7§2Fortune from increasing crop collection\n§2You get 8☘ per digit - 4"), @@ -28,5 +29,10 @@ enum class FortuneStats(val label: String, val tooltip: String) { "§2Expired Pumpkin", "§7§2Gain 12☘ from giving 3,000 to Carrolyn in Scarleton!\n" + "§eRun /shpumpkin to toggle the stat" - ) + ), + SUPREME_CHOCOLATE_BAR( + "§2Supreme Chocolate Bar", + "§7§2Gain 12☘ from giving 3,000 to Carrolyn in Scarleton!\n" + + "§eRun /shcocoabeans to toggle the stat" + ), } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt index ed3023eae..605081e4e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt @@ -16,13 +16,14 @@ class OverviewPage : FFGuideGUI.FFGuidePage() { private var equipmentFF = mutableMapOf<FFTypes, Double>() private var armorFF = mutableMapOf<FFTypes, Double>() + // TODO display armor stats for gemstones and pesterminator override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { val timeUntilCakes = TimeUtils.formatDuration(FFStats.cakeExpireTime - System.currentTimeMillis()) GuiRenderUtils.drawFarmingBar( "§6Universal Farming Fortune", "§7§2Farming fortune in that is\n§2applied to every crop\n§eNot the same as tab FF\n" + - "§eSee on the grass block page", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1277, + "§eSee on the grass block page", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, if (FFStats.usingSpeedBoots) 1373 else 1377, FFGuideGUI.guiLeft + 15, FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay ) @@ -87,19 +88,20 @@ class OverviewPage : FFGuideGUI.FFGuidePage() { line = if (currentArmor == 0) "§7§2Total fortune from your armor\n§2Select a piece for more info" else "§7§2Total fortune from your\n${armorItem.getItem().displayName}" - var value = if (currentArmor == 0) { - 325 - } else if (FFStats.usingSpeedBoots) { + var value = if (FFStats.usingSpeedBoots) { when (currentArmor) { - 1 -> 76.67 - 2, 3 -> 81.67 - else -> 85 + 0 -> 421 + 1 -> 101.67 + 2, 3 -> 106.67 + 4 -> 106 + else -> 0 } } else { when (currentArmor) { - 1 -> 78.75 - 2, 3 -> 83.75 - else -> 78.75 + 0 -> 425 + 1, 4 -> 103.75 + 2, 3 -> 108.75 + else -> 0 } } GuiRenderUtils.drawFarmingBar( |