Skip to content

Commit

Permalink
maybe fix the death chat message detection being wrong idk
Browse files Browse the repository at this point in the history
i did these changes like last month i dont rememver what they do
  • Loading branch information
My-Name-Is-Jeff committed Aug 29, 2023
1 parent b941c84 commit 409cf47
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/kotlin/gg/skytils/skytilsmod/listeners/DungeonListener.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ object DungeonListener {
if (!Utils.inDungeons) return
if (event.packet is S02PacketChat) {
val text = event.packet.chatComponent.formattedText
if (event.packet.chatComponent.unformattedText.startsWith("Starting in 1 second.")) {
if (text == "§r§aStarting in 1 second.§r") {
team.clear()
deads.clear()
missingPuzzles.clear()
TickTask(40) {
getMembers()
}
} else if (event.packet.chatComponent.unformattedText.stripControlCodes()
} else if (text.stripControlCodes()
.trim() == "> EXTRA STATS <"
) {
if (Skytils.config.dungeonDeathCounter) {
Expand Down Expand Up @@ -149,18 +149,20 @@ object DungeonListener {
TickTask(2, repeats = true) {
if (Utils.inDungeons && (DungeonTimer.scoreShownAt == -1L || System.currentTimeMillis() - DungeonTimer.scoreShownAt < 1500)) {
val tabEntries = TabListUtils.tabEntries
val self = team[mc.thePlayer.name]
for (teammate in team.values) {
if (tabEntries.size <= teammate.tabEntryIndex) continue
val entry = tabEntries[teammate.tabEntryIndex].second
if (!entry.contains(teammate.playerName)) continue
teammate.player = mc.theWorld.playerEntities.find {
it.name == teammate.playerName && it.uniqueID.version() == 4
}
teammate.dead = entry.endsWith("§r§cDEAD§r§f)§r")
if (teammate.dead) {
markDead(teammate)
} else {
deads.remove(teammate)
if (self?.dead != true) {
if (entry.endsWith("§r§cDEAD§r§f)§r")) {
markDead(teammate)
} else if (deads.remove(teammate)) {
teammate.dead = true
}
}
}
}
Expand All @@ -174,6 +176,7 @@ object DungeonListener {
// there's no way they die twice in less than half a second
if (lastDeath != null && time - lastDeath <= 500) return
teammate.lastMarkedDead = time
teammate.dead = true
teammate.deaths++
val totalDeaths = team.values.sumOf { it.deaths }
val isFirstDeath = totalDeaths == 1
Expand Down

0 comments on commit 409cf47

Please sign in to comment.