forked from public/foundryvtt-reve-de-dragon
Image du token pour les Commerces non liés
This commit is contained in:
@ -22,17 +22,38 @@ export class RdDCommerceSheet extends RdDBaseActorSheet {
|
||||
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }]
|
||||
});
|
||||
}
|
||||
get title() {
|
||||
if (this.actor.token && this.actor.token != this.actor.prototypeToken) {
|
||||
return this.actor.token.name;
|
||||
}
|
||||
return super.title
|
||||
}
|
||||
|
||||
async getData() {
|
||||
const formData = await super.getData();
|
||||
if (this.actor.token && this.actor.token != this.actor.prototypeToken) {
|
||||
mergeObject(formData,
|
||||
{
|
||||
title: this.actor.token.name,
|
||||
token: {
|
||||
img: this.actor.token.texture.src
|
||||
}
|
||||
},
|
||||
{ overwrite: true });
|
||||
|
||||
}
|
||||
return formData;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
this.html.find('a.item-acheter').click(async event => await this.vente(this.getItem(event)));
|
||||
|
||||
|
||||
if (!this.options.editable) return;
|
||||
|
||||
this.html.find('a.item-quantite-moins').click(async event => await this.getItem(event)?.quantiteIncDec(-1, { supprimerSiZero: false}));
|
||||
|
||||
this.html.find('a.item-quantite-moins').click(async event => await this.getItem(event)?.quantiteIncDec(-1, { supprimerSiZero: false }));
|
||||
this.html.find('a.item-quantite-plus').click(async event => await this.getItem(event)?.quantiteIncDec(1));
|
||||
this.html.find('input.item-quantite').change(async event => {
|
||||
const newQuantite = Math.max(0, Number.parseInt(this.html.find(event.currentTarget).val()));
|
||||
@ -48,7 +69,7 @@ export class RdDCommerceSheet extends RdDBaseActorSheet {
|
||||
return RdDItem.getItemTypesInventaire('all');
|
||||
}
|
||||
|
||||
|
||||
|
||||
async vente(item) {
|
||||
const acheteur = RdDUtility.getSelectedActor();
|
||||
if (!acheteur) {
|
||||
|
Reference in New Issue
Block a user