Update v11

This commit is contained in:
2023-06-23 08:37:50 +02:00
parent 1b8e0840b0
commit 3be7f4bf9f
5 changed files with 101 additions and 36 deletions

View File

@ -27,23 +27,23 @@ export class BoLItemSheet extends ItemSheet {
data.category = itemData.system.category
data.isGM = game.user.isGM;
data.itemProperties = this.item.itemProperties;
data.description = await TextEditor.enrichHTML(this.object.system.description, {async: true})
data.description = await TextEditor.enrichHTML(this.object.system.description, { async: true })
// Dynamic default data fix/adapt
if (itemData.type == "item") {
if (!itemData.system.category) {
itemData.system.category = "equipment"
}
if ( itemData.system.category == "equipment" && itemData.system.properties.equipable) {
if (itemData.system.category == "equipment" && itemData.system.properties.equipable) {
if (!itemData.system.properties.slot) {
itemData.system.properties.slot = "-"
}
}
if (itemData.system.category == 'spell') {
if(!itemData.system.properties.mandatoryconditions) {
if (!itemData.system.properties.mandatoryconditions) {
itemData.system.properties.mandatoryconditions = []
}
if(!itemData.system.properties.optionnalconditions) {
if (!itemData.system.properties.optionnalconditions) {
itemData.system.properties.optionnalconditions = []
}
for (let i = 0; i < 4; i++) {
@ -64,7 +64,27 @@ export class BoLItemSheet extends ItemSheet {
}
/* -------------------------------------------- */
_getHeaderButtons() {
let buttons = super._getHeaderButtons();
buttons.unshift({
class: "post",
icon: "fas fa-comment",
onclick: ev => this.postItem()
});
return buttons
}
/* -------------------------------------------- */
postItem() {
let chatData = duplicate(this.item)
if (this.actor) {
chatData.actor = { id: this.actor.id };
}
BoLUtility.postItem(chatData);
}
/* -------------------------------------------- */
/** @override */
setPosition(options = {}) {
const position = super.setPosition(options);