diff --git a/lang/en.json b/lang/en.json index 6a772b5..8f6b274 100644 --- a/lang/en.json +++ b/lang/en.json @@ -7,7 +7,6 @@ "TypeWeapon": "Weapon", "TypeShield": "Shield", "TypeArmor": "Armor", - "TypeSkill": "Skill", "TypeSpell": "Spell", "TypeModule": "Module", "TypeMoney": "Money", diff --git a/modules/avd12-item-sheet.js b/modules/avd12-item-sheet.js index 50de955..07c37e0 100644 --- a/modules/avd12-item-sheet.js +++ b/modules/avd12-item-sheet.js @@ -121,6 +121,7 @@ export class Avd12ItemSheet extends ItemSheet { async _onDrop(event) { const levelIndex = Number($(event.toElement).data("level-index")) + const choiceIndex = Number($(event.toElement).data("choice-index")) let data = event.dataTransfer.getData('text/plain') let dataItem = JSON.parse(data) let item = fromUuidSync(dataItem.uuid) @@ -133,7 +134,7 @@ export class Avd12ItemSheet extends ItemSheet { } if (this.object.type == "module" && __ALLOWED_MODULE_TYPES[item.type]) { let levels = duplicate(this.object.system.levels) - levels[levelIndex].features[item.id] = duplicate(item) + levels[levelIndex].choices[choiceIndex].features[item.id] = duplicate(item) this.object.update({ 'system.levels': levels }) return } @@ -202,27 +203,27 @@ export class Avd12ItemSheet extends ItemSheet { html.find('.add-module-level').click(ev => { let levels = duplicate(this.object.system.levels) - levels.push({ features: {} }) + levels.push({ choices: [ {selected: false, features: {} }, {selected: false, features: {} } ] }) this.object.update({ 'system.levels': levels }) }) html.find('.module-feature-delete').click(ev => { let levels = duplicate(this.object.system.levels) let levelIndex = Number($(ev.currentTarget).parents(".item").data("level-index")) + let choiceIndex = Number($(ev.currentTarget).parents(".item").data("choice-index")) let featureId = $(ev.currentTarget).parents(".item").data("feature-id") - levels[levelIndex].features[featureId] = undefined + levels[levelIndex].choices[choiceIndex].features[featureId] = undefined this.object.update({ 'system.levels': levels }) }) - html.find('.feature-level-selected').change(ev => { + html.find('.choice-level-selected').change(ev => { let levels = duplicate(this.object.system.levels) let levelIndex = Number($(ev.currentTarget).parents(".item").data("level-index")) - let featureId = $(ev.currentTarget).parents(".item").data("feature-id") - for (let id in levels[levelIndex].features) { - let feature = levels[levelIndex].features[id] - feature.system.selected = false // Everybody to false + let choiceIndex = Number($(ev.currentTarget).parents(".item").data("choice-index")) + for (let choice of levels[levelIndex].choices) { + choice.selected = false // Everybody to false } - levels[levelIndex].features[featureId].system.selected = ev.currentTarget.value + levels[levelIndex].choices[choiceIndex].selected = ev.currentTarget.value this.object.update({ 'system.levels': levels }) }) } diff --git a/modules/avd12-item.js b/modules/avd12-item.js index f044ffd..d56dc62 100644 --- a/modules/avd12-item.js +++ b/modules/avd12-item.js @@ -1,7 +1,7 @@ import { Avd12Utility } from "./avd12-utility.js"; export const defaultItemImg = { - skill: "systems/fvtt-avd12/images/icons/skill1.webp", + //skill: "systems/fvtt-avd12/images/icons/skill1.webp", armor: "systems/fvtt-avd12/images/icons/chest2.webp", shield: "systems/fvtt-avd12/images/icons/shield2.webp", weapon: "systems/fvtt-avd12/images/icons/weapon2.webp", diff --git a/modules/avd12-utility.js b/modules/avd12-utility.js index c58ccf0..019d6d4 100644 --- a/modules/avd12-utility.js +++ b/modules/avd12-utility.js @@ -41,6 +41,9 @@ export class Avd12Utility { Handlebars.registerHelper('mul', function (a, b) { return parseInt(a) * parseInt(b); }) + Handlebars.registerHelper('add', function (a, b) { + return parseInt(a) + parseInt(b); + }) } /*-------------------------------------------- */ @@ -71,6 +74,15 @@ export class Avd12Utility { bonusList.push( key + "." + bonus ) } } + for(let key in game.system.model.Actor.character.attributes) { + let attrs = game.system.model.Actor.character.attributes[key] + for(let skillKey in attrs.skills) { + bonusList.push( key + ".skills." + skillKey + ".modifier" ) + } + } + for(let key in game.system.model.Actor.character.universal.skills) { + bonusList.push( "universal.skills." + key + ".modifier" ) + } return bonusList } diff --git a/system.json b/system.json index 99a680c..8bc6ad3 100644 --- a/system.json +++ b/system.json @@ -9,7 +9,8 @@ { "lang": "en", "name": "English", - "path": "lang/en.json" + "path": "lang/en.json", + "flags": {} } ], "authors": [ @@ -26,7 +27,6 @@ "maximum": "10" }, "id": "fvtt-avd12", - "packs": [], "primaryTokenAttribute": "secondary.health", "secondaryTokenAttribute": "secondary.delirium", "socket": true, diff --git a/template.json b/template.json index 094b5ff..81bfcd3 100644 --- a/template.json +++ b/template.json @@ -26,7 +26,21 @@ "value": 0, "bonuseffect": 0, "mod": 0, - "col": 1 + "col": 1, + "skills": { + "athletics": { + "modifier": 0, + "good": false + }, + "block": { + "modifier": 0, + "good": false + }, + "strength": { + "modifier": 0, + "good": false + } + } }, "agility": { "label": "Agility", @@ -34,7 +48,21 @@ "value": 0, "bonuseffect": 0, "col": 1, - "mod": 0 + "mod": 0, + "skills": { + "acrobatics": { + "modifier": 0 , + "good": false + }, + "stealth": { + "modifier": 0, + "good": false + }, + "dodge": { + "modifier": 0, + "good": false + } + } }, "willpower": { "label": "Willpower", @@ -42,7 +70,21 @@ "value": 0, "bonuseffect": 0, "col": 1, - "mod": 0 + "mod": 0, + "skills": { + "concentration": { + "modifier": 0, + "good": false + }, + "endurance": { + "modifier": 0 , + "good": false + }, + "resistance": { + "modifier": 0, + "good": false + } + } }, "knowledge": { "label": "Knowledge", @@ -50,7 +92,29 @@ "value": 0, "bonuseffect": 0, "col": 1, - "mod": 0 + "mod": 0, + "skills": { + "wilderness": { + "modifier": 0, + "good": false + }, + "academic": { + "modifier": 0, + "good": false + }, + "arcanum": { + "modifier": 0, + "good": false + }, + "medicine": { + "modifier": 0, + "good": false + }, + "thievery": { + "modifier": 0, + "good": false + } + } }, "social": { "label": "Social", @@ -58,7 +122,37 @@ "value": 0, "bonuseffect": 0, "col": 1, - "mod": 0 + "mod": 0, + "skills": { + "persuasion": { + "modifier": 0, + "good": false + }, + "insight": { + "modifier": 0, + "good": false + }, + "performance": { + "modifier": 0, + "good": false + }, + "animals": { + "modifier": 0, + "good": false + } + } + } + }, + "universal": { + "skills": { + "search": { + "modifier": 0, + "good": false + }, + "initiative": { + "modifier": 0, + "good": false + } } }, "size": { @@ -220,7 +314,6 @@ }, "Item": { "types": [ - "skill", "spell", "armor", "shield", @@ -290,15 +383,12 @@ } }, "action": { - "selected": false, "description": "" }, "reaction": { - "selected": false, "description": "" }, "freeaction": { - "selected": false, "description": "" }, "stance": { @@ -310,12 +400,6 @@ "computebonus": false, "bonusdata": "", "bonusvalue": 0, - "selected": false, - "description": "" - }, - "skill": { - "attribute": "", - "value": 0, "description": "" }, "spell": { diff --git a/templates/items/item-module-sheet.hbs b/templates/items/item-module-sheet.hbs index f29617c..fef02da 100644 --- a/templates/items/item-module-sheet.hbs +++ b/templates/items/item-module-sheet.hbs @@ -6,46 +6,62 @@ - {{> systems/fvtt-avd12/templates/items/partial-item-nav.hbs}} + {{> systems/fvtt-avd12/templates/items/partial-item-nav.hbs builder=true}} {{!-- Sheet Body --}}
{{> systems/fvtt-avd12/templates/items/partial-item-description.hbs}} - +
- -
-
    - {{#each system.levels as |level index|}} -
    -
  • - -
  • -
  • -
    -
  • - - {{#each level.features as |feature id|}} -
  • - - - -
    - -
    -
  • - {{/each}} - {{/each}} - -
  • - -
  • - -
+ TODO : The tre of module choices will be displayed here for players, with the "selected" option only
+ {{#if isGM}} +
+ +
+
    + {{#each system.levels as |level index|}} +
    +
  • +

    Level {{add index 1}}

    +
  • + +
      + {{#each level.choices as |choice choiceIndex|}} +
    • +

      Level choice {{add choiceIndex 1}}

    • +
    • +
      + +
      +   + + +
    • + {{#each choice.features as |feature id|}} +
    • + + +
      + +
      +
    • + {{/each}} + {{/each}} +
    + {{/each}} + +
  • + +
  • + +
+
+ {{/if}} +
diff --git a/templates/items/item-skill-sheet.hbs b/templates/items/item-skill-sheet.hbs deleted file mode 100644 index d436af9..0000000 --- a/templates/items/item-skill-sheet.hbs +++ /dev/null @@ -1,41 +0,0 @@ -
-
- -
-

-
-
- - {{> systems/fvtt-avd12/templates/items/partial-item-nav.hbs}} - - - {{!-- Sheet Body --}} -
- - {{> systems/fvtt-avd12/templates/items/partial-item-description.hbs}} - -
- -
-
    -
  • - - - -
  • - -
  • - - -
  • - -
-
-
- -
-
diff --git a/templates/items/partial-item-nav.hbs b/templates/items/partial-item-nav.hbs index 95b52cd..66a739f 100644 --- a/templates/items/partial-item-nav.hbs +++ b/templates/items/partial-item-nav.hbs @@ -2,4 +2,7 @@