From ef0de7aae10e28b1fc23615c46cd3e61c0e679b8 Mon Sep 17 00:00:00 2001
From: Jeremy
Date: Sat, 30 Jul 2022 12:44:18 -0400
Subject: [PATCH] v0.0.6
---
scripts/classes/DieHardVersionNotification.js | 42 ++++++++++++++-----
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/scripts/classes/DieHardVersionNotification.js b/scripts/classes/DieHardVersionNotification.js
index 4914063..9ddacbc 100644
--- a/scripts/classes/DieHardVersionNotification.js
+++ b/scripts/classes/DieHardVersionNotification.js
@@ -1,22 +1,44 @@
+import {dieHardLog} from "../lib/helpers.js";
/*
* Provides a mechanism to send whisper to GM when new version installed.
*/
export default class DieHardVersionNotification {
static checkVersion() {
- if (game.user.isGM && game.user.getFlag('foundry-die-hard', 'versionNotification') !== game.modules.get('foundry-die-hard').data.version) {
- let versionMessage = "Die Hard v0.0.5" +
- "This version includes the following major changes:
" +
- "- Initial release supporting PF2e system
" +
- "- Right-click of fudge icon to globally pause/disable all fudges
" +
- "- Config dialog UI improvements
" +
- "- This super nifty notification!
" +
- "
To report problems:
"
+ let functionLogName = 'DieHardVersionNotification.checkVersion'
+ let notificationVersion = 2
+ if (game.user.isGM && game.user.getFlag('foundry-die-hard', 'versionNotification') !== notificationVersion) {
+ dieHardLog(false, functionLogName + ' - Send version notification');
+ let commonFooter = "To report problems:
"
+ let versionMessage = {
+ 1: "Die Hard v0.0.5" +
+ "This version includes the following major changes:
" +
+ "- Initial release supporting PF2e system
" +
+ "- Right-click of fudge icon to globally pause/disable all fudges
" +
+ "- Config dialog UI improvements
" +
+ "- This super nifty notification!
" +
+ "
",
+ 2: "Die Hard v0.0.6" +
+ "This version includes the following major changes:
" +
+ "- Fixes for PF2e strike attack fudges
" +
+ "- Differentiate raw die rolls vs roll totals
" +
+ "
",
+ }
+ let finalMessage = ""
+ let startVersion = game.user.getFlag('foundry-die-hard', 'versionNotification')
+ dieHardLog(false, functionLogName + ' - startVersion', startVersion, isNaN(startVersion));
+ if (!isNaN(startVersion)) {
+ startVersion = 1
+ }
+ for (let version = startVersion; version <= notificationVersion; version++) {
+ finalMessage += versionMessage[version]
+ }
+ finalMessage += commonFooter
// GM has never seen current version message
- game.settings.get('foundry-die-hard', 'dieHardSettings').system.dmToGm(versionMessage);
+ game.settings.get('foundry-die-hard', 'dieHardSettings').system.dmToGm(finalMessage);
// Update the saved version
- game.user.setFlag('foundry-die-hard', 'versionNotification', game.modules.get('foundry-die-hard').data.version)
+ game.user.setFlag('foundry-die-hard', 'versionNotification', notificationVersion)
}
}
}