2021-03-25 03:18:27 +01:00
|
|
|
import { Misc } from "./misc.js";
|
2021-03-19 22:20:01 +01:00
|
|
|
|
|
|
|
const monnaiesData = [
|
|
|
|
{
|
2021-03-25 03:18:27 +01:00
|
|
|
name: "Etain (1 denier)", type: 'monnaie',
|
2021-03-19 22:20:01 +01:00
|
|
|
img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp",
|
|
|
|
data: { quantite: 0, valeur_deniers: 1, encombrement: 0.001, description: "" }
|
|
|
|
},
|
|
|
|
{
|
2021-03-25 03:18:27 +01:00
|
|
|
name: "Bronze (10 deniers)", type: 'monnaie',
|
2021-03-19 22:20:01 +01:00
|
|
|
img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_bronze_epees.webp",
|
|
|
|
data: { quantite: 0, valeur_deniers: 10, encombrement: 0.002, description: "" }
|
|
|
|
},
|
|
|
|
{
|
2021-03-25 03:18:27 +01:00
|
|
|
name: "Argent (1 sol)", type: 'monnaie',
|
2021-03-19 22:20:01 +01:00
|
|
|
img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_argent_sol.webp",
|
|
|
|
data: { quantite: 0, valeur_deniers: 100, encombrement: 0.003, description: "" }
|
|
|
|
},
|
|
|
|
{
|
2021-03-25 03:18:27 +01:00
|
|
|
name: "Or (10 sols)", type: 'monnaie',
|
2021-03-19 22:20:01 +01:00
|
|
|
img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_or_sol.webp",
|
|
|
|
data: { quantite: 0, valeur_deniers: 1000, encombrement: 0.004, description: "" }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
export class Monnaie {
|
|
|
|
|
|
|
|
static monnaiesData() {
|
|
|
|
return monnaiesData;
|
|
|
|
}
|
|
|
|
|
|
|
|
static filtrerMonnaies(items) {
|
2021-04-01 00:01:10 +02:00
|
|
|
return items.filter(it => Misc.data(it).type == 'monnaie');
|
2021-03-19 22:20:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static monnaiesManquantes(items) {
|
2021-03-25 03:18:27 +01:00
|
|
|
const valeurs = Monnaie.filtrerMonnaies(items)
|
|
|
|
.map(it => Misc.templateData(it).valeur_deniers)
|
|
|
|
const manquantes = monnaiesData.filter(monnaie => !valeurs.find(v => v != Misc.templateData(monnaie).valeur_deniers));
|
|
|
|
return manquantes;
|
|
|
|
}
|
|
|
|
|
|
|
|
static deValeur(monnaie, v) {
|
|
|
|
return v != monnaie.data.valeur_deniers;
|
2021-03-19 22:20:01 +01:00
|
|
|
}
|
|
|
|
}
|