Skip to content

Commit 5b9e76e

Browse files
committed
fix autototem spamming tasks sometimes
1 parent 7a5d361 commit 5b9e76e

File tree

1 file changed

+8
-7
lines changed
  • src/main/kotlin/com/lambda/module/modules/combat

1 file changed

+8
-7
lines changed

src/main/kotlin/com/lambda/module/modules/combat/AutoTotem.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ import com.lambda.event.events.TickEvent
2323
import com.lambda.event.listener.SafeListener.Companion.listen
2424
import com.lambda.friend.FriendManager
2525
import com.lambda.interaction.material.StackSelection.Companion.select
26-
import com.lambda.interaction.material.container.ContainerManager.transfer
27-
import com.lambda.interaction.material.container.containers.OffHandContainer
26+
import com.lambda.interaction.request.inventory.InventoryRequest.Companion.inventoryRequest
2827
import com.lambda.module.Module
2928
import com.lambda.module.tag.ModuleTag
30-
import com.lambda.task.RootTask.run
31-
import com.lambda.util.Communication.info
3229
import com.lambda.util.NamedEnum
3330
import com.lambda.util.combat.CombatUtils.hasDeadlyCrystal
3431
import com.lambda.util.combat.DamageUtils.isFallDeadly
@@ -64,9 +61,13 @@ object AutoTotem : Module(
6461

6562
if ((!ignoreWhenHolding || !player.isHolding(Items.TOTEM_OF_UNDYING)) && player.offHandStack.item != Items.TOTEM_OF_UNDYING) {
6663
Items.TOTEM_OF_UNDYING.select()
67-
.transfer(OffHandContainer)
68-
?.finally { if (log) info("Swapped the off-hand item with a totem") }
69-
?.run()
64+
.filterSlots(player.currentScreenHandler.slots)
65+
.takeIf { it.isNotEmpty() }
66+
?.let { totems ->
67+
inventoryRequest {
68+
swap(totems.first().id, 40)
69+
}.submit()
70+
}
7071
}
7172
}
7273
}

0 commit comments

Comments
 (0)