Skip to content

Commit

Permalink
fix: update spider's den rain timer (#509)
Browse files Browse the repository at this point in the history
* fix: update spider's den rain time

Updated nextRain time used for calculations to now show correct rain times.

Time used:
Unix (in milliseconds): 1727548440000
Human Time: GMT Saturday, September 28, 2024 6:34:00 PM
Skyblock Time: Year 375, Late Autumn, Day 19

Signed-off-by: L3cache <[email protected]>

* fix: spider's den rain time

Actually fix spider's den rain time feature not showing correct time. Added new variables to make future changes easier with additional helpful comments to further clarify, what each value has to be set to.

Signed-off-by: L3cache <[email protected]>

* Update RainTimer.kt

forgot to update nextRain value, because it was one minute behind

Signed-off-by: L3cache <[email protected]>

* Update RainTimer.kt

Changed `var` to `const val` for compiler optimizations

Signed-off-by: L3cache <[email protected]>

* Update RainTimer.kt

reverted one `const val` to `var` because it's value changes on line 37

Signed-off-by: L3cache <[email protected]>

---------

Signed-off-by: L3cache <[email protected]>
  • Loading branch information
level3cache authored Oct 2, 2024
1 parent f7dc9fe commit 1cef242
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ import gg.skytils.skytilsmod.utils.graphics.colors.CommonColors
* @link https://github.com/PikaFan123/rain-timer
*/
object RainTimer {
var nextRain = 1596552707000
var nextRain = 1727548500000 // Unix-Time of a past rain event start in milliseconds
const val eventCycleTime = 3600000 // Time between two rain event starts in milliseconds
const val eventCooldownTime = 2400000 // Time between rain event end and start in milliseconds

init {
RainTimerGuiElement()
while (nextRain < System.currentTimeMillis()) nextRain += 4850000
while (nextRain < System.currentTimeMillis()) nextRain += eventCycleTime
}

class RainTimerGuiElement : GuiElement(name = "Rain Timer", x = 10, y = 10) {
override fun render() {
if (Utils.inSkyblock && toggled) {
if (nextRain < System.currentTimeMillis()) nextRain += 4850000
val remainingRain = ((nextRain - System.currentTimeMillis()) - 3850000) / 1000L
if (nextRain < System.currentTimeMillis()) nextRain += eventCycleTime
val remainingRain = ((nextRain - System.currentTimeMillis()) - eventCooldownTime) / 1000L
if (remainingRain > 0) {
fr.drawString(
"${remainingRain / 60}:${"%02d".format(remainingRain % 60)}",
Expand Down Expand Up @@ -86,4 +88,4 @@ object RainTimer {
}

}
}
}

0 comments on commit 1cef242

Please sign in to comment.