From aea07cadf48d3d114a75550b35ad542bc7ee5475 Mon Sep 17 00:00:00 2001 From: fredhicks Date: Sat, 22 May 2021 17:03:27 -0400 Subject: [PATCH] Settings support for preconfiguring column groupings for combinable skills Settings support for preconfiguring column groupings for combinable skills --- Fate/FateOmni.html | 92 ++++++++++++++++++++++++++++++++++++------- Fate/sheet.json | 47 +++++++++++++--------- Fate/translation.json | 2 + 3 files changed, 108 insertions(+), 33 deletions(-) diff --git a/Fate/FateOmni.html b/Fate/FateOmni.html index f987476d89..c056fb7cd8 100644 --- a/Fate/FateOmni.html +++ b/Fate/FateOmni.html @@ -34,9 +34,19 @@
- : - -
+ : + +
+
+
+ : + +
+
+
+ : + +
: @@ -44,14 +54,9 @@
- : - -
-
-
- : - -
+ : + +
@@ -2073,6 +2078,8 @@ var gamesets = { consequences: [], conditions: [], skills: [], + combos: [[],[],[]], + combosnames: [], settings: {} }, ngen: { @@ -3174,10 +3181,11 @@ var loadGame = function(key) { if ( key === "custom" ) { getAttrs( - [ "custom-aspects", "custom-consequences", "custom-skills", "custom-stress", "custom-conditions" ], + [ "custom-aspects", "custom-consequences", "custom-skills", "custom-stress", "custom-conditions", "custom-combos" ], function(c) { var aspects = c["custom-aspects"].trim(); var skills = c["custom-skills"].trim(); + var combos = c["custom-combos"].trim(); var consequences = c["custom-consequences"].trim(); var conditions = c["custom-conditions"].trim(); var stresses = c["custom-stress"].trim(); @@ -3188,6 +3196,41 @@ var loadGame = function(key) { set.skills = skills.toString().split(/\s*,\s*/); set.settings["SkillStyle"] = "list"; // So it'll display something at all } + if ( combos !== "" ) { + var tempsplit = []; + set.combos = combos.toString().split(/\s*;\s*/); // column groups are separated by semicolons + set.combosnames = ["","",""]; // ZOD + if ( typeof set.combos[0] !== "undefined" && set.combos[0] !== "" ) { + set.combos[0] = set.combos[0].toString().split(/\s*,\s*/); // split up the comma separated skills in the column, make it an array entry + } + if ( typeof set.combos[1] !== "undefined" && set.combos[1] !== "" ) { + set.combos[1] = set.combos[1].toString().split(/\s*,\s*/); // split up the comma separated skills in the column, make it an array entry + } + if ( typeof set.combos[2] !== "undefined" && set.combos[2] !== "" ) { + set.combos[2] = set.combos[2].toString().split(/\s*,\s*/); // split up the comma separated skills in the column, make it an array entry + } + tempsplit = set.combos[0][0].toString().split(/\s*:\s*/); + if(typeof tempsplit[1] !== "undefined" && tempsplit[1] !== "") { + log("got a column label: " + tempsplit[0]); + // Then we've got the column label in tempsplit[0] and the actual skill name in tempsplit[1] + set.combosnames[0] = tempsplit[0]; + set.combos[0][0] = tempsplit[1]; + } + tempsplit = set.combos[1][0].toString().split(/\s*:\s*/); + if(typeof tempsplit[1] !== "undefined" && tempsplit[1] !== "") { + log("got a column label: " + tempsplit[0]); + // Then we've got the column label in tempsplit[0] and the actual skill name in tempsplit[1] + set.combosnames[1] = tempsplit[0]; + set.combos[1][0] = tempsplit[1]; + } + tempsplit = set.combos[1][0].toString().split(/\s*:\s*/); + if(typeof tempsplit[1] !== "undefined" && tempsplit[1] !== "") { + log("got a column label: " + tempsplit[0]); + // Then we've got the column label in tempsplit[0] and the actual skill name in tempsplit[1] + set.combosnames[2] = tempsplit[0]; + set.combos[2][0] = tempsplit[1]; + } + } if ( consequences !== "" ) { var cons = consequences.toString().split(/\s*,\s*/); set.consequences = []; @@ -3677,6 +3720,14 @@ var addSkills = function(values) { } var attrs = { addskills: "" }; + if ( typeof values.combosnames === "object" ) { + // ZOD combocol1, 2, 3 + for(var i=0; i < values.combosnames.length; i++) { + var colnum = i+1; + attrs["combocol"+colnum] = values.combosnames[i]; + } + } + getSectionIDs("skills", function(currentskills) { var skillFilter = {}; @@ -3709,7 +3760,20 @@ var addSkills = function(values) { var skillid = "repeating_skills_" + newid + "_skill"; attrs[skillid] = skillname; attrs["repeating_skills_" + newid + "_rating"] = 0; - attrs["repeating_skills_" + newid + "_column"] = 1; + attrs["repeating_skills_" + newid + "_column"] = 1; // ZOD ZOD ZOD ZOD ZOD ZOD ZOD ZOD + if ( typeof values.combos === "object" ) { + for(var x=0;x < values.combos.length;x++) { + var stopnow = false; + for(var y=0;y < values.combos[x].length;y++) { + if ( skillname === values.combos[x][y] ) { + attrs["repeating_skills_" + newid + "_column"] = x+1; + stopnow = true; break; + } + } + if (stopnow) { break; } + } + } + // loadSkills() does this work too, but this makes sure that it won't have weird gaps if the rating attribute is encountered before the skill skillFilter[skillname] = true; skillNameByID[skillid] = skillname; @@ -4660,7 +4724,7 @@ on("clicked:repeating_swaps:loadswap", function(e) { // their at-rest state is empty anyway. const attributes = [ - "character_name", "uninitialized", "SheetOptions", "Show-Aspects", "Show-Combinable", "Show-Conditions", "Show-Consequences", "Show-Corruption", "Show-Diceprompts", "Show-Extras", "Show-FP", "Show-Logo", "Show-Modes", "Show-Notes", "Show-Packages", "Show-Powers", "Show-Refresh", "Show-Roles", "Show-RollableAspects", "Show-Skills", "Show-Skillswaps", "Show-Stress", "Show-Stunts", "Show-TempAspects", "EditAspects", "EditCombos", "EditConditions", "EditConsequences", "EditExtras", "EditModes", "EditNotes", "EditPackages", "EditPowers", "EditRoles", "EditSkills", "EditStress", "EditStunts", "EditSwaps", "EditTempAspects", "aspectlist", "combomulti", "combotally", "combotext", "combocol1", "combocol2", "combocol3", "corruption", "custom-aspects", "custom-conditions", "custom-consequences", "custom-skills", "custom-stress", "focused", "fp", "lastswapped", "pronouns", "refresh", "rolllist", "rolltally", "setgame", "skillcount", "SkillStyle", "specialized", "stuntcount", "theme" + "character_name", "uninitialized", "SheetOptions", "Show-Aspects", "Show-Combinable", "Show-Conditions", "Show-Consequences", "Show-Corruption", "Show-Diceprompts", "Show-Extras", "Show-FP", "Show-Logo", "Show-Modes", "Show-Notes", "Show-Packages", "Show-Powers", "Show-Refresh", "Show-Roles", "Show-RollableAspects", "Show-Skills", "Show-Skillswaps", "Show-Stress", "Show-Stunts", "Show-TempAspects", "EditAspects", "EditCombos", "EditConditions", "EditConsequences", "EditExtras", "EditModes", "EditNotes", "EditPackages", "EditPowers", "EditRoles", "EditSkills", "EditStress", "EditStunts", "EditSwaps", "EditTempAspects", "aspectlist", "combomulti", "combotally", "combotext", "combocol1", "combocol2", "combocol3", "corruption", "custom-aspects", "custom-combos", "custom-conditions", "custom-consequences", "custom-skills", "custom-stress", "focused", "fp", "lastswapped", "pronouns", "refresh", "rolllist", "rolltally", "setgame", "skillcount", "SkillStyle", "specialized", "stuntcount", "theme" ]; const fieldsets = { diff --git a/Fate/sheet.json b/Fate/sheet.json index 8b71ea302b..358718b7bc 100644 --- a/Fate/sheet.json +++ b/Fate/sheet.json @@ -234,13 +234,31 @@ "descriptiontranslationkey": "custom-aspects-desc" }, { - "attribute": "custom-conditions", - "displayname": "Custom Conditions", - "displaytranslationkey": "custom-conditions", + "attribute": "custom-skills", + "displayname": "Custom Skill List", + "displaytranslationkey": "custom-skills", "type": "text", "value": "", - "description": "Enter a list separated by commas, with each entry in this format (not including the quotes): \"Label:Length\", e.g., \"Indebted:5\". You may optionally include values for each box separated by spaces after the length, e.g., \"Doomed:1 6\". You must select the Custom Build option up top for this to be used.", - "descriptiontranslationkey": "custom-conditions-desc" + "description": "Enter a list separated by commas. You must select the Custom Build option up top for this to be used.", + "descriptiontranslationkey": "custom-skills-desc" + }, + { + "attribute": "custom-combos", + "displayname": "Custom Combinable Skill Columns", + "displaytranslationkey": "custom-combos-columns", + "type": "text", + "value": "", + "description": "You must define the skills in the skill list, before categorizing them into columns here. Separate skills by commas and columns (up to 3) by semicolons: \"Skill, Skill; Skill, Skill\", e.g., \"Body, Mind; Air, Earth, Fire, Water\" for two columns skills. If each column has a label, put that at the start of each list followed by a colon, e.g., \"Self: Body, Mind; Element: Air, Earth, Fire, Water\", Make sure to enable Combinable Skills. You must select the Custom Build option up top for this to be used.", + "descriptiontranslationkey": "custom-combos-desc" + }, + { + "attribute": "custom-stress", + "displayname": "Custom Stress Tracks", + "displaytranslationkey": "custom-stress", + "type": "text", + "value": "", + "description": "Enter a list separated by commas, with each entry in this format (not including the quotes): \"Label:Default Length\", e.g., \"Social:2\". You may optionally include values for each box (including ones beyond the default length) separated by spaces after the length, e.g., \"Social:2 1 2 3 4 5 6\". You must select the Custom Build option up top for this to be used.", + "descriptiontranslationkey": "custom-stress-desc" }, { "attribute": "custom-consequences", @@ -252,22 +270,13 @@ "descriptiontranslationkey": "custom-consequences-desc" }, { - "attribute": "custom-skills", - "displayname": "Custom Skill List", - "displaytranslationkey": "custom-skills", + "attribute": "custom-conditions", + "displayname": "Custom Conditions", + "displaytranslationkey": "custom-conditions", "type": "text", "value": "", - "description": "Enter a list separated by commas. You must select the Custom Build option up top for this to be used.", - "descriptiontranslationkey": "custom-skills-desc" - }, - { - "attribute": "custom-stress", - "displayname": "Custom Stress Tracks", - "displaytranslationkey": "custom-stress", - "type": "text", - "value": "", - "description": "Enter a list separated by commas, with each entry in this format (not including the quotes): \"Label:Default Length\", e.g., \"Social:2\". You may optionally include values for each box (including ones beyond the default length) separated by spaces after the length, e.g., \"Social:2 1 2 3 4 5 6\". You must select the Custom Build option up top for this to be used.", - "descriptiontranslationkey": "custom-stress-desc" + "description": "Enter a list separated by commas, with each entry in this format (not including the quotes): \"Label:Length\", e.g., \"Indebted:5\". You may optionally include values for each box separated by spaces after the length, e.g., \"Doomed:1 6\". You must select the Custom Build option up top for this to be used.", + "descriptiontranslationkey": "custom-conditions-desc" } ], "legacy": true diff --git a/Fate/translation.json b/Fate/translation.json index fae1df60a0..b8ac83a5a8 100644 --- a/Fate/translation.json +++ b/Fate/translation.json @@ -31,6 +31,8 @@ "cost": "Cost", "Crafts": "Crafts", "custom-track": "Custom Track (?-?-?)", + "custom-combos-columns": "Custom Combinable Skill Columns", + "custom-combos-desc": "You must define the skills in the skill list, before categorizing them into columns here. Separate skills by commas and columns (up to 3) by semicolons: \"Skill, Skill; Skill, Skill\", e.g., \"Body, Mind; Air, Earth, Fire, Water\" for two columns skills. If each column has a label, put that at the start of each list followed by a colon, e.g., \"Self: Body, Mind; Element: Air, Earth, Fire, Water\", Make sure to enable Combinable Skills. You must select the Custom Build option up top for this to be used.", "Deceive": "Deceive", "del-skills": "Remove Skillset", "desc": "Description",