@@ -20,6 +20,7 @@ package com.lambda.module.modules.combat
2020import com.lambda.config.AutomationConfig.Companion.setDefaultAutomationConfig
2121import com.lambda.config.applyEdits
2222import com.lambda.config.groups.Targeting
23+ import com.lambda.context.SafeContext
2324import com.lambda.event.events.PlayerPacketEvent
2425import com.lambda.event.events.TickEvent
2526import com.lambda.event.listener.SafeListener.Companion.listen
@@ -31,13 +32,16 @@ import com.lambda.interaction.material.container.containers.MainHandContainer
3132import com.lambda.module.Module
3233import com.lambda.module.tag.ModuleTag
3334import com.lambda.task.RootTask.run
35+ import com.lambda.threading.runSafe
3436import com.lambda.threading.runSafeAutomated
3537import com.lambda.util.NamedEnum
3638import com.lambda.util.item.ItemStackUtils.attackDamage
39+ import com.lambda.util.item.ItemStackUtils.attackSpeed
3740import com.lambda.util.item.ItemStackUtils.equal
3841import com.lambda.util.math.random
3942import com.lambda.util.player.SlotUtils.hotbarAndStorage
4043import net.minecraft.entity.LivingEntity
44+ import net.minecraft.item.ItemStack
4145import net.minecraft.util.Hand
4246
4347object KillAura : Module(
@@ -48,6 +52,7 @@ object KillAura : Module(
4852 // Interact
4953 private val rotate by setting(" Rotate" , true ).group(Group .General )
5054 private val swap by setting(" Swap" , true , " Swap to the item with the highest damage" ).group(Group .General )
55+ private val damageMode by setting(" Damage Mode" , DamageMode .DPS ).group(Group .General )
5156 private val attackMode by setting(" Attack Mode" , AttackMode .Cooldown ).group(Group .General )
5257 private val cooldownShrink by setting(" Cooldown Offset" , 0 , 0 .. 5 , 1 ) { attackMode == AttackMode .Cooldown }.group(Group .General )
5358 private val hitDelay1 by setting(" Hit Delay 1" , 2.0 , 0.0 .. 20.0 , 1.0 ) { attackMode == AttackMode .Delay }.group(Group .General )
@@ -76,6 +81,12 @@ object KillAura : Module(
7681 Delay
7782 }
7883
84+ @Suppress(" unused" )
85+ enum class DamageMode (override val displayName : String , val block : SafeContext .(ItemStack ) -> Double ) : NamedEnum {
86+ DPS (" Damage Per Second" , { player.attackDamage(stack = it) * player.attackSpeed(stack = it) }),
87+ Total (" Hit Damage" , { player.attackDamage(stack = it) })
88+ }
89+
7990 init {
8091 setDefaultAutomationConfig {
8192 applyEdits {
@@ -95,7 +106,9 @@ object KillAura : Module(
95106 listen<TickEvent .Pre > {
96107 target?.let { entity ->
97108 if (swap) {
98- val selection = selectStack().sortByDescending { player.attackDamage(stack = it) }
109+ val selection = selectStack().sortByDescending {
110+ damageMode.block(this , it)
111+ }
99112
100113 if (! selection.bestItemMatch(player.hotbarAndStorage).equal(player.mainHandStack))
101114 selection.transfer(MainHandContainer )?.run ()
0 commit comments