Last active
December 24, 2024 00:57
-
-
Save 7H3LaughingMan/dfac0caafeb18cf5d37152c58dd358f1 to your computer and use it in GitHub Desktop.
Alchemist Exploration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cumulativeDelta = 0; | |
Hooks.on("updateWorldTime", (worldTime, delta) => { | |
if (game.combat || !game.user.character) { | |
cumulativeDelta = 0; | |
return; | |
} | |
if (delta < 0) { | |
cumulativeDelta = 0; | |
delta = 0; | |
} else if (delta > 3600) { | |
delta = 3600; | |
} | |
cumulativeDelta += delta; | |
if (cumulativeDelta >= 600) { | |
const rounds = Math.floor(cumulativeDelta / 600); | |
const versatileVials = game.user.character.getResource("versatileVials"); | |
if (versatileVials) { | |
const vials = game.user.character.level >= 9 ? 3 : 2; | |
await game.user.character.updateResource("versatileVials", versatileVials.value + vials * rounds); | |
} | |
cumulativeDelta %= 600; | |
} | |
}); | |
ui.notifications.info("Created Alchemist Exploration Hook"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment