Skip to content

Commit 775d250

Browse files
Fix + Improvement: Hoppity API and Hoppity Visitor Reward (#5201)
1 parent 58b9d08 commit 775d250

File tree

6 files changed

+26
-4
lines changed

6 files changed

+26
-4
lines changed

src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/summary/HoppityEventSummaryConfig.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class HoppityEventSummaryConfig {
5656
MEAL_EGGS_FOUND("§7You found §b45§7/§a47 §6Chocolate Meal Eggs§7."),
5757
HITMAN_EGGS("§7You recovered §b20§7/§a40 §7missed §6Meal Eggs §7from §cRabbit Hitman§7."),
5858
HOPPITY_RABBITS_BOUGHT("§7You bought §b7 §fRabbits §7from §aHoppity§7."),
59+
VISITOR_RABBITS("§6Hoppity §7gave you §b3 §dRabbits §7on your §aGarden§7."),
5960
SIDE_DISH_EGGS("§7You found §b4 §6§lSide Dish Eggs §r§7in the §6Chocolate Factory§7."),
6061
MILESTONE_RABBITS("§7You claimed §b2 §6§lMilestone Rabbits§7."),
6162
EMPTY_1(""),

src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityApi.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.Companion.res
2525
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.HITMAN
2626
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.SIDE_DISH
2727
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.STRAY
28+
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.VISITOR
2829
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.CFApi
2930
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.CFBarnManager
3031
import at.hannibal2.skyhanni.features.inventory.chocolatefactory.stray.CFStrayTracker
@@ -321,7 +322,7 @@ object HoppityApi {
321322

322323
// Each of these have their own from-Hypixel chats, so we don't need to add a message here
323324
// as it will be handled in the attemptFireRabbitFound method, from the chat event.
324-
in resettingEntries, HITMAN, BOUGHT, BOUGHT_ABIPHONE -> null
325+
in resettingEntries, HITMAN, BOUGHT, BOUGHT_ABIPHONE, VISITOR -> null
325326
else -> "§d§lHOPPITY'S HUNT §r§7Unknown Egg Type: §c§l${event.type}"
326327
}?.let { hoppityDataSet.hoppityMessages.add(it) }
327328

@@ -337,6 +338,11 @@ object HoppityApi {
337338
postApiEggFoundEvent(type, event, note)
338339
}
339340

341+
if (IslandType.GARDEN.isCurrent()) HoppityEggsManager.hoppityVisitorAccepted.matchMatcher(event.cleanMessage) {
342+
hoppityDataSet.reset()
343+
postApiEggFoundEvent(VISITOR, event)
344+
}
345+
340346
HoppityEggsManager.hitmanEggFoundPattern.matchMatcher(event.message) {
341347
hoppityDataSet.reset()
342348
postApiEggFoundEvent(HITMAN, event)

src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggType.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ enum class HoppityEggType(
3131
BOUGHT_ABIPHONE("✆ Bought", "§a", -1),
3232
CHOCOLATE_SHOP_MILESTONE("Shop Milestone", "§6§l", -1),
3333
CHOCOLATE_FACTORY_MILESTONE("Chocolate Milestone", "§6§l", -1),
34-
STRAY("Stray", "§a", -1)
34+
STRAY("Stray", "§a", -1),
35+
VISITOR("Visitor", "§d", -1),
3536
;
3637

3738
val isResetting get() = resettingEntries.contains(this)

src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ object HoppityEggsManager {
102102
"§7§lDUPLICATE RABBIT! §6\\+(?<amount>[\\d,]+) Chocolate",
103103
)
104104

105+
/**
106+
* REGEX-TEST: [NPC] Hoppity: Simply exquisite! I don't think I'll ever get tired of chocolate.
107+
*/
108+
val hoppityVisitorAccepted by CFApi.patternGroup.pattern(
109+
"hoppity.visitor.accepted",
110+
"\\[NPC\\] Hoppity: Simply exquisite.+"
111+
)
112+
105113
private val noEggsLeftPattern by CFApi.patternGroup.pattern(
106114
"egg.noneleft",
107115
"§cThere are no hidden Chocolate Rabbit Eggs nearby! Try again later!",

src/main/java/at/hannibal2/skyhanni/features/event/hoppity/summary/HoppityEventSummary.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,12 @@ object HoppityEventSummary {
371371
statList.addStr("§7You bought §b${boughtCount.addSeparators()} §f$rabbitFormat §7from §aHoppity§7.")
372372
}
373373

374+
put(HoppityStat.VISITOR_RABBITS) { statList, stats, _ ->
375+
val visitorCount = stats.mealsFound[HoppityEggType.VISITOR]?.takeIf { it > 0 } ?: return@put
376+
val rabbitFormat = StringUtils.pluralize(visitorCount, "Rabbit")
377+
statList.addStr("§6Hoppity §7gave you §b$visitorCount §d$rabbitFormat §r§7on your §aGarden§7.")
378+
}
379+
374380
put(HoppityStat.SIDE_DISH_EGGS) { statList, stats, _ ->
375381
val sideDishCount = stats.mealsFound[HoppityEggType.SIDE_DISH]?.takeIf { it > 0 } ?: return@put
376382
val eggFormat = StringUtils.pluralize(sideDishCount, "Egg")

src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/stray/CFStrayTimer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ object CFStrayTimer {
4343
timer = when (event.type) {
4444
// If a stray is found, the timer is no longer relevant
4545
HoppityEggType.STRAY -> Duration.ZERO
46-
// Only reset the timer for meal entries and hitman eggs
47-
in HoppityEggType.resettingEntries, HoppityEggType.HITMAN -> 30.seconds
46+
// Only reset the timer for meal entries, and hitman/visitor rabbits
47+
in HoppityEggType.resettingEntries, HoppityEggType.HITMAN, HoppityEggType.VISITOR -> 30.seconds
4848
else -> return
4949
}
5050
lastTimerSubtraction = null

0 commit comments

Comments
 (0)