Fix apv2, WIP

This commit is contained in:
2026-06-06 10:21:24 +02:00
parent 6cec1da910
commit 9b77a0c552
130 changed files with 12850 additions and 2830 deletions
+6 -13
View File
@@ -2,7 +2,7 @@
* Extend the basic Item with some very simple modifications.
* @extends {Item}
*/
export class VermineItem extends Item {
export default class VermineItem extends Item {
/**
* Augment the basic Item data model with additional dynamic data.
*/
@@ -15,8 +15,7 @@ export class VermineItem extends Item {
const actorType = (this.actor !== null) ? this.actor.type : 'character';
const itemType = this.type;
// Vérifie si une méthode spécifique au type existe// preparedData specifique au type
// Vérifie si une méthode spécifique au type existe
if (typeof this[`prepare${itemType.charAt(0).toUpperCase() + itemType.slice(1)}Data`] === 'function') {
this[`prepare${itemType.charAt(0).toUpperCase() + itemType.slice(1)}Data`]();
}
@@ -26,15 +25,14 @@ export class VermineItem extends Item {
this.damagedLabel = this.system.damages.state[parseInt(this.system.damages?.value) - 1];
switch (this.damagedLabel) {
case "endommagé":
this.damagedIcon = '<i class="fas fa-exclamation-circle" style:"color="yellow"></i>';
this.damagedIcon = '<i class="fas fa-exclamation-circle" style="color=yellow"></i>';
break;
case "défectueux":
this.damagedIcon = '<i class="fas fa-exclamation-triangle" style:"color="orange"></i>';
this.damagedIcon = '<i class="fas fa-exclamation-triangle" style="color=orange"></i>';
break;
case "hors d'usage":
this.damagedIcon = '<i class="fas fa-star-exclamation" style:"color="red"></i>';
this.damagedIcon = '<i class="fas fa-star-exclamation" style="color=red"></i>';
break;
}
}
}
@@ -44,11 +42,9 @@ export class VermineItem extends Item {
const actorType = (this.actor !== null) ? this.actor.type : 'character';
if (this.system.type == "") {
// console.log('je suis une capacité, avec pour sous-type', this.system.type, actorType);
this.system.type = actorType;
}
if (this.system.totem == "" && this.actor !== null && this.actor.system.identity.totem != "") {
// console.log('je suis une capacité, avec pour sous-type', this.system.type, actorType);
this.system.totem = this.actor.system.identity.totem;
}
}
@@ -79,16 +75,13 @@ export class VermineItem extends Item {
const rollMode = game.settings.get('core', 'rollMode');
const label = `[${item.type}] ${item.name}`;
// If there's no roll data, send a chat message.
let mess = {
speaker: speaker,
rollMode: rollMode,
flavor: label,
};
mess.content = await renderTemplate(`systems/vermine2047/templates/item/chatCards/${this.type}.hbs`, { item: this, message: mess }) ?? null;
mess.content = await foundry.applications.handlebars.renderTemplate(`systems/vermine2047/templates/item/chatCards/${this.type}.hbs`, { item: this, message: mess }) ?? null;
ChatMessage.create(mess)
}
}