aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-23 12:05:11 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-23 12:05:11 +0200
commit99c8869f1780924197dabe589768f3d31f62b171 (patch)
tree3ca918164b4c66b13c76926b79bbd1c1d8b5d266 /src/main/java
parent99ad5e33b9732b1e9bc4fc3cd9cd7637dbc494aa (diff)
downloadskyhanni-99c8869f1780924197dabe589768f3d31f62b171.tar.gz
skyhanni-99c8869f1780924197dabe589768f3d31f62b171.tar.bz2
skyhanni-99c8869f1780924197dabe589768f3d31f62b171.zip
Support for 5% or 10% contribution bonus
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt
index c64710755..a4cba3e35 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt
@@ -9,6 +9,8 @@ import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
+import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.jsonobjects.AnitaUpgradeCostsJson
import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -29,8 +31,14 @@ class AnitaExtraFarmingFortune {
val anitaUpgrade = GardenAPI.config?.fortune?.anitaUpgrade ?: return
- // TODO: Add support for 5% or 10% contribution bonus
-// val currentPrice = levelPrice[anitaUpgrade + 1] ?: return
+ var amountFactor = 1.0
+ val currentPrice = levelPrice[anitaUpgrade + 1] ?: return
+ for (line in event.toolTip) {
+ "§5§o§aJacob's Ticket §8x(?<realAmount>.*)".toPattern().matchMatcher(line) {
+ val realAmount = group("realAmount").formatNumber().toDouble()
+ amountFactor = realAmount / currentPrice.jacob_tickets
+ }
+ }
var goldMedals = 0
var jacobTickets = 0
@@ -40,6 +48,7 @@ class AnitaExtraFarmingFortune {
jacobTickets += price.jacob_tickets
}
}
+ jacobTickets = (amountFactor * jacobTickets).toInt()
val index = event.toolTip.indexOfFirst("§5§o§eClick to trade!")?.let { it - 1 } ?: return