aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorPhoebe <77941535+catgirlseraid@users.noreply.github.com>2024-05-17 20:51:54 +1200
committerGitHub <noreply@github.com>2024-05-17 10:51:54 +0200
commitc9b76f791542eca8a256a042abc5ad73ec5e2cca (patch)
tree081f898ed85924fe9e7c1fdb20fad84e339f1ab1 /src/main/java/at/hannibal2/skyhanni/features
parentef235edc6a7312c2e3d529e35b610b561c45bc4e (diff)
downloadskyhanni-c9b76f791542eca8a256a042abc5ad73ec5e2cca.tar.gz
skyhanni-c9b76f791542eca8a256a042abc5ad73ec5e2cca.tar.bz2
skyhanni-c9b76f791542eca8a256a042abc5ad73ec5e2cca.zip
Added time tower ending reminder (#1816)
Co-authored-by: SeRaid <77941535+SeRaid743@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt
index cf67d91d3..695d1d480 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt
@@ -21,6 +21,7 @@ object ChocolateFactoryTimeTowerManager {
private val profileStorage get() = ChocolateFactoryAPI.profileStorage
private var lastTimeTowerWarning = SimpleTimeMark.farPast()
+ private var lastTimeTowerReminder = SimpleTimeMark.farPast()
@SubscribeEvent
fun onSecondPassed(event: SecondPassedEvent) {
@@ -33,6 +34,10 @@ object ChocolateFactoryTimeTowerManager {
if (ChocolateFactoryAPI.inChocolateFactory) return
+ if (config.timeTowerReminder) {
+ timeTowerReminder()
+ }
+
val nextCharge = SimpleTimeMark(profileStorage.nextTimeTower)
if (nextCharge.isInPast() && !nextCharge.isFarPast() && currentCharges() < maxCharges()) {
@@ -92,11 +97,32 @@ object ChocolateFactoryTimeTowerManager {
fun timeTowerActive(): Boolean {
val currentTime = profileStorage?.lastDataSave ?: 0
- val endTime = profileStorage?.currentTimeTowerEnds ?: 0
+ val endTime = timeTowerEnds()
return endTime > currentTime
}
+ private fun timeTowerEnds(): Long {
+ return profileStorage?.currentTimeTowerEnds ?: 0
+ }
+
+ private fun timeTowerReminder() {
+ if (lastTimeTowerReminder.passedSince() < 20.seconds) return
+
+ val timeUntil = SimpleTimeMark(timeTowerEnds()).timeUntil()
+ if (timeUntil < 1.minutes && timeUntil.isPositive()) {
+ ChatUtils.clickableChat(
+ "§cYour Time Tower is about to end! " +
+ "Open the Chocolate Factory to avoid wasting the multiplier!",
+ onClick = {
+ HypixelCommands.chocolateFactory()
+ }
+ )
+ SoundUtils.playBeepSound()
+ lastTimeTowerReminder = SimpleTimeMark.now()
+ }
+ }
+
fun timeTowerFullTimemark(): SimpleTimeMark {
val profileStorage = profileStorage ?: return SimpleTimeMark.farPast()
if (timeTowerFull()) return SimpleTimeMark.farPast()