Fix monnaie (again....)
This commit is contained in:
parent
19e96b0cac
commit
ec86c81fc8
@ -110,27 +110,31 @@ export class RdDActor extends Actor {
|
|||||||
this.computeEncombrementTotalEtMalusArmure();
|
this.computeEncombrementTotalEtMalusArmure();
|
||||||
this.computeEtatGeneral();
|
this.computeEtatGeneral();
|
||||||
// Sanity check
|
// Sanity check
|
||||||
RdDActor.checkMonnaiePresence(actorData.items);
|
await this.checkMonnaiePresence(actorData.items);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static checkMonnaiePresence( items ) { // Ajout opportuniste si les pièces n'existent pas.
|
async checkMonnaiePresence( items ) { // Ajout opportuniste si les pièces n'existent pas.
|
||||||
if( !items) return; // Sanity check during import
|
if( !items) return; // Sanity check during import
|
||||||
let piece = items.find( item => item.type =='monnaie' && Number(item.data.valeur_deniers) == 1);
|
let piece = items.find( item => item.type =='monnaie' && Number(item.data.valeur_deniers) == 1);
|
||||||
|
let newMonnaie = [];
|
||||||
if (!piece) {
|
if (!piece) {
|
||||||
items.push( RdDUtility.createMonnaie("Etain (1 denier)", 1, "systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp" ) );
|
newMonnaie.push( RdDUtility.createMonnaie("Etain (1 denier)", 1, "systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp" ) );
|
||||||
}
|
}
|
||||||
piece = items.find( item => item.type =='monnaie' && Number(item.data.valeur_deniers) == 10);
|
piece = items.find( item => item.type =='monnaie' && Number(item.data.valeur_deniers) == 10);
|
||||||
if (!piece) {
|
if (!piece) {
|
||||||
items.push(RdDUtility.createMonnaie("Bronze (10 deniers)", 10, "systems/foundryvtt-reve-de-dragon/icons/objets/piece_bronze_epees.webp") );
|
newMonnaie.push(RdDUtility.createMonnaie("Bronze (10 deniers)", 10, "systems/foundryvtt-reve-de-dragon/icons/objets/piece_bronze_epees.webp") );
|
||||||
}
|
}
|
||||||
piece = items.find( item => item.type =='monnaie' && Number(item.data.valeur_deniers) == 100);
|
piece = items.find( item => item.type =='monnaie' && Number(item.data.valeur_deniers) == 100);
|
||||||
if (!piece) {
|
if (!piece) {
|
||||||
items.push(RdDUtility.createMonnaie("Argent (1 sol)", 100, "systems/foundryvtt-reve-de-dragon/icons/objets/piece_argent_sol.webp"));
|
newMonnaie.push(RdDUtility.createMonnaie("Argent (1 sol)", 100, "systems/foundryvtt-reve-de-dragon/icons/objets/piece_argent_sol.webp"));
|
||||||
}
|
}
|
||||||
piece = items.find( item => item.type =='monnaie' && Number(item.data.valeur_deniers) == 1000);
|
piece = items.find( item => item.type =='monnaie' && Number(item.data.valeur_deniers) == 1000);
|
||||||
if (!piece) {
|
if (!piece) {
|
||||||
items.push(RdDUtility.createMonnaie("Or (10 sols)", 1000, "systems/foundryvtt-reve-de-dragon/icons/objets/piece_or_sol.webp") );
|
newMonnaie.push(RdDUtility.createMonnaie("Or (10 sols)", 1000, "systems/foundryvtt-reve-de-dragon/icons/objets/piece_or_sol.webp") );
|
||||||
|
}
|
||||||
|
if ( newMonnaie.length > 0) {
|
||||||
|
await this.createOwnedItem( newMonnaie );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user