From b5f7f658b502d93986ba3bb6251cb8816414d9b1 Mon Sep 17 00:00:00 2001 From: odtheking Date: Wed, 11 Dec 2024 18:35:30 +0200 Subject: [PATCH] Updated library version --- build.gradle.kts | 2 +- .../features/impl/floor7/p3/ArrowsDevice.kt | 6 +- .../me/odinmain/commands/impl/DevCommand.kt | 11 +- .../me/odinmain/commands/impl/OdinCommand.kt | 6 +- .../odinmain/config/DungeonWaypointConfig.kt | 3 +- .../me/odinmain/features/huds/HUDManager.kt | 4 +- .../features/impl/dungeon/LeapHelper.kt | 66 --------- .../features/impl/dungeon/LeapMenu.kt | 135 +++++++++--------- .../odinmain/features/impl/render/ClickGUI.kt | 11 +- .../features/settings/impl/ColorSetting.kt | 21 +-- .../utils/skyblock/dungeon/Dungeon.kt | 13 -- .../utils/skyblock/dungeon/DungeonEnums.kt | 2 +- .../utils/skyblock/dungeon/DungeonUtils.kt | 4 - 13 files changed, 93 insertions(+), 191 deletions(-) delete mode 100644 src/main/kotlin/me/odinmain/features/impl/dungeon/LeapHelper.kt diff --git a/build.gradle.kts b/build.gradle.kts index d2d7eeed8..aa14ca148 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -48,7 +48,7 @@ allprojects { //implementation("com.github.stivais:AuroraUI:0.9.1-beta") // todo: create releases for aurora - implementation("com.github.stivais:AuroraUI:f41a1e07c2") + implementation("com.github.stivais:AuroraUI:4ba1ee9386e01035a05f7efd331c1be0554fc16b") implementation("com.github.odtheking:odin-lwjgl:e50f062233") } diff --git a/odinclient/src/main/kotlin/me/odinclient/features/impl/floor7/p3/ArrowsDevice.kt b/odinclient/src/main/kotlin/me/odinclient/features/impl/floor7/p3/ArrowsDevice.kt index 3d4985730..b0d4da3d3 100644 --- a/odinclient/src/main/kotlin/me/odinclient/features/impl/floor7/p3/ArrowsDevice.kt +++ b/odinclient/src/main/kotlin/me/odinclient/features/impl/floor7/p3/ArrowsDevice.kt @@ -306,10 +306,10 @@ object ArrowsDevice : Module( fun guiOpen(event: GuiOpenEvent) { if (autoState != AutoState.WaitingOnLeapingGui) return val chest = (event.gui as? GuiChest)?.inventorySlots ?: return - if (chest !is ContainerChest || chest.name != "Spirit Leap" || DungeonUtils.leapTeammates.isEmpty()) return + if (chest !is ContainerChest || chest.name != "Spirit Leap" || DungeonUtils.dungeonTeammatesNoSelf.isEmpty()) return - val leapTo = DungeonUtils.leapTeammates.firstOrNull { it.clazz == DungeonClass.entries[autoLeapClass] } - ?: DungeonUtils.leapTeammates.first() + val leapTo = DungeonUtils.dungeonTeammatesNoSelf.firstOrNull { it.clazz == DungeonClass.entries[autoLeapClass] } + ?: DungeonUtils.dungeonTeammatesNoSelf.first() clock.update() diff --git a/src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt b/src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt index 583d68ebb..205662c4e 100644 --- a/src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt +++ b/src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt @@ -1,10 +1,6 @@ package me.odinmain.commands.impl -import com.github.stivais.aurora.color.Color -import com.github.stivais.aurora.utils.hexToRGBA -import com.github.stivais.aurora.utils.toHexString import com.github.stivais.commodore.utils.GreedyString -import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.launch import me.odinmain.OdinMain.mc import me.odinmain.OdinMain.scope @@ -19,14 +15,16 @@ import me.odinmain.features.impl.floor7.WitherDragons.priorityDragon import me.odinmain.features.impl.floor7.WitherDragonsEnum import me.odinmain.features.impl.nether.NoPre import me.odinmain.features.impl.render.DevPlayers.updateDevs -import me.odinmain.utils.* +import me.odinmain.utils.isOtherPlayer +import me.odinmain.utils.postAndCatch +import me.odinmain.utils.sendDataToServer import me.odinmain.utils.skyblock.* import me.odinmain.utils.skyblock.dungeon.Blessing import me.odinmain.utils.skyblock.dungeon.DungeonUtils import me.odinmain.utils.skyblock.dungeon.DungeonUtils.getRelativeCoords import me.odinmain.utils.skyblock.dungeon.ScanUtils import me.odinmain.utils.skyblock.dungeon.ScanUtils.getRoomCenter -import me.odinmain.utils.ui.screens.UIScreen.Companion.open +import me.odinmain.utils.writeToClipboard import net.minecraft.network.play.server.S02PacketChat import net.minecraft.util.ChatComponentText @@ -112,7 +110,6 @@ val devCommand = commodore("oddev") { |currentRoom: ${DungeonUtils.currentRoom?.data?.name}, roomsPassed: ${DungeonUtils.passedRooms.map { it.data.name }} |Teammates: ${DungeonUtils.dungeonTeammates.joinToString { "§${it.clazz.colorCode}${it.name} (${it.clazz} [${it.clazzLvl}])" }} |TeammatesNoSelf: ${DungeonUtils.dungeonTeammatesNoSelf.map { it.name }} - |LeapTeammates: ${DungeonUtils.leapTeammates.map { it.name }} |Blessings: ${Blessing.entries.joinToString { "${it.name}: ${it.current}" }} ${getChatBreak()} """.trimIndent(), "") diff --git a/src/main/kotlin/me/odinmain/commands/impl/OdinCommand.kt b/src/main/kotlin/me/odinmain/commands/impl/OdinCommand.kt index 0a0640318..8d4ffeba9 100644 --- a/src/main/kotlin/me/odinmain/commands/impl/OdinCommand.kt +++ b/src/main/kotlin/me/odinmain/commands/impl/OdinCommand.kt @@ -1,10 +1,9 @@ package me.odinmain.commands.impl -import com.github.stivais.aurora.utils.loop import com.github.stivais.commodore.utils.GreedyString import me.odinmain.commands.commodore import me.odinmain.features.huds.HUDManager -import me.odinmain.features.huds.HUDManager.HUDs +import me.odinmain.features.impl.dungeon.LeapMenu import me.odinmain.features.impl.dungeon.dungeonwaypoints.DungeonWaypoints import me.odinmain.features.impl.render.ClickGUI import me.odinmain.features.impl.render.ClickGUI.clickGUI @@ -12,7 +11,6 @@ import me.odinmain.utils.ServerUtils import me.odinmain.utils.equalsOneOf import me.odinmain.utils.fillItemFromSack import me.odinmain.utils.skyblock.* -import me.odinmain.utils.skyblock.dungeon.DungeonUtils import me.odinmain.utils.ui.screens.UIScreen.Companion.open import me.odinmain.utils.writeToClipboard import kotlin.math.round @@ -146,7 +144,7 @@ val mainCommand = commodore("od", "odin") { literal("leap").runs { player1: String?, player2: String?, player3: String?, player4: String? -> val players = listOfNotNull(player1, player2, player3, player4) - DungeonUtils.customLeapOrder = players + LeapMenu.customLeapOrder = players modMessage("§aCustom leap order set to: §f${players.joinToString(", ")}") } diff --git a/src/main/kotlin/me/odinmain/config/DungeonWaypointConfig.kt b/src/main/kotlin/me/odinmain/config/DungeonWaypointConfig.kt index ae600c999..b49cbf796 100644 --- a/src/main/kotlin/me/odinmain/config/DungeonWaypointConfig.kt +++ b/src/main/kotlin/me/odinmain/config/DungeonWaypointConfig.kt @@ -178,12 +178,11 @@ object DungeonWaypointConfig { return jsonObject } - } class ColorSerializer : JsonSerializer, JsonDeserializer { override fun serialize(p0: Color?, p1: Type?, p2: JsonSerializationContext?): JsonElement { - return JsonPrimitive(p0?.toHexString() ?: "#000000FF") + return JsonPrimitive(p0?.toHexString(true) ?: "#000000FF") } override fun deserialize(p0: JsonElement?, p1: Type?, p2: JsonDeserializationContext?): Color { diff --git a/src/main/kotlin/me/odinmain/features/huds/HUDManager.kt b/src/main/kotlin/me/odinmain/features/huds/HUDManager.kt index 6a8108918..5fa635739 100644 --- a/src/main/kotlin/me/odinmain/features/huds/HUDManager.kt +++ b/src/main/kotlin/me/odinmain/features/huds/HUDManager.kt @@ -119,7 +119,7 @@ object HUDManager { ) hud.settings.loop { if (it is Setting.Renders && !it.hidden) { - scope(it.Drawable()) { + createScope(it.Drawable()) { hoverInformation(description = it.description) onValueChanged { refreshHUDs() } it.apply { create() } @@ -207,7 +207,7 @@ object HUDManager { val py = minY.px return popup(constraints = constrain(px, py, (maxX - minX).px, (maxY - minY).px), smooth = true) { - outline( + outlineBlock( constraints = copies(), color = Color.WHITE, thickness = 1.px diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/LeapHelper.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/LeapHelper.kt deleted file mode 100644 index d9821b6dc..000000000 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/LeapHelper.kt +++ /dev/null @@ -1,66 +0,0 @@ -package me.odinmain.features.impl.dungeon - -import me.odinmain.utils.equal -import me.odinmain.utils.noControlCodes -import me.odinmain.utils.skyblock.dungeon.DungeonUtils -import me.odinmain.utils.skyblock.dungeon.M7Phases -import me.odinmain.utils.skyblock.getBlockAt -import net.minecraft.init.Blocks -import net.minecraft.util.BlockPos -import net.minecraft.util.Vec3 - -// this is only used in LeapMenu, merge into LeapMenu module? -object LeapHelper { - private val NONE = Vec3(0.0, 0.0, 0.0) - private val messageMap = mapOf( - "" to NONE, - "[BOSS] Maxor: I’M TOO YOUNG TO DIE AGAIN!" to Vec3(65.0, 175.0, 53.0), - "[BOSS] Storm: I should have known that I stood no chance." to Vec3(107.0, 119.0, 93.0), - "[BOSS] Goldor: You have done it, you destroyed the factory…" to Vec3(54.0, 115.0, 70.0), - "[BOSS] Necron: You went further than any human before, congratulations." to Vec3(41.0, 64.0, 102.0), - "[BOSS] Necron: That's a very impressive trick. I guess I'll have to handle this myself." to Vec3(54.0, 65.0, 82.0), - "[BOSS] Necron: Let's make some space!" to Vec3(54.0, 4.0, 95.0) - ) - private var currentPos = NONE - - val leapHelperName - get() = getPlayer() - - fun getPlayer(): String { - if (DungeonUtils.dungeonTeammatesNoSelf.isEmpty()) return "" - if (!DungeonUtils.inBoss) return DungeonUtils.doorOpener - if (DungeonUtils.getF7Phase() == M7Phases.P3) scanGates() - if (currentPos == NONE) return "" - return DungeonUtils.dungeonTeammatesNoSelf - .minByOrNull { - val entity = it.entity - if (entity == null) 10000.0 else { - if (currentPos.equal(Vec3(54.0, 4.0, 95.0)) && entity.posY >= 54.0) 10000.0 - else entity.positionVector.distanceTo(currentPos) - } - } - ?.entity - ?.displayNameString - .noControlCodes - } - - private val gateBlocks = mapOf( - BlockPos(8, 118, 50) to Vec3(8.0, 113.0, 51.0), - BlockPos(18, 118, 132) to Vec3(19.0, 114.0, 132.0), - BlockPos(100, 118, 122) to Vec3(100.0, 115.0, 121.0) - ) - - private fun scanGates() { - gateBlocks.entries.forEach { (pos, vec) -> - if (getBlockAt(pos) == Blocks.air) currentPos = vec // Is barrier if gate is closed - } - } - - fun worldLoad() { - currentPos = NONE - } - - fun leapHelperBossChatEvent(message: String) { - if (message in messageMap) currentPos = messageMap[message] ?: NONE - } -} \ No newline at end of file diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/LeapMenu.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/LeapMenu.kt index 9a415bb2b..1865f5615 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/LeapMenu.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/LeapMenu.kt @@ -1,30 +1,24 @@ package me.odinmain.features.impl.dungeon -import com.github.stivais.aurora.color.Color import com.github.stivais.aurora.constraints.impl.positions.Center import com.github.stivais.aurora.constraints.impl.size.AspectRatio -import com.github.stivais.aurora.constraints.impl.size.Copying import com.github.stivais.aurora.dsl.* import com.github.stivais.aurora.elements.Layout.Companion.divider import com.github.stivais.aurora.elements.impl.layout.Grid -import com.github.stivais.aurora.renderer.data.Image +import com.github.stivais.aurora.utils.loop import com.github.stivais.aurora.utils.withAlpha import io.github.moulberry.notenoughupdates.NEUApi import me.odinmain.features.Module -import me.odinmain.features.impl.dungeon.LeapHelper.leapHelperBossChatEvent -import me.odinmain.features.impl.dungeon.LeapHelper.worldLoad import me.odinmain.features.impl.render.ClickGUI.`gray 38` import me.odinmain.features.settings.Setting.Companion.withDependency import me.odinmain.features.settings.impl.* import me.odinmain.utils.name +import me.odinmain.utils.skyblock.* import me.odinmain.utils.skyblock.dungeon.DungeonClass import me.odinmain.utils.skyblock.dungeon.DungeonPlayer -import me.odinmain.utils.skyblock.getItemIndexInContainerChest -import me.odinmain.utils.skyblock.modMessage -import me.odinmain.utils.skyblock.partyMessage +import me.odinmain.utils.skyblock.dungeon.DungeonUtils.dungeonTeammatesNoSelf import me.odinmain.utils.ui.Colors import me.odinmain.utils.ui.renderer.NVGRenderer -import me.odinmain.utils.ui.screens.UIScreen.Companion.open import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraftforge.client.event.GuiOpenEvent @@ -36,63 +30,76 @@ object LeapMenu : Module( name = "Leap Menu", description = "Renders a custom leap menu when in the Spirit Leap gui." ) { - val type by SelectorSetting("Sorting", "Odin Sorting", arrayListOf("Odin Sorting", "A-Z Class (BetterMap)", "A-Z Name", "Custom sorting", "No Sorting"), description = "How to sort the leap menu.") - private val onlyClass by BooleanSetting("Only Classes", false, description = "Renders classes instead of names.") - private val colorStyle by BooleanSetting("Color Style", false, description = "Which color style to use.") - private val backgroundColor by ColorSetting("Background Color", Colors.MINECRAFT_DARK_GRAY.withAlpha(0.9f), allowAlpha = true, description = "Color of the background of the leap menu.") - private val roundedRect by BooleanSetting("Rounded Rect", true, description = "Toggles the rounded rect for the gui.") - private val useNumberKeys by BooleanSetting("Use Number Keys", false, description = "Use keyboard keys to leap to the player you want, going from left to right, top to bottom.") + private val type by SelectorSetting("Sorting", "Odin Sorting", arrayListOf("Odin Sorting", "A-Z Class (BetterMap)", "A-Z Name", "Custom sorting", "No Sorting"), description = "How to sort the leap menu.") + private val onlyClass by BooleanSetting("Only Classes", description = "Renders classes instead of names.") + private val textColor by ColorSetting("Text Color", `gray 38`, description = "Color for the text in the leap menu.") + private val healerColor by ColorSetting("Healer Color", Colors.MINECRAFT_LIGHT_PURPLE.withAlpha(0.5f), description = "Color for the healer class.") + private val tankColor by ColorSetting("Tank Color", Colors.MINECRAFT_DARK_GREEN.withAlpha(0.5f), description = "Color for the tank class.") + private val mageColor by ColorSetting("Mage Color", Colors.MINECRAFT_AQUA.withAlpha(0.5f), description = "Color for the mage class.") + private val archerColor by ColorSetting("Archer Color", Colors.MINECRAFT_GOLD.withAlpha(0.5f), description = "Color for the archer class.") + private val berserkerColor by ColorSetting("Berserker Color", Colors.MINECRAFT_DARK_RED.withAlpha(0.5f), description = "Color for the berserker class.") + private val scaleFactor by NumberSetting("Scale Factor", 0.5f, 0.1f, 1f, 0.1f, description = "Scale factor for the leap menu.") + private val useNumberKeys by BooleanSetting("Use Number Keys", description = "Use keyboard keys to leap to the player you want, going from left to right, top to bottom.") private val topLeftKeybind by KeybindSetting("Top Left", Keyboard.KEY_1, "Used to click on the first person in the leap menu.").withDependency { useNumberKeys } private val topRightKeybind by KeybindSetting("Top Right", Keyboard.KEY_2, "Used to click on the second person in the leap menu.").withDependency { useNumberKeys } private val bottomLeftKeybind by KeybindSetting("Bottom Left", Keyboard.KEY_3, "Used to click on the third person in the leap menu.").withDependency { useNumberKeys } private val bottomRightKeybind by KeybindSetting("Bottom right", Keyboard.KEY_4, "Used to click on the fourth person in the leap menu.").withDependency { useNumberKeys } - private val size by NumberSetting("Scale Factor", 1.0f, 0.5f, 2.0f, 0.1f, description = "Scale factor for the leap menu.") - private val leapHelperToggle by BooleanSetting("Leap Helper", false, description = "Highlights the leap helper player in the leap menu.") - private val leapHelperColor by ColorSetting("Leap Helper Color", Color.WHITE, description = "Color of the Leap Helper highlight.").withDependency { leapHelperToggle } - val delay by NumberSetting("Reset Leap Helper Delay", 30, 10.0, 120.0, 1.0, description = "Delay for clearing the leap helper highlight.").withDependency { leapHelperToggle } - private val leapAnnounce by BooleanSetting("Leap Announce", false, description = "Announces when you leap to a player.") + private val leapAnnounce by BooleanSetting("Leap Announce", description = "Announces when you leap to a player.") + private val classToColorMap = mapOf( + DungeonClass.Healer to healerColor, DungeonClass.Tank to tankColor, DungeonClass.Mage to mageColor, + DungeonClass.Archer to archerColor, DungeonClass.Berserk to berserkerColor + ) private val EMPTY = DungeonPlayer("Empty", DungeonClass.Unknown) - fun leapMenu() = Aurora(renderer = NVGRenderer) { - Grid(copies()).scope { - leapTeammates.forEachIndexed { index, teammate -> - if (teammate == EMPTY) return@forEachIndexed + private fun leapMenu(sortedTeammates: ArrayList) = Aurora(renderer = NVGRenderer) { + Grid(copies()).scope { // separate grid from the actual players to allow for scaling of the grid without affecting click behaviour + sortedTeammates.loop { teammate -> + group(size(50.percent, 50.percent)) { + outlineBlock(copies(), `gray 38`, 2.px) + onClick(nonSpecific = true) { + if (teammate == EMPTY) return@onClick false // ensures we don't handle clicks on empty player + if (teammate.isDead) return@onClick modMessage("§cThis player is dead, can't leap.").let { false } + leapTo(teammate.name) + true + } + } + } + } + Grid(copies()).scope { // actual grid to handle rendering of elements + scale(scaleFactor) + sortedTeammates.loop { teammate -> group(size(50.percent, 50.percent)) { + if (teammate == EMPTY) return@loop // ensures we don't render empty player block( constraints = constrain(Center, Center, AspectRatio(2.5f), 60.percent), - color = `gray 38`, + color = classToColorMap[teammate.clazz] ?: Colors.WHITE, radius = 12.radius() ) { - row(size(Copying, Copying), padding = 5.percent) { + row(copies(), padding = 5.percent) { divider(5.percent) image( teammate.skinImage, constraints = constrain(y = Center, w = 30.percent, h = AspectRatio(1f)), 12f.radius() ) - column(size(Copying, Copying), padding = 5.percent) { + column(constrain(), padding = 5.percent) { divider(40.percent) - text(teammate.name, color = teammate.clazz.color, size = 15.percent) + text(if (!onlyClass) teammate.name else "", color = textColor, size = 40.percent) text(if (teammate.isDead) "DEAD" else teammate.clazz.name, color = if (teammate.isDead) Colors.MINECRAFT_RED else Colors.WHITE, size = 12.percent) } } } - onClick(nonSpecific = true) { - if (teammate.isDead) return@onClick modMessage("§cThis player is dead, can't leap.").let { false } - leapTo(teammate.name) - true - } } } } - onKeycodePressed { (code) -> - if (!useNumberKeys || leapTeammates.isEmpty()) return@onKeycodePressed false + onKeycodePressed { (code) -> // not good + if (!useNumberKeys || sortedTeammates.isEmpty()) return@onKeycodePressed false val keybindIndex = listOf(topLeftKeybind, topRightKeybind, bottomLeftKeybind, bottomRightKeybind).indexOfFirst { it.key == code }.takeIf { it != -1 } ?: return@onKeycodePressed false - if (keybindIndex >= leapTeammates.size) return@onKeycodePressed false + if (keybindIndex >= sortedTeammates.size) return@onKeycodePressed false - val playerToLeap = leapTeammates[keybindIndex] + val playerToLeap = sortedTeammates[keybindIndex] if (playerToLeap == EMPTY || playerToLeap.isDead) return@onKeycodePressed modMessage("§cThis player is dead, can't leap.").let { false } leapTo(playerToLeap.name) @@ -102,10 +109,9 @@ object LeapMenu : Module( @SubscribeEvent fun guiOpen(event: GuiOpenEvent) { - val chest = (event.gui as? GuiChest)?.inventorySlots ?: return - if (chest !is ContainerChest || chest.name != "Spirit Leap" || leapTeammates.isEmpty() || leapTeammates.all { it == EMPTY }) return + (event.gui as? GuiChest)?.takeIf { it.inventorySlots?.name == "Spirit Leap" } ?: return if (Loader.instance().activeModList.any { it.modId == "notenoughupdates" }) NEUApi.setInventoryButtonsToDisabled() - open(leapMenu()) + //open(leapMenu(ArrayList(getSortedLeapList()).ifEmpty { return })) } private fun leapTo(name: String) { @@ -116,19 +122,6 @@ object LeapMenu : Module( modMessage("Teleporting to $name.") } - init { - onMessage(Regex(".*")) { leapHelperBossChatEvent(it) } - - onWorldLoad { worldLoad() } - } - - private val leapTeammates: MutableList = mutableListOf( - DungeonPlayer("Stivais", DungeonClass.Healer, skinImage = Image("https://mc-heads.net/avatar/Stivais/128")), - DungeonPlayer("Odtheking", DungeonClass.Archer, skinImage = Image("https://mc-heads.net/avatar/Odtheking/128")), - DungeonPlayer("freebonsai", DungeonClass.Mage, skinImage = Image("https://mc-heads.net/avatar/freebonsai/128")), - DungeonPlayer("Cezar", DungeonClass.Tank, skinImage = Image("https://mc-heads.net/avatar/Cezar/128")) - ) - /** * Sorts the list of players based on their default quadrant and class priority. * The function first tries to place each player in their default quadrant. If the quadrant is already occupied, @@ -138,27 +131,39 @@ object LeapMenu : Module( * @param players The list of players to be sorted. * @return An array of sorted players. */ - fun odinSorting(players: List): Array { - val result = Array(4) { EMPTY } + private fun odinSorting(players: List): List { val secondRound = mutableListOf() + val result = MutableList(4) { EMPTY } for (player in players.sortedBy { it.clazz.priority }) { - when { - result[player.clazz.defaultQuadrant] == EMPTY -> result[player.clazz.defaultQuadrant] = player - else -> secondRound.add(player) - } + if (result[player.clazz.defaultQuadrant] == EMPTY) result[player.clazz.defaultQuadrant] = player + else secondRound.add(player) } if (secondRound.isEmpty()) return result result.forEachIndexed { index, _ -> - when { - result[index] == EMPTY -> { - result[index] = secondRound.removeAt(0) - if (secondRound.isEmpty()) return result - } - } + if (result[index] != EMPTY) return@forEachIndexed + result[index] = secondRound.removeAt(0) + if (secondRound.isEmpty()) return result } return result } + + private val theGoats = mutableListOf( + DungeonPlayer("Stivais", DungeonClass.Healer), DungeonPlayer("Odtheking", DungeonClass.Archer), + DungeonPlayer("freebonsai", DungeonClass.Berserk), DungeonPlayer("Cezar", DungeonClass.Tank) + ) + var customLeapOrder: List = emptyList() + + private fun getSortedLeapList(): List { + return if (LocationUtils.currentArea.isArea(Island.SinglePlayer)) odinSorting(theGoats) + else when (type) { + 0 -> odinSorting(dungeonTeammatesNoSelf.sortedBy { it.clazz.priority }) + 1 -> dungeonTeammatesNoSelf.sortedWith(compareBy({ it.clazz.ordinal }, { it.name })) + 2 -> dungeonTeammatesNoSelf.sortedBy { it.name } + 3 -> dungeonTeammatesNoSelf.sortedBy { customLeapOrder.indexOf(it.name.lowercase()).takeIf { it != -1 } ?: Int.MAX_VALUE } + else -> dungeonTeammatesNoSelf + } + } } \ No newline at end of file diff --git a/src/main/kotlin/me/odinmain/features/impl/render/ClickGUI.kt b/src/main/kotlin/me/odinmain/features/impl/render/ClickGUI.kt index 0c49d90ed..784e732ce 100644 --- a/src/main/kotlin/me/odinmain/features/impl/render/ClickGUI.kt +++ b/src/main/kotlin/me/odinmain/features/impl/render/ClickGUI.kt @@ -25,13 +25,14 @@ import me.odinmain.features.settings.AlwaysActive import me.odinmain.features.settings.Setting import me.odinmain.features.settings.Setting.Companion.withDependency import me.odinmain.features.settings.impl.* -import me.odinmain.utils.capitalizeFirst import me.odinmain.utils.sendDataToServer import me.odinmain.utils.skyblock.LocationUtils import me.odinmain.utils.skyblock.createClickStyle import me.odinmain.utils.skyblock.getChatBreak import me.odinmain.utils.skyblock.modMessage -import me.odinmain.utils.ui.* +import me.odinmain.utils.ui.lifetimeAnimations +import me.odinmain.utils.ui.onHover +import me.odinmain.utils.ui.regularFont import me.odinmain.utils.ui.renderer.NVGRenderer import me.odinmain.utils.ui.renderer.NVGRenderer.textWidth import me.odinmain.utils.ui.screens.UIScreen.Companion.open @@ -286,10 +287,8 @@ object ClickGUI : Module( loaded = true module.settings.loop { setting -> if (!setting.hidden && setting is Setting.Renders) { - this@column.scope(setting.Drawable()) { - hoverInformation( - description = setting.description - ) + this@column.createScope(setting.Drawable()) { + hoverInformation(description = setting.description) setting.apply { create() } } } diff --git a/src/main/kotlin/me/odinmain/features/settings/impl/ColorSetting.kt b/src/main/kotlin/me/odinmain/features/settings/impl/ColorSetting.kt index 9056f1593..ee8e20427 100644 --- a/src/main/kotlin/me/odinmain/features/settings/impl/ColorSetting.kt +++ b/src/main/kotlin/me/odinmain/features/settings/impl/ColorSetting.kt @@ -29,7 +29,6 @@ import me.odinmain.features.settings.Saving import me.odinmain.features.settings.Setting import me.odinmain.features.settings.Setting.Renders.Companion.onValueChanged import me.odinmain.features.settings.Setting.Renders.Companion.setting -import me.odinmain.utils.skyblock.modMessage import me.odinmain.utils.ui.image import java.awt.Color.HSBtoRGB @@ -68,7 +67,7 @@ class ColorSetting( pos = at(x = Pixel.ZERO), size = 40.percent ) - outline( + outlineBlock( constrain(x = Pixel.ZERO.alignOpposite, w = 30.px, h = 50.percent), color { value.withAlpha(255).rgba }, thickness = 1.px, @@ -92,18 +91,6 @@ class ColorSetting( } } - fun Color.toHexString(returnAlpha: Boolean = false): String { - val r = (rgba shr 16) and 0xFF - val g = (rgba shr 8) and 0xFF - val b = rgba and 0xFF - return if (returnAlpha) { - val a = (rgba shr 24) and 0xFF - String.format("#%02X%02X%02X%02X", r, g, b, a) - } else { - String.format("#%02X%02X%02X", r, g, b) - } - } - private fun ElementScope<*>.colorPicker() = popup(constraints = copies(), smooth = true) { val colorMaxBrightness = color { HSBtoRGB(value.hue, value.saturation, 1f) } val colorOnlyHue = color { HSBtoRGB(value.hue, 1f, 1f) } @@ -160,7 +147,7 @@ class ColorSetting( /** * Saturation and brightness slider */ - outline( + outlineBlock( size(w = 200.px, h = 200.px), colorMaxBrightness, thickness = 1.px, @@ -192,7 +179,7 @@ class ColorSetting( /** * Hue slider */ - outline( + outlineBlock( size(w = 15.px, h = 200.px), colorMaxBrightness, thickness = 1.px, @@ -216,7 +203,7 @@ class ColorSetting( * Alpha slider */ if (allowAlpha) { - outline( + outlineBlock( size(w = 15.px, h = 200.px), colorMaxBrightness, thickness = 1.px, 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 2e1a2d6c1..b69d943b9 100644 --- a/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt +++ b/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt @@ -6,8 +6,6 @@ import me.odinmain.OdinMain.mc import me.odinmain.OdinMain.scope import me.odinmain.events.impl.PacketEvent import me.odinmain.events.impl.RoomEnterEvent -import me.odinmain.features.impl.dungeon.LeapMenu -import me.odinmain.features.impl.dungeon.LeapMenu.odinSorting import me.odinmain.features.impl.dungeon.Mimic import me.odinmain.utils.* import me.odinmain.utils.skyblock.PlayerUtils.posX @@ -31,7 +29,6 @@ class Dungeon(val floor: Floor) { val inBoss: Boolean get() = getBoss() var dungeonTeammates: ArrayList = ArrayList(5) var dungeonTeammatesNoSelf: ArrayList = ArrayList(4) - var leapTeammates: ArrayList = ArrayList(4) var dungeonStats = DungeonStats() val currentRoom: Room? get() = ScanUtils.currentRoom val passedRooms: MutableSet get() = ScanUtils.passedRooms @@ -73,7 +70,6 @@ class Dungeon(val floor: Floor) { fun onWorldLoad() { dungeonTeammates = ArrayList() dungeonTeammatesNoSelf = ArrayList() - leapTeammates = ArrayList() puzzles = emptyList() Blessing.entries.forEach { it.current = 0 } } @@ -177,14 +173,5 @@ class Dungeon(val floor: Floor) { private fun updateDungeonTeammates(tabList: List) { dungeonTeammates = getDungeonTeammates(dungeonTeammates, tabList) dungeonTeammatesNoSelf = ArrayList(dungeonTeammates.filter { it.entity != mc.thePlayer }) - - leapTeammates = - when (LeapMenu.type) { - 0 -> ArrayList(odinSorting(dungeonTeammatesNoSelf.sortedBy { it.clazz.priority }).toList()) - 1 -> ArrayList(dungeonTeammatesNoSelf.sortedWith(compareBy({ it.clazz.ordinal }, { it.name }))) - 2 -> ArrayList(dungeonTeammatesNoSelf.sortedBy { it.name }) - 3 -> ArrayList(dungeonTeammatesNoSelf.sortedBy { DungeonUtils.customLeapOrder.indexOf(it.name.lowercase()).takeIf { it != -1 } ?: Int.MAX_VALUE }) - else -> dungeonTeammatesNoSelf - } } } \ No newline at end of file diff --git a/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/DungeonEnums.kt b/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/DungeonEnums.kt index 77005728c..72cbda3fc 100644 --- a/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/DungeonEnums.kt +++ b/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/DungeonEnums.kt @@ -19,7 +19,7 @@ data class DungeonPlayer( val name: String, val clazz: DungeonClass, val clazzLvl: Int = 0, - val skinImage: Image = Image("https://mc-heads.net/avatar/Stivais/32"), + val skinImage: Image = Image("https://mc-heads.net/avatar/Stivais/256"), var entity: EntityPlayer? = null, var isDead: Boolean = false, var deaths: Int = 0 diff --git a/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/DungeonUtils.kt b/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/DungeonUtils.kt index 49f84f958..5c3f732f7 100644 --- a/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/DungeonUtils.kt +++ b/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/DungeonUtils.kt @@ -92,9 +92,6 @@ object DungeonUtils { val dungeonTeammatesNoSelf: ArrayList get() = currentDungeon?.dungeonTeammatesNoSelf ?: ArrayList() - val leapTeammates: ArrayList - get() = currentDungeon?.leapTeammates ?: ArrayList() - val currentDungeonPlayer: DungeonPlayer get() = dungeonTeammates.find { it.name == mc.thePlayer?.name } ?: DungeonPlayer(mc.thePlayer?.name ?: "Unknown", DungeonClass.Unknown, 0, entity = mc.thePlayer) @@ -224,7 +221,6 @@ object DungeonUtils { } private val tablistRegex = Regex("^\\[(\\d+)] (?:\\[\\w+] )*(\\w+) .*?\\((\\w+)(?: (\\w+))*\\)$") - var customLeapOrder: List = emptyList() fun getDungeonTeammates(previousTeammates: ArrayList, tabList: List): ArrayList { for (line in tabList) {