Utilisation de system dans les Item/Actor Sheet
Utilisation de system dans les data de formulaire pour tous les Item/Actor (à la base, ou les sous-éléments) Corrections sur les sorts en réserve (ce ne sont pas des Item) Petites améliorations: * `actor.itemTypes[type]` revient à faire (sans besoin de filtrer) `actor.items.filter(it => it.type == type)` * dans les ItemSheet, this.object et this.document remplacés par this.item * dans les ActorSheet, this.object et this.document remplacés par this.actor Quelques corrections en plus: * parade ne marchait pas * problèmes sur le commerce
This commit is contained in:
@ -104,7 +104,7 @@ export class RdDUtility {
|
||||
/* -------------------------------------------- */
|
||||
static async init() {
|
||||
Hooks.on("renderChatMessage", async (app, html, msg) => RdDUtility.onRenderChatMessage(app, html, msg));
|
||||
Hooks.on('renderChatLog', (log, html, data) => RdDUtility.chatListeners(html));
|
||||
Hooks.on('renderChatLog', (log, html, chatLog) => RdDUtility.chatListeners(html));
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -445,16 +445,16 @@ export class RdDUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static calculEncContenu(conteneur, objets) {
|
||||
const contenuDatas = (conteneur.system.contenu ?? []).filter(id => id != undefined)
|
||||
.map(id => objets.find(it => (id == it._id)))
|
||||
const contenus = (conteneur.system.contenu ?? []).filter(id => id != undefined)
|
||||
.map(id => objets.find(it => (id == it.id)))
|
||||
.filter(it => it);
|
||||
let enc = Number(conteneur.system.encombrement ?? 0) * Number(conteneur.system.quantite ?? 1);
|
||||
for (let itemData of contenuDatas) {
|
||||
if (itemData.type == 'conteneur') {
|
||||
enc += RdDUtility.calculEncContenu(itemData, objets);
|
||||
for (let contenu of contenus) {
|
||||
if (contenu.type == 'conteneur') {
|
||||
enc += RdDUtility.calculEncContenu(contenu, objets);
|
||||
}
|
||||
else {
|
||||
enc += Number(itemData.system.encombrement ?? 0) * Number(itemData.system.quantite ?? 1)
|
||||
enc += Number(contenu.system.encombrement ?? 0) * Number(contenu.system.quantite ?? 1)
|
||||
}
|
||||
}
|
||||
return enc
|
||||
@ -653,9 +653,9 @@ export class RdDUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async responseNombreAstral(data) {
|
||||
let actor = game.actors.get(data.id);
|
||||
actor.ajouteNombreAstral(data);
|
||||
static async responseNombreAstral(callData) {
|
||||
let actor = game.actors.get(callData.id);
|
||||
actor.ajouteNombreAstral(callData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -753,7 +753,7 @@ export class RdDUtility {
|
||||
static getSelectedActor(msgPlayer = undefined) {
|
||||
if (canvas.tokens.controlled.length == 1) {
|
||||
let token = canvas.tokens.controlled[0];
|
||||
if (token.actor && token.actorLink) {
|
||||
if (token.actor) {
|
||||
return token.actor;
|
||||
}
|
||||
if (msgPlayer != undefined) {
|
||||
@ -776,7 +776,7 @@ export class RdDUtility {
|
||||
static createMonnaie(name, valeur_deniers, img = "", enc = 0.01) {
|
||||
let piece = {
|
||||
name: name, type: 'monnaie', img: img, _id: randomID(16),
|
||||
data: {
|
||||
dasystemta: {
|
||||
quantite: 0,
|
||||
valeur_deniers: valeur_deniers,
|
||||
encombrement: enc,
|
||||
|
Reference in New Issue
Block a user