Skip to content

Commit

Permalink
feat(legacy): RenderAimPointBox option for KillAura. (#5560)
Browse files Browse the repository at this point in the history
  • Loading branch information
mems01 authored Feb 7, 2025
1 parent fbcf872 commit 4ab1656
Showing 1 changed file with 42 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import net.ccbluex.liquidbounce.utils.rotation.RotationUtils.isRotationFaced
import net.ccbluex.liquidbounce.utils.rotation.RotationUtils.isVisible
import net.ccbluex.liquidbounce.utils.rotation.RotationUtils.rotationDifference
import net.ccbluex.liquidbounce.utils.rotation.RotationUtils.searchCenter
import net.ccbluex.liquidbounce.utils.rotation.RotationUtils.serverRotation
import net.ccbluex.liquidbounce.utils.rotation.RotationUtils.setTargetRotation
import net.ccbluex.liquidbounce.utils.rotation.RotationUtils.toRotation
import net.ccbluex.liquidbounce.utils.simulation.SimulatedPlayer
Expand Down Expand Up @@ -212,10 +213,8 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R) {
private val hitDelayTicks by int("HitDelayTicks", 1, 1..5) { useHitDelay }

private val generateClicksBasedOnDist by boolean("GenerateClicksBasedOnDistance", false)
private val cpsMultiplier by intRange("CPS-Multiplier", 1..2, 1..10)
{ generateClicksBasedOnDist }
private val distanceFactor by floatRange("DistanceFactor", 5F..10F, 1F..10F)
{ generateClicksBasedOnDist }
private val cpsMultiplier by intRange("CPS-Multiplier", 1..2, 1..10) { generateClicksBasedOnDist }
private val distanceFactor by floatRange("DistanceFactor", 5F..10F, 1F..10F) { generateClicksBasedOnDist }

private val generateSpotBasedOnDistance by boolean("GenerateSpotBasedOnDistance", false) { options.rotationsActive }

Expand Down Expand Up @@ -247,8 +246,9 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R) {

private val lowestBodyPointToTarget: String by lowestBodyPointToTargetValue

private val horizontalBodySearchRange by floatRange("HorizontalBodySearchRange", 0f..1f, 0f..1f)
{ options.rotationsActive }
private val horizontalBodySearchRange by floatRange(
"HorizontalBodySearchRange", 0f..1f, 0f..1f
) { options.rotationsActive }

private val fov by float("FOV", 180f, 0f..180f)

Expand All @@ -275,7 +275,7 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R) {
"TicksLateToSwing", 4, 0..20
) { swing && failSwing && swingWhenTicksLate.isActive() && options.rotationsActive }
private val renderBoxOnSwingFail by boolean("RenderBoxOnSwingFail", false) { failSwing }
private val renderBoxColor = ColorSettingsInteger(this, "RenderBoxColor") { renderBoxOnSwingFail }.with(0, 255, 255)
private val renderBoxColor = ColorSettingsInteger(this, "RenderBoxColor") { renderBoxOnSwingFail }.with(Color.CYAN)
private val renderBoxFadeSeconds by float("RenderBoxFadeSeconds", 1f, 0f..5f) { renderBoxOnSwingFail }

// Inventory
Expand All @@ -289,14 +289,16 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R) {
// Visuals
private val mark by choices("Mark", arrayOf("None", "Platform", "Box", "Circle"), "Circle").subjective()
private val fakeSharp by boolean("FakeSharp", true).subjective()
private val renderAimPointBox by boolean("RenderAimPointBox", false).subjective()
private val aimPointBoxColor by color("AimPointBoxColor", Color.CYAN) { renderAimPointBox }.subjective()
private val aimPointBoxSize by float("AimPointBoxSize", 0.1f, 0f..0.2F) { renderAimPointBox }.subjective()

// Circle options
private val circleRainbow by boolean("CircleRainbow", false) { mark == "Circle" }.subjective()

// TODO: replace this with color value
private val colors = ColorSettingsInteger(
this,
"CircleColor"
this, "CircleColor"
) { mark == "Circle" && !circleRainbow }.with(132, 102, 255, 100)//.subjective()
private val fillInnerCircle by boolean("FillInnerCircle", false) { mark == "Circle" }.subjective()
private val withHeight by boolean("WithHeight", true) { mark == "Circle" }.subjective()
Expand All @@ -306,10 +308,7 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R) {
private val animateCircleY by boolean("AnimateCircleY", true) { fillInnerCircle || withHeight }.subjective()
private val circleYRange by floatRange("CircleYRange", 0F..0.5F, 0F..2F) { animateCircleY }.subjective()
private val duration by float(
"Duration",
1.5F,
0.5F..3F,
suffix = "Seconds"
"Duration", 1.5F, 0.5F..3F, suffix = "Seconds"
) { animateCircleY || animateHeight }.subjective()

// Box option
Expand Down Expand Up @@ -511,6 +510,8 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R) {
val onRender3D = handler<Render3DEvent> {
handleFailedSwings()

drawAimPointBox()

if (cancelRun) {
target = null
hittable = false
Expand Down Expand Up @@ -748,7 +749,10 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R) {
var bestValue: Double? = null

for (entity in theWorld.loadedEntityList) {
if (entity !is EntityLivingBase || !isSelected(entity, true) || switchMode && entity.entityId in prevTargetEntities) continue
if (entity !is EntityLivingBase || !isSelected(
entity, true
) || switchMode && entity.entityId in prevTargetEntities
) continue

val distance = Backtrack.runWithNearestTrackedDistance(entity) { thePlayer.getDistanceToEntityBox(entity) }

Expand Down Expand Up @@ -858,8 +862,7 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R) {
val boundingBox = entity.hitBox.offset(prediction)
val (currPos, oldPos) = player.currPos to player.prevPos

val simPlayer =
SimulatedPlayer.fromClientPlayer(RotationUtils.modifiedInput)
val simPlayer = SimulatedPlayer.fromClientPlayer(RotationUtils.modifiedInput)

simPlayer.rotationYaw = (currentRotation ?: player.rotation).yaw

Expand Down Expand Up @@ -1205,6 +1208,29 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R) {
}
}

private fun drawAimPointBox() {
val player = mc.thePlayer ?: return
val target = this.target ?: return

if (!renderAimPointBox) {
return
}

val f = aimPointBoxSize.toDouble()

val box = AxisAlignedBB(0.0, 0.0, 0.0, f, f, f)

val renderManager = mc.renderManager

val rotationVec = player.interpolatedPosition(player.prevPos, player.eyeHeight) + getVectorForRotation(
serverRotation.lerpWith(currentRotation ?: player.rotation, mc.timer.renderPartialTicks)
) * player.getDistanceToEntityBox(target).coerceAtMost(range.toDouble())

val offSetBox = box.offset(rotationVec - renderManager.renderPos)

RenderUtils.drawAxisAlignedBB(offSetBox, aimPointBoxColor)
}

/**
* Check if run should be cancelled
*/
Expand Down

0 comments on commit 4ab1656

Please sign in to comment.