Properties sheet

Fixed loading properties from custom compendiums.
Added a line strike on removed/unknown property and ability to remove them.
This commit is contained in:
Vlyan
2022-03-06 13:49:30 +01:00
parent 32f142deae
commit 473ff9997c
6 changed files with 18 additions and 10 deletions

View File

@@ -147,7 +147,7 @@ export class HelpersL5r5e {
// Named pack
if (!document) {
// If no pack passed, but it's a core item, we know the pack to get it
if (!pack && id.substr(0, 7) === "L5RCore") {
if (!pack && id.substring(0, 7) === "L5RCore") {
pack = HelpersL5r5e.getPackNameForCoreItem(id);
}
@@ -167,12 +167,6 @@ export class HelpersL5r5e {
// Unknown pack object, iterate all packs
if (!document) {
for (const comp of game.packs) {
// TODO Bug with babele if "comp.getDocument(id)" return null...
const babeleFix = (await comp.getIndex()).some((e) => e.id === id);
if (!babeleFix) {
continue;
}
const tmpData = await comp.getDocument(id);
if (tmpData) {
document = HelpersL5r5e.createDocumentFromCompendium({ type, data: tmpData });

View File

@@ -45,7 +45,15 @@ export class ItemSheetL5r5e extends BaseItemSheetL5r5e {
sheetData.data.propertiesList.push(gameProp);
props.push({ id: gameProp.id, name: gameProp.name });
} else {
console.warn(`L5R5E | Unknown property id[${property.id}]`);
// Item not found
console.warn(`L5R5E | Unknown property id[${property.id}], name[${property.name}]`);
sheetData.data.propertiesList.push({
id: property.id,
name: property.name,
type: "property",
img: "systems/l5r5e/assets/icons/items/property.svg",
removed: true,
});
}
}
sheetData.data.data.properties = props;

File diff suppressed because one or more lines are too long

View File

@@ -20,6 +20,9 @@
line-height: 1rem;
color: $l5r5e-bold;
}
.removed {
text-decoration-line: line-through;
}
.item-edit,
.item-delete,
.item-equip,

View File

@@ -1,7 +1,7 @@
<li class="item property flexcol" data-property-id="{{property.id}}">
<ul class="item-header property-control">
<li class="item-img"><img src="{{property.img}}" title="{{property.name}}" width="32px" height="32px"/></li>
<li class="item-name l5r5e-tooltip" data-property-id="{{property.id}}">{{property.name}}</li>
<li class="item-name {{#if removed}}removed{{else}}l5r5e-tooltip{{/if}}" data-property-id="{{property.id}}">{{property.name}}</li>
{{#if editable}}
<li class="property-delete" title="{{localize 'Delete'}}"><i class="fas fa-trash"></i></li>
{{/if}}