Merge branch 'v1.5-fixes' into 'v1.5'
Fixes mineurs See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!286
This commit is contained in:
commit
5bc0cec515
@ -2082,7 +2082,7 @@ export class RdDActor extends Actor {
|
|||||||
createCallbackExperience() {
|
createCallbackExperience() {
|
||||||
return {
|
return {
|
||||||
condition: r => r.rolled.isPart && r.finalLevel < 0 && game.settings.get("core", "rollMode") != 'selfroll',
|
condition: r => r.rolled.isPart && r.finalLevel < 0 && game.settings.get("core", "rollMode") != 'selfroll',
|
||||||
action: r => this.appliquerAjoutExperience(r, game.settings.get("core", "rollMode") != 'blindroll')
|
action: r => this.appliquerAjoutExperience(r, (game.settings.get("core", "rollMode") != 'blindroll' && !user.isGM))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2157,7 +2157,7 @@ export class RdDActor extends Actor {
|
|||||||
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence);
|
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence);
|
||||||
if (xpData && display) {
|
if (xpData && display) {
|
||||||
let message = {
|
let message = {
|
||||||
whisher: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData)
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData)
|
||||||
}
|
}
|
||||||
ChatMessage.create(message);
|
ChatMessage.create(message);
|
||||||
@ -3401,7 +3401,7 @@ export class RdDActor extends Actor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const tplData = Misc.templateData(this);
|
const tplData = Misc.templateData(this);
|
||||||
let rolled = await RdDResolutionTable.roll(this.getReveActuel(), - Number(tplData.carac.niveau.value));
|
let rolled = await RdDResolutionTable.roll(this.getReveActuel(), - Number(Misc.templateData(entite).carac.niveau.value));
|
||||||
const rollData = {
|
const rollData = {
|
||||||
alias: this.name,
|
alias: this.name,
|
||||||
rolled: rolled,
|
rolled: rolled,
|
||||||
|
@ -26,7 +26,7 @@ export class RdDItemCompetenceCreature extends Item {
|
|||||||
competence: itemData.name,
|
competence: itemData.name,
|
||||||
resistance: 100,
|
resistance: 100,
|
||||||
equipe: true,
|
equipe: true,
|
||||||
dommagesReels: arme.data.dommages,
|
dommagesReels: itemData.data.dommages,
|
||||||
penetration: 0,
|
penetration: 0,
|
||||||
force: 0,
|
force: 0,
|
||||||
rapide: true
|
rapide: true
|
||||||
|
@ -45,9 +45,13 @@ export class RdDCalendrier extends Application {
|
|||||||
return { top: 200, left: 200 };
|
return { top: 200, left: 200 };
|
||||||
}
|
}
|
||||||
|
|
||||||
static getDefSigne(moisRdD) {
|
static getDefSigne(chiffre) {
|
||||||
moisRdD = moisRdD % RDD_MOIS_PAR_AN;
|
chiffre = chiffre % RDD_MOIS_PAR_AN;
|
||||||
return Object.values(heuresDef).find(h => h.heure == moisRdD);
|
return Object.values(heuresDef).find(h => h.heure == chiffre);
|
||||||
|
}
|
||||||
|
|
||||||
|
static getChiffreFromSigne(signe) {
|
||||||
|
return heuresList.indexOf(signe);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getCalendrier(index) {
|
static getCalendrier(index) {
|
||||||
@ -63,55 +67,50 @@ export class RdDCalendrier extends Application {
|
|||||||
return calendrier;
|
return calendrier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
constructor() {
|
||||||
async initCalendrier() {
|
super();
|
||||||
// Calendrier
|
|
||||||
this.calendrier = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "calendrier"));
|
|
||||||
this.calendrier.annee = this.calendrier.annee ?? (this.calendrier.moisRdD == RDD_MOIS_PAR_AN ? 1 : 0);
|
|
||||||
this.calendrier.moisRdD = (this.calendrier.moisRdD ?? 0) % RDD_MOIS_PAR_AN;
|
|
||||||
|
|
||||||
//console.log("CALENDRIER", this.calendrier);
|
|
||||||
if (this.calendrier == undefined || this.calendrier.moisRdD == undefined) {
|
|
||||||
this.calendrier = RdDCalendrier.getCalendrier(0);
|
|
||||||
if (game.user.isGM) { // Uniquement si GM
|
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", this.calendrier);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// position
|
// position
|
||||||
this.calendrierPos = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "calendrier-pos"));
|
this.calendrierPos = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "calendrier-pos"));
|
||||||
if (this.calendrierPos == undefined || this.calendrierPos.top == undefined) {
|
if (this.calendrierPos == undefined || this.calendrierPos.top == undefined) {
|
||||||
this.calendrierPos = RdDCalendrier.createCalendrierPos();
|
this.calendrierPos = RdDCalendrier.createCalendrierPos();
|
||||||
if (game.user.isGM) { // Uniquement si GM
|
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "calendrier-pos", this.calendrierPos);
|
game.settings.set("foundryvtt-reve-de-dragon", "calendrier-pos", this.calendrierPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calendrier
|
||||||
|
this.calendrier = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "calendrier") ?? RdDCalendrier.getCalendrier(0));
|
||||||
|
this.calendrier.annee = this.calendrier.annee ?? Math.floor((this.calendrier.moisRdD ?? 0) / RDD_MOIS_PAR_AN);
|
||||||
|
this.calendrier.moisRdD = (this.calendrier.moisRdD ?? 0) % RDD_MOIS_PAR_AN;
|
||||||
|
|
||||||
|
if (game.user.isGM) { // Uniquement si GM
|
||||||
|
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", this.calendrier);
|
||||||
}
|
}
|
||||||
|
|
||||||
// nombre astral
|
// nombre astral
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
this.listeNombreAstral = this._loadListNombreAstral();
|
this.listeNombreAstral = this.getListeNombreAstral();
|
||||||
await this.rebuildListeNombreAstral(false); // Ensure always up-to-date
|
this.rebuildListeNombreAstral(false); // Ensure always up-to-date
|
||||||
}
|
}
|
||||||
console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral);
|
console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_loadListNombreAstral() {
|
getListeNombreAstral() {
|
||||||
const listeNombreAstraux = game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral");
|
return game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral") ?? [];
|
||||||
return listeNombreAstraux ?? [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
const options = super.defaultOptions;
|
return mergeObject(super.defaultOptions, {
|
||||||
options.template = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html";
|
template: "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html",
|
||||||
options.popOut = false;
|
popOut: false,
|
||||||
options.resizable = false;
|
resizable: false
|
||||||
return options;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getDateFromIndex(index) {
|
getDateFromIndex(index) {
|
||||||
const date = RdDCalendrier.getCalendrier(index ?? this.getCurrentDayIndex());
|
const date = RdDCalendrier.getCalendrier(index ?? this.getCurrentDayIndex());
|
||||||
return (date.jour+1) + ' ' + heuresDef[heuresList[date.moisRdD]].label;
|
return (date.jour + 1) + ' ' + RdDCalendrier.getDefSigne(date.moisRdD).label;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -183,34 +182,23 @@ export class RdDCalendrier extends Application {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getNombreAstral(indexDate) {
|
getNombreAstral(indexDate) {
|
||||||
if (this.listeNombreAstral == undefined) {
|
let astralData = this.getListeNombreAstral().find((nombreAstral, i) => nombreAstral.index == indexDate);
|
||||||
this.listeNombreAstral = this._loadListNombreAstral() || [];
|
|
||||||
}
|
|
||||||
let liste = this.listeNombreAstral;
|
|
||||||
if ( game.user.isGM ) {
|
|
||||||
if ( typeof(liste) != 'Array' || liste.length == 0 ) {
|
|
||||||
this.rebuildListeNombreAstral();
|
|
||||||
liste = this.listeNombreAstral;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let astralData = liste.find((nombreAstral, i) => nombreAstral.index == indexDate);
|
|
||||||
|
|
||||||
return astralData?.nombreAstral;
|
return astralData?.nombreAstral;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rebuildListeNombreAstral(showDice = true) {
|
async rebuildListeNombreAstral(showDice = true) {
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
|
console.log("rebuildListeNombreAstral", showDice);
|
||||||
let jourCourant = this.getCurrentDayIndex();
|
let jourCourant = this.getCurrentDayIndex();
|
||||||
|
|
||||||
let newList = [];
|
let newList = [];
|
||||||
for (let i = 0; i < MAX_NOMBRE_ASTRAL; i++) {
|
for (let i = 0; i < MAX_NOMBRE_ASTRAL; i++) {
|
||||||
let dayIndex = jourCourant + i;
|
let dayIndex = jourCourant + i;
|
||||||
let na = this.listeNombreAstral.find(n => n.index == dayIndex);
|
let na = this.listeNombreAstral.find(n => n.index == dayIndex);
|
||||||
if (na) {
|
if (na) {
|
||||||
newList[i] = duplicate(na);
|
newList[i] = na;
|
||||||
} else {
|
} else {
|
||||||
newList[i] = await this.ajouterNombreAstral(dayIndex, showDice );
|
newList[i] = await this.ajouterNombreAstral(dayIndex, showDice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log("SAVE list", newList, jourCourant);
|
//console.log("SAVE list", newList, jourCourant);
|
||||||
@ -242,7 +230,7 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
if (this.calendrier.heureRdD >= RDD_HEURES_PAR_JOUR) {
|
if (this.calendrier.heureRdD >= RDD_HEURES_PAR_JOUR) {
|
||||||
this.calendrier.heureRdD -= RDD_HEURES_PAR_JOUR;
|
this.calendrier.heureRdD -= RDD_HEURES_PAR_JOUR;
|
||||||
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
|
||||||
@ -253,10 +241,10 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
incrementerJour() {
|
async incrementerJour() {
|
||||||
const index = this.getCurrentDayIndex() + 1;
|
const index = this.getCurrentDayIndex() + 1;
|
||||||
this.calendrier = RdDCalendrier.getCalendrier(index);
|
this.calendrier = RdDCalendrier.getCalendrier(index);
|
||||||
this.rebuildListeNombreAstral();
|
await this.rebuildListeNombreAstral();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -268,7 +256,7 @@ export class RdDCalendrier extends Application {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async 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;
|
||||||
@ -277,13 +265,14 @@ export class RdDCalendrier extends Application {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
fillCalendrierData(formData = {}) {
|
fillCalendrierData(formData = {}) {
|
||||||
|
console.log(this.calendrier);
|
||||||
let moisKey = heuresList[this.calendrier.moisRdD];
|
let moisKey = heuresList[this.calendrier.moisRdD];
|
||||||
let heureKey = heuresList[this.calendrier.heureRdD];
|
let heureKey = heuresList[this.calendrier.heureRdD];
|
||||||
|
console.log(moisKey, heureKey);
|
||||||
|
|
||||||
const mois = heuresDef[moisKey];
|
const mois = heuresDef[moisKey];
|
||||||
const heure = heuresDef[heureKey];
|
const heure = heuresDef[heureKey];
|
||||||
|
|
||||||
//console.log(moisKey, heureKey);
|
|
||||||
formData.heureKey = heureKey;
|
formData.heureKey = heureKey;
|
||||||
formData.moisKey = moisKey;
|
formData.moisKey = moisKey;
|
||||||
formData.jourMois = this.calendrier.jour + 1;
|
formData.jourMois = this.calendrier.jour + 1;
|
||||||
@ -436,8 +425,8 @@ export class RdDCalendrier extends Application {
|
|||||||
async 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 = RdDCalendrier.getDefSigne(calendrierData.moisKey);
|
this.calendrier.moisRdD = RdDCalendrier.getChiffreFromSigne(calendrierData.moisKey);
|
||||||
this.calendrier.heureRdD = RdDCalendrier.getDefSigne(calendrierData.heureKey); // Index dans heuresList
|
this.calendrier.heureRdD = RdDCalendrier.getChiffreFromSigne(calendrierData.heureKey);
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
||||||
|
|
||||||
await this.rebuildListeNombreAstral();
|
await this.rebuildListeNombreAstral();
|
||||||
@ -454,7 +443,7 @@ export class RdDCalendrier extends Application {
|
|||||||
async showCalendarEditor() {
|
async showCalendarEditor() {
|
||||||
let calendrierData = duplicate(this.fillCalendrierData());
|
let calendrierData = duplicate(this.fillCalendrierData());
|
||||||
if (this.editeur == undefined) {
|
if (this.editeur == undefined) {
|
||||||
calendrierData.jourMoisOptions = this.buildJoursMois();
|
calendrierData.jourMoisOptions = RdDCalendrier.buildJoursMois();
|
||||||
calendrierData.heuresOptions = [0, 1];
|
calendrierData.heuresOptions = [0, 1];
|
||||||
calendrierData.minutesOptions = Array(RDD_MINUTES_PAR_HEURES).fill().map((item, index) => 0 + index);
|
calendrierData.minutesOptions = Array(RDD_MINUTES_PAR_HEURES).fill().map((item, index) => 0 + index);
|
||||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-editor-template.html', calendrierData);
|
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-editor-template.html', calendrierData);
|
||||||
|
@ -221,7 +221,6 @@ Hooks.once("ready", async function () {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Affiche/Init le calendrier */
|
/* Affiche/Init le calendrier */
|
||||||
let calendrier = new RdDCalendrier();
|
let calendrier = new RdDCalendrier();
|
||||||
await calendrier.initCalendrier();
|
|
||||||
let templatePath = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html";
|
let templatePath = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html";
|
||||||
let templateData = {};
|
let templateData = {};
|
||||||
renderTemplate(templatePath, templateData).then(html => {
|
renderTemplate(templatePath, templateData).then(html => {
|
||||||
|
@ -891,7 +891,7 @@ export class RdDUtility {
|
|||||||
static distribuerStress(stressValue, raison = 'Inconnu', nomJoueur = undefined) {
|
static distribuerStress(stressValue, raison = 'Inconnu', nomJoueur = undefined) {
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
if (stressValue == undefined){
|
if (stressValue == undefined){
|
||||||
ui.notifications.warn("Pas de valeuir de stress à distribuer!");
|
ui.notifications.warn("Pas de valeur de stress à distribuer!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (nomJoueur == undefined) {
|
if (nomJoueur == undefined) {
|
||||||
|
Loading…
Reference in New Issue
Block a user