12.0.36 - L'alchimie d'Astrobazzarh #740
@ -43,7 +43,7 @@ export class RdDBaseActorSheet extends ActorSheet {
|
|||||||
effects: this.actor.effects
|
effects: this.actor.effects
|
||||||
}
|
}
|
||||||
|
|
||||||
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||||
formData.calc = {
|
formData.calc = {
|
||||||
fortune: Monnaie.toSolsDeniers(this.actor.getFortune()),
|
fortune: Monnaie.toSolsDeniers(this.actor.getFortune()),
|
||||||
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
||||||
@ -79,22 +79,6 @@ export class RdDBaseActorSheet extends ActorSheet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
static filterItemsPerTypeForSheet(formData, itemTypes) {
|
|
||||||
Object.values(ITEM_TYPES).forEach(t => {
|
|
||||||
formData[t + 's'] = Misc.arrayOrEmpty(itemTypes[t])
|
|
||||||
})
|
|
||||||
|
|
||||||
formData.maladiesPoisons = formData.maladies.concat(formData.poisons)
|
|
||||||
formData.competences = formData.competences.concat(formData.competencecreatures)
|
|
||||||
formData.monnaies = formData.monnaies.sort(Monnaie.triValeurEntiere())
|
|
||||||
|
|
||||||
formData.inventaires = RdDItem.getItemTypesInventaire('all')
|
|
||||||
.map(t => Misc.arrayOrEmpty(itemTypes[t]))
|
|
||||||
.reduce((a, b) => a.concat(b), [])
|
|
||||||
.sort(Misc.ascending(it => it.name));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */ /** @override */
|
/* -------------------------------------------- */ /** @override */
|
||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
@ -105,7 +89,7 @@ export class RdDBaseActorSheet extends ActorSheet {
|
|||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat());
|
this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat());
|
||||||
this.html.find('.item-edit').click(async event => this.getItem(event)?.sheet.render(true))
|
this.html.find('.item-edit').click(async event => this.itemActionEdit(event))
|
||||||
this.html.find('.item-montrer').click(async event => this.getItem(event)?.postItemToChat());
|
this.html.find('.item-montrer').click(async event => this.getItem(event)?.postItemToChat());
|
||||||
|
|
||||||
this.html.find('.recherche')
|
this.html.find('.recherche')
|
||||||
@ -147,6 +131,11 @@ export class RdDBaseActorSheet extends ActorSheet {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itemActionEdit(event) {
|
||||||
|
const item = this.getItem(event);
|
||||||
|
return item?.sheet.render(true);
|
||||||
|
}
|
||||||
|
|
||||||
_rechercherKeyup(event) {
|
_rechercherKeyup(event) {
|
||||||
const currentTarget = event.currentTarget;
|
const currentTarget = event.currentTarget;
|
||||||
const nouvelleRecherche = this._optionRecherche(currentTarget);
|
const nouvelleRecherche = this._optionRecherche(currentTarget);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ACTOR_TYPES, ITEM_TYPES } from "./constants.js";
|
import { ITEM_TYPES } from "./constants.js";
|
||||||
import { DialogItemVente } from "./achat-vente/dialog-item-vente.js";
|
import { DialogItemVente } from "./achat-vente/dialog-item-vente.js";
|
||||||
import { Grammar } from "./grammar.js";
|
import { Grammar } from "./grammar.js";
|
||||||
import { Misc } from "./misc.js";
|
import { Misc } from "./misc.js";
|
||||||
|
@ -29,9 +29,10 @@ export class RdDConteneurItemSheet extends RdDItemInventaireSheet {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
prepareConteneurData(formData) {
|
prepareConteneurData(formData) {
|
||||||
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||||
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires);
|
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires);
|
||||||
formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems;
|
const subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems;
|
||||||
|
formData.subItems = subItems
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onDragStart(event) {
|
async _onDragStart(event) {
|
||||||
|
@ -19,10 +19,11 @@ import { RdDEmpoignade } from "./rdd-empoignade.js";
|
|||||||
import { ExperienceLog } from "./actor/experience-log.js";
|
import { ExperienceLog } from "./actor/experience-log.js";
|
||||||
import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||||
import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js";
|
import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js";
|
||||||
import { RDD_CONFIG } from "./constants.js";
|
import { ITEM_TYPES, RDD_CONFIG } from "./constants.js";
|
||||||
import { RdDBaseActor } from "./actor/base-actor.js";
|
import { RdDBaseActor } from "./actor/base-actor.js";
|
||||||
import { RdDCarac } from "./rdd-carac.js";
|
import { RdDCarac } from "./rdd-carac.js";
|
||||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||||
|
import { Monnaie } from "./item-monnaie.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
// This table starts at 0 -> niveau -10
|
// This table starts at 0 -> niveau -10
|
||||||
@ -465,13 +466,37 @@ export class RdDUtility {
|
|||||||
return ligneObjet;
|
return ligneObjet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static filterItemsPerTypeForSheet(formData, itemTypes) {
|
||||||
|
Object.values(ITEM_TYPES).forEach(t => {
|
||||||
|
formData[t + 's'] = Misc.arrayOrEmpty(itemTypes[t])
|
||||||
|
})
|
||||||
|
|
||||||
|
formData.maladiesPoisons = formData.maladies.concat(formData.poisons)
|
||||||
|
formData.competences = formData.competences.concat(formData.competencecreatures)
|
||||||
|
formData.monnaies = formData.monnaies.sort(Monnaie.triValeurEntiere())
|
||||||
|
|
||||||
|
formData.inventaires = RdDUtility.prepareInventaire(itemTypes)
|
||||||
|
}
|
||||||
|
|
||||||
static buildInventaireConteneur(actorId, itemId, options) {
|
static buildInventaireConteneur(actorId, itemId, options) {
|
||||||
const actor = game.actors.get(actorId)
|
const actor = game.actors.get(actorId)
|
||||||
const item = actor?.items.get(itemId)
|
const item = actor?.items.get(itemId)
|
||||||
if (item) {
|
if (item?.type == ITEM_TYPES.conteneur) {
|
||||||
return RdDUtility.buildContenuConteneur(item, options, { ouvert: true, profondeur: 1 });
|
const formData = {}
|
||||||
|
RdDUtility.filterItemsPerTypeForSheet(formData, actor.itemTypes);
|
||||||
|
RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires);
|
||||||
|
item.subItems = formData.conteneurs.find(it => it._id == itemId)?.subItems;
|
||||||
|
|
||||||
|
return RdDUtility.buildContenuConteneur(item, options, { ouvert: true, profondeur: 1 })
|
||||||
}
|
}
|
||||||
return '';
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
static prepareInventaire(itemTypes) {
|
||||||
|
return RdDItem.getItemTypesInventaire('all')
|
||||||
|
.map(t => Misc.arrayOrEmpty(itemTypes[t]))
|
||||||
|
.reduce((a, b) => a.concat(b), [])
|
||||||
|
.sort(Misc.ascending(it => it.name))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user