mirror of https://github.com/kami-blue/client
[fix] AutoLog shouldn't run totem check if player inventory is empty
closes #1854
This commit is contained in:
parent
fbaaaed520
commit
e5cead1975
|
@ -53,7 +53,7 @@ internal object AutoLog : Module(
|
|||
|
||||
when {
|
||||
CombatUtils.getHealthSmart(player) < health -> log(HEALTH)
|
||||
totem && player.allSlots.countItem(Items.TOTEM_OF_UNDYING) < minTotems -> log(TOTEM)
|
||||
totem && checkTotems() -> log(TOTEM)
|
||||
crystals && checkCrystals() -> log(END_CRYSTAL)
|
||||
creeper && checkCreeper() -> {
|
||||
/* checkCreeper() does log() */
|
||||
|
@ -65,6 +65,12 @@ internal object AutoLog : Module(
|
|||
}
|
||||
}
|
||||
|
||||
private fun SafeClientEvent.checkTotems() : Boolean {
|
||||
val slots = player.allSlots
|
||||
return slots.any { it.hasStack }
|
||||
&& slots.countItem(Items.TOTEM_OF_UNDYING) < minTotems
|
||||
}
|
||||
|
||||
private fun SafeClientEvent.checkCrystals(): Boolean {
|
||||
val maxSelfDamage = CombatManager.crystalMap.values.maxByOrNull { it.second }?.second ?: 0.0f
|
||||
return CombatUtils.getHealthSmart(player) - maxSelfDamage < health
|
||||
|
|
Loading…
Reference in New Issue