aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt12
6 files changed, 44 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.java
index b438d83f5..8bbaa962c 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.java
@@ -198,6 +198,11 @@ public class HoppityEggsConfig {
}
@Expose
+ @ConfigOption(name = "Show Duplicate Count", desc = "Show the number of previous finds of a duplicate Hoppity rabbit in chat messages.")
+ @ConfigEditorBoolean
+ public boolean showDuplicateNumber = false;
+
+ @Expose
@ConfigOption(
name = "Rabbit Pet Warning",
desc = "Warn when using the Egglocator without a §d§lMythic Rabbit Pet §7equipped. " +
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt
index 6c42f8a17..93c9efc04 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityAPI.kt
@@ -6,11 +6,11 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.events.hoppity.EggFoundEvent
import at.hannibal2.skyhanni.events.hoppity.RabbitFoundEvent
+import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.CHOCOLATE_FACTORY_MILESTONE
+import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.CHOCOLATE_SHOP_MILESTONE
+import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.SIDE_DISH
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager.eggFoundPattern
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager.getEggType
-import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.SIDE_DISH
-import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.CHOCOLATE_SHOP_MILESTONE
-import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.CHOCOLATE_FACTORY_MILESTONE
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryStrayTracker
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
@@ -35,6 +35,7 @@ object HoppityAPI {
private var duplicate = false
private var lastRarity = ""
private var lastName = ""
+ private var lastNameCache = ""
private var newRabbit = false
private var lastMeal: HoppityEggType? = null
private var lastDuplicateAmount: Long? = null
@@ -51,6 +52,7 @@ object HoppityAPI {
this.lastDuplicateAmount = null
}
+ fun getLastRabbit(): String = this.lastNameCache
fun isHoppityEvent() = (SkyblockSeason.currentSeason == SkyblockSeason.SPRING || SkyHanniMod.feature.dev.debug.alwaysHoppitys)
fun rarityByRabbit(rabbit: String): LorenzRarity? = hoppityRarities.firstOrNull { it.chatColorCode == rabbit.substring(0, 2) }
@@ -69,7 +71,7 @@ object HoppityAPI {
*/
private val sideDishNamePattern by ChocolateFactoryAPI.patternGroup.pattern(
"rabbit.sidedish",
- "(?:§.)*?Golden Rabbit (?:§.)?- (?:§.)?Side Dish"
+ "(?:§.)*?Golden Rabbit (?:§.)?- (?:§.)?Side Dish",
)
/**
@@ -95,12 +97,12 @@ object HoppityAPI {
if (!ChocolateFactoryAPI.inChocolateFactory) return
InventoryUtils.getItemsInOpenChest().filter {
it.stack.hasDisplayName() &&
- it.stack.getMinecraftId().toString() == "minecraft:skull" &&
- it.stack.getLore().isNotEmpty()
+ it.stack.getMinecraftId().toString() == "minecraft:skull" &&
+ it.stack.getLore().isNotEmpty()
}.forEach {
ChocolateFactoryStrayTracker.strayCaughtPattern.matchMatcher(it.stack.displayName) {
ChocolateFactoryStrayTracker.handleStrayClicked(it)
- when(groupOrNull("name") ?: return@matchMatcher) {
+ when (groupOrNull("name") ?: return@matchMatcher) {
"Fish the Rabbit" -> EggFoundEvent(HoppityEggType.STRAY, it.slotNumber, null).post()
"El Dorado" -> EggFoundEvent(HoppityEggType.STRAY, it.slotNumber, null).post()
else -> return@matchMatcher
@@ -140,9 +142,10 @@ object HoppityAPI {
}
}
- @SubscribeEvent
+ @SubscribeEvent(priority = EventPriority.HIGH)
fun onChat(event: LorenzChatEvent) {
if (!LorenzUtils.inSkyBlock) return
+
eggFoundPattern.matchMatcher(event.message) {
resetRabbitData()
lastMeal = getEggType(event)
@@ -160,6 +163,7 @@ object HoppityAPI {
HoppityEggsManager.rabbitFoundPattern.matchMatcher(event.message) {
lastName = group("name")
+ lastNameCache = lastName
lastRarity = group("rarity")
attemptFireRabbitFound()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt
index 378291966..7be0913e9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt
@@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.render.gui.ReplaceItemEvent
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
+import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.CollectionUtils.addString
import at.hannibal2.skyhanni.utils.CollectionUtils.collectWhile
import at.hannibal2.skyhanni.utils.CollectionUtils.consumeWhile
@@ -449,10 +450,14 @@ object HoppityCollectionStats {
return table
}
- fun incrementRabbit(name: String) {
+ fun getRabbitCount(name: String): Int = name.removeColor().run {
+ loggedRabbits[this]?.takeIf { HoppityCollectionData.isKnownRabbit(this) } ?: 0
+ }
+
+ fun incrementRabbitCount(name: String) {
val rabbit = name.removeColor()
if (!HoppityCollectionData.isKnownRabbit(rabbit)) return
- loggedRabbits[rabbit] = (loggedRabbits[rabbit] ?: 0) + 1
+ loggedRabbits.addOrPut(rabbit, 1)
}
// Gets the found rabbits according to the Hypixel progress bar
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt
index abbdff1f0..4a33820d8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt
@@ -94,9 +94,15 @@ object HoppityEggsCompactChat {
ChocolateFactoryAPI.timeUntilNeed(it).format(maxUnits = 2)
} ?: "?"
+ val dupeNumberFormat = if (eventConfig.showDuplicateNumber) {
+ (HoppityCollectionStats.getRabbitCount(this.lastName) - 1).takeIf { it > 1}?.let {
+ " §7(§b#$it§7)"
+ } ?: ""
+ } else ""
+
val showDupeRarity = rarityConfig.let { it == RarityType.BOTH || it == RarityType.DUPE }
val timeStr = if (config.showDuplicateTime) ", §a+§b$timeFormatted§7" else ""
- "$mealNameFormat! §7Duplicate ${if (showDupeRarity) "$lastRarity " else ""}$lastName §7(§6+$format Chocolate§7$timeStr)"
+ "$mealNameFormat! §7Duplicate ${if (showDupeRarity) "$lastRarity " else ""}$lastName$dupeNumberFormat §7(§6+$format Chocolate§7$timeStr)"
} else if (newRabbit) {
val showNewRarity = rarityConfig.let { it == RarityType.BOTH || it == RarityType.NEW }
"$mealNameFormat! §d§lNEW ${if (showNewRarity) "$lastRarity " else ""}$lastName §7(${lastProfit}§7)"
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt
index 75b65fdc4..b8143d311 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt
@@ -122,7 +122,7 @@ object HoppityEggsManager {
@HandleEvent
fun onRabbitFound(event: RabbitFoundEvent) {
- HoppityCollectionStats.incrementRabbit(event.rabbitName)
+ HoppityCollectionStats.incrementRabbitCount(event.rabbitName)
}
@SubscribeEvent
@@ -233,7 +233,7 @@ object HoppityEggsManager {
val message = "All $amount Hoppity Eggs are ready to be found!"
if (config.warpUnclaimedEggs) {
val (action, actionName) = if (LorenzUtils.inSkyBlock) {
- { HypixelCommands.warp(config.warpDestination) } to "${"warp to ${config.warpDestination}".trim()}"
+ { HypixelCommands.warp(config.warpDestination) } to "warp to ${config.warpDestination}".trim()
} else {
{ HypixelCommands.skyblock() } to "join /skyblock!"
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt
index ccb6712c0..a2b264b35 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.features.event.hoppity.HoppityAPI
import at.hannibal2.skyhanni.features.event.hoppity.HoppityCollectionData
+import at.hannibal2.skyhanni.features.event.hoppity.HoppityCollectionStats
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsCompactChat
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
@@ -15,6 +16,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatLong
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.TimeUtils.format
+import net.minecraft.util.ChatComponentText
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
@@ -40,7 +42,7 @@ object ChocolateFactoryBarnManager {
if (!LorenzUtils.inSkyBlock) return
HoppityEggsManager.newRabbitFound.matchMatcher(event.message) {
- val profileStorage = profileStorage ?: return
+ val profileStorage = profileStorage ?: return@matchMatcher
profileStorage.currentRabbits += 1
trySendBarnFullMessage(inventory = false)
HoppityEggsManager.shareWaypointPrompt()
@@ -58,6 +60,14 @@ object ChocolateFactoryBarnManager {
ChocolateAmount.addToAll(amount)
HoppityEggsCompactChat.compactChat(event, lastDuplicateAmount = amount)
HoppityAPI.attemptFireRabbitFound(lastDuplicateAmount = amount)
+
+ if (hoppityConfig.showDuplicateNumber && !hoppityConfig.compactChat) {
+ (HoppityCollectionStats.getRabbitCount(HoppityAPI.getLastRabbit()) - 1).takeIf { it > 1 }?.let {
+ event.chatComponent = ChatComponentText(
+ event.message.replace("§7§lDUPLICATE RABBIT!", "§7§lDUPLICATE RABBIT! §7(Duplicate §b#$it§7)§r"),
+ )
+ }
+ }
}
rabbitCrashedPattern.matchMatcher(event.message) {