diff --git a/system/scripts/actors/base-sheet.js b/system/scripts/actors/base-sheet.js
index 9ebc88e..28259f4 100644
--- a/system/scripts/actors/base-sheet.js
+++ b/system/scripts/actors/base-sheet.js
@@ -87,6 +87,13 @@ export class BaseSheetL5r5e extends ActorSheet {
event.target.select();
});
+ // Toggle
+ // html.find(".toggle-on-click").on("click", (event) => {
+ // const elmt = $(event.currentTarget).data("toggle");
+ // const tgt = html.find("." + elmt);
+ // tgt.hasClass('toggle-active') ? tgt.removeClass('toggle-active') : tgt.addClass('toggle-active');
+ // });
+
// *** Items : edit, delete ***
["item", "peculiarity", "technique", "advancement"].forEach((type) => {
html.find(`.${type}-edit`).on("click", (event) => {
diff --git a/system/scripts/items/advancement-sheet.js b/system/scripts/items/advancement-sheet.js
index a6e2603..8bd7b5e 100644
--- a/system/scripts/items/advancement-sheet.js
+++ b/system/scripts/items/advancement-sheet.js
@@ -20,10 +20,9 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e {
});
}
- getData() {
- const sheetData = super.getData();
+ async getData() {
+ const sheetData = await super.getData();
- sheetData.data.dtypes = ["String", "Number", "Boolean"];
sheetData.data.subTypesList = AdvancementSheetL5r5e.types;
sheetData.data.skillsList = game.l5r5e.HelpersL5r5e.getSkillsList(true);
diff --git a/system/scripts/items/item-sheet.js b/system/scripts/items/item-sheet.js
index ca212a5..51f25de 100644
--- a/system/scripts/items/item-sheet.js
+++ b/system/scripts/items/item-sheet.js
@@ -14,7 +14,7 @@ export class ItemSheetL5r5e extends ItemSheet {
});
}
- getData() {
+ async getData() {
const sheetData = super.getData();
sheetData.data.dtypes = ["String", "Number", "Boolean"];
@@ -22,7 +22,7 @@ export class ItemSheetL5r5e extends ItemSheet {
sheetData.data.techniquesList = game.l5r5e.HelpersL5r5e.getTechniquesList();
// Prepare Properties (id/name => object)
- this._prepareProperties(sheetData);
+ await this._prepareProperties(sheetData);
return sheetData;
}
@@ -31,21 +31,26 @@ export class ItemSheetL5r5e extends ItemSheet {
* Prepare properties list
* @private
*/
- _prepareProperties(sheetData) {
+ async _prepareProperties(sheetData) {
sheetData.data.propertiesList = [];
+
if (Array.isArray(sheetData.data.properties)) {
const props = [];
- sheetData.data.properties.forEach((e) => {
- const obj = game.items.get(e.id);
- // remove item if not found (probably a deleted item)
- if (!obj) {
- return;
+ for (const property of sheetData.data.properties) {
+ let item = game.items.get(property.id);
+ if (item) {
+ // Live item
+ sheetData.data.propertiesList.push(item);
+ props.push({ id: property.id, name: item.name });
+ } else {
+ // Pack item
+ item = await game.packs.get("l5r5e.Properties").getEntry(property.id);
+ if (item) {
+ sheetData.data.propertiesList.push(item);
+ props.push({ id: item._id, name: item.name });
+ }
}
- sheetData.data.propertiesList.push(obj);
-
- // update name if referenced object was rename
- props.push({ id: e.id, name: obj.name });
- });
+ }
sheetData.data.properties = props;
}
}
@@ -67,6 +72,13 @@ export class ItemSheetL5r5e extends ItemSheet {
event.target.select();
});
+ // Toggle
+ // html.find(".toggle-on-click").on("click", (event) => {
+ // const elmt = $(event.currentTarget).data("toggle");
+ // const tgt = html.find("." + elmt);
+ // tgt.hasClass('toggle-active') ? tgt.removeClass('toggle-active') : tgt.addClass('toggle-active');
+ // });
+
// Delete a property
html.find(`.property-delete`).on("click", (event) => {
const li = $(event.currentTarget).parents(".property");
diff --git a/system/scripts/items/peculiarity-sheet.js b/system/scripts/items/peculiarity-sheet.js
index c009380..dcdfc7a 100644
--- a/system/scripts/items/peculiarity-sheet.js
+++ b/system/scripts/items/peculiarity-sheet.js
@@ -21,10 +21,9 @@ export class PeculiaritySheetL5r5e extends ItemSheetL5r5e {
});
}
- getData() {
- const sheetData = super.getData();
+ async getData() {
+ const sheetData = await super.getData();
- sheetData.data.dtypes = ["String", "Number", "Boolean"];
sheetData.data.subTypesList = PeculiaritySheetL5r5e.types;
return sheetData;
diff --git a/system/scripts/items/weapon-sheet.js b/system/scripts/items/weapon-sheet.js
index 2c33165..48f8cd8 100644
--- a/system/scripts/items/weapon-sheet.js
+++ b/system/scripts/items/weapon-sheet.js
@@ -16,9 +16,8 @@ export class WeaponSheetL5r5e extends ItemSheetL5r5e {
});
}
- getData() {
- const sheetData = super.getData();
- sheetData.data.dtypes = ["String", "Number", "Boolean"];
+ async getData() {
+ const sheetData = await super.getData();
// Martial skills only
sheetData.data.skills = Array.from(L5R5E.skills)
diff --git a/system/templates/actors/character/narrative.html b/system/templates/actors/character/narrative.html
index 46bb788..ec902a7 100644
--- a/system/templates/actors/character/narrative.html
+++ b/system/templates/actors/character/narrative.html
@@ -17,7 +17,7 @@
{{#each actor.items as |item id|}}
{{#ifCond '["distinction","passion"]' 'includes' item.data.peculiarity_type}}
- {{> 'systems/l5r5e/templates/items/peculiarity/peculiarity-entry.html' peculiarity=item id=id }}
+ {{> 'systems/l5r5e/templates/items/peculiarity/peculiarity-entry.html' peculiarity=item id=id editable=../editable }}
{{/ifCond}}
{{/each}}
@@ -29,7 +29,7 @@
{{#each actor.items as |item id|}}
{{#ifCond '["adversity","anxiety"]' 'includes' item.data.peculiarity_type}}
- {{> 'systems/l5r5e/templates/items/peculiarity/peculiarity-entry.html' peculiarity=item id=id }}
+ {{> 'systems/l5r5e/templates/items/peculiarity/peculiarity-entry.html' peculiarity=item id=id editable=../editable }}
{{/ifCond}}
{{/each}}
diff --git a/system/templates/actors/character/techniques.html b/system/templates/actors/character/techniques.html
index 468a1df..eec59d3 100644
--- a/system/templates/actors/character/techniques.html
+++ b/system/templates/actors/character/techniques.html
@@ -18,7 +18,7 @@
{{#each actor.items as |item id|}}
{{#ifCond item.type '==' 'technique'}}
- {{> 'systems/l5r5e/templates/items/technique/technique-entry.html' technique=item }}
+ {{> 'systems/l5r5e/templates/items/technique/technique-entry.html' technique=item editable=../editable }}
{{/ifCond}}
{{/each}}
diff --git a/system/templates/actors/npc/narrative.html b/system/templates/actors/npc/narrative.html
index ac2cfa9..e7833b2 100644
--- a/system/templates/actors/npc/narrative.html
+++ b/system/templates/actors/npc/narrative.html
@@ -3,7 +3,7 @@
{{#each actor.items as |item id|}}
{{#ifCond '["distinction","passion"]' 'includes' item.data.peculiarity_type}}
- {{> 'systems/l5r5e/templates/items/peculiarity/peculiarity-entry.html' peculiarity=item id=id }}
+ {{> 'systems/l5r5e/templates/items/peculiarity/peculiarity-entry.html' peculiarity=item id=id editable=../editable }}
{{/ifCond}}
{{/each}}
@@ -13,7 +13,7 @@
{{#each actor.items as |item id|}}
{{#ifCond '["adversity","anxiety"]' 'includes' item.data.peculiarity_type}}
- {{> 'systems/l5r5e/templates/items/peculiarity/peculiarity-entry.html' peculiarity=item id=id }}
+ {{> 'systems/l5r5e/templates/items/peculiarity/peculiarity-entry.html' peculiarity=item id=id editable=../editable }}
{{/ifCond}}
{{/each}}
diff --git a/system/templates/actors/npc/techniques.html b/system/templates/actors/npc/techniques.html
index 1f20f9e..8477de1 100644
--- a/system/templates/actors/npc/techniques.html
+++ b/system/templates/actors/npc/techniques.html
@@ -7,7 +7,7 @@
{{#each actor.items as |item id|}}
{{#ifCond item.type '==' 'technique'}}
- {{> 'systems/l5r5e/templates/items/technique/technique-entry.html' technique=item }}
+ {{> 'systems/l5r5e/templates/items/technique/technique-entry.html' technique=item editable=../editable }}
{{/ifCond}}
{{/each}}
diff --git a/system/templates/items/advancement/advancement-entry.html b/system/templates/items/advancement/advancement-entry.html
index a6cb621..c4b8c02 100644
--- a/system/templates/items/advancement/advancement-entry.html
+++ b/system/templates/items/advancement/advancement-entry.html
@@ -2,8 +2,10 @@
{{{ advancement.data.description }}}
\ No newline at end of file
diff --git a/system/templates/items/armor/armor-entry.html b/system/templates/items/armor/armor-entry.html
index bd6ac73..28efce6 100644
--- a/system/templates/items/armor/armor-entry.html
+++ b/system/templates/items/armor/armor-entry.html
@@ -6,8 +6,10 @@
{{item.data.armor.physical}}
{{item.data.armor.supernatural}}
+ {{#if editable}}
+ {{/if}}
{{#each item.data.properties as |property id|}}
diff --git a/system/templates/items/armor/armors.html b/system/templates/items/armor/armors.html
index c276d78..3fcf931 100644
--- a/system/templates/items/armor/armors.html
+++ b/system/templates/items/armor/armors.html
@@ -3,7 +3,7 @@
{{#each actor.items as |item id|}}
{{#ifCond item.type '==' 'armor'}}
- {{> 'systems/l5r5e/templates/items/armor/armor-entry.html' item=item id=id }}
+ {{> 'systems/l5r5e/templates/items/armor/armor-entry.html' item=item id=id editable=../editable }}
{{/ifCond}}
{{/each}}
diff --git a/system/templates/items/item/item-entry.html b/system/templates/items/item/item-entry.html
index d70e7cc..8f90dcc 100644
--- a/system/templates/items/item/item-entry.html
+++ b/system/templates/items/item/item-entry.html
@@ -2,8 +2,10 @@
{{#each item.data.properties as |property id|}}
diff --git a/system/templates/items/item/items.html b/system/templates/items/item/items.html
index 1ef7fc1..083436e 100644
--- a/system/templates/items/item/items.html
+++ b/system/templates/items/item/items.html
@@ -3,7 +3,7 @@
{{#each actor.items as |item id|}}
{{#ifCond item.type '==' 'item'}}
- {{> 'systems/l5r5e/templates/items/item/item-entry.html' item=item id=id }}
+ {{> 'systems/l5r5e/templates/items/item/item-entry.html' item=item id=id editable=../editable }}
{{/ifCond}}
{{/each}}
diff --git a/system/templates/items/peculiarity/peculiarity-entry.html b/system/templates/items/peculiarity/peculiarity-entry.html
index b6d8bb9..429c24d 100644
--- a/system/templates/items/peculiarity/peculiarity-entry.html
+++ b/system/templates/items/peculiarity/peculiarity-entry.html
@@ -2,8 +2,10 @@
{{{ peculiarity.data.description }}}
\ No newline at end of file
diff --git a/system/templates/items/property/properties.html b/system/templates/items/property/properties.html
index d132059..b4b31e2 100644
--- a/system/templates/items/property/properties.html
+++ b/system/templates/items/property/properties.html
@@ -3,7 +3,7 @@
{{#each properties as |item id|}}
- {{> 'systems/l5r5e/templates/items/property/property-entry.html' item=item id=id }}
+ {{> 'systems/l5r5e/templates/items/property/property-entry.html' item=item id=id editable=../editable }}
{{/each}}
diff --git a/system/templates/items/property/property-entry.html b/system/templates/items/property/property-entry.html
index 3017d4d..1974ba3 100644
--- a/system/templates/items/property/property-entry.html
+++ b/system/templates/items/property/property-entry.html
@@ -2,7 +2,9 @@
{{{ item.data.description }}}
\ No newline at end of file
diff --git a/system/templates/items/technique/technique-entry.html b/system/templates/items/technique/technique-entry.html
index 9a861c7..45e8474 100644
--- a/system/templates/items/technique/technique-entry.html
+++ b/system/templates/items/technique/technique-entry.html
@@ -2,8 +2,10 @@
{{{ technique.data.description }}}
\ No newline at end of file
diff --git a/system/templates/items/weapon/weapon-entry.html b/system/templates/items/weapon/weapon-entry.html
index 20eabf0..0de9c6c 100644
--- a/system/templates/items/weapon/weapon-entry.html
+++ b/system/templates/items/weapon/weapon-entry.html
@@ -7,8 +7,10 @@
{{item.data.damage}}
{{item.data.deadliness}}
+ {{#if editable}}
+ {{/if}}
{{#each item.data.properties as |property id|}}
diff --git a/system/templates/items/weapon/weapons.html b/system/templates/items/weapon/weapons.html
index 53dc878..42fc63e 100644
--- a/system/templates/items/weapon/weapons.html
+++ b/system/templates/items/weapon/weapons.html
@@ -3,7 +3,7 @@
{{#each actor.items as |item id|}}
{{#ifCond item.type '==' 'weapon'}}
- {{> 'systems/l5r5e/templates/items/weapon/weapon-entry.html' item=item id=id }}
+ {{> 'systems/l5r5e/templates/items/weapon/weapon-entry.html' item=item id=id editable=../editable }}
{{/ifCond}}
{{/each}}