Properties loading optimizations by KitCat
This commit is contained in:
@@ -11,6 +11,7 @@ Date format : day/month/year
|
||||
- Fix for fade configuration (!66)
|
||||
- Added basic token conditions (Thanks to Putty)
|
||||
- Added ability to remove condition from actor sheet and core journal on click.
|
||||
- Added some Properties loading optimizations (!63 Thanks to KitCat).
|
||||
|
||||
## 1.13.0 - 24/08/2025 - Foundry v13 Compatibility (Thx to Litasa)
|
||||
__! Be certain to carefully back up any critical user data before installing this update !__
|
||||
|
||||
@@ -189,12 +189,12 @@ export class HelpersL5r5e {
|
||||
|
||||
// Unknown pack object, iterate all packs
|
||||
if (!document) {
|
||||
for (const comp of game.packs) {
|
||||
await Promise.all(game.packs.map(async (comp) => {
|
||||
const tmpData = await comp.getDocument(id);
|
||||
if (tmpData) {
|
||||
document = HelpersL5r5e.createDocumentFromCompendium({ type, data: tmpData });
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// Final
|
||||
|
||||
@@ -37,31 +37,26 @@ export class ItemSheetL5r5e extends BaseItemSheetL5r5e {
|
||||
* @private
|
||||
*/
|
||||
async _prepareProperties(sheetData) {
|
||||
sheetData.data.propertiesList = [];
|
||||
sheetData.data.propertiesList = await Promise.all((sheetData.data?.system?.properties || []).map(async (property) => {
|
||||
|
||||
if (Array.isArray(sheetData.data.system.properties)) {
|
||||
const props = [];
|
||||
for (const property of sheetData.data.system.properties) {
|
||||
const gameProp = await game.l5r5e.HelpersL5r5e.getObjectGameOrPack({ id: property.id, type: "Item" });
|
||||
if (gameProp) {
|
||||
sheetData.data.propertiesList.push(gameProp);
|
||||
props.push({ id: gameProp.id, name: gameProp.name });
|
||||
} else {
|
||||
return gameProp;
|
||||
}
|
||||
|
||||
// Item not found
|
||||
console.warn(`L5R5E | IS | Unknown property id[${property.id}], name[${property.name}]`);
|
||||
sheetData.data.propertiesList.push({
|
||||
return {
|
||||
id: property.id,
|
||||
name: property.name,
|
||||
type: "property",
|
||||
img: "systems/l5r5e/assets/icons/items/property.svg",
|
||||
removed: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
sheetData.data.system.properties = props;
|
||||
}
|
||||
};
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to events from the sheet.
|
||||
* @param {jQuery} html HTML content of the sheet.
|
||||
|
||||
Reference in New Issue
Block a user