Merge branch 'v1.4-fix' into 'v1.4'
Plusieurs fixes See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!245
This commit is contained in:
commit
04b67f2188
@ -1030,6 +1030,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
else if (dest?.isEquipementSimilaire(item)) {
|
else if (dest?.isEquipementSimilaire(item)) {
|
||||||
await this.regrouperEquipementsSimilaires(item, dest);
|
await this.regrouperEquipementsSimilaires(item, dest);
|
||||||
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1800,7 +1801,7 @@ export class RdDActor extends Actor {
|
|||||||
jetVie: {
|
jetVie: {
|
||||||
forceAlcool: forceAlcool,
|
forceAlcool: forceAlcool,
|
||||||
nbDoses: nbDoses,
|
nbDoses: nbDoses,
|
||||||
selectedCarac: actorData.data.carac.constitution,
|
selectedCarac: actorData.data.sante.vie,
|
||||||
carac: actorData.data.carac,
|
carac: actorData.data.carac,
|
||||||
caracValue: actorData.data.sante.vie.max,
|
caracValue: actorData.data.sante.vie.max,
|
||||||
finalLevel: etat + forceAlcool - nbDoses,
|
finalLevel: etat + forceAlcool - nbDoses,
|
||||||
@ -1809,6 +1810,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await RdDResolutionTable.rollData(ethylismeData.jetVie);
|
await RdDResolutionTable.rollData(ethylismeData.jetVie);
|
||||||
|
this._appliquerExperienceRollData(ethylismeData.jetVie);
|
||||||
RollDataAjustements.calcul(ethylismeData.jetVie, this);
|
RollDataAjustements.calcul(ethylismeData.jetVie, this);
|
||||||
if (ethylismeData.jetVie.rolled.isSuccess) {
|
if (ethylismeData.jetVie.rolled.isSuccess) {
|
||||||
ethylisme.nb_doses++;
|
ethylisme.nb_doses++;
|
||||||
@ -1816,22 +1818,22 @@ export class RdDActor extends Actor {
|
|||||||
ethylisme.value = Math.max(ethylisme.value - 1, -7);
|
ethylisme.value = Math.max(ethylisme.value - 1, -7);
|
||||||
ethylisme.nb_doses = 0;
|
ethylisme.nb_doses = 0;
|
||||||
|
|
||||||
let perte = await RdDDice.rollTotal("1d6", {showDice:true});
|
let perte = await RdDDice.rollTotal("1d6", { showDice: true });
|
||||||
ethylismeData.perteEndurance = await this.santeIncDec("endurance", -perte, { ethylisme: true });
|
ethylismeData.perteEndurance = await this.santeIncDec("endurance", -perte, { ethylisme: true });
|
||||||
|
|
||||||
if (!ethylisme.jet_moral) {
|
if (!ethylisme.jet_moral) {
|
||||||
ethylismeData.jetMoral = await this._jetMoral('heureuse');
|
ethylismeData.jetMoral = await this._jetMoral('heureuse');
|
||||||
if (ethylismeData.jetMoral.ajustement == 1) {
|
if (ethylismeData.jetMoral.ajustement == 1) {
|
||||||
ethylismeData.moralAlcool ='heureux';
|
ethylismeData.moralAlcool = 'heureux';
|
||||||
ethylisme.jet_moral = true;
|
ethylisme.jet_moral = true;
|
||||||
} else if (ethylisme.value == -1) {
|
} else if (ethylisme.value == -1) {
|
||||||
ethylismeData.jetMoral.ajustement = -1;
|
ethylismeData.jetMoral.ajustement = -1;
|
||||||
ethylismeData.moralAlcool ='triste';
|
ethylismeData.moralAlcool = 'triste';
|
||||||
ethylisme.jet_moral = true;
|
ethylisme.jet_moral = true;
|
||||||
await this.moralIncDec(-1);
|
await this.moralIncDec(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ethylisme.value<0) {
|
if (ethylisme.value < 0) {
|
||||||
// Qui a bu boira (p 164)
|
// Qui a bu boira (p 164)
|
||||||
ethylismeData.jetVolonte = {
|
ethylismeData.jetVolonte = {
|
||||||
selectedCarac: actorData.data.carac.volonte,
|
selectedCarac: actorData.data.carac.volonte,
|
||||||
@ -1841,6 +1843,7 @@ export class RdDActor extends Actor {
|
|||||||
showDice: true
|
showDice: true
|
||||||
}
|
}
|
||||||
await RdDResolutionTable.rollData(ethylismeData.jetVolonte);
|
await RdDResolutionTable.rollData(ethylismeData.jetVolonte);
|
||||||
|
this._appliquerExperienceRollData(ethylismeData.jetVolonte);
|
||||||
RollDataAjustements.calcul(ethylismeData.jetVolonte, this);
|
RollDataAjustements.calcul(ethylismeData.jetVolonte, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2315,7 +2318,9 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_appliquerExperienceRollData(rollData) {
|
_appliquerExperienceRollData(rollData) {
|
||||||
const callback = this.createCallbackExperience();
|
const callback = this.createCallbackExperience();
|
||||||
if (callback.condition(rollData)) { callback.action(rollData); }
|
if (callback.condition(rollData)) {
|
||||||
|
callback.action(rollData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -2777,6 +2782,7 @@ export class RdDActor extends Actor {
|
|||||||
return { result: false, xpcarac: 0, xpCompetence: 0 };
|
return { result: false, xpcarac: 0, xpCompetence: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (caracName == 'Vie') caracName = 'constitution';
|
||||||
if (caracName == 'derobee') caracName = 'agilite';
|
if (caracName == 'derobee') caracName = 'agilite';
|
||||||
if (caracName == 'reve-actuel') caracName = 'reve';
|
if (caracName == 'reve-actuel') caracName = 'reve';
|
||||||
let xp = Math.abs(rolled.finalLevel);
|
let xp = Math.abs(rolled.finalLevel);
|
||||||
@ -3405,7 +3411,7 @@ export class RdDActor extends Actor {
|
|||||||
ui.notifications.info("Inutile de se vendre à soi-même");
|
ui.notifications.info("Inutile de se vendre à soi-même");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!game.user.isGM) {
|
if (!Misc.isElectedUser()) {
|
||||||
RdDActor.remoteActorCall({
|
RdDActor.remoteActorCall({
|
||||||
userId: Misc.connectedGMOrUser(),
|
userId: Misc.connectedGMOrUser(),
|
||||||
actorId: this.vendeur?.id ?? this.acheteur?.id,
|
actorId: this.vendeur?.id ?? this.acheteur?.id,
|
||||||
@ -3449,10 +3455,14 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
if (acheteur) {
|
if (acheteur) {
|
||||||
// TODO: achat depuis un compendium
|
// TODO: achat depuis un compendium
|
||||||
const achat = duplicate(Misc.data(vendeur?.getObjet(itemId) ?? game.items.get(itemId)));
|
const itemData = Misc.data(vendeur?.getObjet(itemId) ?? game.items.get(itemId));
|
||||||
|
const achat = {
|
||||||
|
type: itemData.type,
|
||||||
|
img: itemData.img,
|
||||||
|
name: itemData.name,
|
||||||
|
data: itemData.data
|
||||||
|
}
|
||||||
achat.data.quantite = venteData.quantiteTotal;
|
achat.data.quantite = venteData.quantiteTotal;
|
||||||
achat._id = undefined;
|
|
||||||
// TODO: investigate bug - création marche mal...
|
|
||||||
await acheteur.createEmbeddedDocuments("Item", [achat]);
|
await acheteur.createEmbeddedDocuments("Item", [achat]);
|
||||||
}
|
}
|
||||||
if (coutDeniers > 0) {
|
if (coutDeniers > 0) {
|
||||||
@ -3464,6 +3474,7 @@ export class RdDActor extends Actor {
|
|||||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.html', venteData)
|
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.html', venteData)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!venteData.quantiteIllimite) {
|
||||||
if (venteData.quantiteNbLots <= venteData.nombreLots) {
|
if (venteData.quantiteNbLots <= venteData.nombreLots) {
|
||||||
ChatUtility.removeChatMessageId(chatMessageIdVente);
|
ChatUtility.removeChatMessageId(chatMessageIdVente);
|
||||||
}
|
}
|
||||||
@ -3475,7 +3486,7 @@ export class RdDActor extends Actor {
|
|||||||
messageVente.update({ content: newMessageVente });
|
messageVente.update({ content: newMessageVente });
|
||||||
messageVente.render(true);
|
messageVente.render(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -29,6 +29,7 @@ export class DialogItemAchat extends Dialog {
|
|||||||
vendeur: Misc.data(vendeur),
|
vendeur: Misc.data(vendeur),
|
||||||
acheteur: Misc.data(acheteur),
|
acheteur: Misc.data(acheteur),
|
||||||
tailleLot: event.currentTarget.attributes['data-tailleLot']?.value ?? 1,
|
tailleLot: event.currentTarget.attributes['data-tailleLot']?.value ?? 1,
|
||||||
|
quantiteIllimite : event.currentTarget.attributes['data-quantiteIllimite']?.value == 'true',
|
||||||
quantiteNbLots: event.currentTarget.attributes['data-quantiteNbLots']?.value,
|
quantiteNbLots: event.currentTarget.attributes['data-quantiteNbLots']?.value,
|
||||||
nombreLots: 1,
|
nombreLots: 1,
|
||||||
prixLot: prixLot,
|
prixLot: prixLot,
|
||||||
|
@ -39,11 +39,11 @@ export const defaultItemImg = {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
export class RdDItem extends Item {
|
export class RdDItem extends Item {
|
||||||
|
|
||||||
constructor(data) {
|
constructor(data, context) {
|
||||||
if (!data.img) {
|
if (!data.img) {
|
||||||
data.img = defaultItemImg[data.type];
|
data.img = defaultItemImg[data.type];
|
||||||
}
|
}
|
||||||
super(data);
|
super(data, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTypeObjetsEquipement() {
|
static getTypeObjetsEquipement() {
|
||||||
|
@ -6,7 +6,7 @@ import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
|||||||
import { RdDUtility } from "./rdd-utility.js";
|
import { RdDUtility } from "./rdd-utility.js";
|
||||||
import { Grammar } from "./grammar.js";
|
import { Grammar } from "./grammar.js";
|
||||||
import { Misc } from "./misc.js";
|
import { Misc } from "./misc.js";
|
||||||
import {RdDDice } from "./rdd-dice.js";
|
import { RdDDice } from "./rdd-dice.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
|
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
|
||||||
@ -65,14 +65,15 @@ export class RdDCalendrier extends Application {
|
|||||||
// nombre astral
|
// nombre astral
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
this.listeNombreAstral = this._loadListNombreAstral();
|
this.listeNombreAstral = this._loadListNombreAstral();
|
||||||
this.rebuildListeNombreAstral(); // Ensure always up-to-date
|
await this.rebuildListeNombreAstral(); // Ensure always up-to-date
|
||||||
}
|
}
|
||||||
console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral);
|
console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_loadListNombreAstral() {
|
_loadListNombreAstral() {
|
||||||
return Object.values(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral"));
|
const listeNombreAstraux = game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral");
|
||||||
|
return Object.values(listeNombreAstraux);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -96,8 +97,10 @@ export class RdDCalendrier extends Application {
|
|||||||
getNumericDateFromIndex(index = undefined) {
|
getNumericDateFromIndex(index = undefined) {
|
||||||
if (!index) index = this.getCurrentDayIndex();
|
if (!index) index = this.getCurrentDayIndex();
|
||||||
let month = Math.floor(index / 28)
|
let month = Math.floor(index / 28)
|
||||||
return { month: heuresList[month],
|
return {
|
||||||
day: (index - (month * 28)) + 1 }
|
month: heuresList[month],
|
||||||
|
day: (index - (month * 28)) + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -112,7 +115,7 @@ export class RdDCalendrier extends Application {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getIndexFromDate(jour, mois) {
|
getIndexFromDate(jour, mois) {
|
||||||
return (heuresDef[mois].heure * 28) + (jour-1);
|
return (heuresDef[mois].heure * 28) + (jour - 1);
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getJoursSuivants(num) {
|
getJoursSuivants(num) {
|
||||||
@ -127,41 +130,45 @@ export class RdDCalendrier extends Application {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async ajouterNombreAstral(index) {
|
async ajouterNombreAstral(index) {
|
||||||
|
const nombreAstral = await RdDDice.rollTotal("1dh");
|
||||||
return {
|
return {
|
||||||
nombreAstral: await RdDDice.rollTotal("1dh"),
|
nombreAstral: nombreAstral,
|
||||||
valeursFausses: [],
|
valeursFausses: [],
|
||||||
index: index
|
index: index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getCurrentNombreAstral() {
|
async getCurrentNombreAstral() {
|
||||||
let indexDate = this.getCurrentDayIndex();
|
let indexDate = this.getCurrentDayIndex();
|
||||||
return this.getNombreAstral(indexDate);
|
return await this.getNombreAstral(indexDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
resetNombreAstral( ) {
|
resetNombreAstral() {
|
||||||
this.listeNombreAstral = [];
|
this.listeNombreAstral = [];
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getNombreAstral(indexDate) {
|
async getNombreAstral(indexDate) {
|
||||||
const liste = this.listeNombreAstral ?? this._loadListNombreAstral();
|
const liste = this.listeNombreAstral ?? this._loadListNombreAstral();
|
||||||
let astralData = liste.find((nombreAstral, i) => nombreAstral.index == indexDate);
|
let astralData = liste.find((nombreAstral, i) => nombreAstral.index == indexDate);
|
||||||
if (!astralData?.nombreAstral) {
|
if (!astralData?.nombreAstral) {
|
||||||
this.rebuildListeNombreAstral();
|
await this.rebuildListeNombreAstral();
|
||||||
astralData = liste.find((nombreAstral, i) => nombreAstral.index == indexDate);
|
astralData = liste.find((nombreAstral, i) => nombreAstral.index == indexDate);
|
||||||
}
|
}
|
||||||
return astralData?.nombreAstral ?? "N/A";
|
return astralData?.nombreAstral ?? "N/A";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
rebuildListeNombreAstral() {
|
async rebuildListeNombreAstral() {
|
||||||
let jourCourant = this.getCurrentDayIndex();
|
let jourCourant = this.getCurrentDayIndex();
|
||||||
let jourFin = jourCourant + 12;
|
let jourFin = jourCourant + 12;
|
||||||
let newList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(i => this.ajouterNombreAstral(jourCourant + i));
|
let newList = [];
|
||||||
|
for (let i=0; i<12; i++) {
|
||||||
|
newList.push(await this.ajouterNombreAstral(jourCourant + i));
|
||||||
|
}
|
||||||
if (this.listeNombreAstral) {
|
if (this.listeNombreAstral) {
|
||||||
for (const na of this.listeNombreAstral) {
|
for (const na of this.listeNombreAstral) {
|
||||||
if (na && na.index >= jourCourant && na.index < jourFin) {
|
if (na && na.index >= jourCourant && na.index < jourFin) {
|
||||||
@ -173,21 +180,21 @@ export class RdDCalendrier extends Application {
|
|||||||
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
onCalendarButton(ev) {
|
async onCalendarButton(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const calendarAvance = ev.currentTarget.attributes['data-calendar-avance'];
|
const calendarAvance = ev.currentTarget.attributes['data-calendar-avance'];
|
||||||
const calendarSet = ev.currentTarget.attributes['data-calendar-set'];
|
const calendarSet = ev.currentTarget.attributes['data-calendar-set'];
|
||||||
if (calendarAvance) {
|
if (calendarAvance) {
|
||||||
this.incrementTime(Number(calendarAvance.value));
|
await this.incrementTime(Number(calendarAvance.value));
|
||||||
}
|
}
|
||||||
else if (calendarSet) {
|
else if (calendarSet) {
|
||||||
this.positionnerHeure(Number(calendarSet.value));
|
this.positionnerHeure(Number(calendarSet.value));
|
||||||
}
|
}
|
||||||
this.updateDisplay();
|
await this.updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
incrementTime(minutes = 0) {
|
async incrementTime(minutes = 0) {
|
||||||
this.calendrier.minutesRelative += minutes;
|
this.calendrier.minutesRelative += minutes;
|
||||||
if (this.calendrier.minutesRelative >= 120) {
|
if (this.calendrier.minutesRelative >= 120) {
|
||||||
this.calendrier.minutesRelative -= 120;
|
this.calendrier.minutesRelative -= 120;
|
||||||
@ -195,7 +202,7 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
if (this.calendrier.heureRdD > 11) {
|
if (this.calendrier.heureRdD > 11) {
|
||||||
this.calendrier.heureRdD -= 12;
|
this.calendrier.heureRdD -= 12;
|
||||||
this.incrementerJour();
|
await this.incrementerJour();
|
||||||
}
|
}
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
||||||
// Notification aux joueurs
|
// Notification aux joueurs
|
||||||
@ -206,7 +213,7 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
incrementerJour() {
|
async incrementerJour() {
|
||||||
this.calendrier.jour += 1;
|
this.calendrier.jour += 1;
|
||||||
if (this.calendrier.jour >= RDD_JOUR_PAR_MOIS) {
|
if (this.calendrier.jour >= RDD_JOUR_PAR_MOIS) {
|
||||||
this.calendrier.jour -= RDD_JOUR_PAR_MOIS;
|
this.calendrier.jour -= RDD_JOUR_PAR_MOIS;
|
||||||
@ -215,19 +222,20 @@ export class RdDCalendrier extends Application {
|
|||||||
this.calendrier.moisRdD += 1;
|
this.calendrier.moisRdD += 1;
|
||||||
// Reconstruire les nombres astraux
|
// Reconstruire les nombres astraux
|
||||||
}
|
}
|
||||||
this.rebuildListeNombreAstral();
|
await this.rebuildListeNombreAstral();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
syncPlayerTime(calendrier) {
|
async syncPlayerTime(calendrier) {
|
||||||
this.calendrier = duplicate(calendrier); // Local copy update
|
this.calendrier = duplicate(calendrier); // Local copy update
|
||||||
this.updateDisplay();
|
await this.updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
positionnerHeure(indexHeure) {
|
async positionnerHeure(indexHeure) {
|
||||||
if (indexHeure <= this.calendrier.heureRdD)
|
if (indexHeure <= this.calendrier.heureRdD){
|
||||||
this.incrementerJour();
|
await this.incrementerJour();
|
||||||
|
}
|
||||||
this.calendrier.heureRdD = indexHeure;
|
this.calendrier.heureRdD = indexHeure;
|
||||||
this.calendrier.minutesRelative = 0;
|
this.calendrier.minutesRelative = 0;
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
||||||
@ -269,18 +277,18 @@ export class RdDCalendrier extends Application {
|
|||||||
console.log(request);
|
console.log(request);
|
||||||
let jourDiff = this.getLectureAstrologieDifficulte(request.date);
|
let jourDiff = this.getLectureAstrologieDifficulte(request.date);
|
||||||
let niveau = Number(request.astrologie.data.niveau) + Number(request.conditions) + Number(jourDiff) + Number(request.etat);
|
let niveau = Number(request.astrologie.data.niveau) + Number(request.conditions) + Number(jourDiff) + Number(request.etat);
|
||||||
let rollData= {
|
let rollData = {
|
||||||
caracValue: request.carac_vue,
|
caracValue: request.carac_vue,
|
||||||
finalLevel: niveau,
|
finalLevel: niveau,
|
||||||
showDice: false
|
showDice: false
|
||||||
};
|
};
|
||||||
await RdDResolutionTable.rollData(rollData);
|
await RdDResolutionTable.rollData(rollData);
|
||||||
let nbAstral = this.getNombreAstral(request.date);
|
let nbAstral = await this.getNombreAstral(request.date);
|
||||||
request.rolled = rollData.rolled;
|
request.rolled = rollData.rolled;
|
||||||
request.isValid = true;
|
request.isValid = true;
|
||||||
if (!request.rolled.isSuccess) {
|
if (!request.rolled.isSuccess) {
|
||||||
request.isValid = false;
|
request.isValid = false;
|
||||||
nbAstral = await RdDDice.rollTotal("1dhr"+nbAstral);
|
nbAstral = await RdDDice.rollTotal("1dhr" + nbAstral);
|
||||||
// Mise à jour des nombres astraux du joueur
|
// Mise à jour des nombres astraux du joueur
|
||||||
let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == request.date);
|
let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == request.date);
|
||||||
astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstral });
|
astralData.valeursFausses.push({ actorId: request.id, nombreAstral: nbAstral });
|
||||||
@ -299,11 +307,11 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getAjustementAstrologique(heureNaissance, name = 'inconnu') {
|
async getAjustementAstrologique(heureNaissance, name = 'inconnu') {
|
||||||
let heure = Grammar.toLowerCaseNoAccent(heureNaissance);
|
let heure = Grammar.toLowerCaseNoAccent(heureNaissance);
|
||||||
if (heure && heuresDef[heure]) {
|
if (heure && heuresDef[heure]) {
|
||||||
let hn = heuresDef[heure].heure;
|
let hn = heuresDef[heure].heure;
|
||||||
let chiffreAstral = this.getCurrentNombreAstral();
|
let chiffreAstral = await this.getCurrentNombreAstral();
|
||||||
let heureCourante = this.calendrier.heureRdD;
|
let heureCourante = this.calendrier.heureRdD;
|
||||||
let ecartChance = (hn + chiffreAstral - heureCourante) % 12;
|
let ecartChance = (hn + chiffreAstral - heureCourante) % 12;
|
||||||
switch (ecartChance) {
|
switch (ecartChance) {
|
||||||
@ -350,12 +358,12 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
updateDisplay() {
|
async updateDisplay() {
|
||||||
let data = this.fillCalendrierData();
|
let data = this.fillCalendrierData();
|
||||||
// Rebuild data
|
// Rebuild data
|
||||||
let dateHTML = `Jour ${data.jourMois} de ${data.nomMois} (${data.nomSaison})`;
|
let dateHTML = `Jour ${data.jourMois} de ${data.nomMois} (${data.nomSaison})`;
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
dateHTML = dateHTML + " - NA: " + this.getCurrentNombreAstral();
|
dateHTML = dateHTML + " - NA: " + await this.getCurrentNombreAstral();
|
||||||
}
|
}
|
||||||
for (let handle of document.getElementsByClassName("calendar-date-rdd")) {
|
for (let handle of document.getElementsByClassName("calendar-date-rdd")) {
|
||||||
handle.innerHTML = dateHTML;
|
handle.innerHTML = dateHTML;
|
||||||
@ -372,16 +380,16 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
saveEditeur(calendrierData) {
|
async saveEditeur(calendrierData) {
|
||||||
this.calendrier.minutesRelative = Number(calendrierData.minutesRelative);
|
this.calendrier.minutesRelative = Number(calendrierData.minutesRelative);
|
||||||
this.calendrier.jour = Number(calendrierData.jourMois) - 1;
|
this.calendrier.jour = Number(calendrierData.jourMois) - 1;
|
||||||
this.calendrier.moisRdD = heuresList.findIndex(mois => mois === calendrierData.moisKey);
|
this.calendrier.moisRdD = heuresList.findIndex(mois => mois === calendrierData.moisKey);
|
||||||
this.calendrier.heureRdD = heuresList.findIndex(heure => heure === calendrierData.heureKey);; // Index dans heuresList
|
this.calendrier.heureRdD = heuresList.findIndex(heure => heure === calendrierData.heureKey);; // Index dans heuresList
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
||||||
|
|
||||||
this.rebuildListeNombreAstral();
|
await this.rebuildListeNombreAstral();
|
||||||
|
|
||||||
this.updateDisplay();
|
await this.updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -421,12 +429,12 @@ export class RdDCalendrier extends Application {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/** @override */
|
/** @override */
|
||||||
activateListeners(html) {
|
async activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
|
|
||||||
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
|
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
|
||||||
|
|
||||||
this.updateDisplay();
|
await this.updateDisplay();
|
||||||
|
|
||||||
html.find('.calendar-btn').click(ev => this.onCalendarButton(ev));
|
html.find('.calendar-btn').click(ev => this.onCalendarButton(ev));
|
||||||
|
|
||||||
|
@ -134,9 +134,8 @@ export class RdDDice {
|
|||||||
return roll;
|
return roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async rollTotal(formula) {
|
static async rollTotal(formula, options = { showDice: false }) {
|
||||||
const roll = new Roll(formula);
|
const roll = await RdDDice.roll(formula, options);
|
||||||
await roll.evaluate({ async: true });
|
|
||||||
return roll.total;
|
return roll.total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{{#if bless.active}}
|
{{#if bless.active}}
|
||||||
<i class="fas fa-skull-crossbones blessure-active-{{gravite}}"></i>
|
<i class="fas fa-skull-crossbones blessure-active-{{gravite}}"></i>
|
||||||
{{else}}
|
{{else}}
|
||||||
<i class="fas fa-skull-crossbones fas-inactive"></i>
|
<i class="fas fa-skull-crossbones blessure-inactive"></i>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -243,7 +243,7 @@
|
|||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.tir categorie="Compétences de Tir"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.tir categorie="Compétences de Tir"}}
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.lancer categorie="Compétences de Lancer"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.lancer categorie="Compétences de Lancer"}}
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.connaissance categorie="Connaissances"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.connaissance categorie="Connaissances"}}
|
||||||
{{#if data.attributs.hautrevant.value}}
|
{{#if (or data.attributs.hautrevant.value options.montrerArchetype)}}
|
||||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.draconic categorie="Draconic"}}
|
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=competenceByCategory.draconic categorie="Draconic"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
@ -15,13 +15,15 @@
|
|||||||
{{item.name}}</h4>
|
{{item.name}}</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#unless quantiteIllimite}}
|
|
||||||
<div class="flexrow flex-group-left">
|
<div class="flexrow flex-group-left">
|
||||||
<label>{{#if (gt tailleLot 1)}}Lots disponibles
|
<label>{{#if (gt tailleLot 1)}}Lots disponibles
|
||||||
{{else}}Quantité disponible{{/if}}</label>
|
{{else}}Quantité disponible{{/if}}</label>
|
||||||
<label>{{quantiteNbLots}}</label>
|
<label>{{#if quantiteIllimite}}
|
||||||
|
pas de limite
|
||||||
|
{{else}}
|
||||||
|
{{quantiteNbLots}}
|
||||||
|
{{/if}}</label>
|
||||||
</div>
|
</div>
|
||||||
{{/unless}}
|
|
||||||
<div class="flexrow flex-group-left">
|
<div class="flexrow flex-group-left">
|
||||||
<label>
|
<label>
|
||||||
{{#if (gt tailleLot 1)}}Nombre de lots de {{tailleLot}}
|
{{#if (gt tailleLot 1)}}Nombre de lots de {{tailleLot}}
|
||||||
|
Loading…
Reference in New Issue
Block a user