diff --git a/odinmain/src/main/kotlin/me/odinmain/commands/impl/TermsimCommand.kt b/odinmain/src/main/kotlin/me/odinmain/commands/impl/TermsimCommand.kt index cccebbab2..98ccf12cf 100644 --- a/odinmain/src/main/kotlin/me/odinmain/commands/impl/TermsimCommand.kt +++ b/odinmain/src/main/kotlin/me/odinmain/commands/impl/TermsimCommand.kt @@ -2,12 +2,15 @@ package me.odinmain.commands.impl import me.odinmain.commands.commodore import me.odinmain.features.impl.floor7.p3.termsim.StartGui +import me.odinmain.features.impl.floor7.p3.termsim.openTerminal import me.odinmain.utils.ServerUtils import kotlin.math.round val termSimCommand = commodore("termsim") { - runs { ping: Long? -> - StartGui.open(ping ?: 0) + runs { ping: Long?, amount: Long? -> + if (amount == null) StartGui.open(ping ?: 0) + else openTerminal(ping ?: 0, amount) + } suggests { listOf(round(ServerUtils.averagePing).toLong().toString()) } diff --git a/odinmain/src/main/kotlin/me/odinmain/features/ModuleManager.kt b/odinmain/src/main/kotlin/me/odinmain/features/ModuleManager.kt index c533e6bcf..a753e74a1 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/ModuleManager.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/ModuleManager.kt @@ -5,6 +5,7 @@ import me.odinmain.events.impl.* import me.odinmain.features.impl.dungeon.* import me.odinmain.features.impl.dungeon.puzzlesolvers.PuzzleSolvers import me.odinmain.features.impl.floor7.NecronDropTimer +import me.odinmain.features.impl.floor7.TerminalSimulator import me.odinmain.features.impl.floor7.WitherDragons import me.odinmain.features.impl.floor7.p3.* import me.odinmain.features.impl.kuudra.* @@ -118,7 +119,8 @@ object ModuleManager { WarpCooldown, CopyChat, DVD, - PlayerDisplay + PlayerDisplay, + TerminalSimulator ) init { diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/TerminalSimulator.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/TerminalSimulator.kt new file mode 100644 index 000000000..3a1a66255 --- /dev/null +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/TerminalSimulator.kt @@ -0,0 +1,29 @@ +package me.odinmain.features.impl.floor7 + +import me.odinmain.features.Category +import me.odinmain.features.Module +import me.odinmain.features.settings.AlwaysActive +import me.odinmain.features.settings.impl.NumberSetting +import me.odinmain.features.settings.impl.StringSetting +import me.odinmain.utils.skyblock.sendCommand + +@AlwaysActive +object TerminalSimulator : Module( + name = "Terminal Simulator", + description = "Simulates a floor 7 terminal from phase 3.", + category = Category.FLOOR7 +) { + private val ping: String by StringSetting("Ping", "0", description = "Ping of the terminal.") + private val repetitiveTerminals: Int by NumberSetting("Random Terminals", 1, 1, 100, description = "Amount of random terminals.") + + override fun onKeybind() { + sendCommand(if (repetitiveTerminals == 1) "termsim $ping" else "termsim $ping $repetitiveTerminals", clientSide = true) + this.toggle() + } + + override fun onEnable() { + sendCommand(if (repetitiveTerminals == 1) "termsim $ping" else "termsim $ping $repetitiveTerminals", clientSide = true) + super.onEnable() + toggle() + } +} \ No newline at end of file diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/SameColor.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/Rubix.kt similarity index 98% rename from odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/SameColor.kt rename to odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/Rubix.kt index 005bf9b2b..73ccd941a 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/SameColor.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/Rubix.kt @@ -8,7 +8,7 @@ import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack import kotlin.math.floor -object SameColor : TermSimGui( +object Rubix : TermSimGui( "Change all to same color!", 45 ) { diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/StartGui.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/StartGui.kt index 6aa13abae..f0e2990bf 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/StartGui.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/StartGui.kt @@ -69,7 +69,7 @@ object StartGui : TermSimGui( StartGui.open(ping) } 11 -> CorrectPanes.open(ping) - 12 -> SameColor.open(ping) + 12 -> Rubix.open(ping) 13 -> InOrder.open(ping) 14 -> StartsWith(StartsWith.letters.shuffled().first()).open(ping) 15 -> SelectAll(EnumDyeColor.entries.getRandom().name.replace("_", " ").uppercase()).open(ping) diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/TermSimGui.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/TermSimGui.kt index 56c0d1994..44d0e920f 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/TermSimGui.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/p3/termsim/TermSimGui.kt @@ -5,7 +5,9 @@ import me.odinmain.OdinMain.display import me.odinmain.config.Config import me.odinmain.events.impl.GuiEvent import me.odinmain.events.impl.PacketSentEvent +import me.odinmain.features.impl.floor7.p3.TerminalTypes import me.odinmain.features.settings.impl.NumberSetting +import me.odinmain.utils.getRandom import me.odinmain.utils.postAndCatch import me.odinmain.utils.round import me.odinmain.utils.runIn @@ -15,6 +17,7 @@ import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraft.inventory.InventoryBasic import net.minecraft.inventory.Slot +import net.minecraft.item.EnumDyeColor import net.minecraft.item.Item import net.minecraft.item.ItemStack import net.minecraft.network.play.client.C0EPacketClickWindow @@ -30,6 +33,7 @@ open class TermSimGui(val name: String, val size: Int, private val inv: Inventor private var inventoryBefore = arrayOf() private var startTime = 0L protected var ping = 0L + private var consecutive = 0L private var doesAcceptClick = true private val minecraft get() = Minecraft.getMinecraft() // this is needed here for some fucking reason and I have no clue but the OdinMain one is sometimes (but not always) null when open() runs ???? (this took like 30 minutes to figure out) @@ -37,7 +41,7 @@ open class TermSimGui(val name: String, val size: Int, private val inv: Inventor this.inventorySlots.inventorySlots.subList(0, size).forEach { it.putStack(blackPane) } // override } - fun open(ping: Long = 0L) { + fun open(ping: Long = 0L, const: Long = 0L) { create() minecraft.thePlayer?.inventory?.mainInventory?.let { inventoryBefore = it.clone() @@ -46,6 +50,7 @@ open class TermSimGui(val name: String, val size: Int, private val inv: Inventor minecraft.thePlayer?.inventory?.mainInventory?.set(i, null) } this.ping = ping + this.consecutive = const - 1 display = this startTime = System.currentTimeMillis() GuiEvent.GuiLoadedEvent(name, inventorySlots as ContainerChest).postAndCatch() @@ -59,13 +64,14 @@ open class TermSimGui(val name: String, val size: Int, private val inv: Inventor Config.save() } else modMessage("§a$name solved in §6${time}s §a!") resetInv() - StartGui.open(ping) + if (this.consecutive > 0) openTerminal(ping, consecutive) else StartGui.open(ping) } open fun slotClick(slot: Slot, button: Int) {} override fun onGuiClosed() { resetInv() + doesAcceptClick = true super.onGuiClosed() } @@ -107,4 +113,16 @@ open class TermSimGui(val name: String, val size: Int, private val inv: Inventor if (slot.stack?.item == pane && slot.stack?.metadata == 15 || clickedButton != 4) return delaySlotClick(slot, 0) } +} + +fun openTerminal(ping: Long = 0L, const: Long = 0L) { + + when (listOf(TerminalTypes.PANES, TerminalTypes.RUBIX, TerminalTypes.ORDER, TerminalTypes.STARTS_WITH, TerminalTypes.SELECT).random()) { + TerminalTypes.PANES -> CorrectPanes.open(ping, const) + TerminalTypes.RUBIX -> Rubix.open(ping, const) + TerminalTypes.ORDER -> InOrder.open(ping, const) + TerminalTypes.STARTS_WITH -> StartsWith(StartsWith.letters.shuffled().first()).open(ping, const) + TerminalTypes.SELECT -> SelectAll(EnumDyeColor.entries.getRandom().name.replace("_", " ").uppercase()).open(ping, const) + TerminalTypes.NONE -> {} + } } \ No newline at end of file diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/render/DVD.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/render/DVD.kt index f5952bb76..ca6ebe06f 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/render/DVD.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/render/DVD.kt @@ -2,9 +2,13 @@ package me.odinmain.features.impl.render import me.odinmain.features.Category import me.odinmain.features.Module +import me.odinmain.features.settings.impl.BooleanSetting import me.odinmain.features.settings.impl.NumberSetting import me.odinmain.features.settings.impl.StringSetting -import me.odinmain.utils.render.* +import me.odinmain.utils.render.Color +import me.odinmain.utils.render.getMCTextHeight +import me.odinmain.utils.render.mcText +import me.odinmain.utils.render.roundedRectangle import me.odinmain.utils.skyblock.PlayerUtils import me.odinmain.utils.skyblock.modMessage import net.minecraft.client.gui.ScaledResolution @@ -20,8 +24,9 @@ object DVD : Module( ) { private val boxWidth: Int by NumberSetting("Box Width", 50, 0, 150, 1, description = "Width of the DVD box.") private val boxHeight: Int by NumberSetting("Box Height", 50, 0, 150, 1, description = "Height of the DVD box.") + private val roundedCorners: Boolean by BooleanSetting("Rounded Corners", true, description = "Whether the DVD box should have rounded corners.") - private val text: String by StringSetting("Text", "DVD", description = "Text to display on the DVD box.") + private val text: String by StringSetting("Text", "ODVD", description = "Text to display on the DVD box.") private val textScale: Float by NumberSetting("Text Scale", 1.5f, 0.1f, 2f, 0.1f, description = "Scale of the text.") private val speed: Long by NumberSetting("Speed", 10, 1, 20, 1, description = "Speed of the DVD box.") @@ -42,7 +47,7 @@ object DVD : Module( @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (event.type != RenderGameOverlayEvent.ElementType.ALL) return - roundedRectangle(x, y, boxWidth, boxHeight, color, 9f) + roundedRectangle(x, y, boxWidth, boxHeight, color, if (roundedCorners) 12f else 0f) mcText(text, x + boxWidth / 2, y + boxHeight / 2 - getMCTextHeight() * textScale / 2 , textScale, color, true) } @@ -67,7 +72,7 @@ object DVD : Module( } if ((x <= 0 || x + boxWidth >= screenWidth) && (y <= 0 || y + boxHeight >= screenHeight)) { - modMessage("DVD hit a corner!") + modMessage("$text hit a corner!") PlayerUtils.playLoudSound("note.pling", 100f, 1f) } }