aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt
index bba86c595..79461a78a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt
@@ -8,6 +8,9 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
import at.hannibal2.skyhanni.features.garden.farming.GardenCropMilestoneDisplay
import at.hannibal2.skyhanni.utils.ChatUtils
+import at.hannibal2.skyhanni.utils.ItemUtils.itemNameWithoutColor
+import at.hannibal2.skyhanni.utils.NEUInternalName
+import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -24,6 +27,21 @@ class GardenCropMilestoneFix {
"levelup",
" {2}§r§b§lGARDEN MILESTONE §3(?<crop>.*) §8.*➜§3(?<tier>.*)"
)
+ /**
+ * REGEX-TEST: §eYou received §a7x Enchanted Potato §efor killing a §6Locust§e!
+ * REGEX-TEST: §eYou received §a6x Enchanted Cocoa Beans §efor killing a §6Moth§e!
+ */
+ private val pestLootPattern by patternGroup.pattern(
+ "pests.loot",
+ "§eYou received §a(?<amount>[0-9]*)x (?<item>.*) §efor killing an? §6(?<pest>.*)§e!"
+ )
+ /**
+ * REGEX-TEST: §6§lRARE DROP! §9Mutant Nether Wart §6(§6+1,344☘)
+ */
+ private val pestRareDropPattern by patternGroup.pattern(
+ "pests.raredrop",
+ "§6§lRARE DROP! (?:§.)*(?<item>.+) §6\\(§6\\+.*☘\\)"
+ )
private val tabListCropProgress = mutableMapOf<CropType, Long>()
@@ -38,6 +56,31 @@ class GardenCropMilestoneFix {
val crops = GardenCropMilestones.getCropsForTier(tier, crop)
changedValue(crop, crops, "level up chat message", 0)
}
+ pestLootPattern.matchMatcher(event.message) {
+ val amount = group("amount").toInt()
+ val item = NEUInternalName.fromItemNameOrNull(group("item")) ?: return
+
+ val multiplier = NEUItems.getMultiplier(item)
+ val rawName = multiplier.first.itemNameWithoutColor
+ val cropType = CropType.getByNameOrNull(rawName) ?: return
+
+ cropType.setCounter(
+ cropType.getCounter() + (amount * multiplier.second)
+ )
+ GardenCropMilestoneDisplay.update()
+ }
+ pestRareDropPattern.matchMatcher(event.message) {
+ val item = NEUInternalName.fromItemNameOrNull(group("item")) ?: return
+
+ val multiplier = NEUItems.getMultiplier(item)
+ val rawName = multiplier.first.itemNameWithoutColor
+ val cropType = CropType.getByNameOrNull(rawName) ?: return
+
+ cropType.setCounter(
+ cropType.getCounter() + multiplier.second
+ )
+ GardenCropMilestoneDisplay.update()
+ }
}
@SubscribeEvent