Fix equipment drop-down

This commit is contained in:
sladecraven 2022-01-27 07:47:42 +01:00
parent aeb7739879
commit 48ae0920b5
2 changed files with 18 additions and 8 deletions

View File

@ -29,13 +29,22 @@ export class BoLItemSheet extends ItemSheet {
data.itemProperties = this.item.itemProperties; data.itemProperties = this.item.itemProperties;
data.isGM = game.user.isGM; data.isGM = game.user.isGM;
// Dynamic spell fix // Dynamic default data fix/adapt
if (itemData.type == "item" && itemData.data.category == 'spell') { if (itemData.type == "item") {
for (let i=0; i<4; i++) { if (!itemData.data.category) {
itemData.data.properties.mandatoryconditions[i] = itemData.data.properties.mandatoryconditions[i]?? "" itemData.data.category = "equipment"
} }
for (let i=0; i<8; i++) { if (itemData.data.category == 'spell') {
itemData.data.properties.optionnalconditions[i] = itemData.data.properties.optionnalconditions[i]?? "" for (let i = 0; i < 4; i++) {
itemData.data.properties.mandatoryconditions[i] = itemData.data.properties.mandatoryconditions[i] ?? ""
}
for (let i = 0; i < 8; i++) {
itemData.data.properties.optionnalconditions[i] = itemData.data.properties.optionnalconditions[i] ?? ""
}
}
} else {
if (!itemData.data.subtype) {
itemData.data.category = "origin"
} }
} }
@ -58,6 +67,7 @@ export class BoLItemSheet extends ItemSheet {
/** @override */ /** @override */
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
// Everything below here is only needed if the sheet is editable // Everything below here is only needed if the sheet is editable
if (!this.options.editable) return; if (!this.options.editable) return;

View File

@ -7,7 +7,7 @@
"url": "https://github.com/ZigmundKreud/bol", "url": "https://github.com/ZigmundKreud/bol",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"flags": {}, "flags": {},
"version": "0.9.1.0", "version": "0.9.1.1",
"templateVersion": 18, "templateVersion": 18,
"minimumCoreVersion": "0.8.6", "minimumCoreVersion": "0.8.6",
"compatibleCoreVersion": "9", "compatibleCoreVersion": "9",
@ -116,7 +116,7 @@
"manifest": "https://raw.githubusercontent.com/ZigmundKreud/bol/master/system.json", "manifest": "https://raw.githubusercontent.com/ZigmundKreud/bol/master/system.json",
"download": "https://github.com/ZigmundKreud/bol/archive/refs/heads/master.zip", "download": "https://github.com/ZigmundKreud/bol/archive/refs/heads/master.zip",
"protected": false, "protected": false,
"background": "ui/splash-page.webp", "background": "images/map_lemurie.webp",
"gridDistance": 1.5, "gridDistance": 1.5,
"gridUnits": "m", "gridUnits": "m",
"primaryTokenAttribute": "resources.hp", "primaryTokenAttribute": "resources.hp",