diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-05-29 22:20:27 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 14:20:27 +0200 |
commit | 85f6fa03d235e2b3ca09b9ae2b3b34dd4bf4fcfb (patch) | |
tree | ccb6037b2a967449b61ffe7e9425273f3943f036 /src/main/java/at/hannibal2/skyhanni | |
parent | 1e851e0ff4293633d2977e1a3d125fdc01193ab5 (diff) | |
download | skyhanni-85f6fa03d235e2b3ca09b9ae2b3b34dd4bf4fcfb.tar.gz skyhanni-85f6fa03d235e2b3ca09b9ae2b3b34dd4bf4fcfb.tar.bz2 skyhanni-85f6fa03d235e2b3ca09b9ae2b3b34dd4bf4fcfb.zip |
Fortune guide - Mostly done (#160)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
37 files changed, 2180 insertions, 174 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 95bbdfbe3..ef8ba9814 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -28,6 +28,7 @@ import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.composter.GardenComposterInventoryFeatures import at.hannibal2.skyhanni.features.garden.contest.* import at.hannibal2.skyhanni.features.garden.farming.* +import at.hannibal2.skyhanni.features.garden.fortuneguide.CaptureFarmingGear import at.hannibal2.skyhanni.features.garden.inventory.* import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorColorNames import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorDropStatistics @@ -275,6 +276,7 @@ class SkyHanniMod { loadModule(TrevorSolver) loadModule(BingoCardTips()) loadModule(GardenVisitorDropStatistics) + loadModule(CaptureFarmingGear()) loadModule(SackDisplay()) loadModule(GardenStartLocation) loadModule(PetCandyUsedDisplay()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index dbd197436..44044fa48 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.misc.update.UpdateManager import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUItems import com.google.gson.GsonBuilder import com.google.gson.TypeAdapter import com.google.gson.stream.JsonReader @@ -13,6 +14,7 @@ import io.github.moulberry.moulconfig.observer.PropertyTypeAdapterFactory import io.github.moulberry.moulconfig.processor.BuiltinMoulConfigGuis import io.github.moulberry.moulconfig.processor.ConfigProcessorDriver import io.github.moulberry.moulconfig.processor.MoulConfigProcessor +import net.minecraft.item.ItemStack import java.io.* import java.nio.charset.StandardCharsets import java.util.* @@ -43,6 +45,15 @@ class ConfigManager { return LorenzVec(x, y, z) } }.nullSafe()) + .registerTypeAdapter(ItemStack::class.java, object : TypeAdapter<ItemStack>() { + override fun write(out: JsonWriter, value: ItemStack) { + out.value(NEUItems.saveNBTData(value)) + } + + override fun read(reader: JsonReader): ItemStack { + return NEUItems.loadNBTData(reader.nextString()) + } + }.nullSafe()) .enableComplexMapKeySerialization() .create() } diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index 9b51acddd..8f9aba6bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -3,9 +3,11 @@ package at.hannibal2.skyhanni.config; import at.hannibal2.skyhanni.data.model.ComposterUpgrade; import at.hannibal2.skyhanni.features.garden.CropAccessory; import at.hannibal2.skyhanni.features.garden.CropType; +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems; import at.hannibal2.skyhanni.features.garden.visitor.VisitorReward; import at.hannibal2.skyhanni.utils.LorenzVec; import com.google.gson.annotations.Expose; +import net.minecraft.item.ItemStack; import java.util.*; @@ -25,7 +27,8 @@ public class Storage { @Expose public Map<String, ProfileSpecific> profiles = new HashMap<>(); // profile name - // TODO save community shop account upgrades here + @Expose + public Integer gardenCommunityUpgrade = -1; } public static class ProfileSpecific { @@ -140,6 +143,9 @@ public class Storage { public long farmingExp = 0; @Expose + public int gardenExp = 0; + + @Expose public long coinsSpent = 0; @Expose @@ -148,7 +154,30 @@ public class Storage { @Expose public Map<CropType, LorenzVec> cropStartLocations = new HashMap<>(); - } + @Expose + public Fortune fortune = new Fortune(); + + public static class Fortune { + + @Expose + public int anitaUpgrade = -1; + + @Expose + public int farmingStrength = -1; + + @Expose + public int farmingLevel = -1; + + @Expose + public int plotsUnlocked = -1; + + @Expose + public long cakeExpiring = -1L; + + @Expose + public Map<FarmingItems, ItemStack> farmingItems = new HashMap<>(); + } + } } } 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 72abc47ca..657f675d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -14,6 +14,8 @@ import at.hannibal2.skyhanni.features.garden.GardenCropTimeCommand import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.CropSpeedMeter +import at.hannibal2.skyhanni.features.garden.fortuneguide.CaptureFarmingGear +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import at.hannibal2.skyhanni.features.garden.farming.GardenStartLocation import at.hannibal2.skyhanni.features.minion.MinionFeatures import at.hannibal2.skyhanni.features.misc.CollectionCounter @@ -24,6 +26,7 @@ import at.hannibal2.skyhanni.test.SkyHanniTestCommand import at.hannibal2.skyhanni.test.TestBingo import at.hannibal2.skyhanni.test.command.* import at.hannibal2.skyhanni.utils.APIUtil +import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.command.ICommandSender import net.minecraftforge.client.ClientCommandHandler @@ -46,6 +49,8 @@ object Commands { // main commands registerCommand("sh", openMainMenu) registerCommand("skyhanni", openMainMenu) + + registerCommand("ff") { openFortuneGuide() } // for users - regular commands registerCommand("shmarkplayer") { MarkedPlayerManager.command(it) } @@ -90,6 +95,15 @@ object Commands { registerCommand("shcopyerror") { CopyErrorCommand.command(it) } } + @JvmStatic + fun openFortuneGuide() { + if (!LorenzUtils.inSkyBlock) { + LorenzUtils.chat("§cJoin Skyblock to open the fortune guide!") + } else { + CaptureFarmingGear.captureFarmingGear() + SkyHanniMod.screenToOpen = FFGuideGUI() + } + } private fun registerCommand(name: String, function: (Array<String>) -> Unit) { ClientCommandHandler.instance.registerCommand(SimpleCommand(name, createCommand(function))) diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt index c80ad2ea5..0044ed6ea 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt @@ -22,8 +22,8 @@ import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize +import at.hannibal2.skyhanni.utils.GuiRenderUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RenderUtils import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiScreen import net.minecraft.client.gui.ScaledResolution @@ -52,10 +52,7 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde } private fun renderLabels(hoveredPos: Int) { - RenderUtils.drawStringCentered( - "§cSkyHanni Position Editor", - Minecraft.getMinecraft().fontRendererObj, (getScaledWidth() / 2).toFloat(), 8f, true, 0xffffff - ) + GuiRenderUtils.drawStringCentered("§cSkyHanni Position Editor", getScaledWidth() / 2, 8) var displayPos = -1 if (clickedPos != -1) { @@ -67,30 +64,17 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde displayPos = hoveredPos } - // When the mouse is not currently hovering over an gui element + // When the mouse is not currently hovering over a gui element if (displayPos == -1) { - RenderUtils.drawStringCentered( - "§eTo edit hidden GUI elements set a key in /sh edit", - Minecraft.getMinecraft().fontRendererObj, (getScaledWidth() / 2).toFloat(), 20f, true, 0xffffff - ) - - RenderUtils.drawStringCentered( - "§ethen click that key while the GUI element is visible", - Minecraft.getMinecraft().fontRendererObj, (getScaledWidth() / 2).toFloat(), 32f, true, 0xffffff - ) + GuiRenderUtils.drawStringCentered("§eTo edit hidden GUI elements set a key in /sh edit", getScaledWidth() / 2, 20) + GuiRenderUtils.drawStringCentered("§ethen click that key while the GUI element is visible", getScaledWidth() / 2, 32) return } val pos = positions[displayPos] - RenderUtils.drawStringCentered( - "§b" + pos.internalName, - Minecraft.getMinecraft().fontRendererObj, (getScaledWidth() / 2).toFloat(), 18f, true, 0xffffff - ) val location = "§7x: §e${pos.rawX}§7, y: §e${pos.rawY}" - RenderUtils.drawStringCentered( - location, - Minecraft.getMinecraft().fontRendererObj, (getScaledWidth() / 2).toFloat(), 28f, true, 0xffffff - ) + GuiRenderUtils.drawStringCentered("§b" + pos.internalName, getScaledWidth() / 2, 18) + GuiRenderUtils.drawStringCentered(location, getScaledWidth() / 2, 28) } private fun renderRectangles(): Int { @@ -114,7 +98,7 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde elementHeight = position.getDummySize().y drawRect(x - border, y - border, x + elementWidth + border * 2, y + elementHeight + border * 2, -0x7fbfbfc0) - if (inXY(mouseX, x, mouseY, y, elementWidth, elementHeight)) { + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - border, y - border, elementWidth + border * 2, elementHeight + border * 2)) { hoveredPos = index } } @@ -140,7 +124,7 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde val x = position.getAbsX() val y = position.getAbsY() if (!position.clicked) { - if (inXY(mouseX, x, mouseY, y, elementWidth, elementHeight)) { + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x - border, y - border, elementWidth + border * 2, elementHeight + border * 2)) { clickedPos = i position.clicked = true grabbedX = mouseX @@ -151,16 +135,6 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde } } - private fun inXY( - mouseX: Int, - x: Int, - mouseY: Int, - y: Int, - elementWidth: Int, - elementHeight: Int, - ) = - mouseX >= x - border && mouseY >= y - border && mouseX <= x + elementWidth + border * 2 && mouseY <= y + elementHeight + border * 2 - @Throws(IOException::class) override fun keyTyped(typedChar: Char, keyCode: Int) { super.keyTyped(typedChar, keyCode) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java index d4c3a5859..b4ebe1ff0 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.config.features; +import at.hannibal2.skyhanni.config.commands.Commands; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.*; @@ -205,7 +206,7 @@ public class Garden { "§c254 Denied", " ", "§c62,072 Copper", - "§23.2m Farming EXP", + "§33.2m Farming EXP", "§647.2m Coins Spent", "§b23 §9Flowering Bouquet", "§b4 §9Overgrown Grass", @@ -214,6 +215,7 @@ public class Garden { "§b6 §9Music Rune", "§b1 §cSpace Helmet", " ", // If they want another empty row + "§212,735 Garden EXP", } ) public List<Integer> textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12)); @@ -1013,14 +1015,14 @@ public class Garden { public Position composterDisplayPos = new Position(-363, 13, false, true); @Expose - @ConfigOption(name = "True Farming Fortune", desc = "") + @ConfigOption(name = "Farming Fortune Display", desc = "") @ConfigEditorAccordion(id = 22) public boolean farmingFortune = false; @Expose @ConfigOption( name = "FF Display", - desc = "Displays current farming fortune, including crop-specific bonuses." + desc = "Displays the true farming fortune for the current crop, including all crop-specific and hidden bonuses." ) @ConfigEditorBoolean @ConfigAccordionId(id = 22) @@ -1036,6 +1038,10 @@ public class Garden { @ConfigAccordionId(id = 22) public boolean farmingFortuneDropMultiplier = true; + @ConfigOption(name = "Farming Fortune Guide", desc = "Opens a guide that breaks down your farming fortune.\n§eCommand: /ff") + @ConfigEditorButton(buttonText = "§2Open") + public Runnable positions = Commands::openFortuneGuide; + @Expose public Position farmingFortunePos = new Position(-375, -200, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt index 3f0562f0d..53815366e 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.gui.inventory.GuiInventory @@ -15,7 +16,7 @@ class RenderGuiData { fun onRenderOverlay(event: RenderGameOverlayEvent.Pre) { // if (!ProfileStorage.loaded) return if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) return - if (GuiEditManager.isInGui()) return + if (GuiEditManager.isInGui() || FFGuideGUI.isInGui()) return GuiRenderEvent.GameOverlayRenderEvent().postAndCatch() } @@ -23,7 +24,7 @@ class RenderGuiData { @SubscribeEvent fun onBackgroundDraw(event: GuiScreenEvent.BackgroundDrawnEvent) { // if (!ProfileStorage.loaded) return - if (GuiEditManager.isInGui()) return + if (GuiEditManager.isInGui() || FFGuideGUI.isInGui()) return val currentScreen = Minecraft.getMinecraft().currentScreen ?: return if (currentScreen !is GuiInventory && currentScreen !is GuiChest) return 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 a4bff0222..f501dd910 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -148,6 +148,9 @@ class FarmingFortuneDisplay { } private val collectionPattern = "§7You have §6\\+([\\d]{1,3})☘ Farming Fortune".toRegex() + private val tooltipFortunePattern = + "^§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?$".toRegex() + private val armorAbilityPattern = "§6Tiered Bonus: .* [(](?<pieces>.*)/4[)]".toPattern() var displayedFortune = 0.0 var reforgeFortune = 0.0 @@ -156,6 +159,9 @@ class FarmingFortuneDisplay { fun getToolFortune(tool: ItemStack?): Double { val internalName = tool?.getInternalName() ?: return 0.0 + if (internalName == "THEORETICAL_HOE") { + return 0.0 + } return if (internalName.startsWith("THEORETICAL_HOE")) { listOf(10.0, 25.0, 50.0)[internalName.last().digitToInt() - 1] } else when (internalName) { @@ -200,27 +206,45 @@ class FarmingFortuneDisplay { fun getHarvestingFortune(tool: ItemStack?): Double { return (tool?.getEnchantments()?.get("harvesting") ?: 0) * 12.5 } fun getCultivatingFortune(tool: ItemStack?): Double { return (tool?.getEnchantments()?.get("cultivating") ?: 0).toDouble()} - fun getAbilityFortune(tool: ItemStack?): Double { // add armor ability stuff here + fun getAbilityFortune(tool: ItemStack?): Double { val lotusAbilityPattern = "§7Piece Bonus: §6+(?<bonus>.*)☘".toPattern() - if (tool?.getInternalName()?.contains("LOTUS") == true) { - for (line in tool.getLore()) { + // todo confirm it works on Melon and Cropie armor + val armorAbilityFortune = "§7.*§7Grants §6(?<bonus>.*)☘.*".toPattern() + var pieces = 0.0 + for (line in tool?.getLore()!!) { + if (tool.getInternalName().contains("LOTUS")) { lotusAbilityPattern.matchMatcher(line) { return group("bonus").toDouble() } } + armorAbilityPattern.matchMatcher(line) { + pieces = group("pieces").toDouble() + } + + armorAbilityFortune.matchMatcher(line) { + return group("bonus").toDouble() / pieces + } } return 0.0 } - fun loadFortuneLineData(tool: ItemStack?, enchantmentFortune: Double, match: MatchGroupCollection) { - displayedFortune = match[1]!!.value.toDouble() - reforgeFortune = match[2]!!.value.toDouble() - if (tool != null) { - itemBaseFortune = if (tool.getInternalName().contains("LOTUS")) 5.0 - else displayedFortune - reforgeFortune - enchantmentFortune - greenThumbFortune = if (tool.getInternalName().contains("LOTUS")) { - displayedFortune - reforgeFortune - itemBaseFortune - } else 0.0 + fun loadFortuneLineData(tool: ItemStack?, enchantmentFortune: Double) { + displayedFortune = 0.0 + reforgeFortune = 0.0 + itemBaseFortune = 0.0 + greenThumbFortune = 0.0 + for (line in tool?.getLore()!!) { + val match = tooltipFortunePattern.matchEntire(line)?.groups + if (match != null) { + displayedFortune = match[1]!!.value.toDouble() + reforgeFortune = match[2]?.value?.toDouble() ?: 0.0 + + itemBaseFortune = if (tool.getInternalName().contains("LOTUS")) 5.0 + else displayedFortune - reforgeFortune - enchantmentFortune + greenThumbFortune = if (tool.getInternalName().contains("LOTUS")) { + displayedFortune - reforgeFortune - itemBaseFortune + } else 0.0 + } } } 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 34a8e96a3..dbf3486b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -181,4 +181,75 @@ object GardenAPI { lastLocation = position CropClickEvent(cropBroken, blockState, event.clickType, event.itemInHand).postAndCatch() } + + fun getExpForLevel(requestedLevel: Int): Long { + var totalExp = 0L + var tier = 0 + for (tierExp in gardenExperience) { + totalExp += tierExp + tier++ + if (tier == requestedLevel) { + return totalExp + } + } + return 0 + } + + fun getLevelForExp(gardenExp: Long): Int { + var tier = 0 + var totalExp = 0L + for (tierExp in gardenExperience) { + totalExp += tierExp + if (totalExp > gardenExp) { + return tier + } + tier++ + } + return tier + } + + private val gardenExperience = listOf( + 0, + 70, + 100, + 140, + 240, + 600, + 1500, + 2000, + 2500, + 3000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, // level 15 + + // overflow levels till 40 for now, in 10k steps + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + 10_000, + ) }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index be00854f4..8948c88e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -43,9 +43,9 @@ class GardenLevelDisplay { } private fun addExp(moreExp: Int) { - val oldLevel = getLevelForExp(gardenExp.toLong()) + val oldLevel = GardenAPI.getLevelForExp(gardenExp.toLong()) gardenExp += moreExp - val newLevel = getLevelForExp(gardenExp.toLong()) + val newLevel = GardenAPI.getLevelForExp(gardenExp.toLong()) if (newLevel == oldLevel + 1) { if (newLevel > 15) { LorenzUtils.chat( @@ -77,7 +77,7 @@ class GardenLevelDisplay { return } } - val expForLevel = getExpForLevel(currentLevel).toInt() + val expForLevel = GardenAPI.getExpForLevel(currentLevel).toInt() gardenExp = expForLevel + nextLevelExp update() } @@ -89,10 +89,10 @@ class GardenLevelDisplay { private fun drawDisplay(): String { if (gardenExp == -1) return "§aGarden Level ? §cOpen the desk!" - val currentLevel = getLevelForExp(gardenExp.toLong()) - val needForLevel = getExpForLevel(currentLevel).toInt() + val currentLevel = GardenAPI.getLevelForExp(gardenExp.toLong()) + val needForLevel = GardenAPI.getExpForLevel(currentLevel).toInt() val nextLevel = currentLevel + 1 - val needForNextLevel = getExpForLevel(nextLevel).toInt() + val needForNextLevel = GardenAPI.getExpForLevel(nextLevel).toInt() return "§aGarden Level $currentLevel" + if (needForNextLevel != 0) { val overflow = gardenExp - needForLevel @@ -104,35 +104,6 @@ class GardenLevelDisplay { } else "" } - private fun getLevelForExp(gardenExp: Long): Int { - var tier = 0 - var totalCrops = 0L - for (tierCrops in gardenExperience) { - totalCrops += tierCrops - if (totalCrops > gardenExp) { - return tier - } - tier++ - } - - return tier - } - - // TODO make table utils method - private fun getExpForLevel(requestedLevel: Int): Long { - var totalCrops = 0L - var tier = 0 - for (tierCrops in gardenExperience) { - totalCrops += tierCrops - tier++ - if (tier == requestedLevel) { - return totalCrops - } - } - - return 0 - } - @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return @@ -141,50 +112,4 @@ class GardenLevelDisplay { } private fun isEnabled() = GardenAPI.inGarden() && config.gardenLevelDisplay - - // TODO use repo - private val gardenExperience = listOf( - 0, - 70, - 100, - 140, - 240, - 600, - 1500, - 2000, - 2500, - 3000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, // level 15 - - // overflow levels till 40 for now, in 10k steps - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - 10_000, - ) }
\ No newline at end of file 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 668848ce8..4e578e6f7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt @@ -4,11 +4,13 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay.Companion.getAbilityFortune import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getFarmingForDummiesCount import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getReforgeName import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase +import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard import java.text.DecimalFormat @@ -17,9 +19,12 @@ import kotlin.math.roundToInt class ToolTooltipTweaks { private val config get() = SkyHanniMod.feature.garden private val tooltipFortunePattern = - "^§5§o§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))\$".toRegex() + "^§5§o§7Farming Fortune: §a\\+([\\d.]+)(?: §2\\(\\+\\d\\))?(?: §9\\(\\+(\\d+)\\))?$".toRegex() private val counterStartLine = setOf("§5§o§6Logarithmic Counter", "§5§o§6Collection Analysis") private val reforgeEndLine = setOf("§5§o", "§5§o§7chance for multiple crops.") + private val abilityDescriptionStart = "§5§o§7These boots gain §a+2❈ Defense" + private val abilityDescriptionEnd = "§5§o§7Skill level." + private val statFormatter = DecimalFormat("0.##") @SubscribeEvent @@ -49,13 +54,14 @@ class ToolTooltipTweaks { var removingFarmhandDescription = false var removingCounterDescription = false var removingReforgeDescription = false + var removingAbilityDescription = false for (line in iterator) { val match = tooltipFortunePattern.matchEntire(line)?.groups if (match != null) { val enchantmentFortune = sunderFortune + harvestingFortune + cultivatingFortune - FarmingFortuneDisplay.loadFortuneLineData(itemStack, enchantmentFortune, match) + FarmingFortuneDisplay.loadFortuneLineData(itemStack, enchantmentFortune) val displayedFortune = FarmingFortuneDisplay.displayedFortune val reforgeFortune = FarmingFortuneDisplay.reforgeFortune @@ -77,10 +83,10 @@ class ToolTooltipTweaks { iterator.set(fortuneLine) if (Keyboard.isKeyDown(config.fortuneTooltipKeybind)) { - iterator.addStat(" §7Base: §a+", baseFortune) + iterator.addStat(" §7Base: §6+", baseFortune) iterator.addStat(" §7Tool: §6+", toolFortune) - iterator.addStat(" $reforgeName: §9+", reforgeFortune) - iterator.addStat(" §7Ability: §a+", abilityFortune) + iterator.addStat(" §7${reforgeName?.removeColor()}: §9+", reforgeFortune) + iterator.addStat(" §7Ability: §2+", abilityFortune) iterator.addStat(" §7Green Thumb: §a+", greenThumbFortune) iterator.addStat(" §7Sunder: §a+", sunderFortune) iterator.addStat(" §7Harvesting: §a+", harvestingFortune) @@ -93,7 +99,7 @@ class ToolTooltipTweaks { } } // Beware, dubious control flow beyond these lines - if (config.compactToolTooltips) { + if (config.compactToolTooltips || FFGuideGUI.isInGui()) { if (line.startsWith("§5§o§7§8Bonus ")) removingFarmhandDescription = true if (removingFarmhandDescription) { iterator.remove() @@ -113,6 +119,22 @@ class ToolTooltipTweaks { removingReforgeDescription = !reforgeEndLine.contains(line) } if (line == "§5§o§9Bountiful Bonus") removingReforgeDescription = true + + if (FFGuideGUI.isInGui()) { + if (line.contains("Click to ") || line.contains("§7§8This item can be reforged!") || line.contains("Dyed")) { + iterator.remove() + } + + if (line == abilityDescriptionStart) { + removingAbilityDescription = true + } + if (removingAbilityDescription) { + iterator.remove() + if (line == abilityDescriptionEnd) { + removingAbilityDescription = false + } + } + } } } 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 new file mode 100644 index 000000000..47d44e5c1 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -0,0 +1,198 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide + +import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.events.GardenToolChangeEvent +import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType +import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal +import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.TabListData +import net.minecraft.client.Minecraft +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class CaptureFarmingGear { + private val farmingItems get() = GardenAPI.config?.fortune?.farmingItems + + private val farmingLevelUpPattern = "SKILL LEVEL UP Farming .*➜(?<level>.*)".toPattern() + private val fortuneUpgradePattern = "You claimed the Garden Farming Fortune (?<level>.*) upgrade!".toPattern() + private val anitaBuffPattern = "You tiered up the Extra Farming Drops upgrade to [+](?<level>.*)%!".toPattern() + private val anitaMenuPattern = "You have: [+](?<level>.*)%".toPattern() + + + companion object { + private val strengthPattern = " Strength: §r§c❁(?<strength>.*)".toPattern() + private val farmingSets = arrayListOf("FERMENTO", "SQUASH", "CROPIE", "MELON", "FARM", + "RANCHERS", "FARMER", "RABBIT") + private val farmingItems get() = GardenAPI.config?.fortune?.farmingItems + + fun captureFarmingGear() { + val farmingItems = farmingItems ?: return + val resultList = mutableListOf<String>() + + val itemStack = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem() ?: return + val itemID = itemStack.getInternalName() + resultList.add(itemStack.displayName.toString()) + resultList.add(itemID) + + val currentCrop = itemStack.getCropType() + + if (currentCrop == null) { + //todo generic tool as fallback item + //todo Daedalus axe + } else { + for (item in FarmingItems.values()) { + if (item.name == currentCrop.name) { + farmingItems[item] = itemStack + } + } + } + for (armor in InventoryUtils.getArmor()) { + if (armor == null) continue + val split = armor.getInternalName().split("_") + if (split.first() in farmingSets) { + for (item in FarmingItems.values()) { + if (item.name == split.last()) { + farmingItems[item] = armor + } + } + } + } + for (line in TabListData.getTabList()) { + strengthPattern.matchMatcher(line) { + GardenAPI.config?.fortune?.farmingStrength = group("strength").toInt() + } + } + } + } + + @SubscribeEvent + fun onGardenToolChange(event: GardenToolChangeEvent) { + captureFarmingGear() + } + + @SubscribeEvent + fun onInventoryOpen(event: InventoryOpenEvent) { + if (!LorenzUtils.inSkyBlock) return + val hidden = GardenAPI.config?.fortune ?: return + val farmingItems = farmingItems ?: return + if (event.inventoryName == "Your Equipment and Stats") { + for ((_, slot) in event.inventoryItems) { + val split = slot.getInternalName().split("_") + if (split.first() == "LOTUS") { + for (item in FarmingItems.values()) { + if (item.name == split.last()) { + farmingItems[item] = slot + } + } + } + } + } + if (event.inventoryName.contains("Pets")) { + // If they have 2 of same pet, one will be overwritten + farmingItems[FarmingItems.ELEPHANT] = FFGuideGUI.getFallbackItem(FarmingItems.ELEPHANT) + farmingItems[FarmingItems.MOOSHROOM_COW] = FFGuideGUI.getFallbackItem(FarmingItems.MOOSHROOM_COW) + farmingItems[FarmingItems.RABBIT] = FFGuideGUI.getFallbackItem(FarmingItems.RABBIT) + var highestElephantLvl = -1 + var highestMooshroomLvl = -1 + var highestRabbitLvl = -1 + + for ((_, item) in event.inventoryItems) { + val split = item.getInternalName().split(";") + if (split.first() == "ELEPHANT") { + if (split.last().toInt() > highestElephantLvl) { + farmingItems[FarmingItems.ELEPHANT] = item + highestElephantLvl = split.last().toInt() + } + } + if (split.first() == "MOOSHROOM_COW") { + if (split.last().toInt() > highestMooshroomLvl) { + farmingItems[FarmingItems.MOOSHROOM_COW] = item + highestMooshroomLvl = split.last().toInt() + } + } + if (split.first() == "RABBIT") { + if (split.last().toInt() > highestRabbitLvl) { + farmingItems[FarmingItems.RABBIT] = item + highestRabbitLvl = split.last().toInt() + } + } + } + } + + if (event.inventoryName.contains("Your Skills")) { + for ((_, item) in event.inventoryItems) { + if (item.displayName.contains("Farming ")) { + hidden.farmingLevel = item.displayName.split(" ").last().romanToDecimalIfNeeded() + } + } + } + if (event.inventoryName.contains("Community Shop")) { + for ((_, item) in event.inventoryItems) { + if (item.displayName.contains("Garden Farming Fortune")) { + if (item.getLore().contains("§aMaxed out!")) { + ProfileStorageData.playerSpecific?.gardenCommunityUpgrade = + item.displayName.split(" ").last().romanToDecimal() + } else { + ProfileStorageData.playerSpecific?.gardenCommunityUpgrade = + item.displayName.split(" ").last().romanToDecimal() - 1 + } + } + } + } + if (event.inventoryName.contains("Configure Plots")) { + var plotsUnlocked = 24 + for (slot in event.inventoryItems) { + if (slot.value.getLore().contains("§7Cost:")) { + plotsUnlocked -= 1 + } + } + hidden.plotsUnlocked = plotsUnlocked + } + if (event.inventoryName.contains("Anita")) { + var level = -1 + for ((_, item) in event.inventoryItems) { + if (item.displayName.contains("Extra Farming Drops")) { + level = 0 + for (line in item.getLore()) { + anitaMenuPattern.matchMatcher(line.removeColor()) { + level = group("level").toInt() / 2 + } + } + } + } + if (level == -1) { + hidden.anitaUpgrade = 15 + } else { + hidden.anitaUpgrade = level + } + } + } + + //todo pet level up + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!LorenzUtils.inSkyBlock) return + val hidden = GardenAPI.config?.fortune ?: return + val msg = event.message.removeColor().trim() + fortuneUpgradePattern.matchMatcher(msg) { + ProfileStorageData.playerSpecific?.gardenCommunityUpgrade = group("level").romanToDecimal() + } + farmingLevelUpPattern.matchMatcher(msg) { + hidden.farmingLevel = group("level").romanToDecimalIfNeeded() + } + anitaBuffPattern.matchMatcher(msg) { + hidden.anitaUpgrade = group("level").toInt() / 2 + } + if (msg == "Yum! You gain +5☘ Farming Fortune for 48 hours!") { + hidden.cakeExpiring = System.currentTimeMillis() + 172800000 + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt new file mode 100644 index 000000000..25636ae8f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt @@ -0,0 +1,299 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide + +import at.hannibal2.skyhanni.features.garden.CropType +import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.* +import at.hannibal2.skyhanni.utils.GuiRenderUtils +import at.hannibal2.skyhanni.utils.SoundUtils +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.GuiScreen +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.init.Blocks +import net.minecraft.item.ItemStack +import org.lwjgl.input.Mouse +import java.io.IOException +import java.util.* + +open class FFGuideGUI : GuiScreen() { + companion object { + val pages = mutableMapOf<FortuneGuidePage, FFGuidePage>() + + var guiLeft = 0 + var guiTop = 0 + var screenHeight = 0 + + const val sizeX = 360 + const val sizeY = 180 + + var selectedPage = FortuneGuidePage.OVERVIEW + var breakdownMode = true + var currentPet = 0 + var currentArmor = 0 + var currentEquipment = 0 + + var mouseX = 0 + var mouseY = 0 + + var tooltipToDisplay = mutableListOf<String>() + + fun isInGui() = Minecraft.getMinecraft().currentScreen is FFGuideGUI + + var cakeBuffTime = -1L + + fun FarmingItems.getItem(): ItemStack { + val fortune = GardenAPI.config?.fortune ?: return getFallbackItem(this) + + val farmingItems = fortune.farmingItems + farmingItems[this]?.let { return it } + + val fallbackItem = getFallbackItem(this) + farmingItems[this] = fallbackItem + return fallbackItem + } + + fun getFallbackItem(item: FarmingItems): ItemStack = + ItemStack(Blocks.barrier).setStackDisplayName("§cNo saved ${item.name.lowercase().replace("_", " ")}") + } + + init { + FFStats.loadFFData() + pages[FortuneGuidePage.OVERVIEW] = OverviewPage() + pages[FortuneGuidePage.WHEAT] = WheatPage() + pages[FortuneGuidePage.CARROT] = CarrotPage() + pages[FortuneGuidePage.POTATO] = PotatoPage() + pages[FortuneGuidePage.PUMPKIN] = PumpkinPage() + pages[FortuneGuidePage.SUGAR_CANE] = CanePage() + pages[FortuneGuidePage.MELON] = MelonPage() + pages[FortuneGuidePage.CACTUS] = CactusPage() + pages[FortuneGuidePage.COCOA_BEANS] = CocoaPage() + pages[FortuneGuidePage.MUSHROOM] = MushroomPage() + pages[FortuneGuidePage.NETHER_WART] = WartPage() + + GardenAPI.config?.fortune?.let { + cakeBuffTime = it.cakeExpiring + } + } + + override fun drawScreen(unusedX: Int, unusedY: Int, partialTicks: Float) { + super.drawScreen(unusedX, unusedY, partialTicks) + drawDefaultBackground() + screenHeight = height + guiLeft = (width - sizeX) / 2 + guiTop = (height - sizeY) / 2 + + mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth + mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1 + + GlStateManager.pushMatrix() + drawRect(guiLeft, guiTop, guiLeft + sizeX, guiTop + sizeY, 0x50000000) + renderTabs() + + if (breakdownMode) { + if (selectedPage != FortuneGuidePage.OVERVIEW) { + GuiRenderUtils.renderItemAndTip( + FarmingItems.ELEPHANT.getItem(), guiLeft + 152, guiTop + 160, mouseX, mouseY, + if (currentPet == 0) 0xFF00FF00.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.MOOSHROOM_COW.getItem(), guiLeft + 172, guiTop + 160, mouseX, mouseY, + if (currentPet == 1) 0xFF00FF00.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.RABBIT.getItem(), guiLeft + 192, guiTop + 160, mouseX, mouseY, + if (currentPet == 2) 0xFF00FF00.toInt() else 0xFF43464B.toInt() + ) + + GuiRenderUtils.renderItemAndTip( + FarmingItems.HELMET.getItem(), guiLeft + 162, guiTop + 80, mouseX, mouseY) + GuiRenderUtils.renderItemAndTip( + FarmingItems.CHESTPLATE.getItem(), guiLeft + 162, guiTop + 100, mouseX, mouseY) + GuiRenderUtils.renderItemAndTip( + FarmingItems.LEGGINGS.getItem(), guiLeft + 162, guiTop + 120, mouseX, mouseY) + GuiRenderUtils.renderItemAndTip( + FarmingItems.BOOTS.getItem(), guiLeft + 162, guiTop + 140, mouseX, mouseY) + + GuiRenderUtils.renderItemAndTip( + FarmingItems.NECKLACE.getItem(), guiLeft + 182, guiTop + 80, mouseX, mouseY) + GuiRenderUtils.renderItemAndTip( + FarmingItems.CLOAK.getItem(), guiLeft + 182, guiTop + 100, mouseX, mouseY) + GuiRenderUtils.renderItemAndTip( + FarmingItems.BELT.getItem(), guiLeft + 182, guiTop + 120, mouseX, mouseY) + GuiRenderUtils.renderItemAndTip( + FarmingItems.BRACELET.getItem(), guiLeft + 182, guiTop + 140, mouseX, mouseY) + + } else { + GuiRenderUtils.renderItemAndTip( + FarmingItems.HELMET.getItem(), guiLeft + 142, guiTop + 5, mouseX, mouseY, + if (currentArmor == 1) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.CHESTPLATE.getItem(), guiLeft + 162, guiTop + 5, mouseX, mouseY, + if (currentArmor == 2) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.LEGGINGS.getItem(), guiLeft + 182, guiTop + 5, mouseX, mouseY, + if (currentArmor == 3) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.BOOTS.getItem(), guiLeft + 202, guiTop + 5, mouseX, mouseY, + if (currentArmor == 4) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + + GuiRenderUtils.renderItemAndTip( + FarmingItems.NECKLACE.getItem(), guiLeft + 262, guiTop + 5, mouseX, mouseY, + if (currentEquipment == 1) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.CLOAK.getItem(), guiLeft + 282, guiTop + 5, mouseX, mouseY, + if (currentEquipment == 2) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.BELT.getItem(), guiLeft + 302, guiTop + 5, mouseX, mouseY, + if (currentEquipment == 3) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.BRACELET.getItem(), guiLeft + 322, guiTop + 5, mouseX, mouseY, + if (currentEquipment == 4) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + + GuiRenderUtils.renderItemAndTip( + FarmingItems.ELEPHANT.getItem(), guiLeft + 152, guiTop + 130, mouseX, mouseY, + if (currentPet == 0) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.MOOSHROOM_COW.getItem(), guiLeft + 172, guiTop + 130, mouseX, mouseY, + if (currentPet == 1) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + GuiRenderUtils.renderItemAndTip( + FarmingItems.RABBIT.getItem(), guiLeft + 192, guiTop + 130, mouseX, mouseY, + if (currentPet == 2) 0xFFB3FFB3.toInt() else 0xFF43464B.toInt() + ) + } + } + + GuiRenderUtils.drawStringCentered("§7SkyHanni", guiLeft + 325, guiTop + 170) + GuiRenderUtils.drawStringCentered("§cIn beta! Report issues and suggestions on the discord", guiLeft + sizeX / 2, guiTop + sizeY + 10) + + pages[selectedPage]?.drawPage(mouseX, mouseY, partialTicks) + + GlStateManager.popMatrix() + + if (tooltipToDisplay.isNotEmpty()) { + GuiRenderUtils.drawTooltip(tooltipToDisplay, mouseX, mouseY, height) + tooltipToDisplay.clear() + } + } + + @Throws(IOException::class) + override fun mouseClicked(originalX: Int, originalY: Int, mouseButton: Int) { + super.mouseClicked(originalX, originalY, mouseButton) + + for (page in FortuneGuidePage.values()) { + val x = guiLeft + (page.ordinal) * 30 + 15 + val y = guiTop - 28 + + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 25, 28)) { + if (selectedPage != page) { + SoundUtils.playClickSound() + selectedPage = page + } + } + } + if (selectedPage == FortuneGuidePage.OVERVIEW) { + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 152, guiTop + 130, 16, 16) && currentPet != 0) { + SoundUtils.playClickSound() + currentPet = 0 + FFStats.totalFF(FFStats.elephantFF) + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 172, guiTop + 130, 16, 16) && currentPet != 1 + ) { + SoundUtils.playClickSound() + currentPet = 1 + FFStats.totalFF(FFStats.mooshroomFF) + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 192, guiTop + 130, 16, 16) && currentPet != 2 + ) { + SoundUtils.playClickSound() + currentPet = 2 + FFStats.totalFF(FFStats.rabbitFF) + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 142, guiTop + 5, 16, 16)) { + SoundUtils.playClickSound() + currentArmor = if (currentArmor == 1) 0 else 1 + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 162, guiTop + 5, 16, 16)) { + SoundUtils.playClickSound() + currentArmor = if (currentArmor == 2) 0 else 2 + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 182, guiTop + 5, 16, 16)) { + SoundUtils.playClickSound() + currentArmor = if (currentArmor == 3) 0 else 3 + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 202, guiTop + 5, 16, 16)) { + SoundUtils.playClickSound() + currentArmor = if (currentArmor == 4) 0 else 4 + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 262, guiTop + 5, 16, 16)) { + SoundUtils.playClickSound() + currentEquipment = if (currentEquipment == 1) 0 else 1 + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 282, guiTop + 5, 16, 16)) { + SoundUtils.playClickSound() + currentEquipment = if (currentEquipment == 2) 0 else 2 + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 302, guiTop + 5, 16, 16)) { + SoundUtils.playClickSound() + currentEquipment = if (currentEquipment == 3) 0 else 3 + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 322, guiTop + 5, 16, 16)) { + SoundUtils.playClickSound() + currentEquipment = if (currentEquipment == 4) 0 else 4 + } + + } else { + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 152, guiTop + 160, 16, 16) && currentPet != 0) { + SoundUtils.playClickSound() + currentPet = 0 + FFStats.totalFF(FFStats.elephantFF) + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 172, guiTop + 160, 16, 16) && currentPet != 1 + ) { + SoundUtils.playClickSound() + currentPet = 1 + FFStats.totalFF(FFStats.mooshroomFF) + } else if (GuiRenderUtils.isPointInRect(mouseX, mouseY, guiLeft + 192, guiTop + 160, 16, 16) && currentPet != 2 + ) { + SoundUtils.playClickSound() + currentPet = 2 + FFStats.totalFF(FFStats.rabbitFF) + } + } + } + + private fun renderTabs() { + for (page in FortuneGuidePage.values()) { + val x = guiLeft + (page.ordinal) * 30 + 15 + val y = guiTop - 28 + drawRect(x, y, x + 25, y + 28, if (page == selectedPage) 0x50555555 else 0x50000000) + + if (page.crop != null) { + GuiRenderUtils.renderItemStack(page.crop.icon, x + 5, y + 5) + } else GuiRenderUtils.renderItemStack(ItemStack(Blocks.grass), x + 5, y + 5) + + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 25, 25)) { + tooltipToDisplay.add(page.pageName) + } + } + } + + enum class FortuneGuidePage(val crop: CropType?) { + OVERVIEW(null), + WHEAT(CropType.WHEAT), + CARROT(CropType.CARROT), + POTATO(CropType.POTATO), + NETHER_WART(CropType.NETHER_WART), + PUMPKIN(CropType.PUMPKIN), + MELON(CropType.MELON), + COCOA_BEANS(CropType.COCOA_BEANS), + SUGAR_CANE(CropType.SUGAR_CANE), + CACTUS(CropType.CACTUS), + MUSHROOM(CropType.MUSHROOM), + ; + + val pageName = crop?.let { "§e" + crop.cropName } ?: "§eOverview" + } + + abstract class FFGuidePage { + abstract fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) + } +} + 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 new file mode 100644 index 000000000..1d5638061 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt @@ -0,0 +1,204 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide + +import at.hannibal2.skyhanni.data.CropAccessoryData +import at.hannibal2.skyhanni.data.GardenCropUpgrades.Companion.getUpgradeLevel +import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.features.garden.FarmingFortuneDisplay +import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getFarmingForDummiesCount +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetItem +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetLevel +import net.minecraft.item.ItemStack + +object FFStats { + private val farmingBoots = arrayListOf("RANCHERS_BOOTS", "FARMER_BOOTS") + val necklaceFF = mutableMapOf<FFTypes, Double>() + val cloakFF = mutableMapOf<FFTypes, Double>() + val beltFF = mutableMapOf<FFTypes, Double>() + val braceletFF = mutableMapOf<FFTypes, Double>() + var equipmentTotalFF = mutableMapOf<FFTypes, Double>() + + val helmetFF = mutableMapOf<FFTypes, Double>() + val chestplateFF = mutableMapOf<FFTypes, Double>() + val leggingsFF = mutableMapOf<FFTypes, Double>() + val bootsFF = mutableMapOf<FFTypes, Double>() + var armorTotalFF = mutableMapOf<FFTypes, Double>() + var usingSpeedBoots = false + + val elephantFF = mutableMapOf<FFTypes, Double>() + val mooshroomFF = mutableMapOf<FFTypes, Double>() + val rabbitFF = mutableMapOf<FFTypes, Double>() + var currentPetItem = "" + + var baseFF = mutableMapOf<FFTypes, Double>() + + var totalBaseFF = mutableMapOf<FFTypes, Double>() + + val wheatFF = mutableMapOf<FFTypes, Double>() + val carrotFF = mutableMapOf<FFTypes, Double>() + val potatoFF = mutableMapOf<FFTypes, Double>() + val caneFF = mutableMapOf<FFTypes, Double>() + val wartFF = mutableMapOf<FFTypes, Double>() + val pumpkinFF = mutableMapOf<FFTypes, Double>() + val melonFF = mutableMapOf<FFTypes, Double>() + val mushroomFF = mutableMapOf<FFTypes, Double>() + val cocoaFF = mutableMapOf<FFTypes, Double>() + val cactusFF = mutableMapOf<FFTypes, Double>() + + fun loadFFData() { + getEquipmentFFData(FarmingItems.NECKLACE.getItem(), necklaceFF) + getEquipmentFFData(FarmingItems.CLOAK.getItem(), cloakFF) + getEquipmentFFData(FarmingItems.BELT.getItem(), beltFF) + getEquipmentFFData(FarmingItems.BRACELET.getItem(), braceletFF) + + equipmentTotalFF = + (necklaceFF.toList() + cloakFF.toList() + beltFF.toList() + braceletFF.toList()).groupBy({ it.first }, + { it.second }).map { (key, values) -> key to values.sum() } + .toMap() as MutableMap<FFTypes, Double> + + getArmorFFData(FarmingItems.HELMET.getItem(), helmetFF) + getArmorFFData(FarmingItems.CHESTPLATE.getItem(), chestplateFF) + getArmorFFData(FarmingItems.LEGGINGS.getItem(), leggingsFF) + getArmorFFData(FarmingItems.BOOTS.getItem(), bootsFF) + + armorTotalFF = + (helmetFF.toList() + chestplateFF.toList() + leggingsFF.toList() + bootsFF.toList()).groupBy({ it.first }, + { it.second }).map { (key, values) -> key to values.sum() } + .toMap() as MutableMap<FFTypes, Double> + + usingSpeedBoots = FarmingItems.BOOTS.getItem().getInternalName() in farmingBoots + + getPetFFData(FarmingItems.ELEPHANT.getItem(), elephantFF) + getPetFFData(FarmingItems.MOOSHROOM_COW.getItem(), mooshroomFF) + getPetFFData(FarmingItems.RABBIT.getItem(), rabbitFF) + + getGenericFF(baseFF) + getToolFF(FarmingItems.WHEAT.getItem(), wheatFF) + getToolFF(FarmingItems.CARROT.getItem(), carrotFF) + getToolFF(FarmingItems.POTATO.getItem(), potatoFF) + getToolFF(FarmingItems.SUGAR_CANE.getItem(), caneFF) + getToolFF(FarmingItems.NETHER_WART.getItem(), wartFF) + getToolFF(FarmingItems.PUMPKIN.getItem(), pumpkinFF) + getToolFF(FarmingItems.MELON.getItem(), melonFF) + getToolFF(FarmingItems.MUSHROOM.getItem(), mushroomFF) + getToolFF(FarmingItems.COCOA_BEANS.getItem(), cocoaFF) + getToolFF(FarmingItems.CACTUS.getItem(), cactusFF) + + currentPetItem = FarmingItems.ELEPHANT.getItem().getPetItem().toString() + + when (FFGuideGUI.currentPet) { + 0 -> totalFF(elephantFF) + 1 -> totalFF(mooshroomFF) + 2 -> totalFF(rabbitFF) + } + } + + private fun getEquipmentFFData(item: ItemStack, out: MutableMap<FFTypes, Double>) { + FarmingFortuneDisplay.loadFortuneLineData(item, 0.0) + out[FFTypes.TOTAL] = 0.0 + out[FFTypes.BASE] = FarmingFortuneDisplay.itemBaseFortune + out[FFTypes.REFORGE] = FarmingFortuneDisplay.reforgeFortune + out[FFTypes.GREEN_THUMB] = FarmingFortuneDisplay.greenThumbFortune + out[FFTypes.ABILITY] = FarmingFortuneDisplay.getAbilityFortune(item) + out[FFTypes.TOTAL] = out.values.sum() + } + + private fun getArmorFFData(item: ItemStack, out: MutableMap<FFTypes, Double>) { + out[FFTypes.TOTAL] = 0.0 + FarmingFortuneDisplay.loadFortuneLineData(item, 0.0) + out[FFTypes.BASE] = FarmingFortuneDisplay.itemBaseFortune + out[FFTypes.REFORGE] = FarmingFortuneDisplay.reforgeFortune + out[FFTypes.ABILITY] = FarmingFortuneDisplay.getAbilityFortune(item) + out[FFTypes.TOTAL] = out.values.sum() + } + + private fun getPetFFData(item: ItemStack, out: MutableMap<FFTypes, Double>) { + val gardenLvl = GardenAPI.getLevelForExp((GardenAPI.config?.experience ?: -1).toLong()) + out[FFTypes.TOTAL] = 0.0 + out[FFTypes.BASE] = getPetFF(item) + out[FFTypes.PET_ITEM] = when (item.getPetItem()) { + "GREEN_BANDANA" -> (4.0 * gardenLvl).coerceAtMost(60.0) + "YELLOW_BANDANA" -> 30.0 + "MINOS_RELIC" -> (out[FFTypes.BASE] ?: 0.0) * .33 + else -> 0.0 + } + out[FFTypes.TOTAL] = out.values.sum() + } + + private fun getGenericFF(out: MutableMap<FFTypes, Double>) { + val savedStats = GardenAPI.config?.fortune ?: return + out[FFTypes.TOTAL] = 0.0 + out[FFTypes.BASE_FF] = 100.0 + out[FFTypes.FARMING_LVL] = savedStats.farmingLevel.toDouble() * 4 + out[FFTypes.COMMUNITY_SHOP] = (ProfileStorageData.playerSpecific?.gardenCommunityUpgrade ?: -1).toDouble() * 4 + out[FFTypes.PLOTS] = savedStats.plotsUnlocked.toDouble() * 3 + out[FFTypes.ANITA] = savedStats.anitaUpgrade.toDouble() * 2 + if (savedStats.cakeExpiring - System.currentTimeMillis() > 0 || savedStats.cakeExpiring == -1L) { + out[FFTypes.CAKE] = 5.0 + } else { + out[FFTypes.CAKE] = 0.0 + } + out[FFTypes.TOTAL] = out.values.sum() + } + + private fun getToolFF(tool: ItemStack, out: MutableMap<FFTypes, Double>) { + out[FFTypes.TOTAL] = 0.0 + val crop = tool.getCropType() + + val accessoryFortune= crop?.let { + CropAccessoryData.cropAccessory?.getFortune(it) + } + + out[FFTypes.CROP_UPGRADE] = (crop?.getUpgradeLevel()?.toDouble() ?: 0.0) * 5.0 + out[FFTypes.ACCESSORY] = accessoryFortune ?: 0.0 + + out[FFTypes.BASE] = FarmingFortuneDisplay.getToolFortune(tool) + out[FFTypes.COUNTER] = FarmingFortuneDisplay.getCounterFortune(tool) + out[FFTypes.COLLECTION] = FarmingFortuneDisplay.getCollectionFortune(tool) + out[FFTypes.TURBO] = FarmingFortuneDisplay.getTurboCropFortune(tool, crop) + out[FFTypes.DEDICATION] = FarmingFortuneDisplay.getDedicationFortune(tool, crop) + out[FFTypes.SUNDER] = FarmingFortuneDisplay.getSunderFortune(tool) + out[FFTypes.HARVESTING] = FarmingFortuneDisplay.getHarvestingFortune(tool) + out[FFTypes.CULTIVATING] = FarmingFortuneDisplay.getCultivatingFortune(tool) + out[FFTypes.FFD] = (tool.getFarmingForDummiesCount() ?: 0).toDouble() + + val enchantmentFortune = out[FFTypes.SUNDER]!! + out[FFTypes.HARVESTING]!! + out[FFTypes.CULTIVATING]!! + + FarmingFortuneDisplay.loadFortuneLineData(tool, enchantmentFortune) + + out[FFTypes.REFORGE] = FarmingFortuneDisplay.reforgeFortune + + out[FFTypes.TOTAL] = out.values.sum() + } + + fun totalFF(petList: MutableMap<FFTypes, Double>) { + totalBaseFF = + (baseFF.toList() + armorTotalFF.toList() + equipmentTotalFF.toList() + petList.toList()).groupBy({ it.first }, + { it.second }).map { (key, values) -> key to values.sum() } + .toMap() as MutableMap<FFTypes, Double> + currentPetItem = when (FFGuideGUI.currentPet) { + 0 -> FarmingItems.ELEPHANT.getItem().getPetItem().toString() + 1 -> FarmingItems.MOOSHROOM_COW.getItem().getPetItem().toString() + else -> FarmingItems.RABBIT.getItem().getPetItem().toString() + } + } + + private fun getPetFF (pet: ItemStack): Double { + val petLevel = pet.getPetLevel() + val strength = (GardenAPI.config?.fortune?.farmingStrength) + if (strength != null) { + return if (pet.getInternalName().contains("ELEPHANT;4")) { + 1.8 * petLevel + } else if (pet.getInternalName().contains("MOOSHROOM_COW;4")) { + println("doing cow calc: ${(10 + petLevel).toDouble() + strength / (40 - petLevel * .2)}ff") + (10 + petLevel).toDouble() + strength / (40 - petLevel * .2) + } else if (pet.getInternalName().contains("MOOSHROOM")) { + (10 + petLevel).toDouble() + } else 0.0 + } + return 0.0 + } +}
\ No newline at end of file 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 new file mode 100644 index 000000000..b317199ec --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFTypes.kt @@ -0,0 +1,7 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide + +enum class FFTypes { + TOTAL, BASE, REFORGE, ABILITY, GREEN_THUMB, BASE_FF, ANITA, FARMING_LVL, COMMUNITY_SHOP, PLOTS, + CAKE, PET_ITEM, COUNTER, COLLECTION, TURBO, DEDICATION, SUNDER, HARVESTING, CULTIVATING, FFD, + CROP_UPGRADE, ACCESSORY +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingItems.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingItems.kt new file mode 100644 index 000000000..3cd80db07 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingItems.kt @@ -0,0 +1,6 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide + +enum class FarmingItems { + WHEAT, CARROT, POTATO, NETHER_WART, PUMPKIN, MELON, COCOA_BEANS, SUGAR_CANE, CACTUS, MUSHROOM, + HELMET, CHESTPLATE, LEGGINGS, BOOTS, NECKLACE, CLOAK, BELT, BRACELET, ELEPHANT, MOOSHROOM_COW, RABBIT +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/TODO list b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/TODO list new file mode 100644 index 000000000..65a9d7385 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/TODO list @@ -0,0 +1,26 @@ +todo list for this display + +Deal with pets leveling up + +Change lore on equipment to reflect visitors served + +GUI: +Add a border around the edge of the display +Make this adjust based on the selected page + +!!!! +Buges: +Major: +Sometimes the ff breakdown for equipment and armor does not work in the gui? + - fixes by holding shift over an item in the inventory then going back into the gui +If they sell their equipment or pets, they will be saved until a new one is bought and their stats counted : fix, don't liquidize your stuff lol +- can fix pets, equipment is more difficult +Minor: +Taking off or putting equipment on inside the menu won't update it until you reopen the inventory + - also if they sell the piece of equipment, it will always think they still have it +!!!! + +Add: +Daedalus axe for mushroom and cocoa?? +Save selected pet to config + - use the already saved one
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CactusPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CactusPage.kt new file mode 100644 index 000000000..3648e21d4 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CactusPage.kt @@ -0,0 +1,61 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils + + +class CactusPage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.CACTUS.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.cactusFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Cactus Farming Fortune", "§7§2Farming fortune for cacti", + totalCropFF, 1548, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.cactusFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.cactusFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.cactusFF[FFTypes.REFORGE] ?: 0, 16, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.cactusFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Harvesting Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.cactusFF[FFTypes.HARVESTING] ?: 0, 75, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.cactusFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Cacti Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.cactusFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.cactusFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CanePage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CanePage.kt new file mode 100644 index 000000000..e8d3df75d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CanePage.kt @@ -0,0 +1,74 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils + + +class CanePage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.SUGAR_CANE.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + +//todo update dynamically + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.caneFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Cane Farming Fortune", "§7§2Farming fortune for cane", + totalCropFF, 1746, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.caneFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.caneFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Base tool fortune", "§7§2Depends on your tools tier", + FFStats.caneFF[FFTypes.BASE] ?: 0, 50, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) +//todo change based on reforge + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.caneFF[FFTypes.REFORGE] ?: 0, 20, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.caneFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Logarithmic Counter", "§7§2Fortune from increasing crop counter\n" + + "§2You get 16☘ per digit - 4", FFStats.caneFF[FFTypes.COUNTER] ?: 0, 96, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Collection Analyst", "§7§2Fortune from increasing crop collection\n" + + "§2You get 8☘ per digit - 4", FFStats.caneFF[FFTypes.COLLECTION] ?: 0, 48, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Harvesting Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.caneFF[FFTypes.HARVESTING] ?: 0, 75, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.caneFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Cane Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.caneFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.caneFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CarrotPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CarrotPage.kt new file mode 100644 index 000000000..bd2204d4f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CarrotPage.kt @@ -0,0 +1,76 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils + + +class CarrotPage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.CARROT.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + + //todo add rift thing at some point + +//todo update dynamically + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.carrotFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Carrot Farming Fortune", "§7§2Farming fortune for carrot", + totalCropFF, 1746, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.carrotFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.carrotFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Base tool fortune", "§7§2Depends on your tools tier", + FFStats.carrotFF[FFTypes.BASE] ?: 0, 50, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) +//todo change based on reforge + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.carrotFF[FFTypes.REFORGE] ?: 0, 20, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.carrotFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Logarithmic Counter", "§7§2Fortune from increasing crop counter\n" + + "§2You get 16☘ per digit - 4", FFStats.carrotFF[FFTypes.COUNTER] ?: 0, 96, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Collection Analyst", "§7§2Fortune from increasing crop collection\n" + + "§2You get 8☘ per digit - 4", FFStats.carrotFF[FFTypes.COLLECTION] ?: 0, 48, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Harvesting Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.carrotFF[FFTypes.HARVESTING] ?: 0, 75, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.carrotFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Carrot Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.carrotFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.carrotFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CocoaPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CocoaPage.kt new file mode 100644 index 000000000..f8dd977d0 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/CocoaPage.kt @@ -0,0 +1,64 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils + +class CocoaPage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.COCOA_BEANS.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.cocoaFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Cocoa Farming Fortune", "§7§2Farming fortune for cocoa beans", + totalCropFF, 1555.5, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.cocoaFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.cocoaFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.cocoaFF[FFTypes.REFORGE] ?: 0, 16, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.cocoaFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Base tool fortune", "§7§2You get 20☘ for using the cocoa chopper", + FFStats.cocoaFF[FFTypes.BASE] ?: 0, 20, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Sunder Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.cocoaFF[FFTypes.SUNDER] ?: 0, 62.5, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.cocoaFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Cocoa Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.cocoaFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.cocoaFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/MelonPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/MelonPage.kt new file mode 100644 index 000000000..8c1d0a940 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/MelonPage.kt @@ -0,0 +1,66 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName + + +class MelonPage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.MELON.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.melonFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Melon Farming Fortune", "§7§2Farming fortune for melon", + totalCropFF, 1539.5, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.melonFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.melonFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.melonFF[FFTypes.REFORGE] ?: 0, 20, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.melonFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Sunder Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.melonFF[FFTypes.SUNDER] ?: 0, 62.5, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.melonFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Melon Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.melonFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.melonFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Tool Ability", "§7§2Theoretical fortune from dicer ability\n§2Is very random!", + if (FarmingItems.MELON.getItem().getInternalName().contains("DICER")) 33 else 0, 33, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/MushroomPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/MushroomPage.kt new file mode 100644 index 000000000..085f0c1f9 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/MushroomPage.kt @@ -0,0 +1,72 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetLevel + +//todo Daedalus axe +class MushroomPage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.MUSHROOM.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.mushroomFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Mushroom Farming Fortune", "§7§2Farming fortune for mushroom", + totalCropFF, 1575, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.mushroomFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.mushroomFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.mushroomFF[FFTypes.REFORGE] ?: 0, 13, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.mushroomFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + if (FFGuideGUI.currentPet == 1) { + GuiRenderUtils.drawFarmingBar("§2Mooshroom Cow Pet", "§7§2The bonus mushrooms that the cow drops\n" + + "§2You get 1 mushroom per crop broken", FarmingItems.MOOSHROOM_COW.getItem().getPetLevel(), + 100, FFGuideGUI.guiLeft + 15, FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } + + GuiRenderUtils.drawFarmingBar("§2Base tool fortune", "§7§2You get 30☘ for farming the right mushroom", + FFStats.mushroomFF[FFTypes.BASE] ?: 0, 30, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Harvesting Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.mushroomFF[FFTypes.HARVESTING] ?: 0, 75, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.mushroomFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Mushroom Enchant", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.mushroomFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.mushroomFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file 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 new file mode 100644 index 000000000..42660970f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/OverviewPage.kt @@ -0,0 +1,208 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.currentArmor +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.currentEquipment +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils +import at.hannibal2.skyhanni.utils.TimeUtils + +class OverviewPage: FFGuideGUI.FFGuidePage() { + private var equipmentFF = mutableMapOf<FFTypes, Double>() + private var armorFF = mutableMapOf<FFTypes, Double>() + + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + //todo migrate to stats page + val timeUntilCakes = TimeUtils.formatDuration(FFGuideGUI.cakeBuffTime - System.currentTimeMillis()) + + //todo change based on pet + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.drawFarmingBar("§6Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + var line = if (FFStats.baseFF[FFTypes.ANITA]!! < 0.0) "§cAnita buff not saved\n§eVisit Anita to set it!" + else "§7§2Fortune for levelling your Anita extra crops\n§2You get 2☘ per buff level" + GuiRenderUtils.drawFarmingBar("§2Anita Buff", line, FFStats.baseFF[FFTypes.ANITA] ?: 0.0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (FFStats.baseFF[FFTypes.FARMING_LVL]!! < 0.0) "§cFarming level not saved\n§eOpen /skills to set it!" + else "§7§2Fortune for levelling your farming skill\n§2You get 4☘ per farming level" + GuiRenderUtils.drawFarmingBar("§2Farming Level", line, FFStats.baseFF[FFTypes.FARMING_LVL] ?: 0.0, 240, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (FFStats.baseFF[FFTypes.COMMUNITY_SHOP]!! < 0.0) "§cCommunity upgrade level not saved\n§eVisit Elizabeth to set it!" + else "§7§2Fortune for community shop upgrades\n§2You get 4☘ per upgrade tier" + GuiRenderUtils.drawFarmingBar("§2Community upgrades", line, FFStats.baseFF[FFTypes.COMMUNITY_SHOP] ?: 0.0, + 40, FFGuideGUI.guiLeft + 15, FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (FFStats.baseFF[FFTypes.PLOTS]!! < 0.0) "§cUnlocked plot count not saved\n§eOpen /desk and view your plots to set it!" + else "§7§2Fortune for unlocking garden plots\n§2You get 3☘ per plot unlocked" + GuiRenderUtils.drawFarmingBar("§2Garden Plots", line, FFStats.baseFF[FFTypes.PLOTS] ?: 0.0, 72, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = when (FFGuideGUI.cakeBuffTime) { + -1L -> "§eYou have not eaten a cake since\n§edownloading this update, assuming the\n§ebuff is active!" + else -> "§7§2Fortune for eating cake\n§2You get 5☘ for eating cake\n§2Time until cake buff runs out: $timeUntilCakes" + } + if (FFGuideGUI.cakeBuffTime - System.currentTimeMillis() < 0 && FFGuideGUI.cakeBuffTime != -1L) { + line = "§cYour cake buff has run out\nGo eat some cake!" + } + GuiRenderUtils.drawFarmingBar("§2Cake Buff", line, FFStats.baseFF[FFTypes.CAKE] ?: 0.0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + val armorItem = when (currentArmor) { + 1 -> FarmingItems.HELMET + 2 -> FarmingItems.CHESTPLATE + 3 -> FarmingItems.LEGGINGS + else -> FarmingItems.BOOTS + } + + armorFF = when (currentArmor) { + 1 -> FFStats.helmetFF + 2 -> FFStats.chestplateFF + 3 -> FFStats.leggingsFF + 4 -> FFStats.bootsFF + else -> FFStats.armorTotalFF + } + + 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) { + when (currentArmor) { + 1 -> 76.67 + 2 -> 81.67 + 3 -> 81.67 + else -> 85 + } + } else { + when (currentArmor) { + 1 -> 78.75 + 2 -> 83.75 + 3 -> 83.75 + else -> 78.75 + } + } + GuiRenderUtils.drawFarmingBar("§2Total Armor Fortune", line, armorFF[FFTypes.TOTAL] ?: 0, value, + FFGuideGUI.guiLeft + 135, FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (currentArmor == 0) "§7§2The base fortune from your armor\n§2Select a piece for more info" + else "§7§2Base fortune from your\n${armorItem.getItem().displayName}" + value = if (currentArmor == 0) { + if (FFStats.usingSpeedBoots) 160 else 130 + } else if (currentArmor == 1) 30 + else if (currentArmor == 2) 35 + else if (currentArmor == 3) 35 + else { + if (FFStats.usingSpeedBoots) 60 else 30 + } + GuiRenderUtils.drawFarmingBar("§2Base Armor Fortune", line, armorFF[FFTypes.BASE] ?: 0, + value, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (currentArmor == 0) "§7§2The fortune from your armor's ability\n§2Select a piece for more info" + else "§7§2Ability fortune from your\n${armorItem.getItem().displayName}" + value = if (FFStats.usingSpeedBoots) { + when (currentArmor) { + 0 -> 50 + 1 -> 16.67 + 2 -> 16.67 + 3 -> 16.67 + else -> 0 + } + } else { + when (currentArmor) { + 0 -> 75 + 1 -> 18.75 + 2 -> 18.75 + 3 -> 18.75 + else -> 18.75 + } + } + + GuiRenderUtils.drawFarmingBar("§2Armor Ability", line, armorFF[FFTypes.ABILITY] ?: 0, + value, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (currentArmor == 0) "§7§2The fortune from your armor's reforge\n§2Select a piece for more info" + else "§7§2Total fortune from your\n${armorItem.getItem().displayName}" + value = if (currentArmor == 0) { + if (FFStats.usingSpeedBoots) 115 else 120 + } else if (currentArmor == 4) { + if (FFStats.usingSpeedBoots) 25 else 30 + } else 30 + GuiRenderUtils.drawFarmingBar("§2Armor Reforge", line, armorFF[FFTypes.REFORGE] ?: 0, + value, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + val currentPet = when (FFGuideGUI.currentPet) { + 0 -> FFStats.elephantFF + 1 -> FFStats.mooshroomFF + else -> FFStats.rabbitFF + } + + GuiRenderUtils.drawFarmingBar("§2Total Pet Fortune", "§7§2The total fortune from your pet and its item", + currentPet[FFTypes.TOTAL] ?: 0, 240, FFGuideGUI.guiLeft + 105, + FFGuideGUI.guiTop + 155, 70, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = when (FFStats.currentPetItem) { + "GREEN_BANDANA" -> "§7§2The fortune from your pet's item\n§2Grants 4☘ per garden level" + "YELLOW_BANDANA" -> "§7§2The fortune from your pet's item" + "MINOS_RELIC" -> "§cGreen Bandana is better than relic!" + else -> "No fortune boosting pet item" + } + GuiRenderUtils.drawFarmingBar("§2Pet Item", line, currentPet[FFTypes.PET_ITEM] ?: 0, 60, FFGuideGUI.guiLeft + 185, + FFGuideGUI.guiTop + 155, 70, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + val equipmentItem = when (currentEquipment) { + 1 -> FarmingItems.NECKLACE + 2 -> FarmingItems.CLOAK + 3 -> FarmingItems.BELT + else -> FarmingItems.BRACELET + } + + equipmentFF = when (currentEquipment) { + 1 -> FFStats.necklaceFF + 2 -> FFStats.cloakFF + 3 -> FFStats.beltFF + 4 -> FFStats.braceletFF + else -> FFStats.equipmentTotalFF + } + + line = if (currentEquipment == 0) "§7§2Total fortune from all your equipment\n§2Select a piece for more info" + else "§7§2Total fortune from your\n${equipmentItem.getItem().displayName}" + GuiRenderUtils.drawFarmingBar("§2Total Equipment Fortune", line, equipmentFF[FFTypes.TOTAL] ?: 0, + if (currentEquipment == 0) 198 else 49.5, + FFGuideGUI.guiLeft + 255, FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (currentEquipment == 0) "§7§2The base fortune from all your equipment\n§2Select a piece for more info" + else "§7§2Total base fortune from your\n${equipmentItem.getItem().displayName}" + GuiRenderUtils.drawFarmingBar("§2Equipment Base Fortune", line, equipmentFF[FFTypes.BASE] ?: 0, + if (currentEquipment == 0) 20 else 5, + FFGuideGUI.guiLeft + 255, FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (currentEquipment == 0) "§7§2The fortune from all of your equipment's abilities\n§2Select a piece for more info" + else "§7§2Total ability fortune from your\n${equipmentItem.getItem().displayName}" + GuiRenderUtils.drawFarmingBar("§2Equipment Ability", line, equipmentFF[FFTypes.ABILITY] ?: 0, + if (currentEquipment == 0) 60 else 15, + FFGuideGUI.guiLeft + 255, FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (currentEquipment == 0) "§7§2The fortune from all of your equipment's reforges\n§2Select a piece for more info" + else "§7§2Total reforge fortune from your\n${equipmentItem.getItem().displayName}" + GuiRenderUtils.drawFarmingBar("§2Equipment Reforge", line, equipmentFF[FFTypes.REFORGE] ?: 0, + if (currentEquipment == 0) 40 else 10, + FFGuideGUI.guiLeft + 255, FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + line = if (currentEquipment == 0) "§7§2The fortune from all of your equipment's enchantments\n§2Select a piece for more info" + else "§7§2Total enchantment fortune from your\n${equipmentItem.getItem().displayName}" + GuiRenderUtils.drawFarmingBar("§2Equipment Enchantment", line, equipmentFF[FFTypes.GREEN_THUMB] ?: 0, + if (currentEquipment == 0) 78 else 19.5, + FFGuideGUI.guiLeft + 255, FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/PotatoPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/PotatoPage.kt new file mode 100644 index 000000000..b78b7170f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/PotatoPage.kt @@ -0,0 +1,74 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils + + +class PotatoPage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.POTATO.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + +//todo update dynamically + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.potatoFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Potato Farming Fortune", "§7§2Farming fortune for potato", + totalCropFF, 1746, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.potatoFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.potatoFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Base tool fortune", "§7§2Depends on your tools tier", + FFStats.potatoFF[FFTypes.BASE] ?: 0, 50, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) +//todo change based on reforge + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.potatoFF[FFTypes.REFORGE] ?: 0, 20, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.potatoFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Logarithmic Counter", "§7§2Fortune from increasing crop counter\n" + + "§2You get 16☘ per digit - 4", FFStats.potatoFF[FFTypes.COUNTER] ?: 0, 96, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Collection Analyst", "§7§2Fortune from increasing crop collection\n" + + "§2You get 8☘ per digit - 4", FFStats.potatoFF[FFTypes.COLLECTION] ?: 0, 48, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Harvesting Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.potatoFF[FFTypes.HARVESTING] ?: 0, 75, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.potatoFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Potato Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.potatoFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.potatoFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/PumpkinPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/PumpkinPage.kt new file mode 100644 index 000000000..e4721ba68 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/PumpkinPage.kt @@ -0,0 +1,66 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName + + +class PumpkinPage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.PUMPKIN.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.pumpkinFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Pumpkin Farming Fortune", "§7§2Farming fortune for pumpkin", + totalCropFF, 1539.5, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.pumpkinFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.pumpkinFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.pumpkinFF[FFTypes.REFORGE] ?: 0, 20, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.pumpkinFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Sunder Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.pumpkinFF[FFTypes.SUNDER] ?: 0, 62.5, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.pumpkinFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Pumpkin Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.pumpkinFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.pumpkinFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Tool Ability", "§7§2Theoretical fortune from dicer ability\n§2Is very random!", + if (FarmingItems.PUMPKIN.getItem().getInternalName().contains("DICER")) 33 else 0, 33, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/WartPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/WartPage.kt new file mode 100644 index 000000000..1a14a0768 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/WartPage.kt @@ -0,0 +1,74 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils + + +class WartPage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.NETHER_WART.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + +//todo update dynamically + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.wartFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Wart Farming Fortune", "§7§2Farming fortune for nether wart", + totalCropFF, 1746, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.wartFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.wartFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Base tool fortune", "§7§2Depends on your tools tier", + FFStats.wartFF[FFTypes.BASE] ?: 0, 50, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) +//todo change based on reforge + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.wartFF[FFTypes.REFORGE] ?: 0, 20, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.wartFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Logarithmic Counter", "§7§2Fortune from increasing crop counter\n" + + "§2You get 16☘ per digit - 4", FFStats.wartFF[FFTypes.COUNTER] ?: 0, 96, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Collection Analyst", "§7§2Fortune from increasing crop collection\n" + + "§2You get 8☘ per digit - 4", FFStats.wartFF[FFTypes.COLLECTION] ?: 0, 48, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Harvesting Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.wartFF[FFTypes.HARVESTING] ?: 0, 75, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.wartFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Warts Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.wartFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.wartFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/WheatPage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/WheatPage.kt new file mode 100644 index 000000000..55c64525d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/WheatPage.kt @@ -0,0 +1,74 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide.pages + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFStats +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFTypes +import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems +import at.hannibal2.skyhanni.utils.GuiRenderUtils + + +class WheatPage: FFGuideGUI.FFGuidePage() { + override fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (FFGuideGUI.breakdownMode) { + GuiRenderUtils.renderItemAndTip(FarmingItems.WHEAT.getItem(), + FFGuideGUI.guiLeft + 172, FFGuideGUI.guiTop + 60, mouseX, mouseY) + +//todo update dynamically + val totalCropFF = FFStats.totalBaseFF[FFTypes.TOTAL]!! + FFStats.wheatFF[FFTypes.TOTAL]!! + GuiRenderUtils.drawFarmingBar("§6Wheat Farming Fortune", "§7§2Farming fortune for wheat", + totalCropFF, 1746, FFGuideGUI.guiLeft + 135, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Universal Farming Fortune", "§7§2Farming fortune in that is\n" + + "§2applied to every crop", FFStats.totalBaseFF[FFTypes.TOTAL] ?: 0, 1250, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Talisman Bonus", "§7§2Fortune from your talisman\n" + + "§2You get 10☘ per talisman tier", FFStats.wheatFF[FFTypes.ACCESSORY] ?: 0, 30, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Crop Upgrade", "§7§2Fortune from Desk crop upgrades\n" + + "§2You get 5☘ per level", FFStats.wheatFF[FFTypes.CROP_UPGRADE] ?: 0, 45, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Base tool fortune", "§7§2Depends on your tools tier", + FFStats.wheatFF[FFTypes.BASE] ?: 0, 50, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) +//todo change based on reforge + GuiRenderUtils.drawFarmingBar("§2Tool reforge", "§7§2Fortune from reforging your tool", + FFStats.wheatFF[FFTypes.REFORGE] ?: 0, 20, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Farming for Dummies", "§7§2Fortune for each applied book\n" + + "§2You get 1☘ per applied book", FFStats.wheatFF[FFTypes.FFD] ?: 0, 5, FFGuideGUI.guiLeft + 15, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Logarithmic Counter", "§7§2Fortune from increasing crop counter\n" + + "§2You get 16☘ per digit - 4", FFStats.wheatFF[FFTypes.COUNTER] ?: 0, 96, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 5, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Collection Analyst", "§7§2Fortune from increasing crop collection\n" + + "§2You get 8☘ per digit - 4", FFStats.wheatFF[FFTypes.COLLECTION] ?: 0, 48, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 30, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Harvesting Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 12.5☘ per level", FFStats.wheatFF[FFTypes.HARVESTING] ?: 0, 75, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 55, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Cultivating Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 1☘ per level", FFStats.wheatFF[FFTypes.CULTIVATING] ?: 0, 10, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 80, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Turbo-Wheat Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2You get 5☘ per level", FFStats.wheatFF[FFTypes.TURBO] ?: 0, 25, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 105, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + + GuiRenderUtils.drawFarmingBar("§2Dedication Enchantment", "§7§2Fortune for each enchantment level\n" + + "§2and crop milestone", FFStats.wheatFF[FFTypes.DEDICATION] ?: 0, 92, FFGuideGUI.guiLeft + 255, + FFGuideGUI.guiTop + 130, 90, mouseX, mouseY, FFGuideGUI.tooltipToDisplay) + } else { + return + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index acdcf5753..059c3fd6e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -27,11 +27,15 @@ object GardenVisitorDropStatistics { private var totalVisitors = 0 private var visitorRarities = mutableListOf<Long>() private var copper = 0 + private var gardenExp = 0 private var farmingExp = 0L var coinsSpent = 0L + var lastAccept = 0L + private val acceptPattern = "OFFER ACCEPTED with (?<visitor>.*) [(](?<rarity>.*)[)]".toPattern() private val copperPattern = "[+](?<amount>.*) Copper".toPattern() + private val gardenExpPattern = "[+](?<amount>.*) Garden Experience".toPattern() private val farmingExpPattern = "[+](?<amount>.*) Farming XP".toPattern() private var rewardsCount = mapOf<VisitorReward, Int>() @@ -52,29 +56,37 @@ object GardenVisitorDropStatistics { fun onChat(event: LorenzChatEvent) { if (!GardenAPI.onBarnPlot) return if (!ProfileStorageData.loaded) return - val message = event.message.removeColor().trim() + if (lastAccept - System.currentTimeMillis() <= 0 && lastAccept - System.currentTimeMillis() > -1000) { + val message = event.message.removeColor().trim() - copperPattern.matchMatcher(message) { - val amount = group("amount").formatNumber().toInt() - copper += amount - saveAndUpdate() - } - farmingExpPattern.matchMatcher(message) { - val amount = group("amount").formatNumber() - farmingExp += amount - saveAndUpdate() - } - acceptPattern.matchMatcher(message) { - setRarities(group("rarity")) - saveAndUpdate() - } - - for (reward in VisitorReward.values()) { - reward.pattern.matchMatcher(message) { - val old = rewardsCount[reward] ?: 0 - rewardsCount = rewardsCount.editCopy { this[reward] = old + 1 } + copperPattern.matchMatcher(message) { + val amount = group("amount").formatNumber().toInt() + copper += amount + saveAndUpdate() + } + farmingExpPattern.matchMatcher(message) { + val amount = group("amount").formatNumber() + farmingExp += amount + saveAndUpdate() + } + gardenExpPattern.matchMatcher(message) { + val amount = group("amount").formatNumber().toInt() + if (amount > 80) return // some of the low visitor milestones will get through but will be minimal + gardenExp += amount saveAndUpdate() } + acceptPattern.matchMatcher(message) { + setRarities(group("rarity")) + saveAndUpdate() + } + + for (reward in VisitorReward.values()) { + reward.pattern.matchMatcher(message) { + val old = rewardsCount[reward] ?: 0 + rewardsCount = rewardsCount.editCopy { this[reward] = old + 1 } + saveAndUpdate() + } + } } } @@ -108,6 +120,8 @@ object GardenVisitorDropStatistics { addAsSingletonList(format(copper, "Copper", "§c", "")) //7 addAsSingletonList(format(farmingExp, "Farming EXP", "§3", "§7")) + //16 + addAsSingletonList(format(gardenExp, "Garden EXP", "§2", "§7")) //8 addAsSingletonList(format(coinsSpent, "Coins Spent", "§6", "")) @@ -148,6 +162,7 @@ object GardenVisitorDropStatistics { hidden.visitorRarities = visitorRarities hidden.copper = copper hidden.farmingExp = farmingExp + hidden.gardenExp = gardenExp hidden.coinsSpent = coinsSpent hidden.rewardsCount = rewardsCount display = formatDisplay(drawVisitorStatsDisplay()) @@ -168,6 +183,7 @@ object GardenVisitorDropStatistics { visitorRarities = hidden.visitorRarities copper = hidden.copper farmingExp = hidden.farmingExp + gardenExp = hidden.gardenExp coinsSpent = hidden.coinsSpent rewardsCount = hidden.rewardsCount saveAndUpdate() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 4554f3845..588ee9172 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -238,6 +238,7 @@ class GardenVisitorFeatures { changeStatus(visitor, VisitorStatus.ACCEPTED, "accepted") update() GardenVisitorDropStatistics.coinsSpent += round(price).toLong() + GardenVisitorDropStatistics.lastAccept = System.currentTimeMillis() return } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index f1b1a0db3..5a80e45a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -97,6 +97,7 @@ class GardenVisitorTimer { if (lastVisitors != -1 && visitorsAmount - lastVisitors == 1) { if (!queueFull) { visitorInterval = ((millis - 1) / 60_000L + 1) * 60_000L + GardenAPI.config?.visitorInterval = visitorInterval } else { updateSixthVisitorArrivalTime() } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt new file mode 100644 index 000000000..a4dbede9d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt @@ -0,0 +1,208 @@ +package at.hannibal2.skyhanni.utils + +import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI +import at.hannibal2.skyhanni.utils.LorenzUtils.round +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.FontRenderer +import net.minecraft.client.gui.GuiScreen +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.client.renderer.RenderHelper +import net.minecraft.item.ItemStack +import org.lwjgl.opengl.GL11 +import java.awt.Color +import java.text.DecimalFormat +import kotlin.math.roundToInt + +/** + * Taken from NotEnoughUpdates + */ +object GuiRenderUtils { + + fun drawStringCentered(str: String?, fr: FontRenderer, x: Float, y: Float, shadow: Boolean, colour: Int) { + val strLen = fr.getStringWidth(str) + val x2 = x - strLen / 2f + val y2 = y - fr.FONT_HEIGHT / 2f + GL11.glTranslatef(x2, y2, 0f) + fr.drawString(str, 0f, 0f, colour, shadow) + GL11.glTranslatef(-x2, -y2, 0f) + } + + fun drawString(str: String, x: Float, y: Float) { + Minecraft.getMinecraft().fontRendererObj.drawString(str, x, y, 0xffffff, true) + } + + fun drawStringCentered(str: String?, x: Int, y: Int) { + drawStringCentered( + str, + Minecraft.getMinecraft().fontRendererObj, + x.toFloat(), + y.toFloat(), + true, + 0xffffff + ) + } + + fun renderItemStack(item: ItemStack, x: Int, y: Int) { + val itemRender = Minecraft.getMinecraft().renderItem + RenderHelper.enableGUIStandardItemLighting() + itemRender.zLevel = -145f + itemRender.renderItemAndEffectIntoGUI(item, x, y) + itemRender.zLevel = 0f + RenderHelper.disableStandardItemLighting() + } + + // Code taken and edited from NEU + private fun drawTooltip( + textLines: List<String>, + mouseX: Int, + mouseY: Int, + screenHeight: Int, + fr: FontRenderer + ) { + if (textLines.isNotEmpty()) { + val borderColor = StringUtils.getColor(textLines[0], 0x505000FF) + + GlStateManager.disableRescaleNormal() + RenderHelper.disableStandardItemLighting() + GlStateManager.disableLighting() + GlStateManager.enableDepth() + var tooltipTextWidth = 0 + + for (textLine in textLines) { + val textLineWidth: Int = fr.getStringWidth(textLine) + if (textLineWidth > tooltipTextWidth) { + tooltipTextWidth = textLineWidth + } + } + + val tooltipX = mouseX + 12 + var tooltipY = mouseY - 12 + var tooltipHeight = 8 + + if (textLines.size > 1) tooltipHeight += (textLines.size - 1) * 10 + 2 + GlStateManager.translate(0f, 0f, 100f) + if (tooltipY + tooltipHeight + 6 > screenHeight) tooltipY = screenHeight - tooltipHeight - 6 + // main background + GuiScreen.drawRect(tooltipX - 3, tooltipY - 3, + tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, -0xfeffff0) + + // borders + GuiScreen.drawRect(tooltipX - 3, tooltipY - 3 + 1, + tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColor) + + GuiScreen.drawRect(tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, + tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColor) + + GuiScreen.drawRect(tooltipX - 3, tooltipY - 3, + tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColor) + + GuiScreen.drawRect(tooltipX - 3, tooltipY + tooltipHeight + 2, + tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColor) + GlStateManager.translate(0f, 0f, -100f) + GlStateManager.disableDepth() + + for (line in textLines) { + fr.drawString(line, tooltipX.toFloat(), tooltipY.toFloat(), 0xffffff, true) + + tooltipY += if (line == textLines[0]) 12 else 10 + } + + GlStateManager.enableDepth() + GlStateManager.enableLighting() + GlStateManager.enableRescaleNormal() + RenderHelper.enableStandardItemLighting() + } + GlStateManager.disableLighting() + } + + fun drawTooltip(textLines: List<String>, mouseX: Int, mouseY: Int, screenHeight: Int) { + drawTooltip(textLines, mouseX, mouseY, screenHeight, Minecraft.getMinecraft().fontRendererObj) + } + + fun isPointInRect(x: Int, y: Int, left: Int, top: Int, width: Int, height: Int): Boolean { + return left <= x && x < left + width && top <= y && y < top + height + } + + fun drawProgressBar(x: Int, y: Int, barWidth: Int, progress: Float) { + GuiScreen.drawRect(x, y, x + barWidth, y + 6, 0xFF43464B.toInt()) + val width = barWidth * progress + GuiScreen.drawRect(x + 1, y + 1, (x + width).toInt() + 1, y + 5, 0xFF00FF00.toInt()) + if (progress != 1f) GuiScreen.drawRect((x + width).toInt() + 1, y + 1, x + barWidth - 1, y + 5, 0xFF013220.toInt()) + } + + fun renderItemAndTip(item: ItemStack?, x: Int, y: Int, mouseX: Int, mouseY: Int, color: Int = 0xFF43464B.toInt()) { + GuiScreen.drawRect(x, y, x + 16, y + 16, color) + if (item != null) { + renderItemStack(item, x, y) + if (isPointInRect(mouseX, mouseY, x, y, 16, 16)) { + val tt: List<String> = item.getTooltip(Minecraft.getMinecraft().thePlayer, false) + FFGuideGUI.tooltipToDisplay.addAll(tt) + } + } + } + + // assuming 70% font size + fun drawFarmingBar( + label: String, + tooltip: String, + currentValue: Number, + maxValue: Number, + xPos: Int, + yPos: Int, + width: Int, + mouseX: Int, + mouseY: Int, + output: MutableList<String>, + textScale: Float = .7f + ) { + var currentVal = currentValue.toDouble() + currentVal = if (currentVal < 0) 0.0 else currentVal + + var barProgress = currentVal / maxValue.toFloat() + if (maxValue == 0) barProgress = 1.0 + barProgress = when { + barProgress > 1 -> 1.0 + barProgress < 0 -> 0.0 + else -> barProgress + } + + val filledWidth = (width * barProgress).toInt() + val current = DecimalFormat("0.##").format(currentVal.round(2)) + val progressPercentage = (barProgress * 10000).roundToInt() / 100 + val inverseScale = 1 / textScale + val textWidth: Int = Minecraft.getMinecraft().fontRendererObj.getStringWidth("$progressPercentage%") + val barColor = barColorGradient(barProgress) + + GlStateManager.scale(textScale, textScale, textScale) + drawString(label, xPos * inverseScale, yPos * inverseScale) + drawString("§2$current / $maxValue☘", xPos * inverseScale, (yPos + 8) * inverseScale) + drawString("§2$progressPercentage%", (xPos + width - textWidth * textScale) * inverseScale, (yPos + 8) * inverseScale) + GlStateManager.scale(inverseScale, inverseScale, inverseScale) + + GuiScreen.drawRect(xPos, yPos + 16, xPos + width, yPos + 20, 0xFF43464B.toInt()) + GuiScreen.drawRect(xPos + 1, yPos + 17, xPos + width - 1, yPos + 19, barColor.darkenColor()) + GuiScreen.drawRect(xPos + 1, yPos + 17, + if (filledWidth < 2) xPos + 1 else xPos + filledWidth - 1, yPos + 19, barColor) + + if (tooltip != "") { + if (isPointInRect(mouseX, mouseY, xPos - 2, yPos - 2, width + 4, 20 + 4)) { + val split = tooltip.split("\n") + for (line in split) { + output.add(line) + } + } + } + } + + private fun barColorGradient(double: Double): Int { + var newDouble = (double - .5) * 2 + if (newDouble < 0) newDouble = 0.0 + return Color((255 * (1 - newDouble)).toInt(), (255 * newDouble).toInt(), 0).rgb + } + + fun Int.darkenColor(): Int { + val color = Color(this) + return Color(color.red / 5, color.green / 5, color.blue / 5).rgb + } + +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 69687535b..b78a23c0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -1,10 +1,13 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.utils.ItemBlink.checkBlinkItem import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import com.google.gson.JsonObject +import com.google.gson.JsonPrimitive import io.github.moulberry.notenoughupdates.NEUManager import io.github.moulberry.notenoughupdates.NEUOverlay import io.github.moulberry.notenoughupdates.NotEnoughUpdates @@ -268,4 +271,23 @@ object NEUItems { + ";" + group("level").romanToDecimal()) } } + + //Uses NEU + fun saveNBTData(item: ItemStack, removeLore: Boolean = true): String { + val jsonObject = manager.getJsonForItem(item) + if (!jsonObject.has("internalname")) { + jsonObject.add("internalname", JsonPrimitive("_")) + } + if (removeLore) { + if (jsonObject.has("lore")) jsonObject.remove("lore") + } + val jsonString = jsonObject.toString() + return StringUtils.encodeBase64(jsonString) + } + + fun loadNBTData(encoded: String): ItemStack { + val jsonString = StringUtils.decodeBase64(encoded) + val jsonObject = ConfigManager.gson.fromJson(jsonString, JsonObject::class.java) + return manager.jsonToStack(jsonObject, false) + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index bab653f68..7e56be09e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -791,15 +791,5 @@ object RenderUtils { GlStateManager.enableDepth() } - /** - * Taken from NotEnoughUpdates - */ - fun drawStringCentered(str: String?, fr: FontRenderer, x: Float, y: Float, shadow: Boolean, colour: Int) { - val strLen = fr.getStringWidth(str) - val x2 = x - strLen / 2f - val y2 = y - fr.FONT_HEIGHT / 2f - GL11.glTranslatef(x2, y2, 0f) - fr.drawString(str, 0f, 0f, colour, shadow) - GL11.glTranslatef(-x2, -y2, 0f) - } -}
\ No newline at end of file + +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index fa86f5a18..83c28c099 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -3,11 +3,13 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import com.google.gson.JsonObject import net.minecraft.item.ItemStack object SkyBlockItemModifierUtils { private val drillPartTypes = listOf("drill_part_upgrade_module", "drill_part_engine", "drill_part_fuel_tank") + private val petLevelPattern = "§7\\[Lvl (?<level>.*)\\] .*".toPattern() fun ItemStack.getHotPotatoCount() = getAttributeInt("hot_potato_count") @@ -32,7 +34,19 @@ object SkyBlockItemModifierUtils { fun ItemStack.getManaDisintegrators() = getAttributeInt("mana_disintegrator_count") - fun ItemStack.getPetCandyUsed() = ConfigManager.gson.fromJson(getExtraAttributes()?.getString("petInfo"), JsonObject::class.java)?.get("candyUsed")?.asInt + fun ItemStack.getPetCandyUsed() = getPetInfo()?.get("candyUsed")?.asInt + + fun ItemStack.getPetItem() = getPetInfo()?.get("heldItem")?.asString + + private fun ItemStack.getPetInfo() = + ConfigManager.gson.fromJson(getExtraAttributes()?.getString("petInfo"), JsonObject::class.java) + + fun ItemStack.getPetLevel(): Int { + petLevelPattern.matchMatcher(this.displayName) { + return group("level").toInt() + } + return 0 + } fun ItemStack.getMasterStars(): Int { val stars = mapOf( diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt index 95406b1bf..325e87211 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt @@ -8,6 +8,7 @@ import net.minecraft.util.ResourceLocation object SoundUtils { private val beepSound by lazy { createSound("random.orb", 1f) } + private val clickSound by lazy { createSound("gui.button.press", 1f) } fun ISound.playSound() { Minecraft.getMinecraft().addScheduledTask { @@ -48,4 +49,8 @@ object SoundUtils { fun playBeepSound() { beepSound.playSound() } + + fun playClickSound() { + clickSound.playSound() + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 62ab4330d..8ae1fe288 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -1,5 +1,7 @@ package at.hannibal2.skyhanni.utils +import at.hannibal2.skyhanni.utils.GuiRenderUtils.darkenColor +import net.minecraft.client.Minecraft import org.intellij.lang.annotations.Language import java.util.* import java.util.regex.Matcher @@ -72,4 +74,23 @@ object StringUtils { split[0].removeColor() } } + + fun getColor(string: String, default: Int, darker: Boolean = true): Int { + val stringPattern = "§[0123456789abcdef].*".toPattern() + + val matcher = stringPattern.matcher(string) + if (matcher.matches()) { + val colorInt = Minecraft.getMinecraft().fontRendererObj.getColorCode(string[1]) + return if (darker) { + colorInt.darkenColor() + } else { + "ff${Integer.toHexString(colorInt)}".toLong(radix = 16).toInt() + } + } + return default + } + + fun encodeBase64(input: String) = Base64.getEncoder().encodeToString(input.toByteArray()) + + fun decodeBase64(input: String) = Base64.getDecoder().decode(input).decodeToString() } |