forked from public/foundryvtt-reve-de-dragon
Support drag-drop vers conteneur
This commit is contained in:
@ -104,14 +104,15 @@ export class RdDItem extends Item {
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
if (this.isEquipement(this)) {
|
||||
if (this.isEquipement()) {
|
||||
this._calculsEquipement();
|
||||
|
||||
if (this.isPotion()) {
|
||||
this.prepareDataPotion()
|
||||
}
|
||||
const itemData = Misc.data(this);
|
||||
itemData.data.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
|
||||
}
|
||||
if (this.isPotion()) {
|
||||
this.prepareDataPotion()
|
||||
}
|
||||
const itemData = Misc.data(this);
|
||||
itemData.data.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
|
||||
}
|
||||
|
||||
prepareDataPotion() {
|
||||
@ -139,7 +140,7 @@ export class RdDItem extends Item {
|
||||
|
||||
getActionPrincipale(options = { warnIfNot: true }) {
|
||||
const itemData = Misc.data(this);
|
||||
if ((itemData.data.quantite ?? 0) <= 0) {
|
||||
if (itemData.type != 'conteneur' && (itemData.data.quantite ?? 0) <= 0) {
|
||||
if (options.warnIfNot) {
|
||||
ui.notifications.warn(`Vous n'avez plus de ${itemData.name}.`);
|
||||
}
|
||||
@ -149,9 +150,10 @@ export class RdDItem extends Item {
|
||||
case 'nourritureboisson': return itemData.data.boisson ? 'Boire' : 'Manger';
|
||||
case 'potion': return 'Boire';
|
||||
case 'livre': return 'Lire';
|
||||
case 'conteneur': return 'Ouvrir';
|
||||
}
|
||||
if (options.warnIfNot) {
|
||||
ui.notifications.warn(`Impossible d'utilise un ${itemData.name}, aucune action associée définie.`);
|
||||
ui.notifications.warn(`Impossible d'utiliser un ${itemData.name}, aucune action associée définie.`);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@ -200,7 +202,7 @@ export class RdDItem extends Item {
|
||||
.filter(([key, value]) => value != otherTplData[key]);
|
||||
if (differences.length > 0) {
|
||||
let message = `Impossible de regrouper les ${itemData.type} ${itemData.name}: `;
|
||||
for (const [key, value] of differences){
|
||||
for (const [key, value] of differences) {
|
||||
message += `<br>${key}: ${value} vs ${otherTplData[key]}`;
|
||||
}
|
||||
ui.notifications.info(message)
|
||||
@ -236,7 +238,7 @@ export class RdDItem extends Item {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async postItem( modeOverride ) {
|
||||
async postItem(modeOverride) {
|
||||
console.log(this);
|
||||
let chatData = duplicate(Misc.data(this));
|
||||
const properties = this.getProprietes();
|
||||
@ -568,11 +570,11 @@ export class RdDItem extends Item {
|
||||
`<b>Dommages</b>: ${tplData.dommages}`
|
||||
]
|
||||
if (tplData.remedesconnus) {
|
||||
properties.push(`<b>Remedes</b>: ${tplData.remedes}` )
|
||||
properties.push(`<b>Remedes</b>: ${tplData.remedes}`)
|
||||
}
|
||||
} else {
|
||||
properties = [
|
||||
`<b>Inconnue</b>` ]
|
||||
`<b>Inconnue</b>`]
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
Reference in New Issue
Block a user