Skip to content

Commit

Permalink
[DO NOT CHERRYPICK, REVERT IMMEDIATELY] playtime stack size
Browse files Browse the repository at this point in the history
Signed-off-by: Erymanthus[#5074] | (u/)RayDeeUx <[email protected]>
  • Loading branch information
RayDeeUx committed Jan 18, 2024
1 parent a0d550d commit 2652069
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ public enum PlayerAdvanced {
public enum PlayerTryhard {
MENU_NAVIGATION("§bMenu Pagination, Sort/Filter Abbvs, Selected Tab"), // §b(Menu Pagination: Shows page numbers.\nSort/Filter Abbvs: AH/Abiphones have their own abbreviation config options.\nSelected Tabs: §a⬇§bs in Community Shop, §a➡§bs in AH + BZ)
RNG_METER_ODDS("§bRNG Meter Drop Odds"), // (Abbvs)
COMMUNITY_ESSENCE_UPGRADES("§bCommunity + Essence Shops Upgrade Tiers"), // (#)
COMMUNITY_ESSENCE_UPGRADES("§bCommunity/Essence Shops Upgrade Tiers"), // (#)
BOOKSHELF_POWER("§bBookshelf Power"), // (#)
FAME_RANK_BITS("§bFame Rank, Fame Count, Bits Available"), // (Abbvs)
BOOSTER_COOKIE_POTION_EFFECTS("§bBooster Cookie Duration + Active Potion Effects"), //§b[highest unit of time only: Xy ➡ Xd ➡ Xh ➡ etc...]
DELIVERIES_PROJECTS("§bJerry Deliveries, Project Contributions"), // (Includes)
ACCESSORY_BAG_UTILS("§bAccessory Bag Utils"), // (Various)
EVENT_COUNTDOWN_ABBV("§bEvents \"Start(ing) in\" Countdowns"), //§b[highest unit of time only: Xy ➡ Xd ➡ Xh ➡ etc...]
SKYBLOCK_ACHIEVEMENT_POINTS("§bSkyBlock Achievements Points"), // (%)
ACHIEVEMENT_PLAYTIME("§bSkyBlock Achievements Points, Detailed Playtime"), // (%)
;

final String str;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.features.inventory.itemdisplayoverlay.AbstractMenuS
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
Expand Down Expand Up @@ -175,6 +176,26 @@ class MenuItemDisplayOverlayPlayerTryhard : AbstractMenuStackSize() {
"island.management.deliveries.itemname",
".* Deliveries"
)
private val playtimeChestPattern by playerTryhardSubgroup.pattern(
"playtime.chestname",
"Detailed .?[pP]laytime"
)
private val playtimeBreakdownPattern by playerTryhardSubgroup.pattern(
"playtime.breakdown.loreline",
"(?:§.)*Totalling (?:§.)*(?<pt>[\\d,]+)(?:\\.\\d*)?(?: (?:§.)*hours(?: (?:§.)*on(?: (?:§.)*this(?: (?:§.)*profile.)?)?)?)?"
)
private val breakdownItemPattern by playerTryhardSubgroup.pattern(
"playtime.breakdown.itemname",
".?[pP]laytime Breakdown"
)
private val islandPlaytimePattern by playerTryhardSubgroup.pattern(
"playtime.island.loreline",
"(?:§.)*Playtime: (?:§.)*(?<minute>[\\d,]+)(?:\\.\\d*)? minutes?"
)
private val islandItemColoredPattern by playerTryhardSubgroup.pattern(
"playtime.island.itemname.colored",
"§a.*"
)

@SubscribeEvent
override fun onRenderItemTip(event: RenderItemTipEvent) {
Expand Down Expand Up @@ -435,11 +456,30 @@ class MenuItemDisplayOverlayPlayerTryhard : AbstractMenuStackSize() {
}
}

if (stackSizeConfig.contains(StackSizeMenuConfig.PlayerTryhard.SKYBLOCK_ACHIEVEMENT_POINTS) && (chestName == ("Your Equipment and Stats") && itemName.lowercase() == ("skyblock achievements"))) {
// §7Points: §e1,995§7/§e2,835 §8(70%§8)
for (line in item.getLore()) {
achievementPointsPattern.matchMatcher(line) {
return group("percent")
if (stackSizeConfig.contains(StackSizeMenuConfig.PlayerTryhard.ACHIEVEMENT_PLAYTIME)) {
val lore = item.getLore()
if (chestName == "Your Equipment and Stats" && itemName.lowercase() == "skyblock achievements") {
for (line in lore) {
achievementPointsPattern.matchMatcher(line) {
return group("percent")
}
}
}
playtimeChestPattern.matchMatcher(chestName) {
breakdownItemPattern.matchMatcher(itemName) {
for (line in lore) {
playtimeBreakdownPattern.matchMatcher(line) {
return NumberUtil.format(group("pt").formatNumber())
}
}
}
val nameWithColor = item.name ?: ""
islandItemColoredPattern.matchMatcher(nameWithColor) {
for (line in lore) {
islandPlaytimePattern.matchMatcher(line) {
return NumberUtil.format(group("minute").formatNumber())
}
}
}
}
}
Expand Down

0 comments on commit 2652069

Please sign in to comment.