diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-15 17:45:33 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-15 17:45:33 +0200 |
commit | 56dd32cf12cf14583f685e6bb1c874a1623c9e30 (patch) | |
tree | 94ebedf83e4eb13580f04bf871e2c91be25e27cd /src/main/java/at/hannibal2/skyhanni | |
parent | a303f356007d7833a41c73c71524044393e3620c (diff) | |
download | skyhanni-56dd32cf12cf14583f685e6bb1c874a1623c9e30.tar.gz skyhanni-56dd32cf12cf14583f685e6bb1c874a1623c9e30.tar.bz2 skyhanni-56dd32cf12cf14583f685e6bb1c874a1623c9e30.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
2 files changed, 16 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt index fa6d63578..e018933bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt @@ -11,7 +11,7 @@ enum class ItemAbility( var lastActivation: Long = 0L, var specialColor: LorenzColor? = null, var lastItemClick: Long = 0L, - val actionBarDetection: Boolean = true + val actionBarDetection: Boolean = true, ) { //TODO add into repo @@ -49,15 +49,19 @@ enum class ItemAbility( var newVariant = false var internalNames = mutableListOf<String>() - constructor(cooldownInSeconds: Int, vararg alternateInternalNames: String, alternativePosition: Boolean = false) : this("no name", cooldownInSeconds, actionBarDetection = false, alternativePosition = alternativePosition) { + constructor( + cooldownInSeconds: Int, + vararg alternateInternalNames: String, + alternativePosition: Boolean = false, + ) : this("no name", cooldownInSeconds, actionBarDetection = false, alternativePosition = alternativePosition) { newVariant = true internalNames.addAll(alternateInternalNames) internalNames.add(name) } - fun activate(color: LorenzColor? = null, offset: Long = 0L) { + fun activate(color: LorenzColor? = null, customCooldown: Int = (cooldownInSeconds * 1000)) { specialColor = color - lastActivation = System.currentTimeMillis() + offset + lastActivation = System.currentTimeMillis() - ((cooldownInSeconds * 1000) - customCooldown) } fun isOnCooldown(): Boolean = lastActivation + getCooldown() > System.currentTimeMillis() diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index 13af7e369..c7f7d5994 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -141,14 +141,14 @@ class ItemAbilityCooldown { if (message.contains("§lCASTING IN ")) { if (ItemAbility.RAGNAROCK_AXE.specialColor != LorenzColor.WHITE) { - ItemAbility.RAGNAROCK_AXE.activate(LorenzColor.WHITE, -17_000) + ItemAbility.RAGNAROCK_AXE.activate(LorenzColor.WHITE, 3_000) } } else if (message.contains("§lCASTING")) { if (ItemAbility.RAGNAROCK_AXE.specialColor == LorenzColor.WHITE) { - ItemAbility.RAGNAROCK_AXE.activate(LorenzColor.DARK_PURPLE, -17_000) + ItemAbility.RAGNAROCK_AXE.activate(LorenzColor.DARK_PURPLE, 3_000) } } else if (message.contains("§c§lCANCELLED")) { - ItemAbility.RAGNAROCK_AXE.activate(null, -3_000) + ItemAbility.RAGNAROCK_AXE.activate(null, 17_000) } } @@ -221,12 +221,12 @@ class ItemAbilityCooldown { private fun tryHandleNextPhase(ability: ItemAbility, specialColor: LorenzColor) { if (ability == ItemAbility.GYROKINETIC_WAND_RIGHT) { if (specialColor == LorenzColor.BLUE) { - ability.activate(null, -4_000) + ability.activate(null, 4_000) } } if (ability == ItemAbility.RAGNAROCK_AXE) { if (specialColor == LorenzColor.DARK_PURPLE) { - ability.activate(null, -6_000) + ability.activate(null, 14_000) } } } @@ -276,14 +276,14 @@ class ItemAbilityCooldown { ItemAbility.WITHER_CLOAK.activate() } if (message == "§dCreeper Veil §r§cDe-activated!") { - ItemAbility.WITHER_CLOAK.activate(null, -5000L) + ItemAbility.WITHER_CLOAK.activate(null, 5000) } youAlignedOthersPattern.matchMatcher(message) { - ItemAbility.GYROKINETIC_WAND_RIGHT.activate(LorenzColor.BLUE, -4_000) + ItemAbility.GYROKINETIC_WAND_RIGHT.activate(LorenzColor.BLUE, 6_000) } if (message == "§eYou §r§aaligned §r§eyourself!") { - ItemAbility.GYROKINETIC_WAND_RIGHT.activate(LorenzColor.BLUE, -4_000) + ItemAbility.GYROKINETIC_WAND_RIGHT.activate(LorenzColor.BLUE, 6_000) } } |