Skip to content

Commit 97da101

Browse files
Doogie13Avanatiker
andauthored
Added Criticals -> Strict setting for packet crits (#461)
* Added Criticals -> Strict setting for packet crits * Sorry Doogie but i dont like so many empty lines :D Co-authored-by: Constructor <[email protected]>
1 parent b252f97 commit 97da101

File tree

1 file changed

+44
-19
lines changed
  • src/main/kotlin/com/lambda/client/module/modules/combat

1 file changed

+44
-19
lines changed

src/main/kotlin/com/lambda/client/module/modules/combat/Criticals.kt

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.lambda.client.event.SafeClientEvent
55
import com.lambda.client.event.events.CriticalsUpdateWalkingEvent
66
import com.lambda.client.event.events.PacketEvent
77
import com.lambda.client.event.events.PlayerAttackEvent
8+
import com.lambda.client.event.events.PlayerMoveEvent
89
import com.lambda.client.mixin.extension.isInWeb
910
import com.lambda.client.mixin.extension.playerIsOnGround
1011
import com.lambda.client.mixin.extension.playerMoving
@@ -32,6 +33,7 @@ object Criticals : Module(
3233
private val mode by setting("Mode", Mode.EDIT)
3334
private val jumpMotion by setting("Jump Motion", 0.25, 0.1..0.5, 0.01, { mode == Mode.MINI_JUMP }, fineStep = 0.001)
3435
private val attackFallDistance by setting("Attack Fall Distance", 0.1, 0.05..1.0, 0.05, { mode == Mode.MINI_JUMP || mode == Mode.JUMP })
36+
private val strict by setting("Strict", true, visibility = { mode == Mode.PACKET })
3537

3638
private enum class Mode(override val displayName: String) : DisplayEnum {
3739
PACKET("Packet"),
@@ -43,6 +45,7 @@ object Criticals : Module(
4345
private var delayTick = -1
4446
private var target: Entity? = null
4547
private var spoofedY = -1337.0
48+
private var moveTick = 69
4649

4750
override fun isActive(): Boolean {
4851
return isEnabled && !delaying()
@@ -66,30 +69,32 @@ object Criticals : Module(
6669

6770
safeListener<PacketEvent.Send> {
6871
if (it.packet is CPacketAnimation
69-
&& mode != Mode.PACKET
72+
&& mode == Mode.MINI_JUMP || mode == Mode.JUMP
7073
&& delayTick > -1
7174
) {
7275
it.cancel()
7376
return@safeListener
7477
}
7578

76-
if (it.packet is CPacketPlayer
77-
&& mode == Mode.EDIT
78-
) {
79-
// the advantage of this is that it doesn't delay anything and doesn't send extra packets
80-
if (player.onGround) {
81-
if (spoofedY <= 0) {
82-
spoofedY = .01
83-
} else {
84-
spoofedY -= .00001
79+
if (it.packet is CPacketPlayer) {
80+
if (mode == Mode.EDIT) {
81+
// the advantage of this is that it doesn't delay anything and doesn't send extra packets
82+
if (player.onGround) {
83+
if (spoofedY <= 0) {
84+
spoofedY = .01
85+
} else {
86+
spoofedY -= .00001
87+
}
88+
} else spoofedY = -1337.0
89+
90+
it.packet.playerMoving = true
91+
it.packet.playerIsOnGround = false
92+
93+
if (spoofedY >= 0) {
94+
it.packet.playerY += spoofedY
8595
}
86-
} else spoofedY = -1337.0
87-
88-
it.packet.playerMoving = true
89-
it.packet.playerIsOnGround = false
90-
91-
if (spoofedY >= 0) {
92-
it.packet.playerY += spoofedY
96+
} else if (mode == Mode.PACKET && strict && moveTick < 0) {
97+
it.cancel()
9398
}
9499
}
95100
}
@@ -103,8 +108,19 @@ object Criticals : Module(
103108
Mode.PACKET -> {
104109
if (!cooldownReady) return@safeListener
105110

106-
connection.sendPacket(CPacketPlayer.Position(player.posX, player.posY + 0.1, player.posZ, false))
107-
connection.sendPacket(CPacketPlayer.Position(player.posX, player.posY, player.posZ, false))
111+
if (strict) {
112+
connection.sendPacket(CPacketPlayer.Position(player.posX, player.posY + 0.11, player.posZ, false))
113+
connection.sendPacket(CPacketPlayer.Position(player.posX, player.posY + 0.1100013579, player.posZ, false))
114+
connection.sendPacket(CPacketPlayer.Position(player.posX, player.posY + 1.3579E-6, player.posZ, false))
115+
116+
player.motionX = .0
117+
player.motionZ = .0
118+
119+
moveTick = -3
120+
} else {
121+
connection.sendPacket(CPacketPlayer.Position(player.posX, player.posY + 0.1, player.posZ, false))
122+
connection.sendPacket(CPacketPlayer.Position(player.posX, player.posY, player.posZ, false))
123+
}
108124
}
109125
Mode.JUMP -> {
110126
jumpAndCancel(it, cooldownReady, null)
@@ -116,6 +132,14 @@ object Criticals : Module(
116132
}
117133
}
118134

135+
safeListener<PlayerMoveEvent> {
136+
if (++moveTick < 0) {
137+
player.motionX = .0
138+
player.motionY = .0
139+
player.motionZ = .0
140+
}
141+
}
142+
119143
safeListener<TickEvent.ClientTickEvent> { event ->
120144
if (event.phase != TickEvent.Phase.END
121145
|| mode == Mode.PACKET
@@ -139,6 +163,7 @@ object Criticals : Module(
139163

140164
private fun reset() {
141165
delayTick = -1
166+
moveTick = 69
142167
target = null
143168
}
144169

0 commit comments

Comments
 (0)