aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-17 02:11:45 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-17 02:11:45 +0100
commit6536f1307c232ad57f96e83f4371a47d6b3fff89 (patch)
treec490c1aa4797df501a26485aabf820e8dc4debfa /src/main/java/at/hannibal2
parent0454b6420983dc37ff6c333adde1ce4aa6c36824 (diff)
downloadskyhanni-6536f1307c232ad57f96e83f4371a47d6b3fff89.tar.gz
skyhanni-6536f1307c232ad57f96e83f4371a47d6b3fff89.tar.bz2
skyhanni-6536f1307c232ad57f96e83f4371a47d6b3fff89.zip
Garden: Crop Milestone + Crop Upgrades
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt44
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt2
4 files changed, 64 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 3266af83c..a848ab072 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -23,6 +23,7 @@ import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowHelper;
import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowParticleFinder;
import at.hannibal2.skyhanni.features.event.diana.SoopyGuessBurrow;
import at.hannibal2.skyhanni.features.fishing.*;
+import at.hannibal2.skyhanni.features.garden.GardenInventoryNumbers;
import at.hannibal2.skyhanni.features.garden.GardenVisitorFeatures;
import at.hannibal2.skyhanni.features.garden.SkyMartBestProfit;
import at.hannibal2.skyhanni.features.inventory.*;
@@ -199,6 +200,7 @@ public class SkyHanniMod {
loadModule(new MiscFeatures());
loadModule(new SkyMartBestProfit());
loadModule(new GardenVisitorFeatures());
+ loadModule(new GardenInventoryNumbers());
Commands.INSTANCE.init();
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 d5344900b..139567c97 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -51,4 +51,21 @@ public class Garden {
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
public boolean visitorHelperShowPrice = true;
+
+ @Expose
+ @ConfigOption(name = "Numbers", desc = "")
+ @ConfigEditorAccordion(id = 2)
+ public boolean numbers = false;
+
+ @Expose
+ @ConfigOption(name = "Crop Milestone", desc = "Show the number of the crop milestone in the inventory.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean cropMilestoneNumber = true;
+
+ @Expose
+ @ConfigOption(name = "Crop Upgrades", desc = "Show the number of upgrades in the crop upgrades inventory.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean cropUpgradesNumber = true;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt
new file mode 100644
index 000000000..95b9b1e9e
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenInventoryNumbers.kt
@@ -0,0 +1,44 @@
+package at.hannibal2.skyhanni.features.garden
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.events.RenderItemTipEvent
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.regex.Pattern
+
+class GardenInventoryNumbers {
+
+ private var patternTierProgress = Pattern.compile("§7Progress to Tier (.*): §e(?:.*)")
+ private var patternUpgradeTier = Pattern.compile("§7Current Tier: §e(.*)§7/§a.*")
+
+ @SubscribeEvent
+ fun onRenderItemTip(event: RenderItemTipEvent) {
+ if (!isEnabled()) return
+
+ if (InventoryUtils.openInventoryName() == "Crop Milestones") {
+ if (!SkyHanniMod.feature.garden.cropMilestoneNumber) return
+
+ event.stack.getLore()
+ .map { patternTierProgress.matcher(it) }
+ .filter { it.matches() }
+ .map { it.group(1).romanToDecimal() - 1 }
+ .forEach { event.stackTip = "" + it }
+ }
+
+ if (InventoryUtils.openInventoryName() == "Crop Upgrades") {
+ if (!SkyHanniMod.feature.garden.cropUpgradesNumber) return
+
+ event.stack.getLore()
+ .map { patternUpgradeTier.matcher(it) }
+ .filter { it.matches() }
+ .map { it.group(1) }
+ .forEach { event.stackTip = "" + it }
+ }
+ }
+
+ private fun isEnabled() = LorenzUtils.inSkyBlock && LorenzUtils.skyBlockIsland == IslandType.GARDEN
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt
index 369765c5d..ead2f6832 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/SkyMartBestProfit.kt
@@ -20,6 +20,7 @@ import java.util.regex.Pattern
class SkyMartBestProfit {
+ private val pattern = Pattern.compile("§c(.*) Copper")
private val display = mutableListOf<String>()
@SubscribeEvent
@@ -29,7 +30,6 @@ class SkyMartBestProfit {
val inventory = event.inventory
if (inventory.title != "SkyMart") return
- val pattern = Pattern.compile("§c(.*) Copper")
val priceMap = mutableMapOf<Pair<String, String>, Double>()
val auctionManager = NotEnoughUpdates.INSTANCE.manager.auctionManager