Meilleur post to tchat

This commit is contained in:
Vincent Vandemeulebrouck 2022-12-03 22:01:06 +01:00
parent d998a4cb08
commit db8fd6dbf8
2 changed files with 51 additions and 53 deletions

View File

@ -132,12 +132,6 @@ export class EnvironmentSheetHelper {
});
}
/* -------------------------------------------- */
static getHeaderButtons(sheet, buttons) {
buttons.unshift({ class: "post", icon: "fas fa-comment", onclick: ev => sheet.item.postItem() });
return buttons;
}
static setPosition(sheet, superPosition) {
const position = superPosition;
const sheetHeader = sheet.element.find(".sheet-header");
@ -155,6 +149,7 @@ export class EnvironmentSheetHelper {
static activateListeners(sheet, html) {
if (!sheet.options.editable) return;
html.find("input.input-selection-milieu").keypress(event => {
if (event.keyCode == '13') {
EnvironmentSheetHelper.onAddMilieu(html, sheet, event);

View File

@ -333,7 +333,7 @@ export class RdDItem extends Item {
/* -------------------------------------------- */
getProprietes() {
return this[`_${this.type}ChatData`]();
return this[`_${this.type}ChatData`]().filter(it => it != undefined);
}
/* -------------------------------------------- */
@ -357,29 +357,31 @@ export class RdDItem extends Item {
});
}
static propertyIfDefined(name, val, condition = (it) => true) {
return condition ? [`<b>${name}</b>: ${val}`] : [];
static propertyIfDefined(name, val, condition = true) {
return condition ? `<b>${name}</b>: ${val}` : undefined;
}
_inventaireTemplateChatData() {
return [
RdDItem.propertyIfDefined('Qualité', this.system.qualite, this.system.qualite != 0),
RdDItem.propertyIfDefined('Encombrement', this.system.encombrement)
// cout et quantité masqués
]
}
/* -------------------------------------------- */
_objetChatData() {
return [].concat(
RdDItem.propertyIfDefined('Résistance', this.system.resistance, this.system.resistance),
RdDItem.propertyIfDefined('Qualité', this.system.qualite, this.system.qualite),
RdDItem.propertyIfDefined('Encombrement', this.system.encombrement),
);
return this._inventaireTemplateChatData()
}
/* -------------------------------------------- */
_nourritureboissonChatData() {
return [].concat(
return [
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),
RdDItem.propertyIfDefined('Qualité', this.system.qualite, this.system.qualite),
RdDItem.propertyIfDefined('Encombrement', this.system.encombrement),
);
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
_armeChatData() {
@ -388,21 +390,19 @@ export class RdDItem extends Item {
`<b>Dommages</b>: ${this.system.dommages}`,
`<b>Force minimum</b>: ${this.system.force}`,
`<b>Resistance</b>: ${this.system.resistance}`,
`<b>Encombrement</b>: ${this.system.encombrement}`
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
_conteneurChatData() {
return [
`<b>Capacité</b>: ${this.system.capacite} Enc.`,
`<b>Encombrement</b>: ${this.system.encombrement}`
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
_munitionChatData() {
return [
`<b>Encombrement</b>: ${this.system.encombrement}`
]
return this._inventaireTemplateChatData()
}
/* -------------------------------------------- */
_armureChatData() {
@ -410,7 +410,7 @@ export class RdDItem extends Item {
`<b>Protection</b>: ${this.system.protection}`,
`<b>Détérioration</b>: ${this.system.deterioration}`,
`<b>Malus armure</b>: ${this.system.malus}`,
`<b>Encombrement</b>: ${this.system.encombrement}`
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
@ -444,16 +444,16 @@ export class RdDItem extends Item {
_herbeChatData() {
return [
`<b>Milieu</b>: ${this.system.milieu}`,
`<b>Rareté</b>: ${this.system.rarete}`,
`<b>Catégorie</b>: ${this.system.categorie}`,
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
_ingredientChatData() {
return [
`<b>Milieu</b>: ${this.system.milieu}`,
`<b>Rareté</b>: ${this.system.rarete}`,
`<b>Catégorie</b>: ${this.system.categorie}`,
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
@ -463,12 +463,9 @@ export class RdDItem extends Item {
`<b>Compétence</b>: ${this.system.competence}`,
`<b>Périodicité</b>: ${this.system.periodicite}`,
`<b>Fatigue</b>: ${this.system.fatigue}`,
`<b>Difficulté</b>: ${this.system.difficulte}`
].concat([
this.system.cacher_points_de_tache ? [] : `<b>Points de Tâche</b>: ${this.system.points_de_tache}`
]).concat([
`<b>Difficulté</b>: ${this.system.difficulte}`,
RdDItem.propertyIfDefined('Points de Tâche', this.system.points_de_tache, this.system.cacher_points_de_tache),
`<b>Points de Tâche atteints</b>: ${this.system.points_de_tache_courant}`]
);
}
/* -------------------------------------------- */
_livreChatData() {
@ -476,8 +473,8 @@ export class RdDItem extends Item {
`<b>Compétence</b>: ${this.system.competence}`,
`<b>Auteur</b>: ${this.system.auteur}`,
`<b>Difficulté</b>: ${this.system.difficulte}`,
`<b>Points de Tâche</b>: ${this.system.points_de_tache}`,
`<b>Encombrement</b>: ${this.system.encombrement}`
RdDItem.propertyIfDefined('Points de Tâche', this.system.points_de_tache, this.system.cacher_points_de_tache),
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
@ -485,32 +482,44 @@ export class RdDItem extends Item {
return [
`<b>Rareté</b>: ${this.system.rarete}`,
`<b>Catégorie</b>: ${this.system.categorie}`,
`<b>Encombrement</b>: ${this.system.encombrement}`,
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
_queueChatData() {
function label(categorie) {
switch (categorie) {
case 'ideefixe': return 'Idée fixe';
case 'lancinant': return 'Désir lancinant';
}
return ''
}
return [
`<b>Refoulement</b>: ${this.system.refoulement}`
`<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'}`,
]
}
/* -------------------------------------------- */
_ombreChatData() {
return [
`<b>Refoulement</b>: ${this.system.refoulement}`
]
return this._queueChatData()
}
/* -------------------------------------------- */
_souffleChatData() {
return [];
return [
`<b>Affecte</b>: ${this.system.hautrevant ? 'les haut-rêvants' : 'tout le monde'}`,
];
}
/* -------------------------------------------- */
_teteChatData() {
return [];
return [
`<b>Affecte</b>: ${this.system.hautrevant ? 'les haut-rêvants' : 'tout le monde'}`,
];
}
/* -------------------------------------------- */
_tarotChatData() {
return [
RdDItem.propertyIfDefined('Carte', RdDUtility.linkCompendium(this.pack, this.id, this.name), this.pack),
`<b>Concept</b>: ${this.system.concept}`,
`<b>Aspect</b>: ${this.system.aspect}`,
]
@ -524,10 +533,7 @@ export class RdDItem extends Item {
}
/* -------------------------------------------- */
_monnaieChatData() {
return [
`<b>Valeur en Sols</b>: ${this.system.cout}`,
`<b>Encombrement</b>: ${this.system.encombrement}`
]
return this._inventaireTemplateChatData()
}
/* -------------------------------------------- */
_meditationChatData() {
@ -551,9 +557,9 @@ export class RdDItem extends Item {
]
}
return [
`<b>Force</b>: ${this.system.force}`,
`<b>Force</b>: ${this.system.formule}`,
`<b>Refoulement</b>: ${this.system.refoulement}`,
`<b>Présent de cités</b>: ${this.system.presentCite}`,
RdDItem.propertyIfDefined('<b>Présent de cités</b>', '', this.system.presentCite),
]
}
/* -------------------------------------------- */
@ -568,15 +574,12 @@ export class RdDItem extends Item {
if (!this.system.identifie) {
return [`<b>Inconnue</b>`]
}
let properties = [
return [
`<b>Malignité</b>: ${this.system.malignite}`,
`<b>Périodicité</b>: ${this.system.periodicite}`,
`<b>Dommages</b>: ${this.system.dommages}`
`<b>Dommages</b>: ${this.system.dommages}`,
RdDItem.propertyIfDefined('<b>Remedes</b>', this.system.remedes, this.system.remedesconnus),
]
if (this.system.remedesconnus) {
properties.push(`<b>Remedes</b>: ${this.system.remedes}`)
}
return properties;
}
/* -------------------------------------------- */
@ -591,7 +594,7 @@ export class RdDItem extends Item {
`<b>Taille</b>: ${this.system.taille}`,
`<b>Inertie</b>: ${this.system.inertie}`,
`<b>Enchantabilité</b>: ${this.system.enchantabilite}`,
`<b>Prix</b>: ${this.system.cout}`,
...this._inventaireTemplateChatData()
]
}