2025-01-15 16:16:59 +01:00
|
|
|
import { ITEM_TYPES } from "../constants.js";
|
|
|
|
import { RdDItem } from "../item.js";
|
2024-12-03 23:25:58 +01:00
|
|
|
import { Grammar } from "../grammar.js"
|
|
|
|
import { SystemCompendiums } from "../settings/system-compendiums.js"
|
|
|
|
|
|
|
|
const DON_HAUT_REVE = "Don de Haut-Rêve"
|
|
|
|
|
|
|
|
export class RdDItemTete extends RdDItem {
|
|
|
|
|
|
|
|
static get defaultIcon() {
|
|
|
|
return "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp"
|
|
|
|
}
|
|
|
|
|
|
|
|
static isDonDeHautReve(tete) {
|
|
|
|
return tete.type == ITEM_TYPES.tete && Grammar.equalsInsensitive(tete.name, DON_HAUT_REVE)
|
|
|
|
}
|
|
|
|
|
|
|
|
static async teteDonDeHautReve() {
|
|
|
|
const tetes = await SystemCompendiums.getItems("tetes-de-dragon-pour-tous-personnages", ITEM_TYPES.tete)
|
|
|
|
const tete = tetes.find(it => RdDItemTete.isDonDeHautReve(it))
|
|
|
|
if (!tete) {
|
|
|
|
ui.notifications.warn(`Impossible de trouver la tête "${DON_HAUT_REVE}", vérifiez le compendium de têtes pour tous personnages`)
|
|
|
|
}
|
|
|
|
return tete
|
|
|
|
}
|
|
|
|
}
|