From 5795c42808944cf4b33e3089381d8304e00b5602 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Fri, 12 Mar 2021 15:03:35 +0100 Subject: [PATCH] #5 Languages/Subcultures management --- module/actor-sheet.js | 10 ++++--- styles/simple.css | 3 +- templates/actor-sheet.html | 48 ++++++++++++++++++++++++++++-- templates/item-language-sheet.html | 22 ++++++++++++++ 4 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 templates/item-language-sheet.html diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 2ad579b..0f75153 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -47,12 +47,14 @@ export class SoSActorSheet extends ActorSheet { data.data.currentWounds = this.actor.computeCurrentWounds(); data.data.totalWounds = this.actor.data.data.scores.wound.value; - data.data.subculture = this.actor.data.items.find( item => item.type == 'subculture'); - data.data.geneline = this.actor.data.items.find( item => item.type == 'geneline'); + data.data.subcultureList = this.actor.data.items.filter( item => item.type == 'subculture'); + if ( data.data.subculture != "" ) { // background.subculture contains the main subculture ID + data.data.mainSubculture = data.data.subcultureList.find( subc => subc._id == data.data.subculture); + } + data.data.languageList = this.actor.data.items.filter( item => item.type == 'language'); + data.data.geneline = this.actor.data.items.find( item => item.type == 'geneline'); data.data.editStatSkill = this.options.editStatSkill; console.log("stats", data); - //data.stats = duplicate(this.actor.stats); - //data.scores = duplicate(this.actor.scores); return data; } diff --git a/styles/simple.css b/styles/simple.css index ca51d61..c619063 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -618,6 +618,7 @@ ul, li { flex-grow: 0; margin-right: 0.25rem; } +.genelang-column, .skill-column { flex-direction: column; align-content: flex-start; @@ -631,7 +632,7 @@ ul, li { font-weight: bold; flex-grow: 0; } - +.genelang-label, .skill-label, .conseq-label, .generic-label { diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 1905dd5..a583569 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -274,8 +274,14 @@
  • - - + +
  • @@ -305,6 +311,44 @@
  • +
    +
    +
    + +
    + Familiar Subcultures +
      + {{#each data.subcultureList as |subculture key|}} +
    • + + {{subculture.name}} +
      + + +
      +
    • + {{/each}} +
    +
    +
    + Known Languages +
      + {{#each data.languageList as |language key|}} +
    • + + {{language.name}} +
      + + +
      +
    • + {{/each}} +
    +
    +
    +
    + +

    diff --git a/templates/item-language-sheet.html b/templates/item-language-sheet.html new file mode 100644 index 0000000..2049b1e --- /dev/null +++ b/templates/item-language-sheet.html @@ -0,0 +1,22 @@ +
    +
    + +
    +

    +
    +
    + + {{!-- Sheet Body --}} +
    + +
    +
    + +
    + {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} +
    +
    +
    + +
    +