From e59a815eaf73e8fbb796cc5138d4e2e167f4ada2 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Tue, 15 Mar 2022 20:57:51 +0100 Subject: [PATCH] Add item --- modules/pegasus-actor-sheet.js | 16 ++++++++++------ modules/pegasus-main.js | 4 ++-- templates/actor-sheet.html | 24 +++++++++++++++++++++++- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/modules/pegasus-actor-sheet.js b/modules/pegasus-actor-sheet.js index 4d50655..334d276 100644 --- a/modules/pegasus-actor-sheet.js +++ b/modules/pegasus-actor-sheet.js @@ -111,17 +111,21 @@ export class PegasusActorSheet extends ActorSheet { // Update Inventory Item html.find('.item-edit').click(ev => { - const li = $(ev.currentTarget).parents(".item"); - let itemId = li.data("item-id"); + const li = $(ev.currentTarget).parents(".item") + let itemId = li.data("item-id") const item = this.actor.items.get( itemId ); item.sheet.render(true); }); // Delete Inventory Item html.find('.item-delete').click(ev => { - const li = $(ev.currentTarget).parents(".item"); - PegasusUtility.confirmDelete(this, li); - }); - + const li = $(ev.currentTarget).parents(".item") + PegasusUtility.confirmDelete(this, li) + }) + html.find('.item-add').click(ev => { + let dataType = $(ev.currentTarget).data("type") + this.actor.createEmbeddedDocuments('Item', [{ name: "NewItem", type: dataType }], { renderSheet: true }) + }) + html.find('.spec-group-activate').click(ev => { const li = $(ev.currentTarget).parents(".item"); let itemId = li.data("item-id"); diff --git a/modules/pegasus-main.js b/modules/pegasus-main.js index f2c76cf..39b9c92 100644 --- a/modules/pegasus-main.js +++ b/modules/pegasus-main.js @@ -32,12 +32,12 @@ Hooks.once("init", async function () { /* -------------------------------------------- */ game.settings.register("fvtt-pegasus-rpg", "dice-max-level", { name: "Maximum level value for dices lists", - hint: "Se the maximum level value for dices lists", + hint: "Set the maximum level value for dices lists", scope: "world", config: true, default: 20, type: Number - }); + }) /* -------------------------------------------- */ // Set an initiative formula for the system diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index efa57a7..bd4dce3 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -482,6 +482,10 @@ +
 
+
+ +
{{#each moneys as |money key|}}
  • @@ -538,6 +542,10 @@ +
     
    +
    + +
  • {{#each weapons as |weapon key|}}
  • @@ -610,6 +618,11 @@ + +
     
    +
    + +
  • {{#each armors as |armor key|}}
  • @@ -665,8 +678,12 @@ - + +
     
    +
    + +
  • {{#each shields as |shield key|}}
  • @@ -721,6 +738,11 @@ +
     
    +
    + +
    +
  • {{#each containersTree as |equip key|}} {{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=equip level=1}}