2024-06-01 00:17:39 +02:00
import { DialogItemVente } from "./achat-vente/dialog-item-vente.js" ;
2021-04-12 00:16:23 +02:00
import { Grammar } from "./grammar.js" ;
2022-12-03 22:32:32 +01:00
import { Misc } from "./misc.js" ;
2022-09-07 18:47:56 +02:00
import { RdDHerbes } from "./rdd-herbes.js" ;
2023-03-29 22:53:40 +02:00
import { RdDTimestamp } from "./time/rdd-timestamp.js" ;
2021-01-01 21:11:56 +01:00
import { RdDUtility } from "./rdd-utility.js" ;
2022-12-23 00:22:13 +01:00
import { SystemCompendiums } from "./settings/system-compendiums.js" ;
2023-01-18 01:37:22 +01:00
import { RdDRaretes } from "./item/raretes.js" ;
2023-06-13 01:55:38 +02:00
import { RdDItemCompetence } from "./item-competence.js" ;
import { RdDItemCompetenceCreature } from "./item-competencecreature.js" ;
2021-01-01 21:11:56 +01:00
2023-05-12 22:56:45 +02:00
export const TYPES = {
competence : 'competence' ,
competencecreature : 'competencecreature' ,
2023-06-08 01:34:21 +02:00
empoignade : 'empoignade' ,
possession : 'possession' ,
blessure : 'blessure' ,
maladie : 'maladie' ,
poison : 'poison' ,
2023-05-12 22:56:45 +02:00
arme : 'arme' ,
armure : 'armure' ,
conteneur : 'conteneur' ,
2023-06-08 01:34:21 +02:00
objet : 'objet' ,
monnaie : 'monnaie' ,
gemme : 'gemme' ,
munition : 'munition' ,
nourritureboisson : 'nourritureboisson' ,
2023-05-12 22:56:45 +02:00
herbe : 'herbe' ,
2023-06-05 20:17:19 +02:00
plante : 'plante' ,
2023-05-12 22:56:45 +02:00
ingredient : 'ingredient' ,
2023-06-08 01:34:21 +02:00
faune : 'faune' ,
2023-05-12 22:56:45 +02:00
livre : 'livre' ,
potion : 'potion' ,
2023-06-08 01:34:21 +02:00
service : 'service' ,
musique : 'musique' ,
danse : 'danse' ,
chant : 'chant' ,
jeu : 'jeu' ,
recettecuisine : 'recettecuisine' ,
oeuvre : 'oeuvre' ,
recettealchimique : 'recettealchimique' ,
tache : 'tache' ,
sort : 'sort' ,
sortreserve : 'sortreserve' ,
2023-05-12 22:56:45 +02:00
rencontre : 'rencontre' ,
queue : 'queue' ,
ombre : 'ombre' ,
souffle : 'souffle' ,
tete : 'tete' ,
2023-06-08 01:34:21 +02:00
casetmr : 'casetmr' ,
2023-05-12 22:56:45 +02:00
meditation : 'meditation' ,
signedraconique : 'signedraconique' ,
tarot : 'tarot' ,
2023-06-08 01:34:21 +02:00
nombreastral : 'nombreastral' ,
extraitpoetique : 'extraitpoetique' ,
2023-05-12 22:56:45 +02:00
}
2023-06-08 01:34:21 +02:00
2023-01-03 00:31:32 +01:00
const typesInventaireMateriel = [
2023-05-12 22:56:45 +02:00
TYPES . arme ,
TYPES . armure ,
TYPES . conteneur ,
TYPES . faune ,
TYPES . gemme ,
TYPES . herbe ,
TYPES . plante ,
TYPES . ingredient ,
TYPES . livre ,
TYPES . monnaie ,
TYPES . munition ,
TYPES . nourritureboisson ,
TYPES . objet ,
TYPES . potion ,
2022-10-04 01:58:49 +02:00
]
2023-01-03 00:31:32 +01:00
const typesInventaire = {
materiel : typesInventaireMateriel ,
all : [ 'service' ] . concat ( typesInventaireMateriel ) ,
}
2023-05-12 22:56:45 +02:00
const typesObjetsOeuvres = [ TYPES . oeuvre , TYPES . recettecuisine , TYPES . musique , TYPES . chant , TYPES . danse , TYPES . jeu ]
const typesObjetsDraconiques = [ TYPES . queue , TYPES . ombre , TYPES . souffle , TYPES . tete , TYPES . signedraconique , TYPES . sortreserve , TYPES . rencontre ]
const typesObjetsConnaissance = [ TYPES . meditation , TYPES . recettealchimique , TYPES . sort ]
const typesObjetsEffet = [ TYPES . possession , TYPES . poison , TYPES . maladie , TYPES . blessure ]
const typesObjetsCompetence = [ TYPES . competence , TYPES . competencecreature ]
const typesObjetsTemporels = [ TYPES . blessure , TYPES . poison , TYPES . maladie , TYPES . queue , TYPES . ombre , TYPES . souffle , TYPES . signedraconique , TYPES . rencontre ]
const typesObjetsEquipable = [ TYPES . arme , TYPES . armure , TYPES . objet ] ;
2023-01-18 00:11:10 +01:00
const typesEnvironnement = typesInventaireMateriel ;
2022-10-04 01:58:49 +02:00
const encBrin = 0.00005 ; // un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc
const encPepin = 0.0007 ; / * u n p é p i n d e g e m m e = 1 / 1 0 c m 3 = 1 / 1 0 0 0 l = 3 . 5 / 1 0 0 0 k g = 7 / 2 0 0 0 k g = 7 / 1 0 0 0 e n c
densité 3.5 ( ~ 2.3 à 4 , parfois plus ) -- https : //www.juwelo.fr/guide-des-pierres/faits-et-chiffres/
* /
2021-04-13 22:42:39 +02:00
2021-05-18 19:50:24 +02:00
export const defaultItemImg = {
competence : "systems/foundryvtt-reve-de-dragon/icons/competence_defaut.webp" ,
2022-10-09 02:19:33 +02:00
competencecreature : "systems/foundryvtt-reve-de-dragon/icons/competence_defaut.webp" ,
2021-05-18 19:50:24 +02:00
arme : "systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_gnome.webp" ,
armure : "systems/foundryvtt-reve-de-dragon/icons/armes_armures/armure_plaques.webp" ,
conteneur : "systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp" ,
sort : "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp" ,
2021-11-10 20:03:04 +01:00
herbe : "systems/foundryvtt-reve-de-dragon/icons/botanique/Endorlotte.webp" ,
2022-12-03 18:31:05 +01:00
faune : "systems/foundryvtt-reve-de-dragon/icons/faune/rongeur.webp" ,
2021-05-18 19:50:24 +02:00
ingredient : "systems/foundryvtt-reve-de-dragon/icons/objets/sable_poudre.webp" ,
livre : "systems/foundryvtt-reve-de-dragon/icons/objets/livre.webp" ,
potion : "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp" ,
2022-11-05 18:19:53 +01:00
rencontre : "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp" ,
2021-05-18 19:50:24 +02:00
queue : "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp" ,
ombre : "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp" ,
souffle : "systems/foundryvtt-reve-de-dragon/icons/souffle_dragon.webp" ,
tete : "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp" ,
meditation : "systems/foundryvtt-reve-de-dragon/icons/meditations_ecrits/meditation_alchimie.webp" ,
recettealchimique : "systems/foundryvtt-reve-de-dragon/icons/competence_alchimie.webp" ,
chant : "systems/foundryvtt-reve-de-dragon/icons/arts/chant_0.webp" ,
danse : "systems/foundryvtt-reve-de-dragon/icons/arts/danse_0.webp" ,
jeu : "systems/foundryvtt-reve-de-dragon/icons/arts/jeux_petasse.webp" ,
recettecuisine : "systems/foundryvtt-reve-de-dragon/icons/arts/recette_cuisine_1.webp" ,
musique : "systems/foundryvtt-reve-de-dragon/icons/arts/chant_0.webp" ,
maladie : "systems/foundryvtt-reve-de-dragon/icons/maladies_venins/maladie.webp" ,
poison : "systems/foundryvtt-reve-de-dragon/icons/maladies_venins/venin.webp" ,
oeuvre : "systems/foundryvtt-reve-de-dragon/icons/competence_comedie.webp" ,
nourritureboisson : "systems/foundryvtt-reve-de-dragon/icons/objets/provision_crue.webp" ,
2023-01-01 22:21:30 +01:00
service : "systems/foundryvtt-reve-de-dragon/icons/services/lit.webp" ,
2021-05-18 19:50:24 +02:00
signedraconique : "systems/foundryvtt-reve-de-dragon/icons/tmr/signe_draconique.webp" ,
2022-06-12 08:17:59 +02:00
gemme : "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp" ,
2022-09-17 16:07:38 +02:00
possession : "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp" ,
sortreserve : "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp" ,
2022-11-16 03:00:38 +01:00
extraitpoetique : "systems/foundryvtt-reve-de-dragon/icons/competence_ecriture.webp" ,
2022-11-26 03:13:45 +01:00
tarot : "systems/foundryvtt-reve-de-dragon/icons/tarots/dos-tarot.webp" ,
2023-04-21 18:18:20 +02:00
empoignade : "systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp"
2021-05-18 19:50:24 +02:00
}
2021-01-01 21:11:56 +01:00
/* -------------------------------------------- */
export class RdDItem extends Item {
2023-04-18 22:16:18 +02:00
static get defaultIcon ( ) {
return undefined ;
}
2022-11-26 03:13:45 +01:00
static getDefaultImg ( itemType ) {
2022-12-23 00:22:13 +01:00
return game . system . rdd . itemClasses [ itemType ] ? . defaultIcon ? ? defaultItemImg [ itemType ] ;
2022-11-26 03:13:45 +01:00
}
2022-12-03 15:33:16 +01:00
static isFieldInventaireModifiable ( type , field ) {
2022-11-29 00:01:54 +01:00
switch ( field ) {
case 'quantite' :
2023-05-12 22:56:45 +02:00
if ( [ TYPES . conteneur ] . includes ( type ) ) {
2022-11-29 00:01:54 +01:00
return false ;
}
break ;
case 'cout' :
2023-05-12 22:56:45 +02:00
if ( [ TYPES . monnaie ] . includes ( type ) ) {
2022-12-03 15:33:16 +01:00
return game . user . isGM ;
2022-11-29 00:01:54 +01:00
}
break ;
}
return true ;
}
2022-12-23 00:22:13 +01:00
static async getCorrespondingItem ( itemRef ) {
if ( itemRef . pack ) {
return await SystemCompendiums . loadDocument ( itemRef )
}
return game . items . get ( itemRef . id ? ? itemRef . _id ) ;
}
2023-01-03 00:31:32 +01:00
static getItemTypesInventaire ( mode = 'materiel' ) {
return typesInventaire [ mode ? ? 'materiel' ]
2022-12-23 00:22:13 +01:00
}
2023-01-13 04:54:29 +01:00
static getItemTypesDraconiques ( ) {
return typesObjetsDraconiques ;
}
static getItemTypesEnvironnement ( ) {
return typesEnvironnement ;
}
2022-12-23 00:22:13 +01:00
static getTypesOeuvres ( ) {
return typesObjetsOeuvres
}
constructor ( docData , context = { } ) {
if ( ! context . rdd ? . ready ) {
2024-05-26 22:16:42 +02:00
foundry . utils . mergeObject ( context , { rdd : { ready : true } } ) ;
2022-12-23 00:22:13 +01:00
const ItemConstructor = game . system . rdd . itemClasses [ docData . type ] ;
if ( ItemConstructor ) {
if ( ! docData . img ) {
docData . img = ItemConstructor . defaultIcon ;
}
return new ItemConstructor ( docData , context ) ;
}
}
if ( ! docData . img ) {
docData . img = RdDItem . getDefaultImg ( docData . type ) ;
}
2024-06-29 00:03:38 +02:00
context . rdd = undefined
2022-12-23 00:22:13 +01:00
super ( docData , context ) ;
}
2022-12-03 22:32:32 +01:00
getUniteQuantite ( ) {
switch ( this . type ) {
2023-05-12 22:56:45 +02:00
case TYPES . monnaie : return "(Pièces)"
case TYPES . herbe :
2022-12-03 22:32:32 +01:00
switch ( this . system . categorie ) {
case 'Alchimie' : case 'Repos' : case 'Soin' :
return "(Brins)"
case 'Cuisine' : return '' ;
}
return '' ;
2023-05-12 22:56:45 +02:00
case TYPES . ingredient : return "(Pépins ou Brins)"
2022-11-29 00:01:54 +01:00
}
return '' ;
}
2022-11-26 03:13:45 +01:00
2023-04-18 22:16:18 +02:00
isEquipable ( ) {
return typesObjetsEquipable . includes ( this . type )
}
2023-05-12 22:56:45 +02:00
isCompetencePersonnage ( ) { return this . type == TYPES . competence }
isCompetenceCreature ( ) { return this . type == TYPES . competencecreature }
isConteneur ( ) { return this . type == TYPES . conteneur ; }
isMonnaie ( ) { return this . type == TYPES . monnaie ; }
isPotion ( ) { return this . type == TYPES . potion ; }
isNourritureBoisson ( ) { return this . type == TYPES . nourritureboisson ; }
isService ( ) { return this . type == TYPES . service ; }
2023-01-07 23:28:30 +01:00
2023-01-05 00:55:04 +01:00
isCompetence ( ) { return typesObjetsCompetence . includes ( this . type ) }
2023-10-23 23:40:03 +02:00
isEsquive ( ) {
return ( this . isCompetence ( )
&& this . system . categorie == 'melee'
&& Grammar . includesLowerCaseNoAccent ( this . name , 'Esquive' ) ) ;
}
isCorpsACorps ( ) {
2023-11-20 17:17:29 +01:00
return this . isCompetence ( )
2023-10-23 23:40:03 +02:00
&& this . system . categorie == 'melee'
2023-11-20 17:17:29 +01:00
&& Grammar . includesLowerCaseNoAccent ( this . name , 'Corps à Corps' )
2023-10-23 23:40:03 +02:00
}
isCompetenceArme ( ) {
2024-06-01 00:17:39 +02:00
return this . isCompetence ( ) && [ 'melee' , 'tir' , 'lancer' ] . includes ( this . system . categorie )
2023-10-23 23:40:03 +02:00
}
2023-06-13 01:55:38 +02:00
isCompetencePossession ( ) { return TYPES . competencecreature == this . type && this . system . categorie == "possession" }
2023-01-05 00:55:04 +01:00
isTemporel ( ) { return typesObjetsTemporels . includes ( this . type ) }
isOeuvre ( ) { return typesObjetsOeuvres . includes ( this . type ) }
2023-01-13 04:54:29 +01:00
isDraconique ( ) { return RdDItem . getItemTypesDraconiques ( ) . includes ( this . type ) }
2023-05-12 22:56:45 +02:00
isQueueDragon ( ) { return [ TYPES . queue , TYPES . ombre ] . includes ( this . type ) }
2023-01-05 00:55:04 +01:00
isEffet ( ) { return typesObjetsEffet . includes ( this . type ) }
isConnaissance ( ) { return typesObjetsConnaissance . includes ( this . type ) }
isInventaire ( mode = 'materiel' ) { return RdDItem . getItemTypesInventaire ( mode ) . includes ( this . type ) ; }
2023-01-18 00:11:10 +01:00
isBoisson ( ) { return this . isNourritureBoisson ( ) && this . system . boisson ; }
2023-01-07 23:28:30 +01:00
isAlcool ( ) { return this . isNourritureBoisson ( ) && this . system . boisson && this . system . alcoolise ; }
2023-05-12 22:56:45 +02:00
isHerbeAPotion ( ) { return this . type == TYPES . herbe && ( this . system . categorie == 'Soin' || this . system . categorie == 'Repos' ) ; }
isBlessure ( ) { return this . type == TYPES . blessure }
2023-01-13 04:54:29 +01:00
isPresentDansMilieux ( milieux ) {
2023-01-20 03:25:40 +01:00
return this . getEnvironnements ( milieux ) . length > 0
2023-01-13 04:54:29 +01:00
}
2023-06-13 01:55:38 +02:00
getCategories ( ) {
switch ( this . type ) {
case TYPES . competence : return RdDItemCompetence . getCategories ( )
case TYPES . competencecreature : return RdDItemCompetenceCreature . getCategories ( )
}
return { }
}
2023-01-18 00:11:10 +01:00
2023-01-20 03:25:40 +01:00
getEnvironnements ( milieux = undefined ) {
const environnements = this . isInventaire ( ) ? this . system . environnement : undefined ;
if ( milieux == undefined || ! environnements ) {
return environnements ? ? [ ] ;
}
return environnements . filter ( env => milieux . includes ( env . milieu ) )
2023-01-18 00:11:10 +01:00
}
getMilieux ( ) {
2023-01-20 03:25:40 +01:00
return this . getEnvironnements ( ) . map ( env => env . milieu ) ;
2023-01-13 04:54:29 +01:00
}
2023-01-20 03:25:40 +01:00
getRaretes ( milieux = undefined ) {
2023-01-13 04:54:29 +01:00
if ( this . isInventaire ( ) ) {
2023-01-20 03:25:40 +01:00
const raretes = this . getEnvironnements ( milieux ) . map ( env => RdDRaretes . byCode ( env . rarete ) ) ;
if ( milieux == undefined && raretes . length == 0 ) {
return [ RdDRaretes . rareteFrequente ( ) ] ;
}
return raretes ;
2023-01-13 04:54:29 +01:00
}
2023-01-20 03:25:40 +01:00
return [ RdDRaretes . rareteEgale ( ) ] ;
2023-01-13 04:54:29 +01:00
}
2023-01-17 21:51:49 +01:00
2023-01-13 04:54:29 +01:00
getFrequence ( milieux = undefined ) {
2023-01-20 03:25:40 +01:00
const frequences = this . getEnvironnements ( milieux ) . map ( it => it . frequence ) ;
return frequences . length == 0 ? 0 : Math . max ( ... frequences ) ;
2023-01-13 04:54:29 +01:00
}
2022-12-23 00:22:13 +01:00
2022-10-04 23:23:43 +02:00
getItemGroup ( ) {
2022-12-03 15:33:16 +01:00
if ( this . isInventaire ( ) ) return "equipement" ;
2022-10-04 23:23:43 +02:00
if ( this . isOeuvre ( ) ) return "oeuvre" ;
if ( this . isDraconique ( ) ) return "draconique" ;
if ( this . isConnaissance ( ) ) return "connaissance" ;
if ( this . isEffet ( ) ) return "effet" ;
if ( this . isCompetence ( ) ) return "competence" ;
return "autres" ;
}
2023-01-07 23:28:30 +01:00
isConteneurNonVide ( ) { return this . isConteneur ( ) && ( this . system . contenu ? . length ? ? 0 ) > 0 ; }
isConteneurVide ( ) { return this . isConteneur ( ) && ( this . system . contenu ? . length ? ? 0 ) == 0 ; }
isVideOuNonConteneur ( ) { return ! this . isConteneur ( ) || ( this . system . contenu ? . length ? ? 0 ) == 0 ; }
isFinPeriode ( oldTimestamp , newTimestamp ) {
if ( ! this . isTemporel ( ) ) {
return false ;
}
const finPeriode = new RdDTimestamp ( this . system . temporel . fin ) ;
return oldTimestamp . compare ( finPeriode ) < 0 && finPeriode . compare ( newTimestamp ) <= 0
}
async onCreateItemTemporel ( actor ) {
if ( this . isTemporel ( ) ) {
const timestampDebut = game . system . rdd . calendrier . timestamp ;
const timestampFin = await this . calculerFinPeriodeTemporel ( timestampDebut ) ;
await actor . updateEmbeddedDocuments ( 'Item' , [ {
_id : this . id ,
2024-05-02 14:08:02 +02:00
'system.temporel.debut' : foundry . utils . duplicate ( timestampDebut ) ,
'system.temporel.fin' : foundry . utils . duplicate ( timestampFin ) ,
2023-01-07 23:28:30 +01:00
} ] )
}
}
async calculerFinPeriodeTemporel ( timestampDebut ) {
return timestampDebut ;
2021-12-10 01:18:59 +01:00
}
2023-01-07 23:28:30 +01:00
async onFinPeriodeTemporel ( oldTimestamp , newTimestamp ) {
if ( this . isTemporel ( ) && this . actor ) {
await this . onFinPeriode ( oldTimestamp , newTimestamp ) ;
}
2021-12-10 01:18:59 +01:00
}
2023-01-07 23:28:30 +01:00
async onFinPeriode ( oldTimestamp , newTimestamp ) {
console . log ( ` ${ this . actor . name } : l'objet ${ this . name } a expiré et été supprimé ` ) ;
await this . actor ? . deleteEmbeddedDocuments ( 'Item' , [ this . id ] ) ;
2021-05-07 17:27:02 +02:00
}
2023-01-18 00:11:10 +01:00
2023-01-15 15:54:40 +01:00
getUtilisation ( ) {
2022-12-03 22:32:32 +01:00
switch ( this . type ) {
2023-05-12 22:56:45 +02:00
case TYPES . potion :
2023-01-20 23:46:37 +01:00
switch ( this . system . categorie ) {
case 'Alchimie' : case 'AlchimieEnchante' : case 'AlchimieAutre' : return 'alchimie'
case 'Cuisine' : return 'cuisine'
case 'Remede' : case 'Repos' : case 'ReposEnchante' : case 'Soin' : case 'SoinEnchante' : return 'soins'
}
return '' ;
2023-05-12 22:56:45 +02:00
case TYPES . nourritureboisson : return 'cuisine' ;
case TYPES . herbe : case TYPES . faune : case TYPES . ingredient : case TYPES . plante :
2023-01-15 15:54:40 +01:00
switch ( this . system . categorie ) {
case 'Cuisine' : return 'cuisine' ;
2023-01-20 23:45:57 +01:00
case 'Toxique' : case 'Poison' : return 'poison' ;
2023-01-15 15:54:40 +01:00
case 'Alchimie' : return 'alchimie'
case 'Soin' : case 'Repos' : return 'soins'
}
return this . system . sust > 0 ? 'cuisine' : '' ;
}
return '' ;
}
2023-01-18 00:11:10 +01:00
2023-01-15 15:54:40 +01:00
getUtilisationCuisine ( ) {
if ( this . getUtilisation ( ) == 'cuisine' ) {
switch ( this . type ) {
2023-05-12 22:56:45 +02:00
case TYPES . nourritureboisson :
2023-01-15 15:54:40 +01:00
return 'pret' ;
2023-05-12 22:56:45 +02:00
case TYPES . herbe : case TYPES . faune : case TYPES . ingredient : case TYPES . plante :
2023-01-15 15:54:40 +01:00
return 'brut' ;
}
2022-12-03 22:32:32 +01:00
}
return '' ;
}
2021-04-20 23:16:18 +02:00
isCristalAlchimique ( ) {
2023-05-12 22:56:45 +02:00
return this . type == TYPES . objet && Grammar . includesLowerCaseNoAccent ( this . name , 'cristal alchimique' ) && this . system . quantite > 0 ;
2021-04-20 23:16:18 +02:00
}
2021-05-07 17:27:02 +02:00
isMagique ( ) {
2022-06-12 08:17:59 +02:00
return this . system . magique
2021-05-06 21:36:40 +02:00
}
2021-04-13 22:42:39 +02:00
2023-01-07 23:28:30 +01:00
isItemCommerce ( ) {
return this . parent ? . type == 'commerce' ;
}
2023-02-05 20:26:44 +01:00
isNomLike ( texte ) {
return Grammar . includesLowerCaseNoAccent ( this . name , texte )
}
isNomTypeLike ( texte ) {
return this . isNomLike ( texte ) || Grammar . includesLowerCaseNoAccent ( Misc . typeName ( this . type , 'Item' ) , texte )
}
2022-10-04 01:58:49 +02:00
getQuantite ( ) {
2023-01-03 13:38:04 +01:00
return this . isService ( ) ? undefined : Math . round ( this . system . quantite ? ? 0 )
2021-05-27 22:40:12 +02:00
}
2022-10-04 01:58:49 +02:00
getEncTotal ( ) {
2023-06-12 23:04:32 +02:00
return ( this . getQuantite ( ) ? ? 0 ) * this . getEnc ( ) ;
2022-12-03 15:33:16 +01:00
}
2022-10-04 01:58:49 +02:00
2021-04-13 22:42:39 +02:00
getEnc ( ) {
2022-06-12 08:17:59 +02:00
switch ( this . type ) {
2023-05-12 22:56:45 +02:00
case TYPES . service :
2023-01-03 13:38:04 +01:00
return 0 ;
2023-05-12 22:56:45 +02:00
case TYPES . herbe :
2022-12-03 22:32:32 +01:00
return this . getEncHerbe ( ) ;
2023-05-12 22:56:45 +02:00
case TYPES . gemme :
2022-10-04 01:58:49 +02:00
return encPepin * this . system . taille ;
2021-04-13 22:42:39 +02:00
}
2022-10-04 01:58:49 +02:00
return Math . max ( this . system . encombrement ? ? 0 , 0 ) ;
}
2023-07-29 23:42:05 +02:00
getEncContenu ( ) {
return this . getContenu ( )
. map ( it => it . getRecursiveEnc ( ) )
. reduce ( Misc . sum ( ) , 0 ) ;
}
getRecursiveEnc ( ) {
return this . getEncTotal ( ) + this . getEncContenu ( )
}
2022-12-03 22:32:32 +01:00
getEncHerbe ( ) {
switch ( this . system . categorie ) {
case 'Repos' : case 'Soin' : case 'Alchimie' :
return encBrin ;
}
return this . system . encombrement ;
}
2023-07-29 23:42:05 +02:00
getContenu ( ) {
if ( this . isConteneur ( ) ) {
return this . system . contenu . map ( idContenu => this . actor . getItem ( idContenu ) ) ;
}
return [ ]
}
isConteneurContenu ( conteneur ) {
return this . getContenu ( )
. find ( it => it . id == conteneur . id || it . isConteneurContenu ( conteneur ) )
}
2022-11-29 00:01:54 +01:00
valeurTotale ( ) {
2023-01-03 13:38:04 +01:00
return ( this . isService ( ) ? 1 : this . getQuantite ( ) ) * this . valeur ( )
2022-10-04 01:58:49 +02:00
}
2022-11-29 00:01:54 +01:00
valeur ( ) {
return this . system . cout ? ? 0
2021-04-13 22:42:39 +02:00
}
2023-01-03 01:37:50 +01:00
calculerPrixCommercant ( ) {
2023-01-03 23:46:08 +01:00
if ( this . isItemCommerce ( ) ) {
2023-01-03 01:37:50 +01:00
// appliquer le pourcentage
return this . parent . calculerPrix ( this ) ;
}
return this . system . cout ;
}
2021-04-06 23:36:35 +02:00
prepareDerivedData ( ) {
super . prepareDerivedData ( ) ;
2022-12-03 15:33:16 +01:00
if ( this . isInventaire ( ) ) {
2022-10-04 01:58:49 +02:00
this . system . encTotal = this . getEncTotal ( ) ;
2021-12-05 16:48:18 +01:00
if ( this . isPotion ( ) ) {
this . prepareDataPotion ( )
}
2022-09-07 00:09:17 +02:00
this . system . actionPrincipale = this . getActionPrincipale ( { warnIfNot : false } ) ;
2021-04-08 20:37:11 +02:00
}
2023-04-18 22:16:18 +02:00
this . equipable = this . isEquipable ( ) ;
2021-04-12 00:16:23 +02:00
}
prepareDataPotion ( ) {
2022-06-12 08:17:59 +02:00
const categorie = Grammar . toLowerCaseNoAccent ( this . system . categorie ) ;
this . system . magique = categorie . includes ( 'enchante' ) ;
if ( this . system . magique ) {
2021-04-12 00:16:23 +02:00
if ( categorie . includes ( 'soin' ) || categorie . includes ( 'repos' ) ) {
2022-10-08 14:25:31 +02:00
// TODO: utiliser calculPointsRepos / calculPointsGuerison
this . system . puissance = RdDHerbes . calculPuissancePotion ( this ) ;
2021-04-12 00:16:23 +02:00
}
}
2021-04-08 20:37:11 +02:00
}
2021-04-11 18:47:00 +02:00
2021-04-12 00:16:23 +02:00
getActionPrincipale ( options = { warnIfNot : true } ) {
2022-09-16 23:27:26 +02:00
switch ( this . type ) {
2023-05-12 22:56:45 +02:00
case TYPES . conteneur : return 'Ouvrir' ;
2022-12-03 22:32:32 +01:00
}
if ( this . actor ? . isPersonnage ( ) ) {
const warn = options . warnIfNot ;
2023-01-15 15:54:40 +01:00
if ( this . getUtilisationCuisine ( ) == 'brut' ) {
2023-11-06 23:03:44 +01:00
return 'Cuisiner' ;
2022-12-03 22:32:32 +01:00
}
switch ( this . type ) {
2023-05-12 22:56:45 +02:00
case TYPES . nourritureboisson : return this . _actionOrWarnQuantiteZero ( this . system . boisson ? 'Boire' : 'Manger' , warn ) ;
2023-11-06 23:03:44 +01:00
case TYPES . potion : return this . _actionOrWarnQuantiteZero ( 'Consommer' , warn ) ;
2023-05-12 22:56:45 +02:00
case TYPES . livre : return this . _actionOrWarnQuantiteZero ( 'Lire' , warn ) ;
case TYPES . herbe : return this . isHerbeAPotion ( ) ? this . _actionOrWarnQuantiteZero ( 'Décoction' , warn ) : undefined ;
case TYPES . queue : case TYPES . ombre : return this . system . refoulement > 0 ? 'Refouler' : undefined ;
2022-12-03 22:32:32 +01:00
}
2022-09-16 23:27:26 +02:00
}
return undefined ;
}
2022-12-23 00:34:17 +01:00
2022-12-03 22:32:32 +01:00
/* -------------------------------------------- */
async actionPrincipale ( actor , onActionItem = async ( ) => { } ) {
2023-11-06 23:03:44 +01:00
if ( ! this . getActionPrincipale ( ) ) { return }
await actor ? . actionPrincipale ( this , onActionItem ) ;
2022-12-03 22:32:32 +01:00
}
2022-09-16 23:27:26 +02:00
2022-12-03 15:33:16 +01:00
_actionOrWarnQuantiteZero ( actionName , warn ) {
2022-09-16 23:27:26 +02:00
if ( ( this . system . quantite ? ? 0 ) <= 0 ) {
if ( warn ) {
2022-06-12 08:17:59 +02:00
ui . notifications . warn ( ` Vous n'avez plus de ${ this . name } . ` ) ;
2021-04-11 23:01:10 +02:00
}
2021-04-12 00:16:23 +02:00
return undefined ;
2021-04-11 23:01:10 +02:00
}
2022-09-16 23:27:26 +02:00
else {
return actionName ;
2021-04-11 23:01:10 +02:00
}
}
2021-04-12 01:03:37 +02:00
async diminuerQuantite ( nombre , options = { diminuerQuantite : true , supprimerSiZero : false } ) {
if ( options . diminuerQuantite == false ) return ;
2021-04-13 22:42:39 +02:00
await this . quantiteIncDec ( - nombre , options ) ;
}
2022-12-03 22:32:32 +01:00
async onCreateDecoupeComestible ( actor ) {
2023-01-15 15:54:40 +01:00
if ( actor && this . getUtilisationCuisine ( ) == 'brut' && this . system . sust != 1 ) {
2022-12-03 22:32:32 +01:00
if ( this . system . sust < 1 ) {
await actor . updateEmbeddedDocuments ( 'Item' , [ {
_id : this . id ,
'system.sust' : 0
} ] )
}
else {
const sust = Math . floor ( this . system . sust ) ;
await actor . updateEmbeddedDocuments ( 'Item' , [ {
_id : this . id ,
'system.quantite' : this . system . quantite * sust ,
'system.encombrement' : Misc . keepDecimals ( this . system . encombrement / sust , 2 ) ,
2024-06-01 00:17:39 +02:00
'system.cout' : Math . max ( 0 , Misc . keepDecimals ( this . system . cout / sust , 2 ) ) ,
2022-12-03 22:32:32 +01:00
'system.sust' : 1
} ] )
}
}
}
async empiler ( item ) {
2023-01-15 15:54:40 +01:00
if ( this . getUtilisationCuisine ( ) == 'brut' ) {
2022-12-03 22:32:32 +01:00
const sust = this . system . sust + item . system . sust ;
const encombrement = this . system . encombrement + item . system . encombrement ;
await this . update ( {
"system.sust" : sust ,
"system.encombrement" : encombrement
} ) ;
}
else {
await this . quantiteIncDec ( item . system . quantite ) ;
}
await item . delete ( ) ;
}
2023-01-02 01:37:08 +01:00
async quantiteIncDec ( nombre , options = { supprimerSiZero : false } ) {
2022-06-12 08:17:59 +02:00
const quantite = Number ( this . system . quantite ? ? - 1 ) ;
2021-05-07 17:27:02 +02:00
if ( quantite >= 0 ) {
2021-04-14 21:51:29 +02:00
const reste = Math . max ( quantite + Number ( nombre ) , 0 ) ;
2021-04-13 22:42:39 +02:00
if ( reste == 0 ) {
2021-05-07 17:27:02 +02:00
if ( options . supprimerSiZero ) {
2022-06-12 08:17:59 +02:00
ui . notifications . notify ( ` ${ this . name } supprimé de votre équipement ` ) ;
2021-04-13 22:42:39 +02:00
await this . delete ( ) ;
}
else {
2022-06-12 08:17:59 +02:00
ui . notifications . notify ( ` Il ne vous reste plus de ${ this . name } , vous pouvez le supprimer de votre équipement, ou trouver un moyen de vous en procurer. ` ) ;
2022-09-07 18:47:56 +02:00
await this . update ( { "system.quantite" : 0 } ) ;
2021-04-13 22:42:39 +02:00
}
2021-04-12 01:03:37 +02:00
}
else {
2022-09-07 18:47:56 +02:00
await this . update ( { "system.quantite" : reste } ) ;
2021-04-12 01:03:37 +02:00
}
2021-04-11 18:47:00 +02:00
}
}
2021-04-13 22:42:39 +02:00
/* -------------------------------------------- */
// détermine si deux équipements sont similaires: de même type, et avec les même champs hormis la quantité
2022-12-03 15:33:16 +01:00
isInventaireEmpilable ( other ) {
if ( ! other || ! this . isInventaire ( ) ) {
2022-10-17 21:19:01 +02:00
return [ false , undefined ] ;
}
2022-10-04 01:58:49 +02:00
if ( this . system . quantite == undefined ) {
2022-10-17 21:19:01 +02:00
return [ false , ` Impossible de regrouper des ${ this . type } , ils ne sont pas empilables ` ] ;
2022-12-03 15:33:16 +01:00
}
2022-10-04 01:58:49 +02:00
else if ( this . type != other . type ) {
2022-10-17 21:19:01 +02:00
return [ false , ` Impossible de regrouper des ${ this . type } avec des ${ other . type } ` ] ;
2022-09-07 00:09:17 +02:00
}
else if ( this . name != other . name ) {
2022-10-17 21:19:01 +02:00
return [ false , ` Impossible de regrouper ${ this . name } avec ${ other . name } ` ] ;
2022-09-07 00:09:17 +02:00
}
else {
2023-01-18 01:37:22 +01:00
const excludedProperties = [ 'quantite' , 'cout' , 'encTotal' , 'environnement' , 'contenu' ] ;
2023-01-15 15:54:40 +01:00
if ( this . getUtilisationCuisine ( ) ) {
2022-12-03 22:32:32 +01:00
excludedProperties . push ( 'sust' , 'encombrement' ) ;
}
let differences = Object . entries ( this . system )
. filter ( ( [ key , value ] ) => ! excludedProperties . includes ( key ) )
. filter ( ( [ key , value ] ) => value != other . system [ key ] )
2022-09-07 00:09:17 +02:00
if ( differences . length > 0 ) {
2022-10-17 21:19:01 +02:00
let message = ` Impossible de regrouper les ${ this . type } ${ this . name } : ` ;
2022-09-07 00:09:17 +02:00
for ( const [ key , value ] of differences ) {
message += ` <br> ${ key } : ${ value } vs ${ other . system [ key ] } ` ;
}
2022-10-17 21:19:01 +02:00
return [ false , message ] ;
2021-06-02 23:41:25 +02:00
}
2022-09-07 00:09:17 +02:00
}
2022-10-17 21:19:01 +02:00
return [ true , undefined ] ;
2021-04-13 22:42:39 +02:00
}
2023-01-01 22:16:26 +01:00
async proposerVente ( quantiteMax = undefined ) {
2021-05-07 17:27:02 +02:00
console . log ( this ) ;
2021-12-10 01:18:59 +01:00
if ( this . isConteneurNonVide ( ) ) {
2022-10-07 19:05:56 +02:00
ui . notifications . warn ( ` Votre ${ this . name } n'est pas vide, pas possible de le proposer ` ) ;
2021-12-10 01:18:59 +01:00
return ;
}
2024-06-01 00:17:39 +02:00
await DialogItemVente . display ( { item : this , quantiteMax } )
2021-05-07 17:27:02 +02:00
}
2021-04-13 22:42:39 +02:00
2021-10-29 21:31:58 +02:00
/* -------------------------------------------- */
2021-06-08 00:32:27 +02:00
getProprietes ( ) {
2022-12-23 00:34:17 +01:00
if ( this [ ` _ ${ this . type } ChatData ` ] ) {
return this [ ` _ ${ this . type } ChatData ` ] ( ) . filter ( it => it != undefined ) ;
}
return [ ] ;
2021-06-08 00:32:27 +02:00
}
2021-01-01 21:11:56 +01:00
/* -------------------------------------------- */
2022-12-29 02:25:45 +01:00
async postItemToChat ( modeOverride ) {
2021-01-01 21:11:56 +01:00
console . log ( this ) ;
2022-12-29 02:25:45 +01:00
let chatData = {
doctype : 'Item' ,
id : this . id ,
type : this . type ,
img : this . img ,
pack : this . pack ,
name : this . name ,
2023-01-03 00:31:32 +01:00
actor : this . actor ? { id : this . actor . id } : undefined ,
2022-12-29 02:25:45 +01:00
system : { description : this . system . description } ,
properties : this . getProprietes ( ) ,
2021-04-14 22:40:12 +02:00
}
2022-12-23 00:34:17 +01:00
renderTemplate ( this . getChatItemTemplate ( ) , chatData ) . then ( html => {
2021-10-29 21:31:58 +02:00
let chatOptions = RdDUtility . chatDataSetup ( html , modeOverride ) ;
2021-01-01 21:11:56 +01:00
ChatMessage . create ( chatOptions )
} ) ;
}
2022-12-23 00:34:17 +01:00
getChatItemTemplate ( ) {
return 'systems/foundryvtt-reve-de-dragon/templates/post-item.html' ;
}
2022-12-03 22:01:06 +01:00
static propertyIfDefined ( name , val , condition = true ) {
return condition ? ` <b> ${ name } </b>: ${ val } ` : undefined ;
2021-04-11 18:47:00 +02:00
}
2022-12-03 22:01:06 +01:00
_inventaireTemplateChatData ( ) {
return [
RdDItem . propertyIfDefined ( 'Qualité' , this . system . qualite , this . system . qualite != 0 ) ,
RdDItem . propertyIfDefined ( 'Encombrement' , this . system . encombrement )
// cout et quantité masqués
]
}
2021-01-01 21:11:56 +01:00
/* -------------------------------------------- */
_objetChatData ( ) {
2022-12-03 22:01:06 +01:00
return this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
}
2021-04-11 18:47:00 +02:00
/* -------------------------------------------- */
_nourritureboissonChatData ( ) {
2022-12-03 22:01:06 +01:00
return [
2022-11-05 18:06:30 +01:00
RdDItem . propertyIfDefined ( 'Sustentation' , this . system . sust , this . system . sust > 0 ) ,
RdDItem . propertyIfDefined ( 'Désaltère' , this . system . desaltere , this . system . boisson ) ,
RdDItem . propertyIfDefined ( 'Force alcool' , this . system . force , this . system . boisson && this . system . alcoolise ) ,
RdDItem . propertyIfDefined ( 'Exotisme' , this . system . exotisme , this . system . exotisme < 0 ) ,
2022-12-03 22:01:06 +01:00
... this . _inventaireTemplateChatData ( )
]
2021-04-11 18:47:00 +02:00
}
2021-01-01 21:11:56 +01:00
/* -------------------------------------------- */
_armeChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Compétence</b>: ${ this . system . competence } ` ,
2023-07-29 23:42:05 +02:00
` <b>Dommages</b>: ${ this . system . dommages } ${ this . system . mortalite == 'non-mortel' ? '(Non mortel)' : '' } ` ,
2022-11-05 18:06:30 +01:00
` <b>Force minimum</b>: ${ this . system . force } ` ,
` <b>Resistance</b>: ${ this . system . resistance } ` ,
2022-12-03 22:01:06 +01:00
... this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_conteneurChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Capacité</b>: ${ this . system . capacite } Enc. ` ,
2022-12-03 22:01:06 +01:00
... this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_munitionChatData ( ) {
2022-12-03 22:01:06 +01:00
return this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
}
/* -------------------------------------------- */
_armureChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Protection</b>: ${ this . system . protection } ` ,
` <b>Détérioration</b>: ${ this . system . deterioration } ` ,
` <b>Malus armure</b>: ${ this . system . malus } ` ,
2022-12-03 22:01:06 +01:00
... this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_competenceChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Catégorie</b>: ${ this . system . categorie } ` ,
` <b>Niveau</b>: ${ this . system . niveau } ` ,
` <b>Caractéristique par défaut</b>: ${ this . system . carac _defaut } ` ,
` <b>XP</b>: ${ this . system . xp } `
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_competencecreatureChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Catégorie</b>: ${ this . system . categorie } ` ,
` <b>Niveau</b>: ${ this . system . niveau } ` ,
` <b>Caractéristique</b>: ${ this . system . carac _value } ` ,
` <b>XP</b>: ${ this . system . xp } `
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_sortChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Draconic</b>: ${ this . system . draconic } ` ,
` <b>Difficulté</b>: ${ this . system . difficulte } ` ,
` <b>Case TMR</b>: ${ this . system . caseTMR } ` ,
` <b>Points de Rêve</b>: ${ this . system . ptreve } `
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_herbeChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Milieu</b>: ${ this . system . milieu } ` ,
` <b>Catégorie</b>: ${ this . system . categorie } ` ,
2022-12-03 22:01:06 +01:00
... this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_ingredientChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Milieu</b>: ${ this . system . milieu } ` ,
` <b>Catégorie</b>: ${ this . system . categorie } ` ,
2022-12-03 22:01:06 +01:00
... this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
2022-12-03 18:31:05 +01:00
_fauneChatData ( ) {
return [
` <b>Sustentation</b>: ${ this . system . sust } ` ,
` <b>Milieu</b>: ${ this . system . milieu } ` ,
... this . _inventaireTemplateChatData ( )
]
}
/* -------------------------------------------- */
2021-01-01 21:11:56 +01:00
_tacheChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Caractéristique</b>: ${ this . system . carac } ` ,
` <b>Compétence</b>: ${ this . system . competence } ` ,
` <b>Périodicité</b>: ${ this . system . periodicite } ` ,
` <b>Fatigue</b>: ${ this . system . fatigue } ` ,
2022-12-03 22:01:06 +01:00
` <b>Difficulté</b>: ${ this . system . difficulte } ` ,
2023-11-10 22:38:33 +01:00
RdDItem . propertyIfDefined ( 'Points de Tâche' , this . system . points _de _tache , ! this . system . cacher _points _de _tache ) ,
2022-11-05 18:06:30 +01:00
` <b>Points de Tâche atteints</b>: ${ this . system . points _de _tache _courant } ` ]
2021-01-01 21:11:56 +01:00
}
/* -------------------------------------------- */
_livreChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Compétence</b>: ${ this . system . competence } ` ,
` <b>Auteur</b>: ${ this . system . auteur } ` ,
` <b>Difficulté</b>: ${ this . system . difficulte } ` ,
2023-11-10 22:38:33 +01:00
RdDItem . propertyIfDefined ( 'Points de Tâche' , this . system . points _de _tache , ! this . system . cacher _points _de _tache ) ,
2022-12-03 22:01:06 +01:00
... this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_potionChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Rareté</b>: ${ this . system . rarete } ` ,
` <b>Catégorie</b>: ${ this . system . categorie } ` ,
2022-12-03 22:01:06 +01:00
... this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_queueChatData ( ) {
2022-12-03 22:01:06 +01:00
function label ( categorie ) {
switch ( categorie ) {
case 'ideefixe' : return 'Idée fixe' ;
case 'lancinant' : return 'Désir lancinant' ;
}
return ''
}
2022-11-05 18:06:30 +01:00
return [
2022-12-03 22:01:06 +01:00
` <b>Refoulement</b>: ${ this . system . refoulement } ` ,
` <b>Catégorie</b>: ${ label ( this . system . categorie ) } ` ,
` <b>Affecte</b>: ${ this . system . hautrevant ? 'les haut-rêvants' : 'tout le monde' } ` ,
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_ombreChatData ( ) {
2022-12-03 22:01:06 +01:00
return this . _queueChatData ( )
2021-01-01 21:11:56 +01:00
}
/* -------------------------------------------- */
_souffleChatData ( ) {
2022-12-03 22:01:06 +01:00
return [
` <b>Affecte</b>: ${ this . system . hautrevant ? 'les haut-rêvants' : 'tout le monde' } ` ,
] ;
2021-01-01 21:11:56 +01:00
}
/* -------------------------------------------- */
_teteChatData ( ) {
2022-12-03 22:01:06 +01:00
return [
` <b>Affecte</b>: ${ this . system . hautrevant ? 'les haut-rêvants' : 'tout le monde' } ` ,
] ;
2021-01-01 21:11:56 +01:00
}
/* -------------------------------------------- */
_tarotChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
2022-12-03 22:01:06 +01:00
RdDItem . propertyIfDefined ( 'Carte' , RdDUtility . linkCompendium ( this . pack , this . id , this . name ) , this . pack ) ,
2022-11-05 18:06:30 +01:00
` <b>Concept</b>: ${ this . system . concept } ` ,
` <b>Aspect</b>: ${ this . system . aspect } ` ,
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_nombreastralChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Valeur</b>: ${ this . system . value } ` ,
` <b>Jour</b>: ${ this . system . jourlabel } ` ,
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
_monnaieChatData ( ) {
2022-12-03 22:01:06 +01:00
return this . _inventaireTemplateChatData ( )
2021-01-01 21:11:56 +01:00
}
/* -------------------------------------------- */
_meditationChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Thème</b>: ${ this . system . theme } ` ,
` <b>Compétence</b>: ${ this . system . competence } ` ,
` <b>Support</b>: ${ this . system . support } ` ,
` <b>Heure</b>: ${ this . system . heure } ` ,
` <b>Purification</b>: ${ this . system . purification } ` ,
` <b>Vêture</b>: ${ this . system . veture } ` ,
` <b>Comportement</b>: ${ this . system . comportement } ` ,
` <b>Case TMR</b>: ${ this . system . tmr } `
2021-01-01 21:11:56 +01:00
]
}
/* -------------------------------------------- */
2022-11-05 18:19:53 +01:00
_rencontreChatData ( ) {
if ( this . system . coord ) {
return [
` <b>Force</b>: ${ this . system . force } ` ,
` <b>Coordonnées</b>: ${ this . system . coord } ` ,
]
}
return [
2022-12-03 22:01:06 +01:00
` <b>Force</b>: ${ this . system . formule } ` ,
2022-11-05 18:19:53 +01:00
` <b>Refoulement</b>: ${ this . system . refoulement } ` ,
2022-12-03 22:01:06 +01:00
RdDItem . propertyIfDefined ( '<b>Présent de cités</b>' , '' , this . system . presentCite ) ,
2022-11-05 18:19:53 +01:00
]
}
/* -------------------------------------------- */
2021-01-01 21:11:56 +01:00
_casetmrChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Coordonnée</b>: ${ this . system . coord } ` ,
` <b>Spécificité</b>: ${ this . system . specific } `
2021-01-01 21:11:56 +01:00
]
}
2021-10-29 21:31:58 +02:00
/* -------------------------------------------- */
_maladieChatData ( ) {
2022-11-05 18:06:30 +01:00
if ( ! this . system . identifie ) {
return [ ` <b>Inconnue</b> ` ]
}
2022-12-03 22:01:06 +01:00
return [
2022-12-03 15:33:16 +01:00
` <b>Malignité</b>: ${ this . system . malignite } ` ,
` <b>Périodicité</b>: ${ this . system . periodicite } ` ,
2022-12-03 22:01:06 +01:00
` <b>Dommages</b>: ${ this . system . dommages } ` ,
RdDItem . propertyIfDefined ( '<b>Remedes</b>' , this . system . remedes , this . system . remedesconnus ) ,
2022-12-03 15:33:16 +01:00
]
2021-10-29 21:31:58 +02:00
}
/* -------------------------------------------- */
_poisonChatData ( ) {
return this . _maladieChatData ( ) ;
}
/* -------------------------------------------- */
_gemmeChatData ( ) {
2022-11-05 18:06:30 +01:00
return [
` <b>Pureté</b>: ${ this . system . purete } ` ,
` <b>Taille</b>: ${ this . system . taille } ` ,
` <b>Inertie</b>: ${ this . system . inertie } ` ,
` <b>Enchantabilité</b>: ${ this . system . enchantabilite } ` ,
2022-12-03 22:01:06 +01:00
... this . _inventaireTemplateChatData ( )
2021-10-29 21:31:58 +02:00
]
}
2021-01-01 21:11:56 +01:00
}