From e9f1fa9015489e19724c3c6c3b477d970eb4651b Mon Sep 17 00:00:00 2001 From: odtheking Date: Tue, 12 Nov 2024 14:52:22 +0200 Subject: [PATCH] Added expand to EtherWarpHelper Changed PuzzleTimer to be on room complete instead of leave Cleanup --- gradle.properties | 2 +- .../features/impl/render/EtherWarpHelper.kt | 13 +++--- .../features/impl/render/EtherWarpHelper.kt | 13 +++--- .../me/odinmain/events/EventDispatcher.kt | 15 +++--- .../odinmain/features/impl/dungeon/Mimic.kt | 6 +-- .../impl/dungeon/puzzlesolvers/BlazeSolver.kt | 9 ++-- .../dungeon/puzzlesolvers/IceFillSolver.kt | 6 +-- .../dungeon/puzzlesolvers/PuzzleSolvers.kt | 46 +++++++++---------- .../dungeon/puzzlesolvers/TPMazeSolver.kt | 2 +- .../impl/dungeon/puzzlesolvers/WaterSolver.kt | 2 +- .../features/impl/floor7/p3/TerminalSounds.kt | 25 +++------- src/main/kotlin/me/odinmain/utils/Utils.kt | 3 +- .../me/odinmain/utils/render/Renderer.kt | 14 +++--- .../me/odinmain/utils/skyblock/ItemUtils.kt | 2 +- .../utils/skyblock/dungeon/Dungeon.kt | 9 ++-- 15 files changed, 76 insertions(+), 91 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0aa135deb..7e295f25f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ org.gradle.configureondemand=true org.gradle.jvmargs=-Xmx2G org.gradle.parallel=true -version = 1.2.5.beta13 \ No newline at end of file +version = 1.2.5.beta14 \ No newline at end of file diff --git a/odin/src/main/kotlin/me/odin/features/impl/render/EtherWarpHelper.kt b/odin/src/main/kotlin/me/odin/features/impl/render/EtherWarpHelper.kt index 235302411..3e8adee75 100644 --- a/odin/src/main/kotlin/me/odin/features/impl/render/EtherWarpHelper.kt +++ b/odin/src/main/kotlin/me/odin/features/impl/render/EtherWarpHelper.kt @@ -34,6 +34,7 @@ object EtherWarpHelper : Module( private val style by SelectorSetting("Style", Renderer.DEFAULT_STYLE, Renderer.styles, description = Renderer.STYLE_DESCRIPTION) private val lineWidth by NumberSetting("Line Width", 2f, 0.1f, 10f, 0.1f, description = "The width of the box's lines.") private val depthCheck by BooleanSetting("Depth check", false, description = "Boxes show through walls.") + private val expand by NumberSetting("Expand", 0.0, -1, 1, 0.01, description = "Expands the box by this amount.") private val useServerPosition by DualSetting("Positioning", "Server Pos", "Player Pos", description = "If etherwarp guess should use your server position or real position.").withDependency { render } private val dropdown by DropdownSetting("Sounds", false) @@ -59,15 +60,13 @@ object EtherWarpHelper : Module( etherPos = EtherWarpHelper.getEtherPos(positionLook) if (etherPos.succeeded || renderFail) - Renderer.drawStyledBlock(etherPos.pos ?: return, if (etherPos.succeeded) color else wrongColor, style, lineWidth, depthCheck) + Renderer.drawStyledBlock(etherPos.pos ?: return, if (etherPos.succeeded) color else wrongColor, style, lineWidth, depthCheck, true, expand) } @SubscribeEvent - fun onSoundPacket(event: PacketReceivedEvent) { - with(event.packet) { - if (this !is S29PacketSoundEffect || soundName != "mob.enderdragon.hit" || !sounds || volume != 1f || pitch != 0.53968257f || customSound == "mob.enderdragon.hit") return - playLoudSound(if (sound == defaultSounds.size - 1) customSound else defaultSounds[sound], soundVolume, soundPitch, positionVector) - event.isCanceled = true - } + fun onSoundPacket(event: PacketReceivedEvent) = with(event.packet) { + if (this !is S29PacketSoundEffect || soundName != "mob.enderdragon.hit" || !sounds || volume != 1f || pitch != 0.53968257f || customSound == "mob.enderdragon.hit") return + playLoudSound(if (sound == defaultSounds.size - 1) customSound else defaultSounds[sound], soundVolume, soundPitch, positionVector) + event.isCanceled = true } } \ No newline at end of file diff --git a/odinclient/src/main/kotlin/me/odinclient/features/impl/render/EtherWarpHelper.kt b/odinclient/src/main/kotlin/me/odinclient/features/impl/render/EtherWarpHelper.kt index a3d1919bb..419dfca1c 100644 --- a/odinclient/src/main/kotlin/me/odinclient/features/impl/render/EtherWarpHelper.kt +++ b/odinclient/src/main/kotlin/me/odinclient/features/impl/render/EtherWarpHelper.kt @@ -43,6 +43,7 @@ object EtherWarpHelper : Module( private val style by SelectorSetting("Style", Renderer.DEFAULT_STYLE, Renderer.styles, description = Renderer.STYLE_DESCRIPTION).withDependency { render } private val lineWidth by NumberSetting("Line Width", 2f, 0.1f, 10f, 0.1f, description = "The width of the box's lines.").withDependency { render } private val depthCheck by BooleanSetting("Depth check", false, description = "Boxes show through walls.").withDependency { render } + private val expand by NumberSetting("Expand", 0.0, -1, 1, 0.01, description = "Expands the box by this amount.").withDependency { render } private val useServerPosition by DualSetting("Positioning", "Server Pos", "Player Pos", description = "If etherwarp guess should use your server position or real position.").withDependency { render } private val etherwarpTBDropDown by DropdownSetting("Trigger Bot") @@ -87,7 +88,7 @@ object EtherWarpHelper : Module( etherPos = EtherWarpHelper.getEtherPos(positionLook) if (render && (etherPos.succeeded || renderFail)) - Renderer.drawStyledBlock(etherPos.pos ?: return, if (etherPos.succeeded) color else wrongColor, style, lineWidth, depthCheck) + Renderer.drawStyledBlock(etherPos.pos ?: return, if (etherPos.succeeded) color else wrongColor, style, lineWidth, depthCheck, true, expand) } @SubscribeEvent @@ -127,11 +128,9 @@ object EtherWarpHelper : Module( } @SubscribeEvent - fun onSoundPacket(event: PacketReceivedEvent) { - with(event.packet) { - if (this !is S29PacketSoundEffect || soundName != "mob.enderdragon.hit" || !sounds || volume != 1f || pitch != 0.53968257f || customSound == "mob.enderdragon.hit") return - playLoudSound(if (sound == defaultSounds.size - 1) customSound else defaultSounds[sound], soundVolume, soundPitch, positionVector) - event.isCanceled = true - } + fun onSoundPacket(event: PacketReceivedEvent) = with(event.packet) { + if (this !is S29PacketSoundEffect || soundName != "mob.enderdragon.hit" || !sounds || volume != 1f || pitch != 0.53968257f || customSound == "mob.enderdragon.hit") return + playLoudSound(if (sound == defaultSounds.size - 1) customSound else defaultSounds[sound], soundVolume, soundPitch, positionVector) + event.isCanceled = true } } \ No newline at end of file diff --git a/src/main/kotlin/me/odinmain/events/EventDispatcher.kt b/src/main/kotlin/me/odinmain/events/EventDispatcher.kt index a519bf257..dfce60624 100644 --- a/src/main/kotlin/me/odinmain/events/EventDispatcher.kt +++ b/src/main/kotlin/me/odinmain/events/EventDispatcher.kt @@ -26,21 +26,18 @@ object EventDispatcher { * Dispatches [SecretPickupEvent.Item] */ @SubscribeEvent - fun onRemoveEntity(event: EntityLeaveWorldEvent) { - if (!inDungeons || event.entity !is EntityItem || event.entity.entityItem?.unformattedName?.containsOneOf(dungeonItemDrops, true) == false || mc.thePlayer.getDistanceToEntity(event.entity) > 6) return - SecretPickupEvent.Item(event.entity).postAndCatch() + fun onRemoveEntity(event: EntityLeaveWorldEvent) = with(event.entity) { + if (inDungeons && this is EntityItem && this.entityItem?.unformattedName?.containsOneOf(dungeonItemDrops, true) != false && mc.thePlayer.getDistanceToEntity(this) <= 6) + SecretPickupEvent.Item(this).postAndCatch() } /** * Dispatches [SecretPickupEvent.Interact] */ @SubscribeEvent - fun onPacket(event: PacketSentEvent) { - with(event.packet) { - if (inDungeons && this is C08PacketPlayerBlockPlacement && position != null && - isSecret(mc.theWorld?.getBlockState(position) ?: return, position)) - SecretPickupEvent.Interact(position, mc.theWorld?.getBlockState(position) ?: return).postAndCatch() - } + fun onPacket(event: PacketSentEvent) = with(event.packet) { + if (inDungeons && this is C08PacketPlayerBlockPlacement && position != null) + SecretPickupEvent.Interact(position, mc.theWorld?.getBlockState(position)?.takeIf { isSecret(it, position) } ?: return).postAndCatch() } /** diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/Mimic.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/Mimic.kt index c92120722..dda1b5b5c 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/Mimic.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/Mimic.kt @@ -40,10 +40,8 @@ object Mimic : Module( } @SubscribeEvent - fun onEntityDeath(event: LivingDeathEvent) { - with(event.entity) { - if (!DungeonUtils.inDungeons || this !is EntityZombie || !this.isChild || !(0..3).all { this.getCurrentArmor(it) == null }) return - } + fun onEntityDeath(event: LivingDeathEvent) = with(event.entity) { + if (!DungeonUtils.inDungeons || this !is EntityZombie || !this.isChild || !(0..3).all { this.getCurrentArmor(it) == null }) return mimicKilled() } diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/BlazeSolver.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/BlazeSolver.kt index 470fd8cd5..f248c9f47 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/BlazeSolver.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/BlazeSolver.kt @@ -3,7 +3,7 @@ package me.odinmain.features.impl.dungeon.puzzlesolvers import me.odinmain.OdinMain.mc import me.odinmain.features.impl.dungeon.puzzlesolvers.PuzzleSolvers.blazeHeight import me.odinmain.features.impl.dungeon.puzzlesolvers.PuzzleSolvers.blazeWidth -import me.odinmain.features.impl.dungeon.puzzlesolvers.PuzzleSolvers.puzzleTimersMap +import me.odinmain.features.impl.dungeon.puzzlesolvers.PuzzleSolvers.onPuzzleComplete import me.odinmain.utils.* import me.odinmain.utils.render.RenderUtils.renderBoundingBox import me.odinmain.utils.render.RenderUtils.renderVec @@ -18,6 +18,7 @@ object BlazeSolver { private var blazes = mutableListOf() private var roomType = 0 private var lastBlazeCount = 10 + private val blazeHealthRegex = Regex("^\\[Lv15] Blaze [\\d,]+/([\\d,]+)❤$") fun getBlaze() { val room = DungeonUtils.currentRoom ?: return @@ -26,7 +27,7 @@ object BlazeSolver { blazes.clear() mc.theWorld?.loadedEntityList?.forEach { entity -> if (entity !is EntityArmorStand || entity in blazes) return@forEach - val hp = Regex("^\\[Lv15] Blaze [\\d,]+/([\\d,]+)❤$").find(entity.name.noControlCodes)?.groups?.get(1)?.value?.replace(",", "")?.toIntOrNull() ?: return@forEach + val hp = blazeHealthRegex.find(entity.name.noControlCodes)?.groups?.get(1)?.value?.replace(",", "")?.toIntOrNull() ?: return@forEach hpMap[entity] = hp blazes.add(entity) } @@ -43,8 +44,8 @@ object BlazeSolver { if (blazes.isEmpty() && lastBlazeCount == 1) { LocationUtils.currentDungeon?.puzzles?.find { it.name == Puzzle.Blaze.name }?.status = PuzzleStatus.Completed if (PuzzleSolvers.blazeSendComplete) partyMessage("Blaze puzzle solved!") - puzzleTimersMap["Higher Blaze"]?.hasCompleted = true - puzzleTimersMap["Lower Blaze"]?.hasCompleted = true + onPuzzleComplete("Higher Blaze") + onPuzzleComplete("Lower Blaze") lastBlazeCount = 0 return } diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/IceFillSolver.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/IceFillSolver.kt index 16782dfc8..e4f9fcbee 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/IceFillSolver.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/IceFillSolver.kt @@ -80,10 +80,8 @@ object IceFillSolver { } } - fun transformTo(vec: Vec3i, rotation: Rotations): Vec3 { - return with(transform(vec.x, vec.z, rotation)) { - Vec3(x.toDouble(), vec.y.toDouble(), z.toDouble()) - } + fun transformTo(vec: Vec3i, rotation: Rotations): Vec3 = with(transform(vec.x, vec.z, rotation)) { + Vec3(x.toDouble(), vec.y.toDouble(), z.toDouble()) } fun reset() { diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/PuzzleSolvers.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/PuzzleSolvers.kt index b596c7d3d..dd378216e 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/PuzzleSolvers.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/PuzzleSolvers.kt @@ -109,8 +109,7 @@ object PuzzleSolvers : Module( private val puzzleTimers by BooleanSetting("Puzzle Timers", true, description = "Shows the time it took to solve each puzzle.").withDependency { enabled } private val puzzleToIntMap = mapOf("Creeper Beams" to 0, "Blaze Lower" to 1, "Blaze Higher" to 2, "Boulder" to 3, "Ice FIll" to 4, "Quiz" to 5, "Teleport Maze" to 6, "Water Board" to 7, "Three Weirdos" to 8) - data class PuzzleTimer(val timeEntered: Long = System.currentTimeMillis(), var hasCompleted: Boolean = false, var sentMessage: Boolean = false) - val puzzleTimersMap = hashMapOf() + val puzzleTimersMap = hashMapOf() init { execute(500) { @@ -145,29 +144,27 @@ object PuzzleSolvers : Module( val room = DungeonUtils.currentRoom ?: return@onPacket when (room.data.name) { - "Water Board" -> room.getRealCoords(15, 56, 22) == it.blockPosition - "Creeper Beams" -> room.getRealCoords(15, 69, 15) == it.blockPosition - "Boulder" -> room.getRealCoords(15, 66, 29) == it.blockPosition "Three Weirdos" -> it.blockPosition.equalsOneOf(room.getRealCoords(18, 69, 24), room.getRealCoords(16, 69, 25), room.getRealCoords(14, 69, 24)) - "Teleport Maze" -> room.getRealCoords(15, 70, 20) == it.blockPosition - "Ice Fill" -> it.blockPosition.equalsOneOf(room.getRealCoords(14, 75, 29), room.getRealCoords(16, 75, 29)) - else -> false - }.takeIf { it } ?: return@onPacket - - puzzleTimersMap[room.data.name]?.hasCompleted = true + "Ice Fill" -> it.blockPosition.equalsOneOf(room.getRealCoords(14, 75, 29), room.getRealCoords(16, 75, 29)) + "Creeper Beams" -> it.blockPosition == room.getRealCoords(15, 69, 15) + "Teleport Maze" -> it.blockPosition == room.getRealCoords(15, 70, 20) + "Water Board" -> it.blockPosition == room.getRealCoords(15, 56, 22) + "Boulder" -> it.blockPosition == room.getRealCoords(15, 66, 29) + else -> false + }.takeIf { !it } ?: onPuzzleComplete(room.data.name) } onWorldLoad { - WaterSolver.reset() - TPMazeSolver.reset() + puzzleTimersMap.clear() IceFillSolver.reset() + WeirdosSolver.reset() + BoulderSolver.reset() + TPMazeSolver.reset() + WaterSolver.reset() BlazeSolver.reset() BeamsSolver.reset() - WeirdosSolver.reset() QuizSolver.reset() - BoulderSolver.reset() TTTSolver.reset() - puzzleTimersMap.clear() } } @@ -175,8 +172,8 @@ object PuzzleSolvers : Module( fun onWorldRender(event: RenderWorldLastEvent) { if ((!inDungeons || inBoss) && !LocationUtils.currentArea.isArea(Island.SinglePlayer)) return profile("Puzzle Solvers Render") { - if (waterSolver) WaterSolver.waterRender() - if (tpMaze) TPMazeSolver.tpRender() + if (waterSolver) WaterSolver.onRenderWorld() + if (tpMaze) TPMazeSolver.onRenderWorld() if (iceFillSolver) IceFillSolver.onRenderWorld(iceFillColor) if (blazeSolver) BlazeSolver.onRenderWorld() if (beamsSolver) BeamsSolver.onRenderWorld() @@ -196,12 +193,7 @@ object PuzzleSolvers : Module( BoulderSolver.onRoomEnter(event) TPMazeSolver.onRoomEnter(event) if (!puzzleTimers) return - if (event.room?.data?.type == RoomType.PUZZLE && puzzleTimersMap.none { it.key == event.room.data.name }) puzzleTimersMap[event.room.data.name] = PuzzleTimer() - puzzleTimersMap.forEach { - if (!it.value.hasCompleted || it.value.sentMessage) return@forEach - puzzlePBs.time(puzzleToIntMap[it.key] ?: return@forEach, (System.currentTimeMillis() - it.value.timeEntered) / 1000.0, "s§7!", "§a${it.key} §7solved in §6", addPBString = true, addOldPBString = true, sendOnlyPB = true) - it.value.sentMessage = true - } + if (event.room?.data?.type == RoomType.PUZZLE && puzzleTimersMap.none { it.key == event.room.data.name }) puzzleTimersMap[event.room.data.name] = System.currentTimeMillis() } @SubscribeEvent @@ -209,4 +201,10 @@ object PuzzleSolvers : Module( if ((!inDungeons || inBoss) && !LocationUtils.currentArea.isArea(Island.SinglePlayer)) return if (beamsSolver) BeamsSolver.onBlockChange(event) } + + fun onPuzzleComplete(puzzleName: String) { + puzzleTimersMap[puzzleName]?.let { + puzzlePBs.time(puzzleToIntMap[puzzleName] ?: return@let, (System.currentTimeMillis() - it) / 1000.0, "s§7!", "§a${puzzleName} §7solved in §6", addPBString = true, addOldPBString = true, sendOnlyPB = false) + } + } } \ No newline at end of file diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/TPMazeSolver.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/TPMazeSolver.kt index d6f2b7b19..d1187222e 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/TPMazeSolver.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/TPMazeSolver.kt @@ -47,7 +47,7 @@ object TPMazeSolver { } } - fun tpRender() { + fun onRenderWorld() { if (DungeonUtils.currentRoomName != "Teleport Maze") return tpPads.forEach { when (it) { diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/WaterSolver.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/WaterSolver.kt index 0bf6c0650..183be7746 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/WaterSolver.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/puzzlesolvers/WaterSolver.kt @@ -82,7 +82,7 @@ object WaterSolver { } } - fun waterRender() { + fun onRenderWorld() { if (variant == -1 || DungeonUtils.currentRoomName != "Water Board") return val solutionList = solutions diff --git a/src/main/kotlin/me/odinmain/features/impl/floor7/p3/TerminalSounds.kt b/src/main/kotlin/me/odinmain/features/impl/floor7/p3/TerminalSounds.kt index 02e2ff339..624316734 100644 --- a/src/main/kotlin/me/odinmain/features/impl/floor7/p3/TerminalSounds.kt +++ b/src/main/kotlin/me/odinmain/features/impl/floor7/p3/TerminalSounds.kt @@ -44,29 +44,20 @@ object TerminalSounds : Module( private var lastPlayed = System.currentTimeMillis() @SubscribeEvent - fun onPacket(event: PacketReceivedEvent){ - with(event.packet) { - if ( - this is S29PacketSoundEffect && - soundName == "note.pling" && - volume == 8f && - pitch == 4.047619f && - shouldReplaceSounds - ) event.isCanceled = true - } + fun onPacket(event: PacketReceivedEvent) = with(event.packet) { + if (this is S29PacketSoundEffect && soundName == "note.pling" && volume == 8f && pitch == 4.047619f && shouldReplaceSounds) + event.isCanceled = true } @SubscribeEvent fun onSlotClick(event: GuiEvent.GuiMouseClickEvent) { if (!shouldReplaceSounds) return - val slot = (event.gui as? GuiChest)?.slotUnderMouse?.slotIndex ?: return - clickSlot(slot) + clickSlot((event.gui as? GuiChest)?.slotUnderMouse?.slotIndex ?: return) } @SubscribeEvent fun onCustomSlotClick(event: GuiEvent.CustomTermGuiClick) { - if (!shouldReplaceSounds) return - clickSlot(event.slot) + if (shouldReplaceSounds) clickSlot(event.slot) } @SubscribeEvent @@ -94,14 +85,12 @@ object TerminalSounds : Module( } fun playCompleteSound() { - val sound = if (completedSound == defaultSounds.size - 1) customCompleteSound else defaultSounds[completedSound] - PlayerUtils.playLoudSound(sound, completeVolume, completePitch) + PlayerUtils.playLoudSound( if (completedSound == defaultSounds.size - 1) customCompleteSound else defaultSounds[completedSound], completeVolume, completePitch) } private fun playTerminalSound() { if (System.currentTimeMillis() - lastPlayed <= 2) return - val sound = if (sound == defaultSounds.size - 1) customSound else defaultSounds[sound] - PlayerUtils.playLoudSound(sound, clickVolume, clickPitch) + PlayerUtils.playLoudSound(if (sound == defaultSounds.size - 1) customSound else defaultSounds[sound], clickVolume, clickPitch) lastPlayed = System.currentTimeMillis() } diff --git a/src/main/kotlin/me/odinmain/utils/Utils.kt b/src/main/kotlin/me/odinmain/utils/Utils.kt index 9456c6664..d1da8b460 100644 --- a/src/main/kotlin/me/odinmain/utils/Utils.kt +++ b/src/main/kotlin/me/odinmain/utils/Utils.kt @@ -281,8 +281,9 @@ fun writeToClipboard(text: String, successMessage: String = "§aCopied to clipbo } private val romanMap = mapOf('I' to 1, 'V' to 5, 'X' to 10, 'L' to 50, 'C' to 100, 'D' to 500, 'M' to 1000) +private val numberRegex = Regex("^[0-9]+$") fun romanToInt(s: String): Int { - return if (s.matches(Regex("^[0-9]+$"))) s.toInt() + return if (s.matches(numberRegex)) s.toInt() else { var result = 0 for (i in 0 until s.length - 1) { diff --git a/src/main/kotlin/me/odinmain/utils/render/Renderer.kt b/src/main/kotlin/me/odinmain/utils/render/Renderer.kt index c38f9422c..12dc12acf 100644 --- a/src/main/kotlin/me/odinmain/utils/render/Renderer.kt +++ b/src/main/kotlin/me/odinmain/utils/render/Renderer.kt @@ -66,11 +66,12 @@ object Renderer { outlineAlpha: Number = 1, fillAlpha: Number = 1, depth: Boolean = false, - lineSmoothing: Boolean = true + lineSmoothing: Boolean = true, + expand: Double = 0.0 ) { val block = getBlockAt(pos) block.setBlockBoundsBasedOnState(mc.theWorld, pos) - drawBox(block.getSelectedBoundingBox(mc.theWorld, pos).outlineBounds(), color, outlineWidth, outlineAlpha, fillAlpha, depth, lineSmoothing) + drawBox(block.getSelectedBoundingBox(mc.theWorld, pos).outlineBounds().expand(expand, expand, expand), color, outlineWidth, outlineAlpha, fillAlpha, depth, lineSmoothing) } fun drawStyledBlock( @@ -79,12 +80,13 @@ object Renderer { style: Int, width: Number = 3, depth: Boolean = false, - lineSmoothing: Boolean = true + lineSmoothing: Boolean = true, + expand: Double = 0.0 ) { when (style) { - 0 -> drawBlock(pos, color, width, 0, color.alpha, depth, lineSmoothing) - 1 -> drawBlock(pos, color, width, color.alpha, 0, depth, lineSmoothing) - 2 -> drawBlock(pos, color, width, color.alpha, color.multiplyAlpha(.75f).alpha, depth, lineSmoothing) + 0 -> drawBlock(pos, color, width, 0, color.alpha, depth, lineSmoothing, expand) + 1 -> drawBlock(pos, color, width, color.alpha, 0, depth, lineSmoothing, expand) + 2 -> drawBlock(pos, color, width, color.alpha, color.multiplyAlpha(.75f).alpha, depth, lineSmoothing, expand) } } diff --git a/src/main/kotlin/me/odinmain/utils/skyblock/ItemUtils.kt b/src/main/kotlin/me/odinmain/utils/skyblock/ItemUtils.kt index 65821c68a..8ab889c01 100644 --- a/src/main/kotlin/me/odinmain/utils/skyblock/ItemUtils.kt +++ b/src/main/kotlin/me/odinmain/utils/skyblock/ItemUtils.kt @@ -144,7 +144,7 @@ enum class ItemRarity( VERY_SPECIAL("VERY SPECIAL", "§c", Color.RED); } -private val rarityRegex: Regex = Regex("§l(?${ItemRarity.entries.joinToString("|") { it.loreName }}) ?(?[A-Z ]+)?(?:§[0-9a-f]§l§ka)?$") +private val rarityRegex = Regex("§l(?${ItemRarity.entries.joinToString("|") { it.loreName }}) ?(?[A-Z ]+)?(?:§[0-9a-f]§l§ka)?$") /** * Gets the rarity of an item diff --git a/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt b/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt index acccd1763..33b6da956 100644 --- a/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt +++ b/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt @@ -83,10 +83,10 @@ class Dungeon(val floor: Floor) { private fun handleChatPacket(packet: S02PacketChat) { val message = packet.chatComponent.unformattedText.noControlCodes - if (Regex("\\[BOSS] The Watcher: You have proven yourself. You may pass.").matches(message)) expectingBloodUpdate = true - Regex("(?:\\[\\w+] )?(\\w+) opened a (?:WITHER|Blood) door!").find(message)?.let { dungeonStats.doorOpener = it.groupValues[1] } + if (expectingBloodRegex.matches(message)) expectingBloodUpdate = true + doorOpenRegex.find(message)?.let { dungeonStats.doorOpener = it.groupValues[1] } - val partyMessage = Regex("Party > .*?: (.+)\$").find(message)?.groupValues?.get(1)?.lowercase() ?: return + val partyMessage = partyMessageRegex.find(message)?.groupValues?.get(1)?.lowercase() ?: return if (partyMessage.equalsOneOf("mimic killed", "mimic slain", "mimic killed!", "mimic dead", "mimic dead!", "\$skytils-dungeon-score-mimic\$", Mimic.mimicMessage)) dungeonStats.mimicKilled = true if (partyMessage.equalsOneOf("blaze done!", "blaze done", "blaze puzzle solved!")) //more completion messages may be necessary. @@ -120,6 +120,9 @@ class Dungeon(val floor: Floor) { } } + private val partyMessageRegex = Regex("Party > .*?: (.+)\$") + private val doorOpenRegex = Regex("(?:\\[\\w+] )?(\\w+) opened a (?:WITHER|Blood) door!") + private val expectingBloodRegex = Regex("\\[BOSS] The Watcher: You have proven yourself. You may pass.") private val timeRegex = Regex("§r Time: §r§6((?:\\d+h ?)?(?:\\d+m ?)?\\d+s)§r") private val clearedRegex = Regex("^Cleared: §[c6a](\\d+)% §8(?:§8)?\\(\\d+\\)$") private val secretCountRegex = Regex("^§r Secrets Found: §r§b(\\d+)§r$")