Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update spider's den rain time #509

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
}

}
}
}