Skip to content

Commit

Permalink
Improvement: Added another gui for bits to claim (hannibal002#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
j10a1n15 authored Mar 21, 2024
1 parent 685c8d2 commit 183330c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/BitsAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,16 @@ object BitsAPI {
"^SkyBlock Menu$"
)

private val bitsGuiStackPattern by bitsGuiGroup.pattern(
private val cookieGuiStackPattern by bitsGuiGroup.pattern(
"mainmenustack",
"^§6Booster Cookie$"
)

private val bitsStackPattern by bitsGuiGroup.pattern(
"bitsstack",
"§bBits"
)

private val fameRankGuiNamePattern by bitsGuiGroup.pattern(
"famerankmenuname",
"^(Community Shop|Booster Cookie)$"
Expand Down Expand Up @@ -146,7 +151,7 @@ object BitsAPI {
val stacks = event.inventoryItems

if (bitsGuiNamePattern.matches(event.inventoryName)) {
val cookieStack = stacks.values.lastOrNull { bitsGuiStackPattern.matches(it.displayName) }
val cookieStack = stacks.values.lastOrNull { cookieGuiStackPattern.matches(it.displayName) }

// If the cookie stack is null, then the player should not have any bits to claim
if (cookieStack == null) {
Expand All @@ -165,6 +170,7 @@ object BitsAPI {
}

if (fameRankGuiNamePattern.matches(event.inventoryName)) {
val bitsStack = stacks.values.lastOrNull { bitsStackPattern.matches(it.displayName) } ?: return
val fameRankStack = stacks.values.lastOrNull { fameRankGuiStackPattern.matches(it.displayName) } ?: return

line@ for (line in fameRankStack.getLore()) {
Expand Down Expand Up @@ -198,6 +204,14 @@ object BitsAPI {
continue@line
}
}

line@ for (line in bitsStack.getLore()) {
bitsAvailableMenuPattern.matchMatcher(line) {
bitsToClaim = group("toClaim").formatInt()

continue@line
}
}
}
}

Expand Down

0 comments on commit 183330c

Please sign in to comment.