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: Widget abstractions #1150

Merged
merged 45 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ed3209e
init
Thunderblade73 Mar 8, 2024
72bc1b1
Merge branch 'beta' into widget
Thunderblade73 Mar 12, 2024
6a43b1e
added all widgets
Thunderblade73 Mar 12, 2024
4aec172
fixed pattern
Thunderblade73 Mar 12, 2024
d266204
formatting
Thunderblade73 Mar 12, 2024
3b5edd8
added updating the enum via repo
Thunderblade73 Mar 12, 2024
6468ebf
cleanup
Thunderblade73 Mar 12, 2024
c3e86d8
added garden patterns
Thunderblade73 Mar 12, 2024
ebc620c
added lines to enum
Thunderblade73 Mar 12, 2024
cef4edb
removed debug
Thunderblade73 Mar 12, 2024
eacc076
added to copyTabList
Thunderblade73 Mar 12, 2024
b2279f6
fixed patterns
Thunderblade73 Mar 12, 2024
89e6c4b
optimisation and cleanup
Thunderblade73 Mar 13, 2024
e7b08db
added verifyKeyShape and doc for RepoPatternManager.getUnusedPatterns
Thunderblade73 Mar 13, 2024
6d79c49
fix
Thunderblade73 Mar 13, 2024
55effdb
Update prefix and added a notice
Thunderblade73 Mar 14, 2024
ba5af7c
Merge branch 'beta' into widget
Thunderblade73 Mar 22, 2024
bff58f8
major fixes
Thunderblade73 Mar 22, 2024
30c83ff
Merge branch 'beta' into widget
Thunderblade73 Mar 24, 2024
b4a2013
added missing dungeon "widgets"
Thunderblade73 Mar 24, 2024
b0db6ed
fixed typo
Thunderblade73 Mar 25, 2024
b577ffc
Merge branch 'beta' into widget
Thunderblade73 Mar 25, 2024
5758c2c
Merge branch 'beta' into widget
Thunderblade73 Mar 28, 2024
72925f2
Merge branch 'beta' into widget
Thunderblade73 Mar 31, 2024
65ac5e8
Merge branch 'beta' into widget
Thunderblade73 Apr 3, 2024
f971784
Merge branch 'beta' into widget
Thunderblade73 Apr 3, 2024
d25375a
Merge branch 'beta' into widget
Thunderblade73 Apr 7, 2024
7b42911
Kdocs + add missing widget
Thunderblade73 Apr 7, 2024
7d22916
Merge branch 'beta' into widget
Thunderblade73 Apr 13, 2024
4eda0e1
Merge branch 'beta' into widget
Thunderblade73 Apr 16, 2024
76f5a5b
Merge branch 'beta' into widget
Thunderblade73 Apr 17, 2024
ecb78db
Merge branch 'beta' into widget
Thunderblade73 Apr 18, 2024
18c6068
Merge branch 'beta' into widget
Thunderblade73 Apr 21, 2024
6791720
Merge branch 'beta' into widget
Thunderblade73 Apr 23, 2024
fc322ed
Merge branch 'beta' into widget
Thunderblade73 Apr 24, 2024
7b1e493
Merge branch 'beta' into widget
Thunderblade73 Apr 25, 2024
3542737
added new frozen corpses widget
Thunderblade73 May 5, 2024
4413b86
Merge branch 'refs/heads/beta' into widget
Thunderblade73 Jun 1, 2024
33340cc
updated
Thunderblade73 Jun 1, 2024
00d4acf
Merge branch 'refs/heads/beta' into fork/Thunderblade73/widget
CalMWolfs Jun 2, 2024
b49f661
slight code cleanup, and fix bug
CalMWolfs Jun 2, 2024
44b758c
re send added
Thunderblade73 Jun 2, 2024
5c34481
killed sub events
Thunderblade73 Jun 2, 2024
f3efe00
being not so to fast :)
Thunderblade73 Jun 3, 2024
8ada530
Merge branch 'refs/heads/beta' into widget
Thunderblade73 Jun 3, 2024
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
2 changes: 2 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import at.hannibal2.skyhanni.data.jsonobjects.local.VisualWordsJson
import at.hannibal2.skyhanni.data.mob.MobData
import at.hannibal2.skyhanni.data.mob.MobDebug
import at.hannibal2.skyhanni.data.mob.MobDetection
import at.hannibal2.skyhanni.data.model.TabWidget
import at.hannibal2.skyhanni.data.repo.RepoManager
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.PreInitFinishedEvent
Expand Down Expand Up @@ -579,6 +580,7 @@ class SkyHanniMod {
loadModule(ChatUtils)
loadModule(FixedRateTimerManager())
loadModule(ChromaManager)
loadModule(TabWidget)
loadModule(HotmData)
loadModule(ContributorManager)
loadModule(TabComplete)
Expand Down
36 changes: 26 additions & 10 deletions src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package at.hannibal2.skyhanni.data

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigManager.Companion.gson
import at.hannibal2.skyhanni.data.model.TabWidget
import at.hannibal2.skyhanni.events.HypixelJoinEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
import at.hannibal2.skyhanni.events.WidgetUpdateEvent
import at.hannibal2.skyhanni.features.bingo.BingoAPI
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.features.rift.RiftAPI
Expand Down Expand Up @@ -68,6 +70,7 @@ class HypixelData {
"playeramount.guesting",
"^\\s*(?:§.)*Guests (?:§.)*\\((?<amount>\\d+)\\)\\s*$"
)

/**
* REGEX-TEST: §r§b§lParty §r§f(4)
*/
Expand Down Expand Up @@ -342,7 +345,6 @@ class HypixelData {

val inSkyBlock = checkScoreboard()
if (inSkyBlock) {
checkIsland()
checkSidebar()
checkCurrentServerId()
}
Expand All @@ -351,6 +353,14 @@ class HypixelData {
skyBlock = inSkyBlock
}

@SubscribeEvent
fun onTabListUpdate(event: WidgetUpdateEvent) {
when (event.widget) {
TabWidget.AREA -> checkIsland(event)
else -> Unit
}
}

private fun checkProfileName() {
if (profileName.isNotEmpty()) return

Expand Down Expand Up @@ -392,18 +402,24 @@ class HypixelData {
noTrade = ironman || stranded || bingo
}

private fun checkIsland() {
var foundIsland = ""
TabListData.fullyLoaded = false
private fun checkIsland(event: WidgetUpdateEvent) {
val islandType: IslandType
val foundIsland: String
if (event.isClear()) {

TabListData.fullyLoaded = false
islandType = IslandType.NONE
foundIsland = ""

TabListData.getTabList().matchFirst(islandNamePattern) {
foundIsland = group("island").removeColor()
} else {
TabListData.fullyLoaded = true
// Can not use color coding, because of the color effect (§f§lSKYB§6§lL§e§lOCK§A§L GUEST)
val guesting = guestPattern.matches(ScoreboardData.objectiveTitle.removeColor())
foundIsland = TabWidget.AREA.matchMatcherFirstLine { group("island").removeColor() } ?: ""
islandType = getIslandType(foundIsland, guesting)
TabWidget.reSendEvents()
}

// Can not use color coding, because of the color effect (§f§lSKYB§6§lL§e§lOCK§A§L GUEST)
val guesting = guestPattern.matches(ScoreboardData.objectiveTitle.removeColor())
val islandType = getIslandType(foundIsland, guesting)

if (skyBlockIsland != islandType) {
IslandChangeEvent(islandType, skyBlockIsland).postAndCatch()
if (islandType == IslandType.UNKNOWN) {
Expand Down
Loading
Loading