+
+ v4.02
(2022-03-30)
+
+
+
+ Fixed the handling of secret (whispered) rolls so that it works across tabs and different roll types. Also, it no longer resets when opening the sheet. An upgrade function will ensure setting stays same as before.
+
+
+ Please note an upcoming release will fix the Default Sheet Settings, and it seems like there is no way to prevent the game default settings from overriding the local settings for each sheet. This change will be announced later, and will require you to reset your sheet configuraiton if different from the game default.
+
+
+
v4.01
(2022-03-20)
@@ -2875,7 +2887,7 @@
{{#rollGreater() stress-dice 0}}
- Panic:
+ Stress:
{{/rollGreater() stress-dice 0}}
{{#rollLess() stress-dice 1}}
@@ -3029,7 +3041,7 @@
Success:
- Panic:
+ Stress:
{{/stress-dice}}
{{^stress-dice}}
@@ -3290,10 +3302,13 @@
config_notice: 1
});
break;
+ case actual < float(4.02) :
+ clog(`New version upgrade needed. Sheet version: ${sheet}, actual: ${actual}`);
+ upg_4_02();
case actual < sheet :
// This can be use as example of upgrade handling, use specific versions in the case logic to handle version specific upgrade of attributes, e.g. actual < 2.10 :
// Any upgrade handling needs to be done above this one, and may set the actual variable to be same as sheet to avoid doing the below setAttrs twice.
- clog(`New version identified. New char: ${newchar}, sheet version: ${sheet}, actual: ${actual}`);
+ clog(`Updating version. Sheet version: ${sheet}, actual: ${actual}`);
// Add reference to upgrade function here, if needed, e.g. upgrade_to_2.24()
setAttrs({
version: sheet,
@@ -3305,8 +3320,32 @@
}
});
});
-
-
+ const upg_4_02 = () => {
+ //clog("==== Upgrading to version 4.02 ====");
+ getAttrs(['config_apirolls', 'secret_roll_api','secret_roll', 'config_apirolls', 'config_advencumbrance'], (values) => {
+ // // // Secret Rolls // // //
+ const sa = values.secret_roll_api,
+ s = values.secret_roll,
+ api = values.config_apirolls;
+ var val = "";
+ clog(`upgrading secret rolls. secret api: ${sa}, secret rolls : ${s}, api enabled : ${api}`);
+ clog(`upgrading secret rolls. secret api: ${!!sa}, secret rolls : ${!!s}, api enabled : ${!!api}`);
+ if ( (api == "on" || api == 1) && typeof sa !== "undefined" ) {
+ val = ( sa == "1" || sa == "!alienrw" || sa == "w" ) ? 1 : 0;
+ } else {
+ val = ( s == "1" || s == "/w gm" ) ? 1 : 0;
+ }
+ clog(`secret roll new : ${val}`);
+ const r = ( val == 1 || val == "1" ) ? "/w gm" : "",
+ a = ( val == 1 || val == "1" ) ?"!alienrw" : "!alienr";
+ clog(`Secret roll ${r}, secret api ${a}`);
+ setAttrs({
+ secret_roll: val,
+ roll_command: r,
+ roll_command_api: a
+ });
+ });
+ }
// Parsed Roll, triggered from sheet. Need to add logic and attributes for pushing rolls, keeping this for future additions.
const rollFirst = async (ev) => {
@@ -3327,7 +3366,7 @@
for(let i = 1; i <= total; i++) { baseStr += "[[1d6]] "; }
for(let i = 1; i <= stress; i++) { stressStr += "[[1d6]] "; }
- let rollBase = `@{secret_roll} &{template:aliens} {{character-name=${attrs.character_name} }} {{roll-name=${rollName} }} {{base-dice=${baseStr} }} {{stress-dice=${stressStr} }} {{passthroughdata=[[0]]}} {{buttonlabel=Push Roll}} {{buttonlink=pushroll}}`;
+ let rollBase = `@{roll_command} &{template:aliens} {{character-name=${attrs.character_name} }} {{roll-name=${rollName} }} {{base-dice=${baseStr} }} {{stress-dice=${stressStr} }} {{passthroughdata=[[0]]}} {{buttonlabel=Push Roll}} {{buttonlink=pushroll}}`;
let firstRoll = await startRoll(rollBase);
// rollValue = firstRoll.results.roll1.result;
clog(`First roll data: ${JSON.stringify(firstRoll)}`);
@@ -3380,19 +3419,20 @@
});
*/
- on('change:secret_roll_api sheet:opened', (ev) => {
- getAttrs(['secret_roll_api', 'roll_command'], (values) => {
- var s = values.secret_roll_api;
- var r = "";
+ on('change:secret_roll', (ev) => {
+ getAttrs(['secret_roll', 'roll_command', 'roll_command_api', ], (values) => {
+ clog(`Secret roll update: ${JSON.stringify(ev)}`);
+ const s = values.secret_roll;
+ var r = "/w gm",
+ a = "!alienrw";
+ clog("Testing secret rolls: "+ !( s == "0" || !s ));
if ( s == "0" || !s ) {
- s = "!alienr";
- } else {
- s = "!alienrw"
- r = "/w gm";
- }
+ r = "";
+ a = "!alienr";
+ }
setAttrs({
- roll_command: s,
- secret_roll: r
+ roll_command: r,
+ roll_command_api: a
});
});
});