diff --git a/.gitignore b/.gitignore index 87b14293e..5ca841444 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ /odinmain/src/main/resources/shaders/glslopt.exe /odinmain/src/main/resources/shaders/output/ /odinmain/src/main/resources/shaders/optimize.bat +.DS_Store diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/kotlin/me/odinmain/features/ModuleManager.kt b/src/main/kotlin/me/odinmain/features/ModuleManager.kt index f4d504dee..72630ec24 100644 --- a/src/main/kotlin/me/odinmain/features/ModuleManager.kt +++ b/src/main/kotlin/me/odinmain/features/ModuleManager.kt @@ -66,7 +66,7 @@ object ModuleManager { //skyblock NoCursorReset, AutoSprint, BlazeAttunement, ChatCommands, DeployableTimer, DianaHelper, Ragnarock, MobSpawn, Splits, WardrobeKeybinds, InvincibilityTimer, ItemsHighlight, PlayerDisplay, - FarmKeys, PetKeybinds, CommandKeybinds, SpringBoots, AbilityTimers, SlotBinds, + FarmKeys, PetKeybinds, CommandKeybinds, SpringBoots, AbilityTimers, SlotBinds, HollowWand, // kuudra BuildHelper, FreshTools, KuudraDisplay, NoPre, PearlWaypoints, RemovePerks, SupplyHelper, TeamHighlight, diff --git a/src/main/kotlin/me/odinmain/features/impl/skyblock/HollowWand.kt b/src/main/kotlin/me/odinmain/features/impl/skyblock/HollowWand.kt new file mode 100644 index 000000000..63ca6e522 --- /dev/null +++ b/src/main/kotlin/me/odinmain/features/impl/skyblock/HollowWand.kt @@ -0,0 +1,96 @@ +package me.odinmain.features.impl.skyblock + +import me.odinmain.clickgui.settings.Setting.Companion.withDependency +import me.odinmain.clickgui.settings.impl.BooleanSetting +import me.odinmain.clickgui.settings.impl.ColorSetting +import me.odinmain.clickgui.settings.impl.NumberSetting +import me.odinmain.features.Module +import me.odinmain.utils.render.Colors +import me.odinmain.utils.render.Renderer +import me.odinmain.utils.runIn +import me.odinmain.utils.skyblock.PlayerUtils +import me.odinmain.utils.skyblock.modMessage +import me.odinmain.utils.skyblock.sendCommand +import net.minecraft.util.Vec3 +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.math.max + +object HollowWand : Module( + name = "Hollow Wand", + description = "Messages and waypoints for hollow wand casting." +) { + private val sendChatMessage by BooleanSetting("Send Message", false, "Sends a message when hollow wand is casted.") + private val showWaypoint by BooleanSetting("Show Waypoint", false, "Shows a waypoint when party hollow wand message is detected.") + private val waypointColor by ColorSetting("Waypoint Color", Colors.MINECRAFT_DARK_RED, desc = "Color of the pool waypoint.").withDependency { showWaypoint } + private val messageSize by NumberSetting("Message Size", 1f, 0.1f, 4f, 0.1f, desc = "The size of the waypoint text.").withDependency { showWaypoint } + + data class CastCoordinate(val x: Double, val y: Double, val z: Double, var radius: Double = 0.0) + private val poolsToRender = mutableListOf() + private val windsToRender = mutableListOf() + + private val incomingHollowRegex = Regex("^Party > (?:\\[[\\wዞ]+\\+*] )?[\\w_]+: (Raging Wind|Ichor Pool) x: (-?\\d+\\.\\d{3}), y: (-?\\d+), z: (-?\\d+\\.\\d{3})$") + private val outgoingHollowRegex = Regex("^Casting Spell: (Raging Wind|Ichor Pool)!$") + + init { + onMessage(outgoingHollowRegex) { + if(!sendChatMessage) return@onMessage + val type = it.groups[1]?.value ?: return@onMessage + sendCommand("pc $type ${PlayerUtils.getPositionString(true)}") + } + + onMessage(incomingHollowRegex) { + if(!showWaypoint) return@onMessage + val type = it.groups[1]?.value ?: return@onMessage + val x = it.groups[2]?.value?.toDouble() ?: return@onMessage + val y = it.groups[3]?.value?.toDouble() ?: return@onMessage + val z = it.groups[4]?.value?.toDouble() ?: return@onMessage + val thisCast = CastCoordinate(x, y, z) + when(type) { + "Raging Wind" -> { + windsToRender.add(thisCast) + if(PlayerUtils.getDistanceTo(x, y, z) <= 25) { + PlayerUtils.alert("Raging Winds", color = Colors.MINECRAFT_RED) + modMessage("Raging Winds applied") + } + } + "Ichor Pool" -> { + poolsToRender.add(thisCast) + runIn(400, true) { + poolsToRender.remove(thisCast) + } + } + } + } + } + + @SubscribeEvent + fun onRenderWorldLast(event: RenderWorldLastEvent) { + if(!showWaypoint) return + val fps = mc.debug?.split(" ")?.get(0)?.toDoubleOrNull() ?: 60.0 + val windIncrement = 25.0 / max(60.0, fps) + + poolsToRender.forEach { pool -> + Renderer.drawCylinder(Vec3(pool.x, pool.y, pool.z), 8, 8, 0.05, 80f, 1f, 0f, 90f, 90f, waypointColor, true) + Renderer.drawStringInWorld("Ichor Pool", Vec3(pool.x, pool.y + 0.5, pool.z), Colors.WHITE, true, 0.03f * messageSize) + } + + windsToRender.toList().forEach { wind -> + wind.radius += windIncrement + if(wind.radius > 25) { + windsToRender.remove(wind) + return@forEach + } + + Renderer.drawCylinder(Vec3(wind.x, wind.y, wind.z), wind.radius, wind.radius, 0.05, 80f, 1f, 0f, 90f, 90f, waypointColor, true) + Renderer.drawStringInWorld("Raging Wind", Vec3(wind.x, wind.y + 0.5, wind.z), Colors.WHITE, true, 0.03f * messageSize) + } + } + + @SubscribeEvent + fun onWorldLoad(event: WorldEvent.Load) { + poolsToRender.clear() + windsToRender.clear() + } +} diff --git a/src/main/kotlin/me/odinmain/utils/skyblock/PlayerUtils.kt b/src/main/kotlin/me/odinmain/utils/skyblock/PlayerUtils.kt index 50a2548eb..b6003f28f 100644 --- a/src/main/kotlin/me/odinmain/utils/skyblock/PlayerUtils.kt +++ b/src/main/kotlin/me/odinmain/utils/skyblock/PlayerUtils.kt @@ -7,10 +7,14 @@ import me.odinmain.utils.postAndCatch import me.odinmain.utils.render.Color import me.odinmain.utils.render.Colors import me.odinmain.utils.render.Renderer +import me.odinmain.utils.round +import me.odinmain.utils.toFixed import net.minecraft.network.play.client.C0EPacketClickWindow import net.minecraft.util.BlockPos import net.minecraft.util.Vec3 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.math.pow +import kotlin.math.sqrt object PlayerUtils { var shouldBypassVolume = false @@ -49,9 +53,21 @@ object PlayerUtils { inline val posY get() = mc.thePlayer?.posY ?: 0.0 inline val posZ get() = mc.thePlayer?.posZ ?: 0.0 - fun getPositionString(): String { - val blockPos = BlockPos(posX, posY, posZ) - return "x: ${blockPos.x}, y: ${blockPos.y}, z: ${blockPos.z}" + fun getPositionString(getSpecificCoordinates: Boolean = false): String { + return if(getSpecificCoordinates) { + "x: ${posX.toFixed(3)}, y: ${posY.toFixed(0)}, z: ${posZ.toFixed(3)}" + } + else { + val blockPos = BlockPos(posX, posY, posZ) + "x: ${blockPos.x}, y: ${blockPos.y}, z: ${blockPos.z}" + } + } + + fun getDistanceTo(x: Double, y: Double, z: Double): Double { + val xDist = (posX - x).pow(2) + val yDist = (posY - y).pow(2) + val zDist = (posZ - z).pow(2) + return sqrt(xDist + yDist + zDist) } private var lastClickSent = 0L