diff --git a/src/lang/en.json b/src/lang/en.json index 0c48871..a48e864 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -109,7 +109,11 @@ "OSE.items.Melee": "Melee", "OSE.items.Missile": "Missile", "OSE.items.Slow": "Slow", + + "OSE.spells.Memorized": "Memorized", + "OSE.spells.Cast": "Cast", "OSE.spells.Range": "Range", + "OSE.spells.Slots": "Slots", "OSE.spells.Class": "Class", "OSE.spells.Duration": "Duration", "OSE.spells.Level": "Level", diff --git a/src/module/actor/actor-sheet.js b/src/module/actor/actor-sheet.js index aaad751..a1417e5 100644 --- a/src/module/actor/actor-sheet.js +++ b/src/module/actor/actor-sheet.js @@ -39,11 +39,18 @@ export class OseActorSheet extends ActorSheet { [[], [], [], [], []] ); + // Sort spells by level + var sortedSpells = {}; + for (var i = 0; i < spells.length; i++) { + let lvl = spells[i].data.lvl + if (!sortedSpells[lvl]) sortedSpells[lvl] = []; + sortedSpells[lvl].push(spells[i]); + } // Assign and return data.inventory = inventory; data.weapons = weapons; data.armors = armors; - data.spells = spells; + data.spells = sortedSpells; data.abilities = abilities; } @@ -55,6 +62,29 @@ export class OseActorSheet extends ActorSheet { actorObject.rollSave(save, { event: event }); }); + //Toggle Spells + html.find(".item-cast").click(async (ev) => { + const li = $(ev.currentTarget).parents(".item"); + const item = this.actor.getOwnedItem(li.data("itemId")); + await this.actor.updateOwnedItem({ + _id: li.data("itemId"), + data: { + cast: !item.data.data.cast, + }, + }); + }); + //Toggle Equipment + html.find(".item-memorize").click(async (ev) => { + const li = $(ev.currentTarget).parents(".item"); + const item = this.actor.getOwnedItem(li.data("itemId")); + await this.actor.updateOwnedItem({ + _id: li.data("itemId"), + data: { + memorized: !item.data.data.memorized, + }, + }); + }); + super.activateListeners(html); } diff --git a/src/scss/actor-base.scss b/src/scss/actor-base.scss index b085386..189ded6 100644 --- a/src/scss/actor-base.scss +++ b/src/scss/actor-base.scss @@ -10,9 +10,6 @@ .panel { border: 1px solid $colorDark; - &.spells { - border: 0; - } .panel-title { color: whitesmoke; background: $colorDark; diff --git a/src/scss/character.scss b/src/scss/character.scss index 84e0103..f32a585 100644 --- a/src/scss/character.scss +++ b/src/scss/character.scss @@ -21,10 +21,8 @@ .inventory { overflow: auto; height: 520px; - .items-section { - .header-field { - margin: 0; - } + .header-spells { + line-height: 30px; } .item-titles { text-align: center; @@ -38,13 +36,22 @@ font-size: 12px; background: $colorDark; color: white; + input { + color: white; + margin: auto; + } } .item-list { list-style: none; margin: 0; padding: 0; - li { - padding: 0 2px; + &>* { + line-height: 30px; + } + .item-summary { + font-size: 13px; + padding: 0 4px; + line-height: 20px; } .item-header { @extend %header-field !optional; @@ -55,12 +62,6 @@ &:nth-child(even) { background: rgba(0, 0, 0, 0.1); } - &:hover { - .item-image { - background-image: url("/icons/svg/d20-grey.svg") !important; - cursor: pointer; - } - } } .item { line-height: 30px; @@ -78,11 +79,18 @@ height: 30px; margin: 0; line-height: 30px; + &:hover .item-image { + background-image: url("/icons/svg/d20-grey.svg") !important; + cursor: pointer; + } .item-image { flex-basis: 30px; flex-grow: 0; background-size: contain; background-repeat: no-repeat; + &:hover { + background-image: url("/icons/svg/d20-black.svg") !important; + } } h4 { margin: 0; @@ -125,6 +133,11 @@ color: rgba(0, 0, 0, 0.2); } } + &.spells { + .item-controls { + flex-basis: 30px; + } + } } } diff --git a/src/template.json b/src/template.json index 4d8ec4c..ee9c1e3 100644 --- a/src/template.json +++ b/src/template.json @@ -42,27 +42,27 @@ "spells": { "enabled": false, "dc": 0, - "lvl1": { + "1": { "value": 0, "max": 0 }, - "lvl2": { + "2": { "value": 0, "max": 0 }, - "lvl3": { + "3": { "value": 0, "max": 0 }, - "lvl4": { + "4": { "value": 0, "max": 0 }, - "lvl5": { + "5": { "value": 0, "max": 0 }, - "lvl6": { + "6": { "value": 0, "max": 0 } @@ -170,7 +170,9 @@ "duration": "", "range": "", "roll": "", - "description": "" + "description": "", + "memorized": false, + "cast": false }, "ability": { "requirements": "", diff --git a/src/templates/actors/partials/character-inventory-tab.html b/src/templates/actors/partials/character-inventory-tab.html index 01605c4..d3753da 100644 --- a/src/templates/actors/partials/character-inventory-tab.html +++ b/src/templates/actors/partials/character-inventory-tab.html @@ -8,7 +8,7 @@
{{localize "OSE.items.Qualities"}}
{{localize "OSE.items.Weight"}}
- {{localize "OSE.Add"}} +
    @@ -59,7 +59,7 @@ {{/if}}
    {{localize "OSE.items.Weight"}}
    - {{localize "OSE.Add"}} +
      @@ -105,7 +105,7 @@
      {{localize "OSE.items.Quantity"}}
      {{localize "OSE.items.Weight"}}
        diff --git a/src/templates/actors/partials/character-spells-tab.html b/src/templates/actors/partials/character-spells-tab.html index 210c6d4..8c08890 100644 --- a/src/templates/actors/partials/character-spells-tab.html +++ b/src/templates/actors/partials/character-spells-tab.html @@ -1,41 +1,50 @@ -
        -
          -
        • -

          {{localize 'OSE.SpellDCShort'}}

          -
          - +
          +
          +
        • +
          +
          {{localize 'OSE.SpellDC'}}
          +
          +
        • +
          + {{#each spells as |spellGroup id|}} +
            +
          1. +
            {{localize "OSE.spells.Level"}} {{id}}
            +
            {{localize 'OSE.spells.Slots'}}
            +
            /
            +
            +
          2. -
        -
        -
        -
        -

        {{localize 'OSE.category.spells'}}

        -
        - {{#if owner}} - - {{/if}} -
        -
        -
        - {{#each spells as |item|}} + {{#each spellGroup as |item|}}
      1. +
        + + +
        -

        - {{item.name~}} -

        + +

        + {{item.name~}} +

        +
        - {{#if ../owner}} - - + {{#if ../../owner}} + + {{/if}}
      2. {{/each}} -
        +
      + {{/each}} \ No newline at end of file diff --git a/src/templates/items/spell-sheet.html b/src/templates/items/spell-sheet.html index fde4184..8634ca2 100644 --- a/src/templates/items/spell-sheet.html +++ b/src/templates/items/spell-sheet.html @@ -13,7 +13,7 @@
      - +