Skip to content

Commit

Permalink
Fixed SendSupplyTime not working
Browse files Browse the repository at this point in the history
Fixed issue of not properly resetting line width
Fixed error with no x Cannon message
Made module toggle in CommandKeybinds work
Fixed CustomTermGui disabling all keyboard clicks
  • Loading branch information
odtheking committed Oct 27, 2024
1 parent 9155bc9 commit db52d24
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ val devCommand = commodore("oddev") {
|currentDungeonPlayer: ${DungeonUtils.currentDungeonPlayer.name}, ${DungeonUtils.currentDungeonPlayer.clazz}, ${DungeonUtils.currentDungeonPlayer.isDead}, ${DungeonUtils.isGhost}
|doorOpener: ${DungeonUtils.doorOpener}
|currentRoom: ${DungeonUtils.currentFullRoom?.room?.data?.name}, roomsPassed: ${DungeonUtils.passedRooms.map { it.room.data.name }}
|Teammates: ${DungeonUtils.dungeonTeammates.joinToString { "${it.clazz.colorCode}${it.name} (${it.clazz})" }}
|Teammates: ${DungeonUtils.dungeonTeammates.joinToString { "§${it.clazz.colorCode}${it.name} (${it.clazz})" }}
|TeammatesNoSelf: ${DungeonUtils.dungeonTeammatesNoSelf.map { it.name }}
|LeapTeammates: ${DungeonUtils.leapTeammates.map { it.name }}
|Blessings: ${Blessing.entries.joinToString { "${it.name}: ${it.current}" }}
Expand Down
5 changes: 0 additions & 5 deletions odinmain/src/main/kotlin/me/odinmain/features/Module.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package me.odinmain.features

import me.odinmain.OdinMain
import me.odinmain.events.impl.ChatPacketEvent
import me.odinmain.features.ModuleManager.executors
import me.odinmain.features.impl.render.ClickGUIModule
import me.odinmain.features.settings.AlwaysActive
Expand Down Expand Up @@ -160,10 +159,6 @@ abstract class Module(
ModuleManager.messageFunctions.add(ModuleManager.MessageFunction(regex, shouldRun, func))
}

fun onMessageCancellable(filter: Regex, shouldRun: () -> Boolean = { alwaysActive || enabled }, func: (ChatPacketEvent) -> Unit) {
ModuleManager.cancellableMessageFunctions.add(ModuleManager.MessageFunctionCancellable(filter, shouldRun, func))
}

fun onWorldLoad(func: () -> Unit) {
ModuleManager.worldLoadFunctions.add(func)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ object ModuleManager {
)

data class MessageFunction(val filter: Regex, val shouldRun: () -> Boolean, val function: (String) -> Unit)
data class MessageFunctionCancellable(val filter: Regex, val shouldRun: () -> Boolean, val function: (ChatPacketEvent) -> Unit)

data class TickTask(var ticksLeft: Int, val function: () -> Unit)

val packetFunctions = mutableListOf<PacketFunction<Packet<*>>>()
val messageFunctions = mutableListOf<MessageFunction>()
val cancellableMessageFunctions = mutableListOf<MessageFunctionCancellable>()
val worldLoadFunctions = mutableListOf<() -> Unit>()
val tickTasks = mutableListOf<TickTask>()
val huds = arrayListOf<HudElement>()
Expand Down Expand Up @@ -120,10 +118,6 @@ object ModuleManager {
messageFunctions.forEach {
if (event.message matches it.filter && it.shouldRun()) it.function(event.message)
}

cancellableMessageFunctions.forEach {
if (event.message matches it.filter && it.shouldRun()) it.function(event)
}
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ object TerminalSolver : Module(
@SubscribeEvent
fun onGuiKeyPress(event: GuiEvent.GuiKeyPressEvent) {
if (currentTerm.type == TerminalTypes.NONE || !enabled || (currentTerm.type == TerminalTypes.MELODY && cancelMelodySolver)) return
if (renderType == 3) event.isCanceled = true // maybe add normal gui keyboard clicking
if (renderType == 3 && (event.keyCode == mc.gameSettings.keyBindDrop.keyCode || event.keyCode in 2..10)) event.isCanceled = true
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object NoPre : Module(
private var preSpot = PreSpot.None
var missing = PreSpot.None

private val partyChatRegex = Regex("^Party > (\\[[^]]*?])? ?(\\w{1,16}): No ?(Triangle|X|Equals|Slash|X Cannon|Square|Shop)!\$")
private val partyChatRegex = Regex("^Party > (\\[[^]]*?])? ?(\\w{1,16}): No ?(Triangle|X|Equals|Slash|xCannon|Square|Shop)!\$")

init {
onMessage("[NPC] Elle: Head over to the main platform, I will join you when I get a bite!", false) {
Expand Down Expand Up @@ -54,7 +54,7 @@ object NoPre : Module(
else if (!second) {
msg = when (preSpot) {
PreSpot.Triangle -> "No Shop!"
PreSpot.X -> "No X Cannon!"
PreSpot.X -> "No xCannon!"
PreSpot.Slash -> "No Square!"
else -> return@onMessage
}
Expand Down Expand Up @@ -104,9 +104,9 @@ object NoPre : Module(

// Slash Missing
PreSpot.Slash -> when (preSpot) {
PreSpot.Triangle -> "Go Square, place on Triangle"
PreSpot.Triangle -> "Go x Cannon"
PreSpot.X -> "Go X Cannon"
PreSpot.Equals -> "Go Square, place on Equals"
PreSpot.Equals -> "Go Square, place on Slash"
PreSpot.Slash -> if (advanced) "Pull Square and X Cannon. Next: collect Shop" else "Pull Square. Next: collect Shop"
else -> ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import me.odinmain.utils.skyblock.KuudraUtils
import me.odinmain.utils.skyblock.KuudraUtils.PreSpot
import me.odinmain.utils.skyblock.modMessage
import net.minecraft.util.Vec3
import net.minecraftforge.client.event.ClientChatReceivedEvent
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.cos
Expand All @@ -29,20 +30,25 @@ object SupplyHelper : Module(
private val sendSupplyTime by BooleanSetting("Send Supply Time", true, description = "Sends a message when a supply is collected.")

private var startRun = 0L

private val supplyPickUpRegex = Regex("(?:\\[[^]]*])? ?(\\w{1,16}) recovered one of Elle's supplies! \\((\\d)/(\\d)\\)")
// https://regex101.com/r/xsDImP/1
init {
onMessage(Regex("\\[NPC] Elle: Okay adventurers, I will go and fish up Kuudra!")) {
startRun = System.currentTimeMillis()
}

onMessageCancellable(Regex("(\\[\\w+])?(\\w+) recovered one of Elle's supplies! \\((\\d)/(\\d)\\)")) {
if (!sendSupplyTime) return@onMessageCancellable
val (name, current, total) = Regex("(\\[\\w+])?(\\w+) recovered one of Elle's supplies! \\((\\d)/(\\d)\\)").find(it.message)?.destructured ?: return@onMessageCancellable
modMessage("$name, §a§lrecovered a supply at ${formatTime((System.currentTimeMillis() - startRun))}!, §r§8($current/$total)", "")
it.isCanceled = true
onMessage(supplyPickUpRegex, { sendSupplyTime && enabled }) {
val (name, current, total) = supplyPickUpRegex.find(it)?.destructured ?: return@onMessage
modMessage("$name, §a§lrecovered a supply in ${formatTime((System.currentTimeMillis() - startRun))}!, §r§8($current/$total)", "")
}
}

@SubscribeEvent
fun onChatMessage(event: ClientChatReceivedEvent) {
if (!KuudraUtils.inKuudra || KuudraUtils.phase != 1 && !sendSupplyTime) return
if (supplyPickUpRegex.matches(event.message.unformattedText)) event.isCanceled = true
}

@SubscribeEvent
fun onWorldRender(event: RenderWorldLastEvent) {
if (!KuudraUtils.inKuudra || KuudraUtils.phase != 1) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@ object CommandKeybinds : Module(
key = null
) {
private val pets by KeybindSetting("Pets", Keyboard.KEY_NONE, description = "Opens the pets menu.").onPress {
if (!enabled) return@onPress
sendCommand("pets")
}
private val storage by KeybindSetting("Storage", Keyboard.KEY_NONE, description = "Opens the storage menu.").onPress {
if (!enabled) return@onPress
sendCommand("storage")
}
private val wardrobe by KeybindSetting("Wardrobe", Keyboard.KEY_NONE, description = "Opens the wardrobe menu.").onPress {
if (!enabled) return@onPress
sendCommand("wardrobe")
}
private val equipment by KeybindSetting("Equipment", Keyboard.KEY_NONE, description = "Opens the equipment menu.").onPress {
if (!enabled) return@onPress
sendCommand("equipment")
}
private val dhub by KeybindSetting("Dungeon Hub", Keyboard.KEY_NONE, description = "Warps to the dungeon hub.").onPress {
if (!enabled) return@onPress
sendCommand("warp dungeon_hub")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ object OutlineUtils {
render(event)
renderFour()
render(event)
glLineWidth(1f)
glPopAttrib()
glPopMatrix()
mc.gameSettings.fancyGraphics = fancyGraphics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ object RenderUtils {
if (smoothLines) GL11.glDisable(GL11.GL_LINE_SMOOTH)

if (!depth) resetDepth()
GL11.glLineWidth(2f)
GL11.glLineWidth(1f)
postDraw()
GlStateManager.popMatrix()
}
Expand All @@ -205,7 +205,7 @@ object RenderUtils {

if (!depth) resetDepth()
GL11.glDisable(GL11.GL_LINE_SMOOTH)
GL11.glLineWidth(2f)
GL11.glLineWidth(1f)
postDraw()
GlStateManager.popMatrix()
}
Expand Down Expand Up @@ -283,6 +283,7 @@ object RenderUtils {
Cylinder().draw(baseRadius.toFloat(), topRadius.toFloat(), height.toFloat(), slices.toInt(), stacks.toInt())

postDraw()
GL11.glLineWidth(1f)
GlStateManager.enableCull()
if (!depth) resetDepth()
GlStateManager.popMatrix()
Expand Down Expand Up @@ -380,7 +381,7 @@ object RenderUtils {
GL11.glEnable(GL11.GL_TEXTURE_2D)

GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f)
GL11.glLineWidth(2f)
GL11.glLineWidth(1f)
GL11.glEnable(GL11.GL_CULL_FACE)

GL11.glEndList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ object RenderUtils2D {
tessellator.draw()

Color.WHITE.bind()
GL11.glLineWidth(1f)
GlStateManager.enableTexture2D()
GlStateManager.disableBlend()
GL11.glDisable(GL11.GL_LINE_SMOOTH)
Expand Down

0 comments on commit db52d24

Please sign in to comment.