diff --git a/css/deltagreen.css b/css/deltagreen.css index 169296b..a82be46 100644 --- a/css/deltagreen.css +++ b/css/deltagreen.css @@ -13,6 +13,12 @@ cursor: pointer; } +.grid-1col{ + display: grid; + grid-column: span 1 / span 1; + gap: 10px; +} + .grid, .grid-2col { display: grid; @@ -306,6 +312,12 @@ span.max-attribute-value-label{ margin: 5px; } +.typed-skill-flexrow{ + display: flex; + flex-direction: row; + margin: 1px; +} + input.percentile-skill-input{ width: 50px; margin-right: 5px; @@ -324,8 +336,30 @@ input.percentile-skill-input{ margin: 0; } -.typed-skill-flexrow{ +div .simple-centered-flex-div{ display: flex; - flex-direction: row; + align-items: center; +} + +div input.fill-remaining-space{ + flex: 1; margin: 1px; -} \ No newline at end of file + text-align: left; +} + +div span.bio-grid-label{ + margin: 1px; + text-align: left; +} + +.bio-grid-2col{ + display: grid; + grid-template-columns: 100px auto; + align-items: center; +} + +.bio-grid-5col{ + display: grid; + grid-template-columns: 100px auto 20px 100px auto; + align-items: center; +} \ No newline at end of file diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 56f74f3..f0bf9fa 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -142,25 +142,9 @@ export class DeltaGreenActorSheet extends ActorSheet { event.preventDefault(); let targetskill = event.target.getAttribute("data-typeskill"); - let updatedData = duplicate(this.actor.data.data); + //let updatedData = duplicate(this.actor.data.data); - // It sucks, but seems like Foundry and/or Handlebars always converts 'types' from an array to an object... - // As such normal array functions like 'push' won't work. - // So just create an array, add all existing items to it, then update the existing object. - // Handlebars doesn't seem to be broken by this sudden change of type from 'Object' to 'Array'. - let typesArr = []; - let x; - for(x in updatedData.type_skills[targetskill].types){ - if(Number.isNumeric(x)){ - typesArr.push(updatedData.type_skills[targetskill].types[x]); - } - } - - typesArr.push({specialization:"New", proficiency: 0, failure: false}); - - updatedData.type_skills[targetskill].types = typesArr; - - this.actor.update({"data": updatedData}); + this._showNewTypeSkillDialog(targetskill); }); html.find('.btn-remove-typed-skill').click(event => { @@ -171,20 +155,55 @@ export class DeltaGreenActorSheet extends ActorSheet { let typesArr = []; let x; - for(x in updatedData.type_skills[targetskill].types){ + for(x in updatedData.type_skills[targetskill].subskills){ if(Number.isNumeric(x) && x != skillindex){ - typesArr.push(updatedData.type_skills[targetskill].types[x]); + typesArr.push(updatedData.type_skills[targetskill].subskills[x]); } } - updatedData.type_skills[targetskill].types = typesArr; + updatedData.type_skills[targetskill].subskills = typesArr; this.actor.update({"data": updatedData}); - //console.log(targetskill); - //console.log(skillindex); }); } + _showNewTypeSkillDialog(targetskill){ + new Dialog({ + content:`
`, + title: "Add New Skill", + buttons: { + add:{ + label: "Add Skill", + callback: btn =>{ + let newTypeSkillLabel = btn.find("[name='new-type-skill-label']").val(); + this._addNewTypedSkill(targetskill, newTypeSkillLabel); + } + } + } + }).render(true); + } + + _addNewTypedSkill(targetskill, newTypeSkillLabel){ + // It sucks, but seems like Foundry and/or Handlebars somehow converts 'types' from being typed as an array to an object... + // As such, normal array functions like 'push' won't work which makes doing the update difficult... + // So just create an array, add all existing items to it, then use that to update the existing object. + // Handlebars doesn't seem to be broken by this sudden update of the type from 'Object' to 'Array'. + let updatedData = duplicate(this.actor.data.data); + let typesArr = []; + let x; + for(x in updatedData.type_skills[targetskill].subskills){ + if(Number.isNumeric(x)){ + typesArr.push(updatedData.type_skills[targetskill].subskills[x]); + } + } + + typesArr.push({specialization:newTypeSkillLabel, proficiency: 40, failure: false}); + + updatedData.type_skills[targetskill].subskills = typesArr; + + this.actor.update({"data": updatedData}); + } + /** * Handle creating a new Owned Item for the actor using initial data defined in the HTML dataset * @param {Event} event The originating click event @@ -255,6 +274,10 @@ export class DeltaGreenActorSheet extends ActorSheet { let currentBreakingPoint = 0; currentBreakingPoint = this.actor.data.data.sanity.value - this.actor.data.data.statistics.pow.value; + + if(currentBreakingPoint < 0){ + currentBreakingPoint = 0; + } let updatedData = duplicate(this.actor.data.data); updatedData.sanity.currentBreakingPoint = currentBreakingPoint; diff --git a/template.json b/template.json index 551e2da..85091ca 100644 --- a/template.json +++ b/template.json @@ -1,8 +1,7 @@ { "Actor": { "types": [ - "agent", - "npc" + "agent" ], "templates": { "base": { @@ -224,7 +223,7 @@ "art": { "label": "Art", "examples": "Sculpting, Painting, Dance, Music, Etc.", - "types":[ + "subskills":[ { "specialization": "Painting", "proficiency": 0, @@ -235,7 +234,7 @@ "craft": { "label": "Craft", "examples": "Mechanic, Carpentry, Electrical, Microelectronics, Locksmith, Gunsmith, Etc.", - "types":[ + "subskills":[ { "specialization": "Electrical", "proficiency": 0, @@ -246,7 +245,7 @@ "military_science": { "label": "Military Science", "examples": "Land, Air, Sea, Etc.", - "types":[ + "subskills":[ { "specialization": "Land", "proficiency": 0, @@ -257,7 +256,7 @@ "pilot": { "label": "Pilot", "examples": "Airplane, Drone, Small Boat, Ship, Helicopter, Space Shuttle, etc.", - "types":[ + "subskills":[ { "specialization": "Airplane", "proficiency": 0, @@ -268,7 +267,7 @@ "science": { "label": "Science", "examples": "Biology, Chemistry, Physics, Astronomy, Geology, Mathematics, etc.", - "types":[ + "subskills":[ { "specialization": "Biology/Chemistry/Physics/Etc.", "proficiency": 0, @@ -279,7 +278,7 @@ "foreign_languages": { "label": "Foreign Languages", "examples": "Spanish, Yiddish, Aklo, etc.", - "types":[ + "subskills":[ { "specialization": "Spanish", "proficiency": 0, @@ -290,7 +289,7 @@ "other_skills": { "label": "Other Skills, Specialties, or Training", "examples": "Lockpicks, SCUBA Diving, Parachuting, Some Exotic Weapon, etc.", - "types":[ + "subskills":[ { "specialization": "", "proficiency": 0, @@ -311,11 +310,23 @@ "value": 100, "currentBreakingPoint": 101, "adaptations": { - "violence": 0, - "helplessness": 0 + "violence": [ + false, + false, + false + ], + "helplessness": [ + false, + false, + false + ] } }, - "physicalDescription": "", + "physical":{ + "description": "(Physical description of agent)", + "wounds": "", + "firstAidAttempted": false + }, "biography": { "profession": "", "employer": "", diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html index bfb8821..2070dfc 100644 --- a/templates/actor/actor-sheet.html +++ b/templates/actor/actor-sheet.html @@ -72,7 +72,7 @@ ({{numberFormat statistic.x5 decimals=0 sign=false}}%)
- +
@@ -85,8 +85,8 @@ {{!-- Sheet Body --}} @@ -94,9 +94,9 @@ {{!-- Skills Tab --}}
-
+
{{#each data.skills as |skill key|}} -
+
@@ -107,24 +107,21 @@
{{#each data.type_skills as |typeskill key|}} -
- +
+
- -
- {{#each typeskill.types}} + {{#each typeskill.subskills as |subskill index|}}
{{!-- Subtyped Skills take the form: data.type_skills.art.types[0].proficiency where 'types' is an array of object. --}} - - - - + {{this.specialization}} + +
{{/each}} @@ -159,7 +156,29 @@
{{!-- Description Tab --}} -
+
+
+ Sex + + + Age And D.O.B + +
+ +
+ + Employer + + + Nationality + + +
+ +
+ Education + +
{{editor content=data.physicalDescription target="data.physicalDescription" button=true owner=owner editable=editable}}