let name = values.character_name;
let origVersion = parseFloat(values.version)||1.0;
let statValue = 0;
-
+
attributes.theSheetAvatar = values.character_avatar;
-
+
// Version Checks
// Check for unversioned sheets
if (values.validateMay23 == undefined) {
// if no points spent, then it's a new sheet
if (parseInt(values.totalCharacterCost)||0 != 0)
origVersion = 1.0;
-
+
attributes.validateMay23 = 1;
}
let version = origVersion;
@@ -13272,7 +13337,7 @@
attributes.hiddenBasicEndurance = Math.max(1, heroRoundLow(hiddenBasicEndurance));
version = 1.1;
}
-
+
if (version < 2.1) {
values = await _getAttrs(["whisperToGM"]);
if (values.whisperToGM||0 == "on")
@@ -13503,6 +13568,18 @@
Version:
setAttrs(attributes);
});
+
+ // Open with first tab (thanks to GiGs).
+ // Make sure delete readiness is off and delete checks are clear.
+ on("sheet:opened", function() {
+ clearDeleteChecks();
+
+ setAttrs({
+ sheetTab: "characteristics",
+ activateDeleteChecks: 0
+ });
+ });
+
// Show the selected sheet tab. This operation works via a proxy variable to make the CSS easier.
const buttonlist = ["characteristics","skills","powers","complications","gear","options"];
@@ -16955,18 +17032,50 @@
Version:
});
- // Show carried equipment checks.
- on("change:checkCarried", function() {
- getAttrs(["checkCarried"], function(values) {
+ // Show carried equipment checks or delete items marked for deletion.
+ // DANGER: Risk of data loss.
+ on("change:checkCarried change:activateDeleteChecks", function() {
+ getAttrs(["checkCarried", "activateDeleteChecks", "equipDelete01", "equipDelete02", "equipDelete03", "equipDelete04", "equipDelete05", "equipDelete06", "equipDelete07", "equipDelete08", "equipDelete09", "equipDelete10", "equipDelete11", "equipDelete12", "equipDelete13", "equipDelete14", "equipDelete15", "equipDelete16"], function(values) {
var attributes = new Object();
+ var equipId = "";
- attributes.equipmentChecks = (values.checkCarried === "on") ? "true" : "false";
+ if (values.activateDeleteChecks === "on") {
+ attributes.equipmentChecks = "delete";
+
+ // Clear all delete checks for safety.
+ clearDeleteChecks();
+ } else {
+ attributes.equipmentChecks = (values.checkCarried === "on") ? "carry" : "move";
+
+ for (var i = 1; i <= maxEquipmentNum; i++) {
+ equipId = String(i).padStart(2,'0');
+
+ if (values["equipDelete"+equipId] === "on") {
+ attributes["equipText"+equipId] = "";
+ attributes["equipMass"+equipId] = "";
+ attributes["equipDelete"+equipId] = 0;
+ }
+ }
+ }
setAttrs(attributes);
});
});
+ function clearDeleteChecks() {
+ var attributes = new Object();
+ var itemId = "";
+
+ for (var i = 1; i <= maxEquipmentNum; i++) {
+ itemId = String(i).padStart(2,'0');
+ attributes["equipDelete"+itemId] = 0;
+ }
+
+ setAttrs(attributes);
+ }
+
+
/* Gear Tab sum up equipment weight */
on("change:liftWeight change:optionCarryAllSets change:armorEND01 change:armorEND02 change:armorEND03 change:armorEND04 change:armorCarried01 change:armorCarried02 change:armorCarried03 change:armorCarried04 change:armorMass01 change:armorMass01 change:armorMass02 change:armorMass03 change:armorMass04 change:shieldCarried change:shieldMass change:weaponCarried01 change:weaponCarried02 change:weaponCarried03 change:weaponCarried04 change:weaponCarried05 change:weaponMass01 change:weaponMass02 change:weaponMass03 change:weaponMass04 change:weaponMass05 change:equipMass01 change:equipMass02 change:equipMass03 change:equipMass04 change:equipMass05 change:equipMass06 change:equipMass07 change:equipMass08 change:equipMass09 change:equipMass10 change:equipMass11 change:equipMass12 change:equipMass13 change:equipMass14 change:equipMass15 change:equipMass16 change:equipCarried01 change:equipCarried02 change:equipCarried03 change:equipCarried04 change:equipCarried05 change:equipCarried06 change:equipCarried07 change:equipCarried08 change:equipCarried09 change:equipCarried10 change:equipCarried11 change:equipCarried12 change:equipCarried13 change:equipCarried14 change:equipCarried15 change:equipCarried16", function () {
// Add the masses of all items of equipment.
@@ -17111,12 +17220,6 @@