From 8f3314c9397a62085941ece6d9fe2114f5338889 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 22 Jun 2024 09:33:15 +0200 Subject: enum is singular --- .../gui/customscoreboard/EventsConfig.java | 4 +- .../lobby/waypoints/easter/EasterEggWaypoints.kt | 2 +- .../event/lobby/waypoints/easter/EggEntrance.kt | 63 +++ .../event/lobby/waypoints/easter/EggEntrances.kt | 63 --- .../lobby/waypoints/halloween/BasketEntrance.kt | 18 + .../lobby/waypoints/halloween/BasketEntrances.kt | 18 - .../lobby/waypoints/halloween/BasketWaypoints.kt | 2 +- .../features/garden/fortuneguide/FarmingReforge.kt | 35 ++ .../garden/fortuneguide/FarmingReforges.kt | 35 -- .../features/garden/fortuneguide/FarmingSet.kt | 16 + .../features/garden/fortuneguide/FarmingSets.kt | 16 - .../garden/fortuneguide/FortuneUpgrades.kt | 14 +- .../gui/customscoreboard/CustomScoreboard.kt | 10 +- .../gui/customscoreboard/ScoreboardElements.kt | 4 +- .../gui/customscoreboard/ScoreboardEvent.kt | 574 +++++++++++++++++++++ .../gui/customscoreboard/ScoreboardEvents.kt | 574 --------------------- .../mining/crystalhollows/CrystalHollowsWalls.kt | 44 +- 17 files changed, 746 insertions(+), 746 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrance.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrances.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrance.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforge.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforges.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSet.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSets.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt delete mode 100644 src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/EventsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/EventsConfig.java index 904e8028f..f2fd7a85a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/EventsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/EventsConfig.java @@ -1,6 +1,6 @@ package at.hannibal2.skyhanni.config.features.gui.customscoreboard; -import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvents; +import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvent; import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList; @@ -17,7 +17,7 @@ public class EventsConfig { desc = "Drag your list to select the priority of each event." ) @ConfigEditorDraggableList() - public List eventEntries = new ArrayList<>(ScoreboardEvents.defaultOption); + public List eventEntries = new ArrayList<>(ScoreboardEvent.defaultOption); @Expose @ConfigOption(name = "Show all active events", desc = "Show all active events in the scoreboard instead of the one with the highest priority.") diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt index 1b3bf9cb4..2df035702 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EasterEggWaypoints.kt @@ -70,7 +70,7 @@ object EasterEggWaypoints { } if (config.allEntranceWaypoints) { - for (eggEntrance in EggEntrances.entries) { + for (eggEntrance in EggEntrance.entries) { if (!eggEntrance.easterEgg.any { it.shouldShow() }) continue event.drawWaypointFilled(eggEntrance.waypoint, LorenzColor.YELLOW.toColor()) event.drawDynamicText(eggEntrance.waypoint, "§e" + eggEntrance.eggEntranceName, 1.5) diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrance.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrance.kt new file mode 100644 index 000000000..1ac684570 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrance.kt @@ -0,0 +1,63 @@ +package at.hannibal2.skyhanni.features.event.lobby.waypoints.easter + +import at.hannibal2.skyhanni.utils.LorenzVec + +enum class EggEntrance( + val eggEntranceName: String, + val waypoint: LorenzVec, + vararg val easterEgg: EasterEgg, +) { + + EASTER_EGG_ENTER_12_13_1_28_1( + "#12, #13, #28 (tunnel)", + LorenzVec(126, 52, 175), + EasterEgg.EASTER_EGG_12, + EasterEgg.EASTER_EGG_13, + EasterEgg.EASTER_EGG_28 + ), + EASTER_EGG_ENTER_13_2("#13 (keep going, stay on your left [<--])", LorenzVec(144, 30, 19), EasterEgg.EASTER_EGG_13), + EASTER_EGG_ENTER_13_3("#13 (enter here)", LorenzVec(107, 42, -47), EasterEgg.EASTER_EGG_13), + EASTER_EGG_ENTER_13_4( + "#13 (straight ahead, don't take the stairs)", + LorenzVec(105, 49, -34), + EasterEgg.EASTER_EGG_13 + ), + EASTER_EGG_ENTER_14_1("#14 (enter here)", LorenzVec(159, 68, -25), EasterEgg.EASTER_EGG_14), + EASTER_EGG_ENTER_14_2("#14 (right turn [-->] here)", LorenzVec(153, 68, -8), EasterEgg.EASTER_EGG_14), + EASTER_EGG_ENTER_14_3("#14 (left turn [<--] here)", LorenzVec(143, 68, -8), EasterEgg.EASTER_EGG_14), + EASTER_EGG_ENTER_18_1("#18 (down this well)", LorenzVec(158, 67, -82), EasterEgg.EASTER_EGG_18), + EASTER_EGG_ENTER_18_2("#18 (through this painting)", LorenzVec(142, 56, -82), EasterEgg.EASTER_EGG_18), + EASTER_EGG_ENTER_21("#21 (through the waterfall)", LorenzVec(-137, 64, -82), EasterEgg.EASTER_EGG_21), + EASTER_EGG_ENTER_28_2("#13, #28 (right turn [-->] here)", LorenzVec(94, 35, 145), EasterEgg.EASTER_EGG_28), + EASTER_EGG_ENTER_28_3( + "#13, #28 (straight ahead, stay on your right [-->])", + LorenzVec(92, 21, 107), + EasterEgg.EASTER_EGG_28 + ), + EASTER_EGG_ENTER_29_2( + "#29 (straight ahead, stay on your right [-->])", + LorenzVec(16, 32, 2), + EasterEgg.EASTER_EGG_29 + ), + EASTER_EGG_ENTER_29_3("#29 (enter here)", LorenzVec(54, 22, 60), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_29_4("#29 (up stairs, make left turn [<--])", LorenzVec(25, 25, 51), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_29_5( + "#29 (up stairs, make left turn [<--] again)", + LorenzVec(17, 32, 66), + EasterEgg.EASTER_EGG_29 + ), + EASTER_EGG_ENTER_29_6("#29 (left turn [<--] here)", LorenzVec(35, 37, 66), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_29_7("#29 (past this door)", LorenzVec(39, 37, 48), EasterEgg.EASTER_EGG_29), + EASTER_EGG_ENTER_30_1("#30 (1st digit, SNEAK + RCLICK)", LorenzVec(143, 65, -30), EasterEgg.EASTER_EGG_30), + EASTER_EGG_ENTER_30_2("#30 (3rd digit, open chest)", LorenzVec(205, 34, -157), EasterEgg.EASTER_EGG_30), + EASTER_EGG_ENTER_27_29_1_30_3( + "#27, #29, #30 (inside this well)", + LorenzVec(10, 63, 0), + EasterEgg.EASTER_EGG_27, + EasterEgg.EASTER_EGG_29, + EasterEgg.EASTER_EGG_30 + ), + EASTER_EGG_ENTER_30_4("#30 (left turn [<--] here)", LorenzVec(-28, 42, 14), EasterEgg.EASTER_EGG_30), + EASTER_EGG_ENTER_30_5("#30 Vault (brute force 2nd digit)", LorenzVec(-35, 25, 63), EasterEgg.EASTER_EGG_30), +} + diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrances.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrances.kt deleted file mode 100644 index 31663b403..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/easter/EggEntrances.kt +++ /dev/null @@ -1,63 +0,0 @@ -package at.hannibal2.skyhanni.features.event.lobby.waypoints.easter - -import at.hannibal2.skyhanni.utils.LorenzVec - -enum class EggEntrances( - val eggEntranceName: String, - val waypoint: LorenzVec, - vararg val easterEgg: EasterEgg, -) { - - EASTER_EGG_ENTER_12_13_1_28_1( - "#12, #13, #28 (tunnel)", - LorenzVec(126, 52, 175), - EasterEgg.EASTER_EGG_12, - EasterEgg.EASTER_EGG_13, - EasterEgg.EASTER_EGG_28 - ), - EASTER_EGG_ENTER_13_2("#13 (keep going, stay on your left [<--])", LorenzVec(144, 30, 19), EasterEgg.EASTER_EGG_13), - EASTER_EGG_ENTER_13_3("#13 (enter here)", LorenzVec(107, 42, -47), EasterEgg.EASTER_EGG_13), - EASTER_EGG_ENTER_13_4( - "#13 (straight ahead, don't take the stairs)", - LorenzVec(105, 49, -34), - EasterEgg.EASTER_EGG_13 - ), - EASTER_EGG_ENTER_14_1("#14 (enter here)", LorenzVec(159, 68, -25), EasterEgg.EASTER_EGG_14), - EASTER_EGG_ENTER_14_2("#14 (right turn [-->] here)", LorenzVec(153, 68, -8), EasterEgg.EASTER_EGG_14), - EASTER_EGG_ENTER_14_3("#14 (left turn [<--] here)", LorenzVec(143, 68, -8), EasterEgg.EASTER_EGG_14), - EASTER_EGG_ENTER_18_1("#18 (down this well)", LorenzVec(158, 67, -82), EasterEgg.EASTER_EGG_18), - EASTER_EGG_ENTER_18_2("#18 (through this painting)", LorenzVec(142, 56, -82), EasterEgg.EASTER_EGG_18), - EASTER_EGG_ENTER_21("#21 (through the waterfall)", LorenzVec(-137, 64, -82), EasterEgg.EASTER_EGG_21), - EASTER_EGG_ENTER_28_2("#13, #28 (right turn [-->] here)", LorenzVec(94, 35, 145), EasterEgg.EASTER_EGG_28), - EASTER_EGG_ENTER_28_3( - "#13, #28 (straight ahead, stay on your right [-->])", - LorenzVec(92, 21, 107), - EasterEgg.EASTER_EGG_28 - ), - EASTER_EGG_ENTER_29_2( - "#29 (straight ahead, stay on your right [-->])", - LorenzVec(16, 32, 2), - EasterEgg.EASTER_EGG_29 - ), - EASTER_EGG_ENTER_29_3("#29 (enter here)", LorenzVec(54, 22, 60), EasterEgg.EASTER_EGG_29), - EASTER_EGG_ENTER_29_4("#29 (up stairs, make left turn [<--])", LorenzVec(25, 25, 51), EasterEgg.EASTER_EGG_29), - EASTER_EGG_ENTER_29_5( - "#29 (up stairs, make left turn [<--] again)", - LorenzVec(17, 32, 66), - EasterEgg.EASTER_EGG_29 - ), - EASTER_EGG_ENTER_29_6("#29 (left turn [<--] here)", LorenzVec(35, 37, 66), EasterEgg.EASTER_EGG_29), - EASTER_EGG_ENTER_29_7("#29 (past this door)", LorenzVec(39, 37, 48), EasterEgg.EASTER_EGG_29), - EASTER_EGG_ENTER_30_1("#30 (1st digit, SNEAK + RCLICK)", LorenzVec(143, 65, -30), EasterEgg.EASTER_EGG_30), - EASTER_EGG_ENTER_30_2("#30 (3rd digit, open chest)", LorenzVec(205, 34, -157), EasterEgg.EASTER_EGG_30), - EASTER_EGG_ENTER_27_29_1_30_3( - "#27, #29, #30 (inside this well)", - LorenzVec(10, 63, 0), - EasterEgg.EASTER_EGG_27, - EasterEgg.EASTER_EGG_29, - EasterEgg.EASTER_EGG_30 - ), - EASTER_EGG_ENTER_30_4("#30 (left turn [<--] here)", LorenzVec(-28, 42, 14), EasterEgg.EASTER_EGG_30), - EASTER_EGG_ENTER_30_5("#30 Vault (brute force 2nd digit)", LorenzVec(-35, 25, 63), EasterEgg.EASTER_EGG_30), -} - diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrance.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrance.kt new file mode 100644 index 000000000..b54b17eb8 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrance.kt @@ -0,0 +1,18 @@ +package at.hannibal2.skyhanni.features.event.lobby.waypoints.halloween + +import at.hannibal2.skyhanni.utils.LorenzVec + +enum class BasketEntrance( + val basketEntranceName: String, + val waypoint: LorenzVec, + vararg val basket: Basket, +) { + + BASKET_ENTER_23("#23, #24 (behind the lava)", LorenzVec(-138, 74, -4), Basket.BASKET_23, Basket.BASKET_24), + BASKET_ENTER_24("#24 (within this tunnel)", LorenzVec(-80, 72, -4), Basket.BASKET_24), + BASKET_ENTER_25_1("#25 (1st digit, SNEAK + RCLICK)", LorenzVec(143, 65, -30), Basket.BASKET_25), + BASKET_ENTER_25_2("#25 (3rd digit, open chest)", LorenzVec(205, 34, -157), Basket.BASKET_25), + BASKET_ENTER_25_3("#25 (inside this well)", LorenzVec(10, 63, 0), Basket.BASKET_25), + BASKET_ENTER_25_4("#25 (left turn [<--] here)", LorenzVec(-28, 41, 14), Basket.BASKET_25), + BASKET_ENTER_25_5("#25 Vault (brute force 2nd digit)", LorenzVec(-35, 25, 63), Basket.BASKET_25), +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt deleted file mode 100644 index 3907986d9..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketEntrances.kt +++ /dev/null @@ -1,18 +0,0 @@ -package at.hannibal2.skyhanni.features.event.lobby.waypoints.halloween - -import at.hannibal2.skyhanni.utils.LorenzVec - -enum class BasketEntrances( - val basketEntranceName: String, - val waypoint: LorenzVec, - vararg val basket: Basket, -) { - - BASKET_ENTER_23("#23, #24 (behind the lava)", LorenzVec(-138, 74, -4), Basket.BASKET_23, Basket.BASKET_24), - BASKET_ENTER_24("#24 (within this tunnel)", LorenzVec(-80, 72, -4), Basket.BASKET_24), - BASKET_ENTER_25_1("#25 (1st digit, SNEAK + RCLICK)", LorenzVec(143, 65, -30), Basket.BASKET_25), - BASKET_ENTER_25_2("#25 (3rd digit, open chest)", LorenzVec(205, 34, -157), Basket.BASKET_25), - BASKET_ENTER_25_3("#25 (inside this well)", LorenzVec(10, 63, 0), Basket.BASKET_25), - BASKET_ENTER_25_4("#25 (left turn [<--] here)", LorenzVec(-28, 41, 14), Basket.BASKET_25), - BASKET_ENTER_25_5("#25 Vault (brute force 2nd digit)", LorenzVec(-35, 25, 63), Basket.BASKET_25), -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt index c2f30a967..a76805577 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt @@ -71,7 +71,7 @@ object BasketWaypoints { } if (config.allEntranceWaypoints) { - for (basketEntrance in BasketEntrances.entries) { + for (basketEntrance in BasketEntrance.entries) { if (!basketEntrance.basket.any { it.shouldShow() }) continue event.drawWaypointFilled(basketEntrance.waypoint, LorenzColor.YELLOW.toColor()) event.drawDynamicText(basketEntrance.waypoint, "§e" + basketEntrance.basketEntranceName, 1.5) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforge.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforge.kt new file mode 100644 index 000000000..75eccf4cc --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforge.kt @@ -0,0 +1,35 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide + +// TODO replace with ReforgeAPI +enum class FarmingReforge( + val reforgeName: String, + val reforgeItem: String, + val common: Int, + val uncommon: Int, + val rare: Int, + val epic: Int, + val legendary: Int, + val mythic: Int, +) { // if reforge item is an empty string it means it will never be called, just for upgrading and recomb stats + BLESSED("Blessed", "BLESSED_FRUIT", 5, 7, 9, 13, 16, 20), + BOUNTIFUL("Bountiful", "GOLDEN_BALL", 1, 2, 3, 5, 7, 10), + BLOOMING("Blooming", "FLOWERING_BOUQUET", 1, 2, 3, 4, 5, 6), + ROOTED("Rooted", "BURROWING_SPORES", 6, 9, 12, 15, 18, 21), + BUSTLING("Bustling", "SKYMART_BROCHURE", 1, 2, 4, 6, 8, 10), + MOSSY("Mossy", "OVERGROWN_GRASS", 5, 10, 15, 20, 25, 30), + ROBUST("Robust", "", 2, 3, 4, 6, 8, 10), + EARTHLY("Earthly", "LARGE_WALNUT", 1, 4, 6, 8, 10, 12), + GREEN_THUMB("Green Thumb", "", 1, 2, 3, 4, 5, 6) +} + +operator fun FarmingReforge.get(index: Int, current: Double = 0.0): Double? { + return when (index) { + 0 -> common - current + 1 -> uncommon - current + 2 -> rare - current + 3 -> epic - current + 4 -> legendary - current + 5 -> mythic - current + else -> null + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforges.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforges.kt deleted file mode 100644 index 6ac7171fb..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingReforges.kt +++ /dev/null @@ -1,35 +0,0 @@ -package at.hannibal2.skyhanni.features.garden.fortuneguide - -// TODO replace with ReforgeAPI -enum class FarmingReforges( - val reforgeName: String, - val reforgeItem: String, - val common: Int, - val uncommon: Int, - val rare: Int, - val epic: Int, - val legendary: Int, - val mythic: Int, -) { // if reforge item is an empty string it means it will never be called, just for upgrading and recomb stats - BLESSED("Blessed", "BLESSED_FRUIT", 5, 7, 9, 13, 16, 20), - BOUNTIFUL("Bountiful", "GOLDEN_BALL", 1, 2, 3, 5, 7, 10), - BLOOMING("Blooming", "FLOWERING_BOUQUET", 1, 2, 3, 4, 5, 6), - ROOTED("Rooted", "BURROWING_SPORES", 6, 9, 12, 15, 18, 21), - BUSTLING("Bustling", "SKYMART_BROCHURE", 1, 2, 4, 6, 8, 10), - MOSSY("Mossy", "OVERGROWN_GRASS", 5, 10, 15, 20, 25, 30), - ROBUST("Robust", "", 2, 3, 4, 6, 8, 10), - EARTHLY("Earthly", "LARGE_WALNUT", 1, 4, 6, 8, 10, 12), - GREEN_THUMB("Green Thumb", "", 1, 2, 3, 4, 5, 6) -} - -operator fun FarmingReforges.get(index: Int, current: Double = 0.0): Double? { - return when (index) { - 0 -> common - current - 1 -> uncommon - current - 2 -> rare - current - 3 -> epic - current - 4 -> legendary - current - 5 -> mythic - current - else -> null - } -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSet.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSet.kt new file mode 100644 index 000000000..4e1c3d521 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSet.kt @@ -0,0 +1,16 @@ +package at.hannibal2.skyhanni.features.garden.fortuneguide + +enum class FarmingSet( + val helmetIncrease: Double, + val chestplateIncrease: Double, + val leggingsIncrease: Double, + val bootsIncrease: Double, +) { + + MELON(15.0, 20.0, 20.0, 15.0), + CROPIE(15.0, 20.0, 20.0, 15.0), + SQUASH(15.0, 20.0, 20.0, 15.0), + FERMENTO(15.0, 20.0, 20.0, 15.0), + FARMER(0.0, 0.0, 0.0, 0.0), + RANCHERS(0.0, 0.0, 0.0, 0.0) +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSets.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSets.kt deleted file mode 100644 index e0b74ce8a..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FarmingSets.kt +++ /dev/null @@ -1,16 +0,0 @@ -package at.hannibal2.skyhanni.features.garden.fortuneguide - -enum class FarmingSets( - val helmetIncrease: Double, - val chestplateIncrease: Double, - val leggingsIncrease: Double, - val bootsIncrease: Double, -) { - - MELON(15.0, 20.0, 20.0, 15.0), - CROPIE(15.0, 20.0, 20.0, 15.0), - SQUASH(15.0, 20.0, 20.0, 15.0), - FERMENTO(15.0, 20.0, 20.0, 15.0), - FARMER(0.0, 0.0, 0.0, 0.0), - RANCHERS(0.0, 0.0, 0.0, 0.0) -} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt index 43289dc62..cd76262c0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt @@ -107,11 +107,11 @@ object FortuneUpgrades { when (item.getReforgeName()) { "rooted" -> {} "blooming" -> { - reforgeItem(item, FarmingReforges.ROOTED, genericUpgrades) + reforgeItem(item, FarmingReforge.ROOTED, genericUpgrades) } else -> { - reforgeItem(item, FarmingReforges.BLOOMING, genericUpgrades) + reforgeItem(item, FarmingReforge.BLOOMING, genericUpgrades) } } } @@ -126,11 +126,11 @@ object FortuneUpgrades { when (item.getReforgeName()) { "mossy" -> {} "bustling" -> { - reforgeItem(item, FarmingReforges.MOSSY, genericUpgrades) + reforgeItem(item, FarmingReforge.MOSSY, genericUpgrades) } else -> { - reforgeItem(item, FarmingReforges.BUSTLING, genericUpgrades, 100) + reforgeItem(item, FarmingReforge.BUSTLING, genericUpgrades, 100) } } } @@ -242,7 +242,7 @@ object FortuneUpgrades { "blessed" -> {} "bountiful" -> {} else -> { - reforgeItem(tool, FarmingReforges.BLESSED, cropSpecificUpgrades) + reforgeItem(tool, FarmingReforge.BLESSED, cropSpecificUpgrades) } } cropSpecificUpgrades.populateAndSort(0) @@ -251,7 +251,7 @@ object FortuneUpgrades { private fun recombobulateItem(item: ItemStack, list: MutableList) { if (item.isRecombobulated()) return val reforge = item.getReforgeName()?.let { - FarmingReforges.entries.find { enumValue -> + FarmingReforge.entries.find { enumValue -> enumValue.name == it.uppercase() } } ?: return @@ -265,7 +265,7 @@ object FortuneUpgrades { private fun reforgeItem( item: ItemStack, - reforge: FarmingReforges, + reforge: FarmingReforge, list: MutableList, copperPrice: Int? = null, ) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt index 721ec62ce..a4d5bd628 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt @@ -242,7 +242,7 @@ object CustomScoreboard { event.transform(37, "$displayPrefix.events.eventEntries") { element -> val array = element.asJsonArray - array.add(JsonPrimitive(ScoreboardEvents.QUEUE.name)) + array.add(JsonPrimitive(ScoreboardEvent.QUEUE.name)) array } event.transform(40, "$displayPrefix.events.eventEntries") { element -> @@ -257,7 +257,7 @@ object CustomScoreboard { } if (jsonArray.any { it.asString in listOf("HOT_DOG_CONTEST", "EFFIGIES") }) { - newArray.add(JsonPrimitive(ScoreboardEvents.RIFT.name)) + newArray.add(JsonPrimitive(ScoreboardEvent.RIFT.name)) } newArray @@ -283,13 +283,13 @@ object CustomScoreboard { } event.transform(50, "$displayPrefix.events.eventEntries") { element -> val array = element.asJsonArray - array.add(JsonPrimitive(ScoreboardEvents.ANNIVERSARY.name)) - array.add(JsonPrimitive(ScoreboardEvents.CARNIVAL.name)) + array.add(JsonPrimitive(ScoreboardEvent.ANNIVERSARY.name)) + array.add(JsonPrimitive(ScoreboardEvent.CARNIVAL.name)) array } event.transform(51, "$displayPrefix.events.eventEntries") { element -> val array = element.asJsonArray - array.add(JsonPrimitive(ScoreboardEvents.NEW_YEAR.name)) + array.add(JsonPrimitive(ScoreboardEvent.NEW_YEAR.name)) array } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 116cecd19..ab3584251 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -730,13 +730,13 @@ private fun getPowderDisplayPair() = buildList { private fun getPowderShowWhen() = inAdvancedMiningIsland() -private fun getEventsDisplayPair(): List = ScoreboardEvents.getEvent() +private fun getEventsDisplayPair(): List = ScoreboardEvent.getEvent() .filterNotNull() .flatMap { it.getLines().map { i -> i to HorizontalAlignment.LEFT } } .takeIf { it.isNotEmpty() } ?: listOf("" to HorizontalAlignment.LEFT) -private fun getEventsShowWhen() = ScoreboardEvents.getEvent().isNotEmpty() +private fun getEventsShowWhen() = ScoreboardEvent.getEvent().isNotEmpty() private fun getMayorDisplayPair() = buildList { val currentMayorName = MayorAPI.currentMayor?.mayorName?.let { MayorAPI.mayorNameWithColorCode(it) } ?: "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt new file mode 100644 index 000000000..7279079ef --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvent.kt @@ -0,0 +1,574 @@ +package at.hannibal2.skyhanni.features.gui.customscoreboard + +import at.hannibal2.skyhanni.data.HypixelData +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.ScoreboardData +import at.hannibal2.skyhanni.features.dungeon.DungeonAPI +import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.eventsConfig +import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvent.VOTING +import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern +import at.hannibal2.skyhanni.features.misc.ServerRestartTitle +import at.hannibal2.skyhanni.features.rift.area.stillgorechateau.RiftBloodEffigies +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter +import at.hannibal2.skyhanni.utils.LorenzUtils.inAdvancedMiningIsland +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.RegexUtils.anyMatches +import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher +import at.hannibal2.skyhanni.utils.RegexUtils.matches +import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.StringUtils.removeResets +import at.hannibal2.skyhanni.utils.TabListData +import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern as SbPattern + +/** + * This enum contains all the lines that either are events or other lines that are so rare/not often seen that they + * don't fit in the normal [ScoreboardElement] enum. + * + * We for example have the [VOTING] Event, while this is clearly not an event, I don't consider them as normal lines + * because they are visible for a maximum of like 1 minute every 5 days and ~12 hours. + */ + +private fun getSbLines(): List { + return ScoreboardData.sidebarLinesFormatted +} + +enum class ScoreboardEvent( + private val displayLine: () -> List, + private val showWhen: () -> Boolean, + private val configLine: String, +) { + VOTING( + ::getVotingLines, + ::getVotingShowWhen, + "§7(All Voting Lines)", + ), + SERVER_CLOSE( + ::getServerCloseLines, + ::getServerCloseShowWhen, + "§cServer closing soon!", + ), + DUNGEONS( + ::getDungeonsLines, + ::getDungeonsShowWhen, + "§7(All Dungeons Lines)", + ), + KUUDRA( + ::getKuudraLines, + ::getKuudraShowWhen, + "§7(All Kuudra Lines)", + ), + DOJO( + ::getDojoLines, + ::getDojoShowWhen, + "§7(All Dojo Lines)", + ), + DARK_AUCTION( + ::getDarkAuctionLines, + ::getDarkAuctionShowWhen, + "Time Left: §b11\n" + + "Current Item:\n" + + " §5Travel Scroll to Sirius", + ), + JACOB_CONTEST( + ::getJacobContestLines, + ::getJacobContestShowWhen, + "§eJacob's Contest\n" + + "§e○ §fCarrot §a18m17s\n" + + " Collected §e8,264", + ), + JACOB_MEDALS( + ::getJacobMedalsLines, + ::getJacobMedalsShowWhen, + "§6§lGOLD §fmedals: §613\n" + + "§f§lSILVER §fmedals: §f3\n" + + "§c§lBRONZE §fmedals: §c4", + ), + TRAPPER( + ::getTrapperLines, + ::getTrapperShowWhen, + "Pelts: §5711\n" + + "Tracker Mob Location:\n" + + "§bMushroom Gorge", + ), + GARDEN_CLEAN_UP( + ::getGardenCleanUpLines, + ::getGardenCleanUpShowWhen, + "Cleanup: §c12.6%", + ), + GARDEN_PASTING( + ::getGardenPastingLines, + ::getGardenPastingShowWhen, + "§fBarn Pasting§7: §e12.3%", + ), + FLIGHT_DURATION( + ::getFlightDurationLines, + ::getFlightDurationShowWhen, + "Flight Duration: §a10m 0s", + ), + WINTER( + ::getWinterLines, + ::getWinterShowWhen, + "§7(All Winter Event Lines)", + ), + NEW_YEAR( + ::getNewYearLines, + ::getNewYearShowWhen, + "§dNew Year Event!§f 24:25", + ), + SPOOKY( + ::getSpookyLines, + ::getSpookyShowWhen, + "§6Spooky Festival§f 50:54\n" + + "§7Your Candy:\n" + + "§a1 Green§7, §50 Purple §7(§61 §7pts.)", + ), + BROODMOTHER( + ::getBroodmotherLines, + ::getBroodmotherShowWhen, + "§4Broodmother§7: §eDormant", + ), + MINING_EVENTS( + ::getMiningEventsLines, + { inAdvancedMiningIsland() }, + "§7(All Mining Event Lines)", + ), + DAMAGE( + ::getDamageLines, + ::getDamageShowWhen, + "Dragon HP: §a6,180,925 §c❤\n" + + "Your Damage: §c375,298.5", + ), + MAGMA_BOSS( + ::getMagmaBossLines, + ::getMagmaBossShowWhen, + "§7(All Magma Boss Lines)\n" + + "§7Boss: §c0%\n" + + "§7Damage Soaked:\n" + + "§e▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎§7▎▎▎▎▎", + ), + CARNIVAL( + ::getCarnivalLines, + ::getCarnivalShowWhen, + "§7(All Carnival Lines)", + ), + RIFT( + ::getRiftLines, + { IslandType.THE_RIFT.isInIsland() }, + "§7(All Rift Lines)", + ), + ESSENCE( + ::getEssenceLines, + ::getEssenceShowWhen, + "Dragon Essence: §d1,285", + ), + QUEUE( + ::getQueueLines, + ::getQueueShowWhen, + "Queued: Glacite Mineshafts\n" + + "Position: §b#45 §fSince: §a00:00", + ), + ACTIVE_TABLIST_EVENTS( + ::getActiveEventLine, + ::getActiveEventShowWhen, + "§7(All Active Tablist Events)\n§dHoppity's Hunt\n §fEnds in: §e26h", + ), + STARTING_SOON_TABLIST_EVENTS( + ::getSoonEventLine, + ::getSoonEventShowWhen, + "§7(All Starting Soon Tablist Events)\n§6Mining Fiesta\n §fStarts in: §e52min", + ), + REDSTONE( + ::getRedstoneLines, + ::getRedstoneShowWhen, + "§e§l⚡ §cRedstone: §e§b7%", + ), + ANNIVERSARY( + ::getAnniversaryLines, + ::getAnniversaryShowWhen, + "§d5th Anniversary§f 167:59:54", + ), + ; + + override fun toString() = configLine + + fun getLines(): List = displayLine() + + companion object { + fun getEvent() = buildList { + if (eventsConfig.showAllActiveEvents) { + for (event in eventsConfig.eventEntries) { + if (event.showWhen()) { + add(event) + } + } + } else { + add(eventsConfig.eventEntries.firstOrNull { it.showWhen() && it.getLines().isNotEmpty() }) + } + } + + // I don't know why, but this field is needed for it to work + @JvmField + val defaultOption = listOf( + VOTING, + SERVER_CLOSE, + DUNGEONS, + KUUDRA, + DOJO, + DARK_AUCTION, + JACOB_CONTEST, + JACOB_MEDALS, + TRAPPER, + GARDEN_CLEAN_UP, + GARDEN_PASTING, + FLIGHT_DURATION, + NEW_YEAR, + WINTER, + SPOOKY, + BROODMOTHER, + MINING_EVENTS, + DAMAGE, + MAGMA_BOSS, + CARNIVAL, + RIFT, + ESSENCE, + ACTIVE_TABLIST_EVENTS, + ) + } +} + +private fun getVotingLines() = buildList { + val sbLines = getSbLines() + + val yearLine = sbLines.firstOrNull { SbPattern.yearVotesPattern.matches(it) } ?: return emptyList() + add(yearLine) + + if (sbLines.nextAfter(yearLine) == "§7Waiting for") { + add("§7Waiting for") + add("§7your vote...") + } else { + if (SbPattern.votesPattern.anyMatches(sbLines)) { + addAll(sbLines.filter { SbPattern.votesPattern.matches(it) }) + } + } +} + +private fun getVotingShowWhen(): Boolean = SbPattern.yearVotesPattern.anyMatches(getSbLines()) + +private fun getServerCloseLines() = buildList { + val matchingLine = getSbLines().first { ServerRestartTitle.restartingGreedyPattern.matches(it) } + add(matchingLine.split("§8")[0]) +} + +private fun getServerCloseShowWhen(): Boolean = ServerRestartTitle.restartingGreedyPattern.anyMatches(getSbLines()) + +private fun getDungeonsLines() = listOf( + SbPattern.m7dragonsPattern, + SbPattern.autoClosingPattern, + SbPattern.startingInPattern, + SbPattern.keysPattern, + SbPattern.timeElapsedPattern, + SbPattern.clearedPattern, + SbPattern.soloPattern, + SbPattern.teammatesPattern, + SbPattern.floor3GuardiansPattern, +).let { patterns -> + // BetterMap adds a random §r at the start, making the line go black + getSbLines().filter { line -> patterns.any { it.matches(line) } }.map { it.removePrefix("§r") } +} + +private fun getDungeonsShowWhen(): Boolean = DungeonAPI.inDungeon() + +private fun getKuudraLines() = listOf( + SbPattern.autoClosingPattern, + SbPattern.startingInPattern, + SbPattern.timeElapsedPattern, + SbPattern.instanceShutdownPattern, + SbPattern.wavePattern, + SbPattern.tokensPattern, + SbPattern.submergesPattern, +) + .mapNotNull { pattern -> + getSbLines().firstOrNull { pattern.matches(it) } + } + +private fun getKuudraShowWhen(): Boolean = IslandType.KUUDRA_ARENA.isInIsland() + +private fun getDojoLines() = listOf( + SbPattern.dojoChallengePattern, + SbPattern.dojoDifficultyPattern, + SbPattern.dojoPointsPattern, + SbPattern.dojoTimePattern, +) + .mapNotNull { pattern -> + getSbLines().firstOrNull { pattern.matches(it) } + } + +private fun getDojoShowWhen(): Boolean = SbPattern.dojoChallengePattern.anyMatches(getSbLines()) + +private fun getDarkAuctionLines() = buildList { + getSbLines().firstOrNull { SbPattern.startingInPattern.matches(it) }?.let { add(it) } + getSbLines().firstOrNull { SbPattern.timeLeftPattern.matches(it) }?.let { add(it) } + + val darkAuctionCurrentItemLine = getSbLines().firstOrNull { SbPattern.darkAuctionCurrentItemPattern.matches(it) } + + if (darkAuctionCurrentItemLine != null) { + add(darkAuctionCurrentItemLine) + getSbLines().nextAfter(darkAuctionCurrentItemLine)?.let { add(it) } + } +} + +private fun getDarkAuctionShowWhen(): Boolean = IslandType.DARK_AUCTION.isInIsland() + +private fun getJacobContestLines() = buildList { + getSbLines().firstOrNull { SbPattern.jacobsContestPattern.matches(it) }?.let { line -> + add(line) + getSbLines().nextAfter(line)?.let { add(it) } + getSbLines().nextAfter(line, 2)?.let { add(it) } + getSbLines().nextAfter(line, 3)?.let { + if (!SbPattern.footerPattern.matches(it)) add(it) + } + } +} + +private fun getJacobContestShowWhen(): Boolean = SbPattern.jacobsContestPattern.anyMatches(getSbLines()) + +private fun getJacobMedalsLines(): List = getSbLines().filter { SbPattern.medalsPattern.matches(it) } + +private fun getJacobMedalsShowWhen(): Boolean = SbPattern.medalsPattern.anyMatches(getSbLines()) + +private fun getTrapperLines() = buildList { + getSbLines().firstOrNull { SbPattern.peltsPattern.matches(it) }?.let { add(it) } + + val trapperMobLocationLine = getSbLines().firstOrNull { SbPattern.mobLocationPattern.matches(it) } + if (trapperMobLocationLine != null) { + add("Tracker Mob Location:") + getSbLines().nextAfter(trapperMobLocationLine)?.let { add(it) } + } +} + +private fun getTrapperShowWhen(): Boolean = + getSbLines().any { ScoreboardPattern.peltsPattern.matches(it) || ScoreboardPattern.mobLocationPattern.matches(it) } + +private fun getGardenCleanUpLines(): List = + listOf(getSbLines().first { SbPattern.cleanUpPattern.matches(it) }.trim()) + +private fun getGardenCleanUpShowWhen(): Boolean = SbPattern.cleanUpPattern.anyMatches(getSbLines()) + +private fun getGardenPastingLines(): List = + listOf(getSbLines().first { SbPattern.pastingPattern.matches(it) }.trim()) + +private fun getGardenPastingShowWhen(): Boolean = SbPattern.pastingPattern.anyMatches(getSbLines()) + +private fun getFlightDurationLines(): List = + listOf(getSbLines().first { SbPattern.flightDurationPattern.matches(it) }.trim()) + +private fun getFlightDurationShowWhen(): Boolean = SbPattern.flightDurationPattern.anyMatches(getSbLines()) + +private fun getWinterLines() = buildList { + getSbLines().firstOrNull { SbPattern.winterEventStartPattern.matches(it) }?.let { add(it) } + getSbLines().firstOrNull { SbPattern.winterNextWavePattern.matches(it) && !it.endsWith("Soon!") }?.let { add(it) } + getSbLines().firstOrNull { SbPattern.winterWavePattern.matches(it) }?.let { add(it) } + getSbLines().firstOrNull { SbPattern.winterMagmaLeftPattern.matches(it) }?.let { add(it) } + getSbLines().firstOrNull { SbPattern.winterTotalDmgPattern.matches(it) }?.let { add(it) } + getSbLines().firstOrNull { SbPattern.winterCubeDmgPattern.matches(it) }?.let { add(it) } +} + +private fun getWinterShowWhen(): Boolean = getSbLines().any { + ScoreboardPattern.winterEventStartPattern.matches(it) + || (ScoreboardPattern.winterNextWavePattern.matches(it) && !it.endsWith("Soon!")) + || ScoreboardPattern.winterWavePattern.matches(it) +} + +private fun getNewYearLines() = listOf(getSbLines().first { SbPattern.newYearPattern.matches(it) }) + +private fun getNewYearShowWhen(): Boolean = SbPattern.newYearPattern.anyMatches(getSbLines()) + +private fun getSpookyLines() = buildList { + getSbLines().firstOrNull { SbPattern.spookyPattern.matches(it) }?.let { add(it) } // Time + add("§7Your Candy: ") + add( + TabListData.getFooter() + .removeResets() + .split("\n") + .firstOrNull { it.startsWith("§7Your Candy:") } + ?.removePrefix("§7Your Candy:") ?: "§cCandy not found", + ) // Candy +} + +private fun getSpookyShowWhen(): Boolean = getSbLines().any { ScoreboardPattern.spookyPattern.matches(it) } + +private fun getTablistEvent(): String? = + TabListData.getTabList().firstOrNull { SbPattern.eventNamePattern.matches(it) } + ?.let { + SbPattern.eventNamePattern.matchMatcher(it) { + group("name") + } + } + +private fun getActiveEventLine(): List { + val currentActiveEvent = getTablistEvent() ?: return emptyList() + + // Some Active Events are better not shown from the tablist, + // but from other locations like the scoreboard + val blockedEvents = listOf("Spooky Festival", "Carnival", "5th SkyBlock Anniversary", "New Year Celebration") + if (blockedEvents.contains(currentActiveEvent.removeColor())) return emptyList() + + val currentActiveEventTime = TabListData.getTabList().firstOrNull { SbPattern.eventTimeEndsPattern.matches(it) } + ?.let { + SbPattern.eventTimeEndsPattern.matchMatcher(it) { + group("time") + } + } + + return listOf(currentActiveEvent, " Ends in: §e$currentActiveEventTime") +} + +private fun getActiveEventShowWhen(): Boolean = + getTablistEvent() != null && TabListData.getTabList().any { SbPattern.eventTimeEndsPattern.matches(it) } + +private fun getSoonEventLine(): List { + val soonActiveEvent = getTablistEvent() ?: return emptyList() + val soonActiveEventTime = TabListData.getTabList().firstOrNull { SbPattern.eventTimeStartsPattern.matches(it) } + ?.let { + SbPattern.eventTimeStartsPattern.matchMatcher(it) { + group("time") + } + } + + return listOf(soonActiveEvent, " Starts in: §e$soonActiveEventTime") +} + +private fun getSoonEventShowWhen(): Boolean = + getTablistEvent() != null && TabListData.getTabList().any { SbPattern.eventTimeStartsPattern.matches(it) } + +private fun getBroodmotherLines(): List = + listOf(getSbLines().first { SbPattern.broodmotherPattern.matches(it) }) + +private fun getBroodmotherShowWhen(): Boolean = getSbLines().any { SbPattern.broodmotherPattern.matches(it) } + +private fun getMiningEventsLines() = buildList { + // Wind + if (getSbLines().any { SbPattern.windCompassPattern.matches(it) } + && getSbLines().any { SbPattern.windCompassArrowPattern.matches(it) }) { + add(getSbLines().first { SbPattern.windCompassPattern.matches(it) }) + add("| ${getSbLines().first { SbPattern.windCompassArrowPattern.matches(it) }} §f|") + } + + // Better Together + if (getSbLines().any { SbPattern.nearbyPlayersPattern.matches(it) }) { + add("§dBetter Together") + add(" ${getSbLines().first { SbPattern.nearbyPlayersPattern.matches(it) }}") + } + + // Zone Events + if (getSbLines().any { SbPattern.miningEventPattern.matches(it) } + && getSbLines().any { SbPattern.miningEventZonePattern.matches(it) }) { + add(getSbLines().first { SbPattern.miningEventPattern.matches(it) }.removePrefix("Event: ")) + add("in ${getSbLines().first { SbPattern.miningEventZonePattern.matches(it) }.removePrefix("Zone: ")}") + } + + // Zone Events but no Zone Line + if (getSbLines().any { SbPattern.miningEventPattern.matches(it) } + && getSbLines().none { SbPattern.miningEventZonePattern.matches(it) }) { + add( + getSbLines().first { SbPattern.miningEventPattern.matches(it) } + .removePrefix("Event: "), + ) + } + + // Mithril Gourmand + if (getSbLines().any { SbPattern.mithrilRemainingPattern.matches(it) } + && getSbLines().any { SbPattern.mithrilYourMithrilPattern.matches(it) }) { + add(getSbLines().first { SbPattern.mithrilRemainingPattern.matches(it) }) + add(getSbLines().first { SbPattern.mithrilYourMithrilPattern.matches(it) }) + } + + // Raffle + if (getSbLines().any { SbPattern.raffleTicketsPattern.matches(it) } + && getSbLines().any { SbPattern.rafflePoolPattern.matches(it) }) { + add(getSbLines().first { SbPattern.raffleTicketsPattern.matches(it) }) + add(getSbLines().first { SbPattern.rafflePoolPattern.matches(it) }) + } + + // Raid + if (getSbLines().any { SbPattern.yourGoblinKillsPattern.matches(it) } + && getSbLines().any { SbPattern.remainingGoblinPattern.matches(it) }) { + add(getSbLines().first { SbPattern.yourGoblinKillsPattern.matches(it) }) + add(getSbLines().first { SbPattern.remainingGoblinPattern.matches(it) }) + } + + // Fortunate Freezing + if (getSbLines().any { SbPattern.fortunateFreezingBonusPattern.matches(it) }) { + add(getSbLines().first { SbPattern.fortunateFreezingBonusPattern.matches(it) }) + } + + // Fossil Dust + if (getSbLines().any { SbPattern.fossilDustPattern.matches(it) }) { + add(getSbLines().first { SbPattern.fossilDustPattern.matches(it) }) + } +} + +private fun getDamageLines(): List = + listOf(getSbLines().first { SbPattern.bossHPPattern.matches(it) }) + + (getSbLines().first { SbPattern.bossDamagePattern.matches(it) }) + +private fun getDamageShowWhen(): Boolean = + getSbLines().any { SbPattern.bossHPPattern.matches(it) } + && getSbLines().any { SbPattern.bossDamagePattern.matches(it) } + +private fun getMagmaBossLines() = getSbLines().filter { line -> + SbPattern.magmaBossPattern.matches(line) + || SbPattern.damageSoakedPattern.matches(line) + || SbPattern.killMagmasPattern.matches(line) + || SbPattern.killMagmasDamagedSoakedBarPattern.matches(line) + || SbPattern.reformingPattern.matches(line) + || SbPattern.bossHealthPattern.matches(line) + || SbPattern.bossHealthBarPattern.matches(line) +} + +private fun getMagmaBossShowWhen(): Boolean = SbPattern.magmaChamberPattern.matches(HypixelData.skyBlockArea) + +private fun getCarnivalLines() = listOf( + SbPattern.carnivalPattern, + SbPattern.carnivalTokensPattern, + SbPattern.carnivalTasksPattern, + SbPattern.timeLeftPattern, + SbPattern.carnivalCatchStreakPattern, + SbPattern.carnivalFruitsPattern, + SbPattern.carnivalAccuracyPattern, + SbPattern.carnivalKillsPattern, + SbPattern.carnivalScorePattern, +) + .mapNotNull { pattern -> + getSbLines().firstOrNull { pattern.matches(it) } + } + +private fun getCarnivalShowWhen(): Boolean = SbPattern.carnivalPattern.anyMatches(getSbLines()) + +private fun getRiftLines() = getSbLines().filter { line -> + RiftBloodEffigies.heartsPattern.matches(line) + || SbPattern.riftHotdogTitlePattern.matches(line) + || SbPattern.timeLeftPattern.matches(line) + || SbPattern.riftHotdogEatenPattern.matches(line) + || SbPattern.riftAveikxPattern.matches(line) + || SbPattern.riftHayEatenPattern.matches(line) + || SbPattern.cluesPattern.matches(line) +} + +private fun getEssenceLines(): List = listOf(getSbLines().first { SbPattern.essencePattern.matches(it) }) + +private fun getEssenceShowWhen(): Boolean = SbPattern.essencePattern.anyMatches(getSbLines()) + +private fun getQueueLines(): List = + listOf(getSbLines().first { SbPattern.queuePattern.matches(it) }) + + (getSbLines().first { SbPattern.queuePositionPattern.matches(it) }) + +private fun getQueueShowWhen(): Boolean = SbPattern.queuePattern.anyMatches(getSbLines()) + +private fun getRedstoneLines(): List = listOf(getSbLines().first { SbPattern.redstonePattern.matches(it) }) + +private fun getRedstoneShowWhen(): Boolean = SbPattern.redstonePattern.anyMatches(getSbLines()) + +private fun getAnniversaryLines() = listOf(getSbLines().first { SbPattern.anniversaryPattern.matches(it) }) + +private fun getAnniversaryShowWhen(): Boolean = SbPattern.anniversaryPattern.anyMatches(getSbLines()) diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt deleted file mode 100644 index ebeed5eee..000000000 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt +++ /dev/null @@ -1,574 +0,0 @@ -package at.hannibal2.skyhanni.features.gui.customscoreboard - -import at.hannibal2.skyhanni.data.HypixelData -import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.data.ScoreboardData -import at.hannibal2.skyhanni.features.dungeon.DungeonAPI -import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.eventsConfig -import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvents.VOTING -import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern -import at.hannibal2.skyhanni.features.misc.ServerRestartTitle -import at.hannibal2.skyhanni.features.rift.area.stillgorechateau.RiftBloodEffigies -import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter -import at.hannibal2.skyhanni.utils.LorenzUtils.inAdvancedMiningIsland -import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.RegexUtils.anyMatches -import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher -import at.hannibal2.skyhanni.utils.RegexUtils.matches -import at.hannibal2.skyhanni.utils.StringUtils.removeColor -import at.hannibal2.skyhanni.utils.StringUtils.removeResets -import at.hannibal2.skyhanni.utils.TabListData -import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern as SbPattern - -/** - * This enum contains all the lines that either are events or other lines that are so rare/not often seen that they - * don't fit in the normal [ScoreboardElement] enum. - * - * We for example have the [VOTING] Event, while this is clearly not an event, I don't consider them as normal lines - * because they are visible for a maximum of like 1 minute every 5 days and ~12 hours. - */ - -private fun getSbLines(): List { - return ScoreboardData.sidebarLinesFormatted -} - -enum class ScoreboardEvents( - private val displayLine: () -> List, - private val showWhen: () -> Boolean, - private val configLine: String, -) { - VOTING( - ::getVotingLines, - ::getVotingShowWhen, - "§7(All Voting Lines)", - ), - SERVER_CLOSE( - ::getServerCloseLines, - ::getServerCloseShowWhen, - "§cServer closing soon!", - ), - DUNGEONS( - ::getDungeonsLines, - ::getDungeonsShowWhen, - "§7(All Dungeons Lines)", - ), - KUUDRA( - ::getKuudraLines, - ::getKuudraShowWhen, - "§7(All Kuudra Lines)", - ), - DOJO( - ::getDojoLines, - ::getDojoShowWhen, - "§7(All Dojo Lines)", - ), - DARK_AUCTION( - ::getDarkAuctionLines, - ::getDarkAuctionShowWhen, - "Time Left: §b11\n" + - "Current Item:\n" + - " §5Travel Scroll to Sirius", - ), - JACOB_CONTEST( - ::getJacobContestLines, - ::getJacobContestShowWhen, - "§eJacob's Contest\n" + - "§e○ §fCarrot §a18m17s\n" + - " Collected §e8,264", - ), - JACOB_MEDALS( - ::getJacobMedalsLines, - ::getJacobMedalsShowWhen, - "§6§lGOLD §fmedals: §613\n" + - "§f§lSILVER §fmedals: §f3\n" + - "§c§lBRONZE §fmedals: §c4", - ), - TRAPPER( - ::getTrapperLines, - ::getTrapperShowWhen, - "Pelts: §5711\n" + - "Tracker Mob Location:\n" + - "§bMushroom Gorge", - ), - GARDEN_CLEAN_UP( - ::getGardenCleanUpLines, - ::getGardenCleanUpShowWhen, - "Cleanup: §c12.6%", - ), - GARDEN_PASTING( - ::getGardenPastingLines, - ::getGardenPastingShowWhen, - "§fBarn Pasting§7: §e12.3%", - ), - FLIGHT_DURATION( - ::getFlightDurationLines, - ::getFlightDurationShowWhen, - "Flight Duration: §a10m 0s", - ), - WINTER( - ::getWinterLines, - ::getWinterShowWhen, - "§7(All Winter Event Lines)", - ), - NEW_YEAR( - ::getNewYearLines, - ::getNewYearShowWhen, - "§dNew Year Event!§f 24:25", - ), - SPOOKY( - ::getSpookyLines, - ::getSpookyShowWhen, - "§6Spooky Festival§f 50:54\n" + - "§7Your Candy:\n" + - "§a1 Green§7, §50 Purple §7(§61 §7pts.)", - ), - BROODMOTHER( - ::getBroodmotherLines, - ::getBroodmotherShowWhen, - "§4Broodmother§7: §eDormant", - ), - MINING_EVENTS( - ::getMiningEventsLines, - { inAdvancedMiningIsland() }, - "§7(All Mining Event Lines)", - ), - DAMAGE( - ::getDamageLines, - ::getDamageShowWhen, - "Dragon HP: §a6,180,925 §c❤\n" + - "Your Damage: §c375,298.5", - ), - MAGMA_BOSS( - ::getMagmaBossLines, - ::getMagmaBossShowWhen, - "§7(All Magma Boss Lines)\n" + - "§7Boss: §c0%\n" + - "§7Damage Soaked:\n" + - "§e▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎§7▎▎▎▎▎", - ), - CARNIVAL( - ::getCarnivalLines, - ::getCarnivalShowWhen, - "§7(All Carnival Lines)", - ), - RIFT( - ::getRiftLines, - { IslandType.THE_RIFT.isInIsland() }, - "§7(All Rift Lines)", - ), - ESSENCE( - ::getEssenceLines, - ::getEssenceShowWhen, - "Dragon Essence: §d1,285", - ), - QUEUE( - ::getQueueLines, - ::getQueueShowWhen, - "Queued: Glacite Mineshafts\n" + - "Position: §b#45 §fSince: §a00:00", - ), - ACTIVE_TABLIST_EVENTS( - ::getActiveEventLine, - ::getActiveEventShowWhen, - "§7(All Active Tablist Events)\n§dHoppity's Hunt\n §fEnds in: §e26h", - ), - STARTING_SOON_TABLIST_EVENTS( - ::getSoonEventLine, - ::getSoonEventShowWhen, - "§7(All Starting Soon Tablist Events)\n§6Mining Fiesta\n §fStarts in: §e52min", - ), - REDSTONE( - ::getRedstoneLines, - ::getRedstoneShowWhen, - "§e§l⚡ §cRedstone: §e§b7%", - ), - ANNIVERSARY( - ::getAnniversaryLines, - ::getAnniversaryShowWhen, - "§d5th Anniversary§f 167:59:54", - ), - ; - - override fun toString() = configLine - - fun getLines(): List = displayLine() - - companion object { - fun getEvent() = buildList { - if (eventsConfig.showAllActiveEvents) { - for (event in eventsConfig.eventEntries) { - if (event.showWhen()) { - add(event) - } - } - } else { - add(eventsConfig.eventEntries.firstOrNull { it.showWhen() && it.getLines().isNotEmpty() }) - } - } - - // I don't know why, but this field is needed for it to work - @JvmField - val defaultOption = listOf( - VOTING, - SERVER_CLOSE, - DUNGEONS, - KUUDRA, - DOJO, - DARK_AUCTION, - JACOB_CONTEST, - JACOB_MEDALS, - TRAPPER, - GARDEN_CLEAN_UP, - GARDEN_PASTING, - FLIGHT_DURATION, - NEW_YEAR, - WINTER, - SPOOKY, - BROODMOTHER, - MINING_EVENTS, - DAMAGE, - MAGMA_BOSS, - CARNIVAL, - RIFT, - ESSENCE, - ACTIVE_TABLIST_EVENTS, - ) - } -} - -private fun getVotingLines() = buildList { - val sbLines = getSbLines() - - val yearLine = sbLines.firstOrNull { SbPattern.yearVotesPattern.matches(it) } ?: return emptyList() - add(yearLine) - - if (sbLines.nextAfter(yearLine) == "§7Waiting for") { - add("§7Waiting for") - add("§7your vote...") - } else { - if (SbPattern.votesPattern.anyMatches(sbLines)) { - addAll(sbLines.filter { SbPattern.votesPattern.matches(it) }) - } - } -} - -private fun getVotingShowWhen(): Boolean = SbPattern.yearVotesPattern.anyMatches(getSbLines()) - -private fun getServerCloseLines() = buildList { - val matchingLine = getSbLines().first { ServerRestartTitle.restartingGreedyPattern.matches(it) } - add(matchingLine.split("§8")[0]) -} - -private fun getServerCloseShowWhen(): Boolean = ServerRestartTitle.restartingGreedyPattern.anyMatches(getSbLines()) - -private fun getDungeonsLines() = listOf( - SbPattern.m7dragonsPattern, - SbPattern.autoClosingPattern, - SbPattern.startingInPattern, - SbPattern.keysPattern, - SbPattern.timeElapsedPattern, - SbPattern.clearedPattern, - SbPattern.soloPattern, - SbPattern.teammatesPattern, - SbPattern.floor3GuardiansPattern, -).let { patterns -> - // BetterMap adds a random §r at the start, making the line go black - getSbLines().filter { line -> patterns.any { it.matches(line) } }.map { it.removePrefix("§r") } -} - -private fun getDungeonsShowWhen(): Boolean = DungeonAPI.inDungeon() - -private fun getKuudraLines() = listOf( - SbPattern.autoClosingPattern, - SbPattern.startingInPattern, - SbPattern.timeElapsedPattern, - SbPattern.instanceShutdownPattern, - SbPattern.wavePattern, - SbPattern.tokensPattern, - SbPattern.submergesPattern, -) - .mapNotNull { pattern -> - getSbLines().firstOrNull { pattern.matches(it) } - } - -private fun getKuudraShowWhen(): Boolean = IslandType.KUUDRA_ARENA.isInIsland() - -private fun getDojoLines() = listOf( - SbPattern.dojoChallengePattern, - SbPattern.dojoDifficultyPattern, - SbPattern.dojoPointsPattern, - SbPattern.dojoTimePattern, -) - .mapNotNull { pattern -> - getSbLines().firstOrNull { pattern.matches(it) } - } - -private fun getDojoShowWhen(): Boolean = SbPattern.dojoChallengePattern.anyMatches(getSbLines()) - -private fun getDarkAuctionLines() = buildList { - getSbLines().firstOrNull { SbPattern.startingInPattern.matches(it) }?.let { add(it) } - getSbLines().firstOrNull { SbPattern.timeLeftPattern.matches(it) }?.let { add(it) } - - val darkAuctionCurrentItemLine = getSbLines().firstOrNull { SbPattern.darkAuctionCurrentItemPattern.matches(it) } - - if (darkAuctionCurrentItemLine != null) { - add(darkAuctionCurrentItemLine) - getSbLines().nextAfter(darkAuctionCurrentItemLine)?.let { add(it) } - } -} - -private fun getDarkAuctionShowWhen(): Boolean = IslandType.DARK_AUCTION.isInIsland() - -private fun getJacobContestLines() = buildList { - getSbLines().firstOrNull { SbPattern.jacobsContestPattern.matches(it) }?.let { line -> - add(line) - getSbLines().nextAfter(line)?.let { add(it) } - getSbLines().nextAfter(line, 2)?.let { add(it) } - getSbLines().nextAfter(line, 3)?.let { - if (!SbPattern.footerPattern.matches(it)) add(it) - } - } -} - -private fun getJacobContestShowWhen(): Boolean = SbPattern.jacobsContestPattern.anyMatches(getSbLines()) - -private fun getJacobMedalsLines(): List = getSbLines().filter { SbPattern.medalsPattern.matches(it) } - -private fun getJacobMedalsShowWhen(): Boolean = SbPattern.medalsPattern.anyMatches(getSbLines()) - -private fun getTrapperLines() = buildList { - getSbLines().firstOrNull { SbPattern.peltsPattern.matches(it) }?.let { add(it) } - - val trapperMobLocationLine = getSbLines().firstOrNull { SbPattern.mobLocationPattern.matches(it) } - if (trapperMobLocationLine != null) { - add("Tracker Mob Location:") - getSbLines().nextAfter(trapperMobLocationLine)?.let { add(it) } - } -} - -private fun getTrapperShowWhen(): Boolean = - getSbLines().any { ScoreboardPattern.peltsPattern.matches(it) || ScoreboardPattern.mobLocationPattern.matches(it) } - -private fun getGardenCleanUpLines(): List = - listOf(getSbLines().first { SbPattern.cleanUpPattern.matches(it) }.trim()) - -private fun getGardenCleanUpShowWhen(): Boolean = SbPattern.cleanUpPattern.anyMatches(getSbLines()) - -private fun getGardenPastingLines(): List = - listOf(getSbLines().first { SbPattern.pastingPattern.matches(it) }.trim()) - -private fun getGardenPastingShowWhen(): Boolean = SbPattern.pastingPattern.anyMatches(getSbLines()) - -private fun getFlightDurationLines(): List = - listOf(getSbLines().first { SbPattern.flightDurationPattern.matches(it) }.trim()) - -private fun getFlightDurationShowWhen(): Boolean = SbPattern.flightDurationPattern.anyMatches(getSbLines()) - -private fun getWinterLines() = buildList { - getSbLines().firstOrNull { SbPattern.winterEventStartPattern.matches(it) }?.let { add(it) } - getSbLines().firstOrNull { SbPattern.winterNextWavePattern.matches(it) && !it.endsWith("Soon!") }?.let { add(it) } - getSbLines().firstOrNull { SbPattern.winterWavePattern.matches(it) }?.let { add(it) } - getSbLines().firstOrNull { SbPattern.winterMagmaLeftPattern.matches(it) }?.let { add(it) } - getSbLines().firstOrNull { SbPattern.winterTotalDmgPattern.matches(it) }?.let { add(it) } - getSbLines().firstOrNull { SbPattern.winterCubeDmgPattern.matches(it) }?.let { add(it) } -} - -private fun getWinterShowWhen(): Boolean = getSbLines().any { - ScoreboardPattern.winterEventStartPattern.matches(it) - || (ScoreboardPattern.winterNextWavePattern.matches(it) && !it.endsWith("Soon!")) - || ScoreboardPattern.winterWavePattern.matches(it) -} - -private fun getNewYearLines() = listOf(getSbLines().first { SbPattern.newYearPattern.matches(it) }) - -private fun getNewYearShowWhen(): Boolean = SbPattern.newYearPattern.anyMatches(getSbLines()) - -private fun getSpookyLines() = buildList { - getSbLines().firstOrNull { SbPattern.spookyPattern.matches(it) }?.let { add(it) } // Time - add("§7Your Candy: ") - add( - TabListData.getFooter() - .removeResets() - .split("\n") - .firstOrNull { it.startsWith("§7Your Candy:") } - ?.removePrefix("§7Your Candy:") ?: "§cCandy not found", - ) // Candy -} - -private fun getSpookyShowWhen(): Boolean = getSbLines().any { ScoreboardPattern.spookyPattern.matches(it) } - -private fun getTablistEvent(): String? = - TabListData.getTabList().firstOrNull { SbPattern.eventNamePattern.matches(it) } - ?.let { - SbPattern.eventNamePattern.matchMatcher(it) { - group("name") - } - } - -private fun getActiveEventLine(): List { - val currentActiveEvent = getTablistEvent() ?: return emptyList() - - // Some Active Events are better not shown from the tablist, - // but from other locations like the scoreboard - val blockedEvents = listOf("Spooky Festival", "Carnival", "5th SkyBlock Anniversary", "New Year Celebration") - if (blockedEvents.contains(currentActiveEvent.removeColor())) return emptyList() - - val currentActiveEventTime = TabListData.getTabList().firstOrNull { SbPattern.eventTimeEndsPattern.matches(it) } - ?.let { - SbPattern.eventTimeEndsPattern.matchMatcher(it) { - group("time") - } - } - - return listOf(currentActiveEvent, " Ends in: §e$currentActiveEventTime") -} - -private fun getActiveEventShowWhen(): Boolean = - getTablistEvent() != null && TabListData.getTabList().any { SbPattern.eventTimeEndsPattern.matches(it) } - -private fun getSoonEventLine(): List { - val soonActiveEvent = getTablistEvent() ?: return emptyList() - val soonActiveEventTime = TabListData.getTabList().firstOrNull { SbPattern.eventTimeStartsPattern.matches(it) } - ?.let { - SbPattern.eventTimeStartsPattern.matchMatcher(it) { - group("time") - } - } - - return listOf(soonActiveEvent, " Starts in: §e$soonActiveEventTime") -} - -private fun getSoonEventShowWhen(): Boolean = - getTablistEvent() != null && TabListData.getTabList().any { SbPattern.eventTimeStartsPattern.matches(it) } - -private fun getBroodmotherLines(): List = - listOf(getSbLines().first { SbPattern.broodmotherPattern.matches(it) }) - -private fun getBroodmotherShowWhen(): Boolean = getSbLines().any { SbPattern.broodmotherPattern.matches(it) } - -private fun getMiningEventsLines() = buildList { - // Wind - if (getSbLines().any { SbPattern.windCompassPattern.matches(it) } - && getSbLines().any { SbPattern.windCompassArrowPattern.matches(it) }) { - add(getSbLines().first { SbPattern.windCompassPattern.matches(it) }) - add("| ${getSbLines().first { SbPattern.windCompassArrowPattern.matches(it) }} §f|") - } - - // Better Together - if (getSbLines().any { SbPattern.nearbyPlayersPattern.matches(it) }) { - add("§dBetter Together") - add(" ${getSbLines().first { SbPattern.nearbyPlayersPattern.matches(it) }}") - } - - // Zone Events - if (getSbLines().any { SbPattern.miningEventPattern.matches(it) } - && getSbLines().any { SbPattern.miningEventZonePattern.matches(it) }) { - add(getSbLines().first { SbPattern.miningEventPattern.matches(it) }.removePrefix("Event: ")) - add("in ${getSbLines().first { SbPattern.miningEventZonePattern.matches(it) }.removePrefix("Zone: ")}") - } - - // Zone Events but no Zone Line - if (getSbLines().any { SbPattern.miningEventPattern.matches(it) } - && getSbLines().none { SbPattern.miningEventZonePattern.matches(it) }) { - add( - getSbLines().first { SbPattern.miningEventPattern.matches(it) } - .removePrefix("Event: "), - ) - } - - // Mithril Gourmand - if (getSbLines().any { SbPattern.mithrilRemainingPattern.matches(it) } - && getSbLines().any { SbPattern.mithrilYourMithrilPattern.matches(it) }) { - add(getSbLines().first { SbPattern.mithrilRemainingPattern.matches(it) }) - add(getSbLines().first { SbPattern.mithrilYourMithrilPattern.matches(it) }) - } - - // Raffle - if (getSbLines().any { SbPattern.raffleTicketsPattern.matches(it) } - && getSbLines().any { SbPattern.rafflePoolPattern.matches(it) }) { - add(getSbLines().first { SbPattern.raffleTicketsPattern.matches(it) }) - add(getSbLines().first { SbPattern.rafflePoolPattern.matches(it) }) - } - - // Raid - if (getSbLines().any { SbPattern.yourGoblinKillsPattern.matches(it) } - && getSbLines().any { SbPattern.remainingGoblinPattern.matches(it) }) { - add(getSbLines().first { SbPattern.yourGoblinKillsPattern.matches(it) }) - add(getSbLines().first { SbPattern.remainingGoblinPattern.matches(it) }) - } - - // Fortunate Freezing - if (getSbLines().any { SbPattern.fortunateFreezingBonusPattern.matches(it) }) { - add(getSbLines().first { SbPattern.fortunateFreezingBonusPattern.matches(it) }) - } - - // Fossil Dust - if (getSbLines().any { SbPattern.fossilDustPattern.matches(it) }) { - add(getSbLines().first { SbPattern.fossilDustPattern.matches(it) }) - } -} - -private fun getDamageLines(): List = - listOf(getSbLines().first { SbPattern.bossHPPattern.matches(it) }) + - (getSbLines().first { SbPattern.bossDamagePattern.matches(it) }) - -private fun getDamageShowWhen(): Boolean = - getSbLines().any { SbPattern.bossHPPattern.matches(it) } - && getSbLines().any { SbPattern.bossDamagePattern.matches(it) } - -private fun getMagmaBossLines() = getSbLines().filter { line -> - SbPattern.magmaBossPattern.matches(line) - || SbPattern.damageSoakedPattern.matches(line) - || SbPattern.killMagmasPattern.matches(line) - || SbPattern.killMagmasDamagedSoakedBarPattern.matches(line) - || SbPattern.reformingPattern.matches(line) - || SbPattern.bossHealthPattern.matches(line) - || SbPattern.bossHealthBarPattern.matches(line) -} - -private fun getMagmaBossShowWhen(): Boolean = SbPattern.magmaChamberPattern.matches(HypixelData.skyBlockArea) - -private fun getCarnivalLines() = listOf( - SbPattern.carnivalPattern, - SbPattern.carnivalTokensPattern, - SbPattern.carnivalTasksPattern, - SbPattern.timeLeftPattern, - SbPattern.carnivalCatchStreakPattern, - SbPattern.carnivalFruitsPattern, - SbPattern.carnivalAccuracyPattern, - SbPattern.carnivalKillsPattern, - SbPattern.carnivalScorePattern, -) - .mapNotNull { pattern -> - getSbLines().firstOrNull { pattern.matches(it) } - } - -private fun getCarnivalShowWhen(): Boolean = SbPattern.carnivalPattern.anyMatches(getSbLines()) - -private fun getRiftLines() = getSbLines().filter { line -> - RiftBloodEffigies.heartsPattern.matches(line) - || SbPattern.riftHotdogTitlePattern.matches(line) - || SbPattern.timeLeftPattern.matches(line) - || SbPattern.riftHotdogEatenPattern.matches(line) - || SbPattern.riftAveikxPattern.matches(line) - || SbPattern.riftHayEatenPattern.matches(line) - || SbPattern.cluesPattern.matches(line) -} - -private fun getEssenceLines(): List = listOf(getSbLines().first { SbPattern.essencePattern.matches(it) }) - -private fun getEssenceShowWhen(): Boolean = SbPattern.essencePattern.anyMatches(getSbLines()) - -private fun getQueueLines(): List = - listOf(getSbLines().first { SbPattern.queuePattern.matches(it) }) + - (getSbLines().first { SbPattern.queuePositionPattern.matches(it) }) - -private fun getQueueShowWhen(): Boolean = SbPattern.queuePattern.anyMatches(getSbLines()) - -private fun getRedstoneLines(): List = listOf(getSbLines().first { SbPattern.redstonePattern.matches(it) }) - -private fun getRedstoneShowWhen(): Boolean = SbPattern.redstonePattern.anyMatches(getSbLines()) - -private fun getAnniversaryLines() = listOf(getSbLines().first { SbPattern.anniversaryPattern.matches(it) }) - -private fun getAnniversaryShowWhen(): Boolean = SbPattern.anniversaryPattern.anyMatches(getSbLines()) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt index 950e93976..e32de6c3d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsWalls.kt @@ -21,7 +21,7 @@ object CrystalHollowsWalls { private val config get() = SkyHanniMod.feature.mining.crystalHollowsAreaWalls - private enum class Areas(val color: Color) { + private enum class Area(val color: Color) { MITHRIL(LorenzColor.GREEN.addOpacity(60)), PRECURSOR(LorenzColor.BLUE.addOpacity(60)), JUNGLE(LorenzColor.LIGHT_PURPLE.addOpacity(60)), @@ -93,19 +93,19 @@ object CrystalHollowsWalls { } private fun drawGoblin(event: LorenzRenderWorldEvent) = RenderUtils.QuadDrawer.draw3D(event.partialTicks) { - drawArea(true, false, Areas.JUNGLE.color, Areas.PRECURSOR.color) + drawArea(true, false, Area.JUNGLE.color, Area.PRECURSOR.color) } private fun drawJungle(event: LorenzRenderWorldEvent) = RenderUtils.QuadDrawer.draw3D(event.partialTicks) { - drawArea(true, true, Areas.GOBLIN.color, Areas.MITHRIL.color) + drawArea(true, true, Area.GOBLIN.color, Area.MITHRIL.color) } private fun drawPrecursor(event: LorenzRenderWorldEvent) = RenderUtils.QuadDrawer.draw3D(event.partialTicks) { - drawArea(false, false, Areas.MITHRIL.color, Areas.GOBLIN.color) + drawArea(false, false, Area.MITHRIL.color, Area.GOBLIN.color) } private fun drawMithril(event: LorenzRenderWorldEvent) = RenderUtils.QuadDrawer.draw3D(event.partialTicks) { - drawArea(false, true, Areas.PRECURSOR.color, Areas.JUNGLE.color) + drawArea(false, true, Area.PRECURSOR.color, Area.JUNGLE.color) } private fun drawHeat(event: LorenzRenderWorldEvent) = RenderUtils.QuadDrawer.draw3D(event.partialTicks) { @@ -114,13 +114,13 @@ object CrystalHollowsWalls { LorenzVec(nucleusBB.minX, heatHeight, nucleusBB.minZ), LorenzVec(nucleusBB.maxX, heatHeight, nucleusBB.minZ), LorenzVec(nucleusBB.minX, heatHeight, nucleusBB.maxZ), - Areas.NUCLEUS.color + Area.NUCLEUS.color ) - drawHeatAreaForHeat(false, false, Areas.PRECURSOR.color, heatHeight) - drawHeatAreaForHeat(false, true, Areas.MITHRIL.color, heatHeight) - drawHeatAreaForHeat(true, false, Areas.GOBLIN.color, heatHeight) - drawHeatAreaForHeat(true, true, Areas.JUNGLE.color, heatHeight) + drawHeatAreaForHeat(false, false, Area.PRECURSOR.color, heatHeight) + drawHeatAreaForHeat(false, true, Area.MITHRIL.color, heatHeight) + drawHeatAreaForHeat(true, false, Area.GOBLIN.color, heatHeight) + drawHeatAreaForHeat(true, true, Area.JUNGLE.color, heatHeight) } private fun drawNucleus(event: LorenzRenderWorldEvent) { @@ -134,55 +134,55 @@ object CrystalHollowsWalls { southEastCorner, southWestCorner, northEastCorner, - Areas.HEAT.color + Area.HEAT.color ) draw( southEastCorner, southEastTopCorner, LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.minY, MIDDLE_Z), - Areas.JUNGLE.color + Area.JUNGLE.color ) draw( southEastCorner, southEastTopCorner, LorenzVec(MIDDLE_X, nucleusBBInflate.minY, nucleusBBInflate.minZ), - Areas.JUNGLE.color + Area.JUNGLE.color ) draw( northWestCorner, northWestTopCorner, LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.minY, MIDDLE_Z), - Areas.PRECURSOR.color + Area.PRECURSOR.color ) draw( northWestCorner, northWestTopCorner, LorenzVec(MIDDLE_X, nucleusBBInflate.minY, nucleusBBInflate.maxZ), - Areas.PRECURSOR.color + Area.PRECURSOR.color ) draw( southWestCorner, southWestTopCorner, LorenzVec(nucleusBBInflate.minX, nucleusBBInflate.minY, MIDDLE_Z), - Areas.GOBLIN.color, + Area.GOBLIN.color, ) draw( southWestCorner, southWestTopCorner, LorenzVec(MIDDLE_X, nucleusBBInflate.minY, nucleusBBInflate.maxZ), - Areas.GOBLIN.color + Area.GOBLIN.color ) draw( northEastCorner, northEastTopCorner, LorenzVec(nucleusBBInflate.maxX, nucleusBBInflate.minY, MIDDLE_Z), - Areas.MITHRIL.color + Area.MITHRIL.color ) draw( northEastCorner, northEastTopCorner, LorenzVec(MIDDLE_X, nucleusBBInflate.minY, nucleusBBInflate.minZ), - Areas.MITHRIL.color + Area.MITHRIL.color ) } } @@ -209,7 +209,7 @@ object CrystalHollowsWalls { val nucleusXSideBase = LorenzVec(nucleusX, heatHeight, middleZ) drawHeatArea( - Areas.HEAT.color, + Area.HEAT.color, heatHeight, nucleusX, middleX, @@ -234,13 +234,13 @@ object CrystalHollowsWalls { nucleusXSideBase, nucleusBase, LorenzVec(nucleusX, MAX_HEIGHT, middleZ), - Areas.NUCLEUS.color, + Area.NUCLEUS.color, ) draw( nucleusZSideBase, nucleusBase, LorenzVec(middleX, MAX_HEIGHT, nucleusZ), - Areas.NUCLEUS.color, + Area.NUCLEUS.color, ) } -- cgit