From c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8 Mon Sep 17 00:00:00 2001 From: Appability Date: Wed, 12 Oct 2022 20:48:51 -0700 Subject: uh a lot of things --- .../ambientaddons/utils/dungeon/DungeonPlayers.kt | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt (limited to 'src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt') diff --git a/src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt b/src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt new file mode 100644 index 0000000..ba21a04 --- /dev/null +++ b/src/main/kotlin/com/ambientaddons/utils/dungeon/DungeonPlayers.kt @@ -0,0 +1,28 @@ +package com.ambientaddons.utils.dungeon + +import com.ambientaddons.utils.Extensions.stripControlCodes +import com.ambientaddons.utils.Area +import com.ambientaddons.utils.SkyBlock +import com.ambientaddons.utils.TabListUtils +import com.ambientaddons.utils.text +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent + +object DungeonPlayers { + private val playerRegex = Regex("^\\[\\d{1,3}] (?[\\w]{3,16}) (?:.*)*\\((?:(?Healer|Tank|Berserk|Mage|Archer) (?[XVIL0]+)|(?DEAD|EMPTY))\\)") + var playerCount = 0 + private val playerSlots = listOf(5, 9, 13, 17, 1) + private var ticks = 0 + + @SubscribeEvent + fun onTick(event: ClientTickEvent) { + if (SkyBlock.area != Area.Dungeon) return + if (ticks % 10 == 0) { + val rawPlayers = TabListUtils.fetchTabEntries().let { tabEntries -> + playerSlots.map { tabEntries[it].text.stripControlCodes() } + } + playerCount = rawPlayers.size + } + ticks++ + } +} \ No newline at end of file -- cgit