Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend: Repo pattern dashes and fixes #3115

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
@SkyHanniModule
object MobFilter {

private val repoGroup = RepoPattern.group("mob.detection")
private val patternGroup = RepoPattern.group("mob.detection")

/** REGEX-TEST: Wither Husk 500M❤ */
val mobNameFilter by repoGroup.pattern(
val mobNameFilter by patternGroup.pattern(
"filter.basic",
"(?:\\[\\w+(?<level>\\d+)\\] )?(?<corrupted>.Corrupted )?(?<name>[^ᛤ]*)(?: ᛤ)? [\\dBMk.,❤]+",
)
val slayerNameFilter by repoGroup.pattern("filter.slayer", "^. (?<name>.*) (?<tier>[IV]+) \\d+.*")
val slayerNameFilter by patternGroup.pattern("filter.slayer", "^. (?<name>.*) (?<tier>[IV]+) \\d+.*")

Check warning on line 62 in src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `slayerNameFilter` must have a regex test.

/** REGEX-TEST: ﴾ Storm ﴿
* REGEX-TEST: ﴾ [Lv200] aMage Outlawa 70M/70M❤ ﴿
Expand All @@ -71,43 +71,43 @@
* REGEX-TEST: ﴾ [Lv100] Endstone Protector 4.6M/5M❤ ﴿
* REGEX-TEST: ﴾ [Lv400] Thunder 29M/35M❤ ﴿
* */
val bossMobNameFilter by repoGroup.pattern(
val bossMobNameFilter by patternGroup.pattern(
"filter.boss",
"^. (?:\\[Lv(?<level>\\d+)\\] )?(?<name>[^ᛤ\n]*?)(?: ᛤ)?(?: [\\d\\/BMk.,❤]+| █+)? .$",
)
val dungeonNameFilter by repoGroup.pattern(
val dungeonNameFilter by patternGroup.pattern(
"filter.dungeon",
"^(?:(?<star>✯)\\s)?(?:(?<attribute>${DungeonAttribute.toRegexLine})\\s)?(?:\\[[\\w\\d]+\\]\\s)?(?<name>[^ᛤ]+)(?: ᛤ)?\\s[^\\s]+$",
)
val summonFilter by repoGroup.pattern(
val summonFilter by patternGroup.pattern(

Check warning on line 82 in src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `summonFilter` must have a regex test.
"filter.summon",
"^(?<owner>\\w+)'s (?<name>.*) \\d+.*",
)
val dojoFilter by repoGroup.pattern(
val dojoFilter by patternGroup.pattern(

Check warning on line 86 in src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `dojoFilter` must have a regex test.
"filter.dojo",
"^(?:(?<points>\\d+) pts|(?<empty>\\w+))$",
)
val jerryPattern by repoGroup.pattern(
val jerryPattern by patternGroup.pattern(

Check warning on line 90 in src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `jerryPattern` must have a regex test.
"jerry",
"(?:\\[\\w+(?<level>\\d+)\\] )?(?<owner>\\w+)'s (?<name>\\w+ Jerry) \\d+ Hits",
)
val petCareNamePattern by repoGroup.pattern(
val petCareNamePattern by patternGroup.pattern(

Check warning on line 94 in src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `petCareNamePattern` must have a regex test.
"pattern.petcare",
"^\\[\\w+ (?<level>\\d+)\\] (?<name>.*)",
)
val wokeSleepingGolemPattern by repoGroup.pattern(
val wokeSleepingGolemPattern by patternGroup.pattern(

Check warning on line 98 in src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `wokeSleepingGolemPattern` must have a regex test.
"pattern.dungeon.woke.golem",
"(?:§c§lWoke|§5§lSleeping) Golem§r",
)
val jerryMagmaCubePattern by repoGroup.pattern(
val jerryMagmaCubePattern by patternGroup.pattern(

Check warning on line 102 in src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `jerryMagmaCubePattern` must have a regex test.
"pattern.jerry.magma.cube",
"§c(?:Cubie|Maggie|Cubert|Cübe|Cubette|Magmalene|Lucky 7|8ball|Mega Cube|Super Cube)(?: ᛤ)? §a\\d+§8\\/§a\\d+§c❤",
)
val summonOwnerPattern by repoGroup.pattern(
val summonOwnerPattern by patternGroup.pattern(

Check warning on line 106 in src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `summonOwnerPattern` must have a regex test.
"pattern.summon.owner",
".*Spawned by: (?<name>.*).*",
)
val heavyPearlPattern by repoGroup.pattern(
val heavyPearlPattern by patternGroup.pattern(

Check warning on line 110 in src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `heavyPearlPattern` must have a regex test.
"pattern.heavypearl.collect",
"§.§lCOLLECT!",
)
Expand All @@ -119,7 +119,7 @@
* REGEX-TEST: §8[§7Lv49§8] §ePig
* REGEX-TEST: §8[§7Lv64§8] §eRat
*/
val illegalEntitiesPattern by repoGroup.pattern(
val illegalEntitiesPattern by patternGroup.pattern(
"pattern.pet.entities",
"^§8\\[§7Lv\\d+§8] §.(?<name>Horse|Armadillo|Skeleton Horse|Pig|Rat)$",
)
Expand Down Expand Up @@ -156,7 +156,7 @@
"anrrtqytsl", // Weaponsmith
)

private val displayNPCCompressedNamePattern by repoGroup.pattern("displaynpc.name", "[a-z0-9]{10}")
private val displayNPCCompressedNamePattern by patternGroup.pattern("displaynpc.name", "[a-z0-9]{10}")

private fun displayNPCNameCheck(name: String) = name.startsWith('§') ||
displayNPCCompressedNamePattern.matches(name) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
@SkyHanniModule
object SpidersDenAPI {

private val repoGroup = RepoPattern.group("combat.spidersden")
private val patternGroup = RepoPattern.group("combat.spidersden")

/**
* REGEX-TEST: §4Broodmother§7: §6Soon
*/
val broodmotherPattern by repoGroup.pattern(
val broodmotherPattern by patternGroup.pattern(
"broodmother",
"§4Broodmother§7: §[e64](?:Slain|Dormant|Soon|Awakening|Imminent|Alive!)",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

private var inTerracottaPhase = false

private val repoGroup = RepoPattern.group("dungeon.terracotta")
private val terracottaStartPattern by repoGroup.pattern(
private val patternGroup = RepoPattern.group("dungeon.terracotta")
private val terracottaStartPattern by patternGroup.pattern(

Check warning on line 23 in src/main/java/at/hannibal2/skyhanni/features/dungeon/TerracottaPhase.kt

View workflow job for this annotation

GitHub Actions / Run detekt

detekt.RepoRules.RepoPatternRegexTest

Repo pattern `terracottaStartPattern` must have a regex test.
"start",
"§c\\[BOSS] Sadan§r§f: So you made it all the way here... Now you wish to defy me\\? Sadan\\?!",
)
private val terracottaEndPattern by repoGroup.pattern(
private val terracottaEndPattern by patternGroup.pattern(
"end",
"§c\\[BOSS] Sadan§r§f: ENOUGH!",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ object CarnivalQuickStart {
* */
private val chatPattern by RepoPattern.pattern("carnival.select.option.chat", "§eSelect an option:.*")

private val repoGroup = RepoPattern.group("carnival.npcs")
private val patternGroup = RepoPattern.group("carnival.npcs")

private val pirate by repoGroup.pattern("pirate", "Carnival Pirateman")
private val fisher by repoGroup.pattern("fisher", "Carnival Fisherman")
private val cowboy by repoGroup.pattern("cowboy", "Carnival Cowboy")
private val pirate by patternGroup.pattern("pirate", "Carnival Pirateman")
private val fisher by patternGroup.pattern("fisher", "Carnival Fisherman")
private val cowboy by patternGroup.pattern("cowboy", "Carnival Cowboy")

private var lastChat = SimpleTimeMark.farPast()
private var lastClicked = SimpleTimeMark.farPast()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ object CarnivalReminder {
storage?.lastClaimedDay = value
}

private val repoGroup = RepoPattern.group("carnival.tickets")
private val patternGroup = RepoPattern.group("carnival.tickets")

/** REGEX-TEST: §aYou claimed §r§aCarnival Ticket §r§8x25§r§a!
*/
private val ticketClaimedPattern by repoGroup.pattern("claimed", "§aYou claimed §r§aCarnival Ticket §r§8x25§r§a!")
private val ticketClaimedPattern by patternGroup.pattern("claimed", "§aYou claimed §r§aCarnival Ticket §r§8x25§r§a!")

/** REGEX-TEST: §e[NPC] §aCarnival Leader§f: §rYou've already claimed your §aCarnival Tickets §ffor §btoday§f, but I'm happy to answer any questions you might have.
*/
@Suppress("MaxLineLength")
private val alreadyClaimedPattern by repoGroup.pattern(
private val alreadyClaimedPattern by patternGroup.pattern(
"already",
"§e\\[NPC\\] §aCarnival Leader§f: §rYou've already claimed your §aCarnival Tickets §ffor §btoday§f, but I'm happy to answer any questions you might have.",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import at.hannibal2.skyhanni.utils.RegexUtils.firstMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

Expand All @@ -44,6 +45,8 @@ object CarnivalShopHelper {
private var overviewInfoItemStack: ItemStack? = null
private var shopSpecificInfoItemStack: ItemStack? = null

private val patternGroup = RepoPattern.group("inventory.carnival-shop-helper")

/**
* REGEX-TEST: §7Your Tokens: §a1,234,567
* REGEX-TEST: §7Your Tokens: §a0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds
Expand All @@ -49,6 +50,8 @@ object EssenceShopHelper {
private var lastClick = SimpleTimeMark.farPast()
private var infoItemStack: ItemStack? = null

private val patternGroup = RepoPattern.group("inventory.essence-shop-helper")

/**
* REGEX-TEST: Gold Essence Shop
* REGEX-TEST: Wither Essence Shop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ object ItemStars {

private val config get() = SkyHanniMod.feature.inventory

private val repoGroup = RepoPattern.group("inventory.itemstars")
private val patternGroup = RepoPattern.group("inventory.itemstars")

/**
* REGEX-TEST: §6Ancient Terror Leggings §d✪✪§6✪✪✪
* REGEX-TEST: §dRenowned Burning Crimson Helmet §6✪✪✪✪✪
*/
private val starPattern by repoGroup.pattern(
private val starPattern by patternGroup.pattern(
"stars",
"^(?<name>.+) (?<stars>(?:(?:§.)?✪)+)",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ object PageScrolling {

private val config get() = SkyHanniMod.feature.inventory.pageScrolling

private val repoGroup = RepoPattern.group("inventory.pagescrolling")
private val patternGroup = RepoPattern.group("inventory.pagescrolling")

private val illegalInventory by repoGroup.list(
private val illegalInventory by patternGroup.list(
"illegal",
"Large Chest",
"Chest",
)

private val forwardPattern by repoGroup.list(
private val forwardPattern by patternGroup.list(
"forward",
"§aNext Page",
"§aScroll Up",
Expand All @@ -38,7 +38,7 @@ object PageScrolling {
"§aScroll Right",
)

private val backwardPattern by repoGroup.list(
private val backwardPattern by patternGroup.list(
"backward",
"§aPrevious Page",
"§aScroll Down",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,29 @@ object ReforgeHelper {

private val config get() = SkyHanniMod.feature.inventory.helper.reforge

private val repoGroup = RepoPattern.group("reforge")
private val patternGroup = RepoPattern.group("reforge")

private val reforgeMenu by repoGroup.pattern(
private val reforgeMenu by patternGroup.pattern(
"menu.blacksmith",
"Reforge Item",
)
private val reforgeHexMenu by repoGroup.pattern(
private val reforgeHexMenu by patternGroup.pattern(
"menu.hex",
"The Hex ➜ Reforges",
)

/**
* REGEX-TEST: §aYou reforged your §r§9Gentle Dreadlord Sword §r§ainto a §r§9Heroic Dreadlord Sword§r§a!
*/
private val reforgeChatMessage by repoGroup.pattern(
private val reforgeChatMessage by patternGroup.pattern(
"chat.success",
"§aYou reforged your .* §r§ainto a .*!|§aYou applied a .* §r§ato your .*!",
)

/**
* REGEX-TEST: §cWait a moment before reforging again!
*/
private val reforgeChatFail by repoGroup.pattern(
private val reforgeChatFail by patternGroup.pattern(
"chat.fail",
"§cWait a moment before reforging again!|§cWhoa! Slow down there!",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.intellij.lang.annotations.Language

val patternGroup = RepoPattern.group("skyblockguide.highlight")
private val patternGroup = RepoPattern.group("skyblockguide.highlight")

private const val KEY_PREFIX_INVENTORY = "inventory"
private const val KEY_PREFIX_CONDITION = "condition"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ object StockOfStonkFeature {

private val config get() = SkyHanniMod.feature.inventory

private val repoGroup = RepoPattern.group("inventory.stockofstonks")
private val patternGroup = RepoPattern.group("inventory.stockofstonks")

/**
* REGEX-TEST: Stonks Auction
*/
private val inventoryPattern by repoGroup.pattern(
private val inventoryPattern by patternGroup.pattern(
"inventory",
"Stonks Auction",
)

/**
* REGEX-TEST: §dStonks Auction
*/
private val itemPattern by repoGroup.pattern(
private val itemPattern by patternGroup.pattern(
"item",
"§dStonks Auction",
)
Expand All @@ -42,15 +42,15 @@ object StockOfStonkFeature {
* REGEX-TEST: §5§o§7§7▶ §c§lTOP 5,000§7 - §5Stock of Stonks §8x2
* REGEX-TEST: §5§o§7§a▶ §a§lTOP 100§7 - §5Stock of Stonks §8x25
*/
private val topPattern by repoGroup.pattern(
private val topPattern by patternGroup.pattern(
"top",
"§5§o§7§.▶ §.§lTOP (?<rank>[\\d,]+)§7 - §5Stock of Stonks §8x(?<amount>\\d+)",
)

/**
* REGEX-TEST: §5§o§7 Minimum Bid: §62,400,002 Coins
*/
private val bidPattern by repoGroup.pattern(
private val bidPattern by patternGroup.pattern(
"bid",
"§5§o§7 Minimum Bid: §6(?<amount>[\\d,]+) Coins",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.features.inventory.patternGroup
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConditionalUtils
Expand All @@ -37,6 +36,7 @@ import at.hannibal2.skyhanni.utils.SkyBlockTime
import at.hannibal2.skyhanni.utils.SpecialColor.toSpecialColor
import at.hannibal2.skyhanni.utils.TimeLimitedCache
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.inventory.ContainerChest
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.awt.Color
Expand All @@ -50,6 +50,8 @@ private typealias DisplayType = CakeTrackerDisplayType
@SkyHanniModule
object CakeTracker {

private val patternGroup = RepoPattern.group("inventory.cake-tracker")

// <editor-fold desc="Patterns">
/**
* REGEX-TEST: §cNew Year Cake (Year 360)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ object WardrobeAPI {

val storage get() = ProfileStorageData.profileSpecific?.wardrobe

private val repoGroup = RepoPattern.group("inventory.wardrobe")
private val patternGroup = RepoPattern.group("inventory.wardrobe")

/**
* REGEX-TEST: Wardrobe (2/2)
*/
private val inventoryPattern by repoGroup.pattern(
private val inventoryPattern by patternGroup.pattern(
"inventory.name",
"Wardrobe \\((?<currentPage>\\d+)/\\d+\\)",
)

/**
* REGEX-TEST: §7Slot 4: §aEquipped
*/
private val equippedSlotPattern by repoGroup.pattern(
private val equippedSlotPattern by patternGroup.pattern(
"equippedslot",
"§7Slot \\d+: §aEquipped",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ object RiftTimer {

private val config get() = RiftAPI.config.timer

private val repoGroup = RepoPattern.group("rift.everywhere")
private val patternGroup = RepoPattern.group("rift.everywhere")
/**
* REGEX-TEST: 3150 §aф
*/
private val nametagPattern by repoGroup.pattern(
private val nametagPattern by patternGroup.pattern(
"nametag.timer",
"(?<time>\\d+) §aф"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ object MotesSession {
private var currentMotes: Long? = null
private var enterRiftTime = SimpleTimeMark.farPast()

private val repoGroup = RepoPattern.group("rift.everywhere.motes")
private val patternGroup = RepoPattern.group("rift.everywhere.motes")

/**
* REGEX-TEST: Lifetime Motes: §r§d593,922
*/
private val lifetimeMotesPattern by repoGroup.pattern(
private val lifetimeMotesPattern by patternGroup.pattern(
"lifetime",
"\\s+Lifetime Motes: §r§d(?<motes>[\\d,.]+)",
)
Expand Down
Loading
Loading