Skip to content

Commit

Permalink
fix: spider's den rain time
Browse files Browse the repository at this point in the history
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 <85846799+level3cache@users.noreply.github.com>
  • Loading branch information
level3cache authored Sep 28, 2024
1 parent 626a682 commit a65daa7
Showing 1 changed file with 6 additions and 4 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 = 1727548440000
var nextRain = 1727548440000 // Unix-Time of a past rain event start in milliseconds
var eventCycleTime = 3600000 // Time between two rain event starts in milliseconds
var 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

0 comments on commit a65daa7

Please sign in to comment.