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

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Changes from 4 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
const val nextRain = 1727548500000 // Unix-Time of a past rain event start in milliseconds
level3cache marked this conversation as resolved.
Show resolved Hide resolved
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 {
}

}
}
}