diff options
author | HiZe_ <superhize@hotmail.com> | 2023-07-19 20:57:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-19 20:57:05 +0200 |
commit | 58d20fe9c2f09790b6e7f1865769b3ebc7ad121c (patch) | |
tree | 908b4129a0391b3b0395cfc31797b6605dbaa285 /src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt | |
parent | 3eb97a2a74833760c2d1fa4b053eff49d94f12ad (diff) | |
download | skyhanni-58d20fe9c2f09790b6e7f1865769b3ebc7ad121c.tar.gz skyhanni-58d20fe9c2f09790b6e7f1865769b3ebc7ad121c.tar.bz2 skyhanni-58d20fe9c2f09790b6e7f1865769b3ebc7ad121c.zip |
Merge pull request #293
* moved formatting stuff into its own class
* started splitting into multiple files
* renamed Formatting file to GhostFormatting
* formatting
* Fixed error when killcombo is over 1000
* save
* added total money made
* fixed detection of bestiary levelup message
* Merge branch 'beta' into ghostcounter_update
* Merge commit 'refs/pull/293/head' of https://github.com/hannibal002/s…
* changed things for money made
* save
* hopefully fixed an error
* Merge branch 'beta' into ghostcounter_update
* fixed error in new command
* fixed error when trying to get combat level
* Merge branch 'hannibal002:beta' into ghostcounter_update
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt index 83430cecb..5fdc63f46 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils -import at.hannibal2.skyhanni.features.misc.GhostCounter +import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostCounter +import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils import io.github.moulberry.notenoughupdates.util.XPInformation @@ -67,42 +68,43 @@ object CombatUtils { /* Must be a better way to do this than repeating the calculateXP function */ - fun calculateETA(){ + fun calculateETA() { lastKillUpdate = System.currentTimeMillis() killGainHourLast = killGainHour val nextLevel = GhostCounter.hidden?.bestiaryNextLevel?.toInt() ?: return val kill = GhostCounter.hidden?.bestiaryCurrentKill?.toInt() ?: return - val sum = GhostCounter.bestiaryData.filterKeys { it <= nextLevel - 1 }.values.sum() + val sum = GhostData.bestiaryData.filterKeys { it <= nextLevel - 1 }.values.sum() val cKill = sum + kill val totalKill = if (GhostCounter.config.showMax) GhostCounter.bestiaryCurrentKill else cKill - if (lastTotalKill > 0){ + if (lastTotalKill > 0) { val delta: Int = totalKill - lastTotalKill - if (delta in 1..19){ + if (delta in 1..19) { gainTimer = GhostCounter.config.pauseTimer killGainQueue.add(0, delta) - while (killGainQueue.size > 30){ + while (killGainQueue.size > 30) { killGainQueue.removeLast() } var totalGain = 0 for (f in killGainQueue) totalGain += f killGainHour = totalGain * (60 * 60) / killGainQueue.size _isKilling = true - }else if(gainTimer > 0){ + } else if (gainTimer > 0) { gainTimer-- killGainQueue.add(0, 0) - while (killGainQueue.size > 30){ + while (killGainQueue.size > 30) { killGainQueue.removeLast() } var totalGain = 0 for (f in killGainQueue) totalGain += f killGainHour = totalGain * (60 * 60) / killGainQueue.size _isKilling = true - }else if (delta <= 0){ + } else if (delta <= 0) { _isKilling = false } } lastTotalKill = totalKill } + /** * Taken from NotEnoughUpdates */ |