forked from public/foundryvtt-reve-de-dragon
		
	Compare commits
	
		
			18 Commits
		
	
	
		
			foundryvtt
			...
			foundryvtt
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 67735197bc | |||
| f81dc9a5f5 | |||
| a563233d6b | |||
| 0c11013694 | |||
| 77cf72a752 | |||
| 42ed5da2d4 | |||
| 5fd3a43b2a | |||
| 1bb710ce83 | |||
| 80579032ea | |||
| a810e20eca | |||
| c6f0aaeba0 | |||
| 3c3be7409d | |||
| f97345e407 | |||
| 4cc50fc190 | |||
| 26967fe1cd | |||
| b23dcaace5 | |||
| 045ee76013 | |||
| 7fed3844b5 | 
@@ -4,7 +4,6 @@ import { RdDRollDialogEthylisme } from "./rdd-roll-ethylisme.js";
 | 
			
		||||
import { RdDRoll } from "./rdd-roll.js";
 | 
			
		||||
import { RdDTMRDialog } from "./rdd-tmr-dialog.js";
 | 
			
		||||
import { Misc } from "./misc.js";
 | 
			
		||||
import { RdDAstrologieJoueur } from "./rdd-astrologie-joueur.js";
 | 
			
		||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
 | 
			
		||||
import { RdDDice } from "./rdd-dice.js";
 | 
			
		||||
import { RdDRollTables } from "./rdd-rolltables.js";
 | 
			
		||||
@@ -36,6 +35,7 @@ import { DialogRepos } from "./sommeil/dialog-repos.js";
 | 
			
		||||
import { RdDBaseActor } from "./actor/base-actor.js";
 | 
			
		||||
import { RdDTimestamp } from "./rdd-timestamp.js";
 | 
			
		||||
import { RdDItemTache } from "./item-tache.js";
 | 
			
		||||
import { APP_ASTROLOGIE_REFRESH, AppAstrologie } from "./sommeil/app-astrologie.js";
 | 
			
		||||
 | 
			
		||||
const POSSESSION_SANS_DRACONIC = {
 | 
			
		||||
  img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp',
 | 
			
		||||
@@ -651,7 +651,7 @@ export class RdDActor extends RdDBaseActor {
 | 
			
		||||
      if (dormi.etat == 'eveil') {
 | 
			
		||||
        message.content += 'Vous êtes réveillé par un Rêve de Dragon.'
 | 
			
		||||
      }
 | 
			
		||||
      options.chateauDormant = options.chateauDormant && dormi.heures == heures;
 | 
			
		||||
      options.chateauDormant = options.chateauDormant && dormi.heures >= heures;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!options.grisReve) {
 | 
			
		||||
@@ -666,8 +666,8 @@ export class RdDActor extends RdDBaseActor {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async dormirDesHeures(jetsReve, message, heures, options) {
 | 
			
		||||
    const dormi = { heures: 1, etat: 'dort' };
 | 
			
		||||
    for (; dormi.heures <= heures && dormi.etat == 'dort'; dormi.heures++) {
 | 
			
		||||
    const dormi = { heures: 0, etat: 'dort' };
 | 
			
		||||
    for (; dormi.heures < heures && dormi.etat == 'dort'; dormi.heures++) {
 | 
			
		||||
      await this._recupererEthylisme(message);
 | 
			
		||||
      if (options.grisReve) {
 | 
			
		||||
        await this.recupererFatigue(message);
 | 
			
		||||
@@ -2916,7 +2916,7 @@ export class RdDActor extends RdDBaseActor {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async resetNombreAstral() {
 | 
			
		||||
  async resetNombresAstraux() {
 | 
			
		||||
    let toDelete = this.listItems('nombreastral');
 | 
			
		||||
    const deletions = toDelete.map(it => it._id);
 | 
			
		||||
    await this.deleteEmbeddedDocuments("Item", deletions);
 | 
			
		||||
@@ -2936,24 +2936,23 @@ export class RdDActor extends RdDBaseActor {
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
    await this.createEmbeddedDocuments("Item", [item]);
 | 
			
		||||
    // Affichage Dialog
 | 
			
		||||
    this.astrologieNombresAstraux();
 | 
			
		||||
    game.system.rdd.calendrier.notifyChangeNombresAstraux();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async supprimerAnciensNombresAstraux() {
 | 
			
		||||
    const toDelete = this.listItems('nombreastral')
 | 
			
		||||
      .filter(it => game.system.rdd.calendrier.isAfterIndexDate(it.system.jourindex))
 | 
			
		||||
      .map(it => it._id);
 | 
			
		||||
    await this.deleteEmbeddedDocuments("Item", toDelete);
 | 
			
		||||
    const calendrier = game.system.rdd.calendrier;
 | 
			
		||||
    if (calendrier) {
 | 
			
		||||
      const toDelete = this.listItems('nombreastral')
 | 
			
		||||
        .filter(it => calendrier.isAfterIndexDate(it.system.jourindex))
 | 
			
		||||
        .map(it => it._id);
 | 
			
		||||
      await this.deleteEmbeddedDocuments("Item", toDelete);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async astrologieNombresAstraux() {
 | 
			
		||||
    // Suppression des anciens nombres astraux
 | 
			
		||||
    await this.supprimerAnciensNombresAstraux();
 | 
			
		||||
 | 
			
		||||
    // Afficher l'interface spéciale
 | 
			
		||||
    await RdDAstrologieJoueur.create(this);
 | 
			
		||||
    await AppAstrologie.create(this);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
 
 | 
			
		||||
@@ -123,21 +123,27 @@ export class RdDBaseActorSheet extends ActorSheet {
 | 
			
		||||
      .map(t => Misc.arrayOrEmpty(itemTypes[t]))
 | 
			
		||||
      .reduce((a, b) => a.concat(b), [])
 | 
			
		||||
      .sort(Misc.ascending(it => it.name));
 | 
			
		||||
  }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
  /* -------------------------------------------- */  /** @override */
 | 
			
		||||
  activateListeners(html) {
 | 
			
		||||
    super.activateListeners(html);
 | 
			
		||||
    this.html = html;
 | 
			
		||||
 | 
			
		||||
    this.html.find('.conteneur-name a').click(async event => {
 | 
			
		||||
      RdDUtility.toggleAfficheContenu(this.getItemId(event));
 | 
			
		||||
      this.render(true);
 | 
			
		||||
    });
 | 
			
		||||
    this.html.find('.item-edit').click(async event => this.getItem(event)?.sheet.render(true))
 | 
			
		||||
    this.html.find('.item-montrer').click(async event => this.getItem(event)?.postItemToChat());
 | 
			
		||||
    this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat());
 | 
			
		||||
    /* -------------------------------------------- */  /** @override */
 | 
			
		||||
    activateListeners(html) {
 | 
			
		||||
      super.activateListeners(html);
 | 
			
		||||
      this.html = html;
 | 
			
		||||
      
 | 
			
		||||
      this.html.find('.conteneur-name a').click(async event => {
 | 
			
		||||
        RdDUtility.toggleAfficheContenu(this.getItemId(event));
 | 
			
		||||
        this.render(true);
 | 
			
		||||
      });
 | 
			
		||||
      this.html.find('.item-edit').click(async event => this.getItem(event)?.sheet.render(true))
 | 
			
		||||
      this.html.find('.item-montrer').click(async event => this.getItem(event)?.postItemToChat());
 | 
			
		||||
      this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat());
 | 
			
		||||
      this.html.find('.recherche')
 | 
			
		||||
        .each((index, field) => {
 | 
			
		||||
          this._rechercheSelectArea(field);
 | 
			
		||||
        })
 | 
			
		||||
        .keyup(async event => this._rechercherKeyup(event))
 | 
			
		||||
        .change(async event => this._rechercherKeyup(event));
 | 
			
		||||
    this.html.find('.recherche').prop( "disabled", false );
 | 
			
		||||
    // Everything below here is only needed if the sheet is editable
 | 
			
		||||
    if (!this.options.editable) return;
 | 
			
		||||
 | 
			
		||||
@@ -160,12 +166,6 @@ export class RdDBaseActorSheet extends ActorSheet {
 | 
			
		||||
    this.html.find('.monnaie-moins').click(async event => {
 | 
			
		||||
      this.actor.monnaieIncDec(this.getItemId(event), -1);
 | 
			
		||||
    });
 | 
			
		||||
    this.html.find('.recherche')
 | 
			
		||||
      .each((index, field) => {
 | 
			
		||||
        this._rechercheSelectArea(field);
 | 
			
		||||
      })
 | 
			
		||||
      .keyup(async event => this._rechercherKeyup(event))
 | 
			
		||||
      .change(async event => this._rechercherKeyup(event));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _rechercherKeyup(event) {
 | 
			
		||||
 
 | 
			
		||||
@@ -26,10 +26,13 @@ export class RdDBaseActor extends Actor {
 | 
			
		||||
      case "msg_remote_actor_call":
 | 
			
		||||
        return RdDBaseActor.onRemoteActorCall(sockmsg.data, sockmsg.userId);
 | 
			
		||||
      case "msg_reset_nombre_astral":
 | 
			
		||||
        console.log("RESET ASTRAL", game.user.character);
 | 
			
		||||
        game.user.character.resetNombreAstral();
 | 
			
		||||
        game.user.character.resetNombresAstraux();
 | 
			
		||||
        game.system.rdd.calendrier.notifyChangeNombresAstraux();
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
      case "msg_refresh_nombre_astral":
 | 
			
		||||
        Hooks.callAll(APP_ASTROLOGIE_REFRESH);
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static remoteActorCall(callData, userId = undefined) {
 | 
			
		||||
 
 | 
			
		||||
@@ -119,6 +119,17 @@ export class Misc {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @returns an array of incremental integers (including from / excluding to).
 | 
			
		||||
   *  if max<min, the array is decrementing integers 
 | 
			
		||||
   */
 | 
			
		||||
  static intArray(from, to) {
 | 
			
		||||
    if (from > to) {
 | 
			
		||||
      return Array.from(Array(from - to).keys()).map(i => from - i)
 | 
			
		||||
    }
 | 
			
		||||
    return Array.from(Array(to - from).keys()).map(i => from + i)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static distinct(array) {
 | 
			
		||||
    return [...new Set(array)];
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,49 +0,0 @@
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Extend the base Dialog entity by defining a custom window to perform roll.
 | 
			
		||||
 * @extends {Dialog}
 | 
			
		||||
 */
 | 
			
		||||
export class RdDAstrologieEditeur extends Dialog {
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  constructor(html, calendrier, calendrierData) {
 | 
			
		||||
 | 
			
		||||
    let myButtons = {
 | 
			
		||||
      resetButton: { label: "Re-tirer les nombres astraux", callback: html => this.resetNombreAstraux() },
 | 
			
		||||
      saveButton: { label: "Fermer", callback: html => {} }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // Common conf
 | 
			
		||||
    let dialogConf = { content: html, title: "Editeur d'Astrologie", buttons: myButtons, default: "saveButton" };
 | 
			
		||||
    let dialogOptions = {
 | 
			
		||||
      classes: ["rdd-roll-dialog"], width: 600,
 | 
			
		||||
      height: 'fit-content',
 | 
			
		||||
      'max-height': 800,
 | 
			
		||||
      'z-index': 99999
 | 
			
		||||
    }
 | 
			
		||||
    super(dialogConf, dialogOptions)
 | 
			
		||||
 | 
			
		||||
    this.calendrier = calendrier;
 | 
			
		||||
    this.updateData(calendrierData);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  activateListeners(html) {
 | 
			
		||||
    super.activateListeners(html);
 | 
			
		||||
    this.html = html;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async resetNombreAstraux() {
 | 
			
		||||
    game.system.rdd.calendrier.resetNombreAstral();
 | 
			
		||||
    await game.system.rdd.calendrier.rebuildListeNombreAstral();
 | 
			
		||||
 | 
			
		||||
    game.system.rdd.calendrier.showAstrologieEditor();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  updateData(calendrierData) {
 | 
			
		||||
    this.calendrierData = duplicate(calendrierData);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,96 +0,0 @@
 | 
			
		||||
import { RdDItemCompetence } from "./item-competence.js";
 | 
			
		||||
import { Misc } from "./misc.js";
 | 
			
		||||
import { SYSTEM_SOCKET_ID } from "./constants.js";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Extend the base Dialog entity by defining a custom window to perform roll.
 | 
			
		||||
 * @extends {Dialog}
 | 
			
		||||
 */
 | 
			
		||||
export class RdDAstrologieJoueur extends Dialog {
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static async create(actor) {
 | 
			
		||||
 | 
			
		||||
    let dialogData = {
 | 
			
		||||
      nombres: this.organizeNombres(actor),
 | 
			
		||||
      dates: game.system.rdd.calendrier.getJoursSuivants(10),
 | 
			
		||||
      etat: actor.getEtatGeneral(),
 | 
			
		||||
      ajustementsConditions: CONFIG.RDD.ajustementsConditions,
 | 
			
		||||
      astrologie: RdDItemCompetence.findCompetence(actor.items, 'Astrologie')
 | 
			
		||||
    }
 | 
			
		||||
    const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', dialogData);
 | 
			
		||||
 | 
			
		||||
    const options = { classes: ["rdd-roll-dialog"], width: 600, height: 'fit-content', 'z-index': 99999 };
 | 
			
		||||
    const dialog = new RdDAstrologieJoueur(html, actor, dialogData, options);
 | 
			
		||||
    dialog.render(true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  constructor(html, actor, dialogData, dialogOptions) {
 | 
			
		||||
    const dialogConf = {
 | 
			
		||||
      title: "Nombres Astraux",
 | 
			
		||||
      content: html,
 | 
			
		||||
      default: "saveButton",
 | 
			
		||||
      buttons: {
 | 
			
		||||
        saveButton: { label: "Fermer", callback: html => {} }
 | 
			
		||||
      },
 | 
			
		||||
    };
 | 
			
		||||
    super(dialogConf, dialogOptions);
 | 
			
		||||
 | 
			
		||||
    this.actor = actor;
 | 
			
		||||
    this.dataNombreAstral = duplicate(dialogData);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  activateListeners(html) {
 | 
			
		||||
    super.activateListeners(html);
 | 
			
		||||
    this.html = html;
 | 
			
		||||
 | 
			
		||||
    this.html.find("[name='diffConditions']").val(0);
 | 
			
		||||
 | 
			
		||||
    this.html.find('[name="jet-astrologie"]').click((event) => {
 | 
			
		||||
      this.requestJetAstrologie();
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static organizeNombres(actor) {
 | 
			
		||||
    let itemNombres = actor.listItems('nombreastral');
 | 
			
		||||
    let itemFiltered = {};
 | 
			
		||||
    for (let item of itemNombres) {
 | 
			
		||||
      if (itemFiltered[item.system.jourindex]) {
 | 
			
		||||
        itemFiltered[item.system.jourindex].listValues.push(item.system.value);
 | 
			
		||||
      } else {
 | 
			
		||||
        itemFiltered[item.system.jourindex] = {
 | 
			
		||||
          listValues: [item.system.value],
 | 
			
		||||
          jourlabel: item.system.jourlabel
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return itemFiltered;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  requestJetAstrologie() {
 | 
			
		||||
    let socketData = {
 | 
			
		||||
      id: this.actor.id,
 | 
			
		||||
      carac_vue: this.actor.system.carac['vue'].value,
 | 
			
		||||
      etat: this.dataNombreAstral.etat,
 | 
			
		||||
      astrologie: this.dataNombreAstral.astrologie,
 | 
			
		||||
      conditions: this.html.find('[name="diffConditions"]').val(),
 | 
			
		||||
      date: this.html.find('[name="joursAstrologie"]').val(),
 | 
			
		||||
      userId: game.user.id
 | 
			
		||||
    }
 | 
			
		||||
    if (Misc.isUniqueConnectedGM()) {
 | 
			
		||||
      game.system.rdd.calendrier.requestNombreAstral(socketData);
 | 
			
		||||
    } else {
 | 
			
		||||
      game.socket.emit(SYSTEM_SOCKET_ID, {
 | 
			
		||||
        msg: "msg_request_nombre_astral",
 | 
			
		||||
        data: socketData
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
    this.close();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,19 +1,14 @@
 | 
			
		||||
import { RdDCalendrierEditeur } from "./rdd-calendrier-editeur.js";
 | 
			
		||||
import { RdDAstrologieEditeur } from "./rdd-astrologie-editeur.js";
 | 
			
		||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
 | 
			
		||||
import { RdDUtility } from "./rdd-utility.js";
 | 
			
		||||
import { RdDDice } from "./rdd-dice.js";
 | 
			
		||||
import { Misc } from "./misc.js";
 | 
			
		||||
import { HIDE_DICE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
 | 
			
		||||
import { DialogChronologie } from "./dialog-chronologie.js";
 | 
			
		||||
import { RdDTimestamp, WORLD_TIMESTAMP_SETTING } from "./rdd-timestamp.js";
 | 
			
		||||
import { MAX_NOMBRE_ASTRAL, RdDTimestamp, WORLD_TIMESTAMP_SETTING } from "./rdd-timestamp.js";
 | 
			
		||||
import { DialogChateauDormant } from "./sommeil/dialog-chateau-dormant.js";
 | 
			
		||||
import { ReglesOptionelles } from "./settings/regles-optionelles.js";
 | 
			
		||||
 | 
			
		||||
const RDD_JOUR_PAR_MOIS = 28;
 | 
			
		||||
const RDD_HEURES_PAR_JOUR = 12;
 | 
			
		||||
const MAX_NOMBRE_ASTRAL = 12;
 | 
			
		||||
const JOURS_DU_MOIS = Array(RDD_JOUR_PAR_MOIS).fill().map((item, index) => 1 + index);
 | 
			
		||||
import { APP_ASTROLOGIE_REFRESH, AppAstrologie } from "./sommeil/app-astrologie.js";
 | 
			
		||||
 | 
			
		||||
/* -------------------------------------------- */
 | 
			
		||||
export class RdDCalendrier extends Application {
 | 
			
		||||
@@ -43,10 +38,10 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
 | 
			
		||||
    if (Misc.isUniqueConnectedGM()) { // Uniquement si GM
 | 
			
		||||
      RdDTimestamp.setWorldTime(this.timestamp);
 | 
			
		||||
      this.listeNombreAstral = this.getListeNombreAstral();
 | 
			
		||||
      this.rebuildListeNombreAstral(HIDE_DICE); // Ensure always up-to-date
 | 
			
		||||
      this.nombresAstraux = this.getNombresAstraux();
 | 
			
		||||
      this.rebuildNombresAstraux(HIDE_DICE); // Ensure always up-to-date
 | 
			
		||||
    }
 | 
			
		||||
    console.log('RdDCalendrier.constructor()', this.timestamp, this.timestamp.toCalendrier(), this.calendrierPos, this.listeNombreAstral);
 | 
			
		||||
    console.log('RdDCalendrier.constructor()', this.timestamp, this.timestamp.toCalendrier(), this.calendrierPos, this.nombresAstraux);
 | 
			
		||||
    Hooks.on('updateSetting', async (setting, update, options, id) => this.onUpdateSetting(setting, update, options, id));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -54,6 +49,7 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
    if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) {
 | 
			
		||||
      this.timestamp = RdDTimestamp.getWorldTime();
 | 
			
		||||
      this.updateDisplay();
 | 
			
		||||
      Hooks.callAll(APP_ASTROLOGIE_REFRESH);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -150,7 +146,7 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  getListeNombreAstral() {
 | 
			
		||||
  getNombresAstraux() {
 | 
			
		||||
    return game.settings.get(SYSTEM_RDD, "liste-nombre-astral") ?? [];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -190,12 +186,8 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  getJoursSuivants(count) {
 | 
			
		||||
    let jours = [];
 | 
			
		||||
    let indexDate = this.timestamp.indexDate;
 | 
			
		||||
    for (let i = 0; i < count; i++, indexDate++) {
 | 
			
		||||
      jours[i] = { label: RdDTimestamp.formatIndexDate(indexDate), index: indexDate };
 | 
			
		||||
    }
 | 
			
		||||
    return jours;
 | 
			
		||||
    return Misc.intArray(this.timestamp.indexDate, this.timestamp.indexDate + count)
 | 
			
		||||
      .map(i => { return { label: RdDTimestamp.formatIndexDate(i), index: i } })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
@@ -216,8 +208,8 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  resetNombreAstral() {
 | 
			
		||||
    this.listeNombreAstral = [];
 | 
			
		||||
  resetNombresAstraux() {
 | 
			
		||||
    this.nombresAstraux = [];
 | 
			
		||||
    game.settings.set(SYSTEM_RDD, "liste-nombre-astral", []);
 | 
			
		||||
 | 
			
		||||
    game.socket.emit(SYSTEM_SOCKET_ID, {
 | 
			
		||||
@@ -237,29 +229,39 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
    if (indexDate == undefined) {
 | 
			
		||||
      indexDate = this.timestamp.indexDate;
 | 
			
		||||
    }
 | 
			
		||||
    const listNombreAstral = this.getListeNombreAstral();
 | 
			
		||||
    let astralData = listNombreAstral.find((nombreAstral, i) => nombreAstral.index == indexDate);
 | 
			
		||||
    this.nombresAstraux = this.getNombresAstraux();
 | 
			
		||||
    let astralData = this.nombresAstraux.find((nombreAstral, i) => nombreAstral.index == indexDate);
 | 
			
		||||
    return astralData?.nombreAstral ?? 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async rebuildListeNombreAstral(showDice = HIDE_DICE) {
 | 
			
		||||
  async rebuildNombresAstraux(showDice = HIDE_DICE) {
 | 
			
		||||
    if (Misc.isUniqueConnectedGM()) {
 | 
			
		||||
      let newList = [];
 | 
			
		||||
      for (let i = 0; i < MAX_NOMBRE_ASTRAL; i++) {
 | 
			
		||||
        let dayIndex = this.timestamp.indexDate + i;
 | 
			
		||||
        let na = this.listeNombreAstral.find(n => n.index == dayIndex);
 | 
			
		||||
        let na = this.nombresAstraux.find(n => n.index == dayIndex);
 | 
			
		||||
        if (na) {
 | 
			
		||||
          newList[i] = na;
 | 
			
		||||
        } else {
 | 
			
		||||
          newList[i] = await this.ajouterNombreAstral(dayIndex, showDice);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      this.listeNombreAstral = newList;
 | 
			
		||||
      this.nombresAstraux = newList;
 | 
			
		||||
      game.settings.set(SYSTEM_RDD, "liste-nombre-astral", newList);
 | 
			
		||||
      game.actors.filter(it => it.isPersonnage()).forEach(actor => actor.supprimerAnciensNombresAstraux());
 | 
			
		||||
      this.notifyChangeNombresAstraux();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  notifyChangeNombresAstraux() {
 | 
			
		||||
    Hooks.callAll(APP_ASTROLOGIE_REFRESH);
 | 
			
		||||
    game.socket.emit(SYSTEM_SOCKET_ID, {
 | 
			
		||||
      msg: "msg_refresh_nombre_astral",
 | 
			
		||||
      data: {}
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async setNewTimestamp(newTimestamp) {
 | 
			
		||||
    const oldTimestamp = this.timestamp;
 | 
			
		||||
@@ -269,7 +271,7 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
      await DialogChateauDormant.create();
 | 
			
		||||
    }
 | 
			
		||||
    this.timestamp = newTimestamp;
 | 
			
		||||
    await this.rebuildListeNombreAstral();
 | 
			
		||||
    await this.rebuildNombresAstraux();
 | 
			
		||||
    this.updateDisplay();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -285,6 +287,7 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
      this.positionnerHeure(Number(calendarSet.value));
 | 
			
		||||
    }
 | 
			
		||||
    this.updateDisplay();
 | 
			
		||||
    Hooks.callAll(APP_ASTROLOGIE_REFRESH);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
@@ -301,7 +304,7 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
  async positionnerHeure(heure) {
 | 
			
		||||
    const indexDate = this.timestamp.indexDate;
 | 
			
		||||
    const addDay = this.timestamp.heure < heure ? 0 : 1;
 | 
			
		||||
    const newTimestamp = new RdDTimestamp({ indexDate: indexDate + addDay}).addHeures(heure);
 | 
			
		||||
    const newTimestamp = new RdDTimestamp({ indexDate: indexDate + addDay }).addHeures(heure);
 | 
			
		||||
    await this.setNewTimestamp(newTimestamp)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -365,20 +368,16 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  addNbAstralIncorect(actorId, date, nbAstral) {
 | 
			
		||||
    let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == date);
 | 
			
		||||
    let astralData = this.nombresAstraux.find((nombreAstral, i) => nombreAstral.index == date);
 | 
			
		||||
    astralData.valeursFausses.push({ actorId: actorId, nombreAstral: nbAstral });
 | 
			
		||||
    game.settings.set(SYSTEM_RDD, "liste-nombre-astral", this.listeNombreAstral);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static ecartHeureChance(heureNaissance, nombreAstral, heure) {
 | 
			
		||||
    return (heureNaissance + nombreAstral - heure) % RDD_HEURES_PAR_JOUR;
 | 
			
		||||
    game.settings.set(SYSTEM_RDD, "liste-nombre-astral", this.nombresAstraux);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  getAjustementAstrologique(heureNaissance, name = undefined) {
 | 
			
		||||
    let defHeure = RdDTimestamp.findHeure(heureNaissance);
 | 
			
		||||
    if (defHeure) {
 | 
			
		||||
      return RdDCalendrier.ajustementAstrologiqueHeure(defHeure.heure, this.getNombreAstral(), this.timestamp.heure);
 | 
			
		||||
      return RdDTimestamp.ajustementAstrologiqueHeure(defHeure.heure, this.getNombreAstral(), this.timestamp.heure);
 | 
			
		||||
    }
 | 
			
		||||
    else if (name) {
 | 
			
		||||
      ui.notifications.warn(name + " n'a pas d'heure de naissance, ou elle est incorrecte : " + heureNaissance);
 | 
			
		||||
@@ -389,16 +388,6 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static ajustementAstrologiqueHeure(hn, nbAstral, heure) {
 | 
			
		||||
    switch (RdDCalendrier.ecartHeureChance(hn, nbAstral, heure)) {
 | 
			
		||||
      case 0: return 4;
 | 
			
		||||
      case 4: case 8: return 2;
 | 
			
		||||
      case 6: return -4;
 | 
			
		||||
      case 3: case 9: return -2;
 | 
			
		||||
    }
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  getData() {
 | 
			
		||||
    let formData = super.getData();
 | 
			
		||||
@@ -472,41 +461,8 @@ export class RdDCalendrier extends Application {
 | 
			
		||||
    this.editeur.render(true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static buildJoursMois() { return JOURS_DU_MOIS; }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async showAstrologieEditor() {
 | 
			
		||||
    const calendrierData = duplicate(this.fillCalendrierData());
 | 
			
		||||
    this.listeNombreAstral = this.listeNombreAstral || [];
 | 
			
		||||
 | 
			
		||||
    calendrierData.astrologieData = this.listeNombreAstral.map(astro => {
 | 
			
		||||
      const timestamp = new RdDTimestamp({ indexDate: astro.index });
 | 
			
		||||
      astro.date = { mois: timestamp.mois, jour: timestamp.jour + 1 }
 | 
			
		||||
      for (let vf of astro.valeursFausses) {
 | 
			
		||||
        let actor = game.actors.get(vf.actorId);
 | 
			
		||||
        vf.actorName = (actor) ? actor.name : "Inconnu";
 | 
			
		||||
      }
 | 
			
		||||
      return astro;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    const nbAstral = this.getNombreAstral()
 | 
			
		||||
    calendrierData.heures = Array.from(Array(RDD_HEURES_PAR_JOUR).keys());
 | 
			
		||||
    calendrierData.ajustementsActeur = game.actors.filter(it => it.isPersonnage() && it.hasPlayerOwner).map(actor => {
 | 
			
		||||
      return {
 | 
			
		||||
        actor,
 | 
			
		||||
        ajustements: calendrierData.heures.map(heure => {
 | 
			
		||||
          const hn = RdDTimestamp.findHeure(actor.getHeureNaissance())?.heure;
 | 
			
		||||
          return {
 | 
			
		||||
            heure,
 | 
			
		||||
            ajustement: RdDCalendrier.ajustementAstrologiqueHeure(hn, nbAstral, heure)
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-astrologie-template.html', calendrierData);
 | 
			
		||||
    let astrologieEditeur = new RdDAstrologieEditeur(html, this, calendrierData)
 | 
			
		||||
    astrologieEditeur.updateData(calendrierData);
 | 
			
		||||
    astrologieEditeur.render(true);
 | 
			
		||||
    await AppAstrologie.create();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -39,35 +39,31 @@ export class RdDCombatManager extends Combat {
 | 
			
		||||
 | 
			
		||||
  static init() {
 | 
			
		||||
    /* -------------------------------------------- */
 | 
			
		||||
    Hooks.on("getCombatTrackerEntryContext", (html, options) => {
 | 
			
		||||
      RdDCombatManager.pushInitiativeOptions(html, options);
 | 
			
		||||
    });
 | 
			
		||||
    Hooks.on("preDeleteCombat", (combat, html, id) => {
 | 
			
		||||
      combat.onPreDeleteCombat()
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  cleanItemUse() {
 | 
			
		||||
    for (let turn of this.turns) {
 | 
			
		||||
      turn.actor.resetItemUse()
 | 
			
		||||
    }
 | 
			
		||||
    Hooks.on("getCombatTrackerEntryContext", (html, options) => { RdDCombatManager.pushInitiativeOptions(html, options); });
 | 
			
		||||
    Hooks.on("updateCombat", (combat, change, options, userId) => { RdDCombat.onUpdateCombat(combat, change, options, userId) });
 | 
			
		||||
    Hooks.on("preDeleteCombat", (combat, html, id) => { combat.onPreDeleteCombat() });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async nextRound() {
 | 
			
		||||
    this.cleanItemUse();
 | 
			
		||||
    await this.finDeRound();
 | 
			
		||||
    return await super.nextRound();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async onPreDeleteCombat() {
 | 
			
		||||
    await this.finDeRound({ terminer: true });
 | 
			
		||||
    if (Misc.isUniqueConnectedGM()) {
 | 
			
		||||
      await this.finDeRound({ terminer: true });
 | 
			
		||||
      ChatUtility.removeChatMessageContaining(`<div data-combatid="${this.id}" data-combatmessage="actor-turn-summary">`)
 | 
			
		||||
      game.messages.filter(m => ChatUtility.getMessageData(m, 'attacker-roll') != undefined && ChatUtility.getMessageData(m, 'defender-roll') != undefined)
 | 
			
		||||
        .forEach(it => it.delete());
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async finDeRound(options = { terminer: false }) {
 | 
			
		||||
    this.turns.forEach(turn => turn.actor.resetItemUse());
 | 
			
		||||
 | 
			
		||||
    for (let combatant of this.combatants) {
 | 
			
		||||
      if (combatant.actor) {
 | 
			
		||||
        await combatant.actor.finDeRound(options);
 | 
			
		||||
@@ -144,9 +140,8 @@ export class RdDCombatManager extends Combat {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static calculInitiative(niveau, caracValue, bonusEcaille = 0) {
 | 
			
		||||
    let base = niveau + Math.floor(caracValue / 2);
 | 
			
		||||
    base += bonusEcaille;
 | 
			
		||||
  static calculInitiative(niveau, caracValue, bonus = 0) {
 | 
			
		||||
    let base = niveau + Math.floor(caracValue / 2) + bonus;
 | 
			
		||||
    return "1d6" + (base >= 0 ? "+" : "") + base;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -420,18 +415,11 @@ export class RdDCombatManager extends Combat {
 | 
			
		||||
/* -------------------------------------------- */
 | 
			
		||||
export class RdDCombat {
 | 
			
		||||
 | 
			
		||||
  static init() {
 | 
			
		||||
    Hooks.on("updateCombat", (combat, change, options, userId) => { RdDCombat.onUpdateCombat(combat, change, options, userId) });
 | 
			
		||||
    Hooks.on("preDeleteCombat", (combat, options, userId) => { RdDCombat.onPreDeleteCombat(combat, options, userId); });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static onSocketMessage(sockmsg) {
 | 
			
		||||
    switch (sockmsg.msg) {
 | 
			
		||||
      case "msg_encaisser":
 | 
			
		||||
        return RdDCombat.onMsgEncaisser(sockmsg.data);
 | 
			
		||||
      case "msg_defense":
 | 
			
		||||
        return RdDCombat.onMsgDefense(sockmsg.data);
 | 
			
		||||
      case "msg_encaisser": return RdDCombat.onMsgEncaisser(sockmsg.data);
 | 
			
		||||
      case "msg_defense": return RdDCombat.onMsgDefense(sockmsg.data);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -442,16 +430,6 @@ export class RdDCombat {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static onPreDeleteCombat(combat, options, userId) {
 | 
			
		||||
    if (Misc.isUniqueConnectedGM()) {
 | 
			
		||||
      combat.cleanItemUse();
 | 
			
		||||
      ChatUtility.removeChatMessageContaining(`<div data-combatid="${combat.id}" data-combatmessage="actor-turn-summary">`)
 | 
			
		||||
      game.messages.filter(m => ChatUtility.getMessageData(m, 'attacker-roll') != undefined && ChatUtility.getMessageData(m, 'defender-roll') != undefined)
 | 
			
		||||
        .forEach(it => it.delete());
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static combatNouveauTour(combat) {
 | 
			
		||||
    if (Misc.isUniqueConnectedGM()) {
 | 
			
		||||
@@ -756,15 +734,6 @@ export class RdDCombat {
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async attaque(competence, arme) {
 | 
			
		||||
    // const nonIncarnee = this.defender.isEntite([ENTITE_NONINCARNE])
 | 
			
		||||
    // const blurette = this.defender.isEntite([ENTITE_BLURETTE])
 | 
			
		||||
    // if (nonIncarnee || blurette) {
 | 
			
		||||
    //   ChatMessage.create( {
 | 
			
		||||
    //     content: `<strong>La cible est ${nonIncarnee ? 'non incarnée' : 'une blurette'}.
 | 
			
		||||
    //       Il est impossible de l'atteindre.`,
 | 
			
		||||
    //     whisper: ChatMessage.getWhisperRecipients("GM")})
 | 
			
		||||
    // }
 | 
			
		||||
 | 
			
		||||
    if (!await this.attacker.accorder(this.defender, 'avant-attaque')) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
@@ -970,9 +939,8 @@ export class RdDCombat {
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  _filterArmesParade(defender, competence) {
 | 
			
		||||
    let items = defender.items.filter(it => RdDItemArme.isArmeUtilisable(it) || RdDItemCompetenceCreature.isCompetenceParade(it))
 | 
			
		||||
    for (let item of items) {
 | 
			
		||||
      item.system.nbUsage = defender.getItemUse(item.id); // Ajout du # d'utilisation ce round  
 | 
			
		||||
    }
 | 
			
		||||
    items.forEach(item => item.system.nbUsage = defender.getItemUse(item.id)); // Ajout du # d'utilisation ce round  
 | 
			
		||||
 | 
			
		||||
    switch (competence.system.categorie) {
 | 
			
		||||
      case 'tir':
 | 
			
		||||
      case 'lancer':
 | 
			
		||||
 
 | 
			
		||||
@@ -55,6 +55,7 @@ import { RdDFauneItemSheet } from "./item/sheet-faune.js";
 | 
			
		||||
import { RdDConteneurItemSheet } from "./item/sheet-conteneur.js";
 | 
			
		||||
import { RdDSigneDraconiqueItemSheet } from "./item/sheet-signedraconique.js";
 | 
			
		||||
import { RdDItemInventaireSheet } from "./item/sheet-base-inventaire.js";
 | 
			
		||||
import { AppAstrologie } from "./sommeil/app-astrologie.js";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * RdD system
 | 
			
		||||
@@ -96,6 +97,8 @@ export class SystemReveDeDragon {
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async onInit() {
 | 
			
		||||
    game.system.rdd = this;
 | 
			
		||||
    this.AppAstrologie = AppAstrologie;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    console.log(`Initializing Reve de Dragon System`);
 | 
			
		||||
 | 
			
		||||
@@ -180,7 +183,6 @@ export class SystemReveDeDragon {
 | 
			
		||||
    RdDUtility.init();
 | 
			
		||||
    RdDDice.init();
 | 
			
		||||
    RdDCommands.init();
 | 
			
		||||
    RdDCombat.init();
 | 
			
		||||
    RdDCombatManager.init();
 | 
			
		||||
    RdDTokenHud.init();
 | 
			
		||||
    RdDBaseActor.init();
 | 
			
		||||
 
 | 
			
		||||
@@ -195,17 +195,6 @@ export class RdDResolutionTable {
 | 
			
		||||
    return Math.max(Math.floor(carac * (diff + 10) / 2), 1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static isAjustementAstrologique(rollData) {
 | 
			
		||||
    if (rollData.selectedCarac?.label.toLowerCase().includes('chance')) {
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    if (rollData.selectedSort?.system.isrituel) {
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  static isEchec(rollData) {
 | 
			
		||||
    switch (rollData.surprise) {
 | 
			
		||||
@@ -294,12 +283,9 @@ export class RdDResolutionTable {
 | 
			
		||||
      carac: carac,
 | 
			
		||||
      difficulte: level,
 | 
			
		||||
      min: minLevel,
 | 
			
		||||
      rows: RdDResolutionTable.incrementalArray(minCarac, maxCarac),
 | 
			
		||||
      cols: RdDResolutionTable.incrementalArray(minLevel, maxLevel)
 | 
			
		||||
      rows: Misc.intArray(minCarac, maxCarac+1),
 | 
			
		||||
      cols: Misc.intArray(minLevel, maxLevel+1)
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
  static incrementalArray(min, max) {
 | 
			
		||||
    return Array.from(Array(max-min+1).keys()).map(i=>i+min)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -5,10 +5,11 @@ import { RdDDice } from "./rdd-dice.js";
 | 
			
		||||
 | 
			
		||||
export const WORLD_TIMESTAMP_SETTING = "calendrier";
 | 
			
		||||
 | 
			
		||||
const RDD_MOIS_PAR_AN = 12;
 | 
			
		||||
const RDD_JOURS_PAR_MOIS = 28;
 | 
			
		||||
const RDD_JOURS_PAR_AN = 336; //RDD_JOURS_PAR_MOIS * RDD_MOIS_PAR_AN;
 | 
			
		||||
const RDD_HEURES_PAR_JOUR = 12;
 | 
			
		||||
const RDD_MOIS_PAR_AN = 12;
 | 
			
		||||
export const RDD_JOURS_PAR_MOIS = 28;
 | 
			
		||||
export const RDD_HEURES_PAR_JOUR = 12;
 | 
			
		||||
export const MAX_NOMBRE_ASTRAL = 12;
 | 
			
		||||
const RDD_MINUTES_PAR_HEURES = 120;
 | 
			
		||||
const RDD_MINUTES_PAR_JOUR = 1440; //RDD_HEURES_PAR_JOUR * RDD_MINUTES_PAR_HEURES;
 | 
			
		||||
const ROUNDS_PAR_MINUTE = 10;
 | 
			
		||||
@@ -46,11 +47,8 @@ const FORMULES_PERIODE = [
 | 
			
		||||
  { code: 'jour', label: "Jours", calcul: async (t, nombre) => t.addJours(nombre) },
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
export class RdDTimestamp {
 | 
			
		||||
 | 
			
		||||
  static iconeHeure(heure) {
 | 
			
		||||
    return `systems/foundryvtt-reve-de-dragon/icons/heures/hd${heure < 9 ? '0' : ''}${heure + 1}.svg`;
 | 
			
		||||
  }
 | 
			
		||||
export class RdDTimestamp {
 | 
			
		||||
 | 
			
		||||
  static init() {
 | 
			
		||||
    game.settings.register(SYSTEM_RDD, WORLD_TIMESTAMP_SETTING, {
 | 
			
		||||
@@ -63,15 +61,41 @@ export class RdDTimestamp {
 | 
			
		||||
 | 
			
		||||
    for (let i = 0; i < DEFINITION_HEURES.length; i++) {
 | 
			
		||||
      DEFINITION_HEURES[i].heure = i;
 | 
			
		||||
      DEFINITION_HEURES[i].hh = RdDTimestamp.hh(i);
 | 
			
		||||
      DEFINITION_HEURES[i].icon = RdDTimestamp.iconeHeure(i);
 | 
			
		||||
      DEFINITION_HEURES[i].webp = DEFINITION_HEURES[i].icon.replace(".svg", ".webp");
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  static hh(heure) {
 | 
			
		||||
    return heure < 9 ? `0${heure + 1}` : `${heure + 1}`;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static iconeHeure(heure) {
 | 
			
		||||
    return `systems/foundryvtt-reve-de-dragon/icons/heures/hd${RdDTimestamp.hh(heure)}.svg`;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static definitions() {
 | 
			
		||||
    return DEFINITION_HEURES
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static formulesDuree() {
 | 
			
		||||
    return FORMULES_DUREE
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static formulesPeriode() {
 | 
			
		||||
    return FORMULES_PERIODE
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static heures() {
 | 
			
		||||
    return Misc.intArray(0, RDD_HEURES_PAR_JOUR)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param signe  
 | 
			
		||||
   * @returns L'entrée de DEFINITION_HEURES correspondant au signe
 | 
			
		||||
   */
 | 
			
		||||
  */
 | 
			
		||||
  static definition(signe) {
 | 
			
		||||
    if (signe == undefined) {
 | 
			
		||||
      signe = 0;
 | 
			
		||||
@@ -86,20 +110,26 @@ export class RdDTimestamp {
 | 
			
		||||
    return definition
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static formulesDuree() {
 | 
			
		||||
    return FORMULES_DUREE
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static formulesPeriode() {
 | 
			
		||||
    return FORMULES_PERIODE
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static imgSigneHeure(heure) {
 | 
			
		||||
    return RdDTimestamp.imgSigne(RdDTimestamp.definition(heure));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static imgSigne(signe) {
 | 
			
		||||
    return signe == undefined ? '' : `<img class="img-signe-heure" src="${signe.webp}" alt="${signe.label}"/>`
 | 
			
		||||
    return signe == undefined ? '' : `<img class="img-signe-heure" src="${signe.webp}" alt="${signe.label}" title="${signe.label}"/>`
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static ajustementAstrologiqueHeure(hn, nbAstral, heure) {
 | 
			
		||||
    let ecart = (hn + nbAstral - heure) % RDD_HEURES_PAR_JOUR;
 | 
			
		||||
    if (ecart < 0) {
 | 
			
		||||
      ecart = (ecart + RDD_HEURES_PAR_JOUR) % RDD_HEURES_PAR_JOUR;
 | 
			
		||||
    }
 | 
			
		||||
    switch (ecart) {
 | 
			
		||||
      case 0: return 4;
 | 
			
		||||
      case 4: case 8: return 2;
 | 
			
		||||
      case 6: return -4;
 | 
			
		||||
      case 3: case 9: return -2;
 | 
			
		||||
    }
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static handleTimestampEditor(html, path, consumeTimestamp = async (path, timestamp) => { }) {
 | 
			
		||||
@@ -222,6 +252,7 @@ export class RdDTimestamp {
 | 
			
		||||
  get heure() { return Math.floor(this.indexMinute / RDD_MINUTES_PAR_HEURES) }
 | 
			
		||||
  get minute() { return this.indexMinute % RDD_MINUTES_PAR_HEURES }
 | 
			
		||||
  get round() { return ROUNDS_PAR_MINUTE * (this.indexMinute - Math.floor(this.indexMinute)) }
 | 
			
		||||
  get pourcentageDuJour() { return this.indexMinute / RDD_MINUTES_PAR_JOUR }
 | 
			
		||||
 | 
			
		||||
  formatDate() {
 | 
			
		||||
    const jour = this.jour + 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -19,9 +19,9 @@ import { RdDRaretes } from "./item/raretes.js";
 | 
			
		||||
/* -------------------------------------------- */
 | 
			
		||||
// This table starts at 0 -> niveau -10
 | 
			
		||||
const carac_array = ["taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"];
 | 
			
		||||
const difficultesLibres = [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10];
 | 
			
		||||
const ajustementsConditions = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10];
 | 
			
		||||
const ajustementsEncaissement = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16, +17, +18, +19, +20, +21, +22, +23, +24, +25];
 | 
			
		||||
const difficultesLibres =  Misc.intArray(0, -11);
 | 
			
		||||
const ajustementsConditions = Misc.intArray(-10, 11);
 | 
			
		||||
const ajustementsEncaissement = Misc.intArray(-10, 26);
 | 
			
		||||
 | 
			
		||||
/* -------------------------------------------- */
 | 
			
		||||
function _buildAllSegmentsFatigue(max) {
 | 
			
		||||
@@ -234,8 +234,10 @@ export class RdDUtility {
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.html',
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html',
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.html',
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html',
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/sommeil/sommeil-actor-moral.hbs',
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-gardien.hbs',
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-joueur.hbs',
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-theme.hbs',
 | 
			
		||||
      // Calendrier
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/calendar-template.html',
 | 
			
		||||
      'systems/foundryvtt-reve-de-dragon/templates/calendar-editor-template.html',
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										216
									
								
								module/sommeil/app-astrologie.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										216
									
								
								module/sommeil/app-astrologie.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,216 @@
 | 
			
		||||
import { SYSTEM_RDD } from "../constants.js";
 | 
			
		||||
import { Misc } from "../misc.js";
 | 
			
		||||
import { RdDTimestamp } from "../rdd-timestamp.js";
 | 
			
		||||
 | 
			
		||||
export const APP_ASTROLOGIE_REFRESH = `${SYSTEM_RDD}-refresh-astrologie`
 | 
			
		||||
 | 
			
		||||
export class AppAstrologie extends Application {
 | 
			
		||||
  static async create(actor = undefined, options = {}) {
 | 
			
		||||
    if (actor == undefined && !game.user.isGM) {
 | 
			
		||||
      actor = game.user.character
 | 
			
		||||
    }
 | 
			
		||||
    if (!actor && !game.user.isGM) {
 | 
			
		||||
      console.error("AppAstrologie uniquement accessible pour le MJ, ou depuis un personnage pour un joueur")
 | 
			
		||||
    }
 | 
			
		||||
    new AppAstrologie(actor, options).render(true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  static get defaultOptions() {
 | 
			
		||||
    return mergeObject(super.defaultOptions, {
 | 
			
		||||
      template: "systems/foundryvtt-reve-de-dragon/templates/sommeil/app-astrologie.hbs",
 | 
			
		||||
      title: "Astrologie",
 | 
			
		||||
      width: 'fit-content',
 | 
			
		||||
      height: 'fit-content',
 | 
			
		||||
      popOut: true,
 | 
			
		||||
      resizable: false
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  constructor(actor, options = {}) {
 | 
			
		||||
    super(options);
 | 
			
		||||
    this.actor = actor;
 | 
			
		||||
    this.hookReference = Hooks.on(APP_ASTROLOGIE_REFRESH, () => this.refreshAstrologie());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getData(options) {
 | 
			
		||||
    this.appData = super.getData(options)
 | 
			
		||||
    const calendrier = game.system.rdd.calendrier;
 | 
			
		||||
    mergeObject(this.appData, {
 | 
			
		||||
      isGM: game.user.isGM,
 | 
			
		||||
      isActor: this.actor != undefined,
 | 
			
		||||
      calendrier: calendrier.getTimestamp().toCalendrier(),
 | 
			
		||||
      dates: calendrier.getJoursSuivants(10),
 | 
			
		||||
      heures: RdDTimestamp.definitions(),
 | 
			
		||||
      actorAstrologie: this.getActorAstrologie(),
 | 
			
		||||
      gmAstrologie: this.getGMAstrologie(calendrier),
 | 
			
		||||
      theme: {
 | 
			
		||||
        signeAstral: RdDTimestamp.definition(0),
 | 
			
		||||
        signeNaissance: RdDTimestamp.definition(0)
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
    return this.appData;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getActorAstrologie() {
 | 
			
		||||
    if (this.actor) {
 | 
			
		||||
      return {
 | 
			
		||||
        actor: this.actor,
 | 
			
		||||
        nombres: this._organizeNombresAstraux(this.actor.listItems('nombreastral')),
 | 
			
		||||
        ajustements: CONFIG.RDD.difficultesLibres,
 | 
			
		||||
        etat: this.actor.getEtatGeneral(),
 | 
			
		||||
        astrologie: this.actor.getCompetence('Astrologie')
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return {}
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  _organizeNombresAstraux(nombresAstraux) {
 | 
			
		||||
    let organized = {};
 | 
			
		||||
    nombresAstraux.forEach(na => {
 | 
			
		||||
      if (!organized[na.system.jourindex]) {
 | 
			
		||||
        organized[na.system.jourindex] = {
 | 
			
		||||
          listValues: [],
 | 
			
		||||
          jourlabel: na.system.jourlabel
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      organized[na.system.jourindex].listValues.push(na.system.value);
 | 
			
		||||
    })
 | 
			
		||||
    return organized;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getGMAstrologie(calendrier) {
 | 
			
		||||
    if (game.user.isGM) {
 | 
			
		||||
      const nbAstral = calendrier.getNombreAstral()
 | 
			
		||||
      const heures = RdDTimestamp.heures();
 | 
			
		||||
      return {
 | 
			
		||||
        ajustementsActors: game.actors.filter(it => it.isPersonnage() && it.hasPlayerOwner)
 | 
			
		||||
          .map(actor => this.getAjustementActor(actor, nbAstral, heures)),
 | 
			
		||||
        nombresAstraux: calendrier.getNombresAstraux().map(na => this.getDetailNombreAstral(na))
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return {}
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getAjustementActor(actor, nbAstral, heures) {
 | 
			
		||||
    const hn = RdDTimestamp.findHeure(actor.getHeureNaissance())?.heure ?? 0;
 | 
			
		||||
    return {
 | 
			
		||||
      actor,
 | 
			
		||||
      ajustements: heures.map(heure => {
 | 
			
		||||
        return { heure, ajustement: RdDTimestamp.ajustementAstrologiqueHeure(hn, nbAstral, heure) };
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getDetailNombreAstral(nombreAstral) {
 | 
			
		||||
    const detail = duplicate(nombreAstral);
 | 
			
		||||
    const timestamp = new RdDTimestamp({ indexDate: nombreAstral.index });
 | 
			
		||||
    detail.date = { mois: timestamp.mois, jour: timestamp.jour + 1 };
 | 
			
		||||
    detail.valeursFausses.forEach(fausse => fausse.actorName = game.actors.get(fausse.actorId).name ?? "Inconnu");
 | 
			
		||||
    return detail;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  activateListeners(html) {
 | 
			
		||||
    super.activateListeners(html);
 | 
			
		||||
    this.html = html;
 | 
			
		||||
    this.html.find('select[name="signe-astral"]').change(event => {
 | 
			
		||||
      this.selectNombreAstral(this.html.find('select[name="signe-astral"]').val());
 | 
			
		||||
    })
 | 
			
		||||
    this.html.find('select[name="signe-naissance"]').change(event => {
 | 
			
		||||
      this.selectHeureNaissance(this.html.find('select[name="signe-naissance"]').val());
 | 
			
		||||
    })
 | 
			
		||||
    this.html.find('td.nombre-astral').click(event => {
 | 
			
		||||
      this.selectNombreAstral(Number.parseInt(event.currentTarget.attributes['data-nombre-astral'].value) - 1);
 | 
			
		||||
    })
 | 
			
		||||
    this.html.find('tr.heure-naissance').click(event => {
 | 
			
		||||
      this.selectHeureNaissance(event.currentTarget.attributes['data-heure-naissance'].value);
 | 
			
		||||
    })
 | 
			
		||||
    this.html.find('[name="jet-astrologie"]').click(event => this.requestJetAstrologie());
 | 
			
		||||
    this.html.find('[name="rebuild-nombres-astraux"]').click(event => this.rebuildNombresAstraux());
 | 
			
		||||
    
 | 
			
		||||
    this.onCalculThemeAstral();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  selectHeureNaissance(heureNaissance) {
 | 
			
		||||
    this.appData.theme.signeNaissance = RdDTimestamp.definition(heureNaissance);
 | 
			
		||||
    this.onCalculThemeAstral();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  selectNombreAstral(nombreAstral) {
 | 
			
		||||
    this.appData.theme.signeAstral = RdDTimestamp.definition(nombreAstral);
 | 
			
		||||
    this.onCalculThemeAstral();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* -------------------------------------------- */
 | 
			
		||||
  async rebuildNombresAstraux() {
 | 
			
		||||
    game.system.rdd.calendrier.resetNombresAstraux();
 | 
			
		||||
 | 
			
		||||
    await game.system.rdd.calendrier.rebuildNombresAstraux();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  onCalculThemeAstral() {
 | 
			
		||||
    const chiffreAstral = this.appData.theme.signeAstral.heure + 1;
 | 
			
		||||
    const heureNaissance = this.appData.theme.signeNaissance.heure + 1;
 | 
			
		||||
    RdDTimestamp.definitions().forEach(dh => {
 | 
			
		||||
      const ajustement = RdDTimestamp.ajustementAstrologiqueHeure(heureNaissance, chiffreAstral, dh.heure + 1);
 | 
			
		||||
      const txtAjustement = ajustement == 0 ? '' : Misc.toSignedString(ajustement);
 | 
			
		||||
      this.html.find(`div.astro-ajustement.ajustement-${dh.hh}`).text(txtAjustement)
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    this.html.find(`select[name="signe-astral"]`).val(this.appData.theme.signeAstral.key)
 | 
			
		||||
    this.html.find(`select[name="signe-naissance"]`).val(this.appData.theme.signeNaissance.key)
 | 
			
		||||
 | 
			
		||||
    const angleAstrologie = ((chiffreAstral + heureNaissance) * 30) % 360;
 | 
			
		||||
    this.html.find(`div.astro-roue div.astro-disque img`).css(this.cssRotation(angleAstrologie));
 | 
			
		||||
 | 
			
		||||
    const timestamp = game.system.rdd.calendrier.getTimestamp();
 | 
			
		||||
    const angleHeure = timestamp.pourcentageDuJour * 360 
 | 
			
		||||
    this.html.find(`div.astro-roue div.astro-horloge img`).css(this.cssRotation(angleHeure));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  cssRotation(angleAstrologie) {
 | 
			
		||||
    const rotation = `rotate(${angleAstrologie}deg)`;
 | 
			
		||||
    const cssRotation = {
 | 
			
		||||
      'transform': rotation,
 | 
			
		||||
      '-ms-transform': rotation,
 | 
			
		||||
      '-moz-transform': rotation,
 | 
			
		||||
      '-webkit-transform': rotation,
 | 
			
		||||
      '-o-transform': rotation
 | 
			
		||||
    };
 | 
			
		||||
    return cssRotation;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  requestJetAstrologie() {
 | 
			
		||||
    if (!this.appData?.isActor) {
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
    let socketData = {
 | 
			
		||||
      id: this.appData.actorAstrologie.actor.id,
 | 
			
		||||
      carac_vue: this.actor.system.carac['vue'].value,
 | 
			
		||||
      etat: this.actor.getEtatGeneral(),
 | 
			
		||||
      astrologie: this.actor.getCompetence('Astrologie'),
 | 
			
		||||
      conditions: this.html.find('[name="diffConditions"]').val(),
 | 
			
		||||
      date: this.html.find('[name="joursAstrologie"]').val(),
 | 
			
		||||
      userId: game.user.id
 | 
			
		||||
    }
 | 
			
		||||
    if (Misc.isUniqueConnectedGM()) {
 | 
			
		||||
      game.system.rdd.calendrier.requestNombreAstral(socketData);
 | 
			
		||||
    } else {
 | 
			
		||||
      game.socket.emit(SYSTEM_SOCKET_ID, {
 | 
			
		||||
        msg: "msg_request_nombre_astral",
 | 
			
		||||
        data: socketData
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  refreshAstrologie() {
 | 
			
		||||
    this.render(true)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async close(options) {
 | 
			
		||||
    Hooks.off(APP_ASTROLOGIE_REFRESH, this.hookReference);
 | 
			
		||||
    this.hookReference = undefined
 | 
			
		||||
    await super.close(options)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
import { EffetsDraconiques } from "../tmr/effets-draconiques.js";
 | 
			
		||||
 | 
			
		||||
export class DialogChateauDormant extends Dialog {
 | 
			
		||||
 | 
			
		||||
@@ -76,28 +75,31 @@ export class DialogChateauDormant extends Dialog {
 | 
			
		||||
 | 
			
		||||
  async onChateauDormant() {
 | 
			
		||||
    const motifStress = this.html.find("form input[name='motifStress']").val();
 | 
			
		||||
    const consignesChateauDormant = jQuery.map(this.html.find('li.set-sommeil-actor'), it => {
 | 
			
		||||
      const actorRow = this.html.find(it);
 | 
			
		||||
      const actorId = actorRow.data('actor-id');
 | 
			
		||||
      const actor = this.getActor(actorId);
 | 
			
		||||
      const insomnie = actorRow.find('input.sommeil-insomnie').is(':checked');
 | 
			
		||||
      return {
 | 
			
		||||
        actor,
 | 
			
		||||
        ignorer: actorRow.find('input.sommeil-ignorer').is(':checked'),
 | 
			
		||||
        stress: {
 | 
			
		||||
          motif: motifStress,
 | 
			
		||||
          valeur: Number.parseInt(actorRow.find('input.sommeil-stress').val()),
 | 
			
		||||
        },
 | 
			
		||||
        sommeil: {
 | 
			
		||||
          nouveaujour: true,
 | 
			
		||||
          date: this.dialogData.finChateauDormant,
 | 
			
		||||
          insomnie: insomnie,
 | 
			
		||||
          heures: insomnie ? 0 : Number.parseInt(actorRow.find('input.sommeil-heures').val()),
 | 
			
		||||
          moral: actor.moral,
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
    consignesChateauDormant.forEach(async consigne => await consigne.actor.prepareChateauDormant(consigne))
 | 
			
		||||
    jQuery.map(
 | 
			
		||||
      this.html.find('li.set-sommeil-actor'),
 | 
			
		||||
      it => this.extractConsigneActor(this.html.find(it), motifStress)
 | 
			
		||||
    ).forEach(async consigne => await consigne.actor.prepareChateauDormant(consigne))
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  extractConsigneActor(actorRow, motifStress) {
 | 
			
		||||
    const actorId = actorRow.data('actor-id');
 | 
			
		||||
    const actor = this.getActor(actorId);
 | 
			
		||||
    const insomnie = actorRow.find('input.sommeil-insomnie').is(':checked');
 | 
			
		||||
    return {
 | 
			
		||||
      actor,
 | 
			
		||||
      ignorer: actorRow.find('input.sommeil-ignorer').is(':checked'),
 | 
			
		||||
      stress: {
 | 
			
		||||
        motif: motifStress,
 | 
			
		||||
        valeur: Number.parseInt(actorRow.find('input.sommeil-stress').val()),
 | 
			
		||||
      },
 | 
			
		||||
      sommeil: {
 | 
			
		||||
        nouveaujour: true,
 | 
			
		||||
        date: this.dialogData.finChateauDormant,
 | 
			
		||||
        insomnie: insomnie,
 | 
			
		||||
        heures: insomnie ? 0 : Number.parseInt(actorRow.find('input.sommeil-heures').val()),
 | 
			
		||||
        moral: actor.system.sommeil.moral ?? 'neutre',
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -4,7 +4,10 @@ import { EffetsDraconiques } from "../tmr/effets-draconiques.js";
 | 
			
		||||
export class DialogRepos extends Dialog {
 | 
			
		||||
 | 
			
		||||
  static async create(actor) {
 | 
			
		||||
    if (!ReglesOptionelles.isUsing("chateau-dormant-gardien")) {
 | 
			
		||||
    if (!actor.isPersonnage()) {
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
    if (!ReglesOptionelles.isUsing("chateau-dormant-gardien") || !actor.hasPlayerOwner) {
 | 
			
		||||
      actor.system.sommeil = {
 | 
			
		||||
        "nouveaujour": true,
 | 
			
		||||
        "insomnie": EffetsDraconiques.isSujetInsomnie(actor),
 | 
			
		||||
 
 | 
			
		||||
@@ -8,5 +8,6 @@
 | 
			
		||||
{"name":"Encaissement","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/svg/bones.svg","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n   selected.encaisser();\n}\nelse {\n  ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671234017623,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"WD6T8AdRbX2Ylxqe"}
 | 
			
		||||
{"name":"Jet quelconque","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/sundries/gaming/dice-runed-tan.webp","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n   selected.roll();\n}\nelse {\n  ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671233500655,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"bnJnbKDHpbqY8Pr9"}
 | 
			
		||||
{"name":"Recherche et tirage","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/tools/scribal/magnifying-glass.webp","command":"game.system.rdd.commands.tirage()","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.ZFWPNdQBjQs9z0YW"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.5.4","coreVersion":"10.291","createdTime":1673472449426,"modifiedTime":1673655461651,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"iVZnxOxhCMpkvYh3"}
 | 
			
		||||
{"name":"Thème astral","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/magic/nature/symbol-moon-stars-white.webp","command":"game.system.rdd.AppAstrologie.create()","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.oA0HPFeFK6YMspAX"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.6.19","coreVersion":"10.291","createdTime":1678127868791,"modifiedTime":1678237392810,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"koqhiDJSGP4gQ4vf"}
 | 
			
		||||
{"name":"Jet d'éthylisme","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/consumables/drinks/alcohol-beer-stein-wooden-metal-brown.webp","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n   selected.jetEthylisme();\n}\nelse {\n  ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671233646086,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"mvub1dRHNFmWjRr7"}
 | 
			
		||||
{"name":"Tirer le tarot","type":"chat","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"systems/foundryvtt-reve-de-dragon/icons/tarots/dos-tarot.webp","command":"/tirer tarot","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.HBZSKR9OHCQbLcTC"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1669469547231,"modifiedTime":1671237401618,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"vTfJTFYYiRu8X5LM"}
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										22
									
								
								styles/img/ui/astro-disque.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								styles/img/ui/astro-disque.svg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<svg width="402.74" height="402.74" version="1.1" viewBox="0 0 106.56 106.56" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
 | 
			
		||||
 <metadata>
 | 
			
		||||
  <rdf:RDF>
 | 
			
		||||
   <cc:Work rdf:about="">
 | 
			
		||||
    <dc:format>image/svg+xml</dc:format>
 | 
			
		||||
    <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
 | 
			
		||||
    <dc:title/>
 | 
			
		||||
   </cc:Work>
 | 
			
		||||
  </rdf:RDF>
 | 
			
		||||
 </metadata>
 | 
			
		||||
 <g transform="translate(-52.554 -94.887)" fill="none">
 | 
			
		||||
  <path d="m54.72 134.47 64.823 64.757" opacity=".8" stroke="#4a0" stroke-width=".53382"/>
 | 
			
		||||
  <path d="m143.17 111.06-88.517 23.669" opacity=".8" stroke="#4a0" stroke-width=".53382"/>
 | 
			
		||||
  <g stroke="#c83737" stroke-width=".52917">
 | 
			
		||||
   <path d="m54.72 134.47 102.23 27.392" opacity=".8"/>
 | 
			
		||||
   <path d="m119.53 97.053-64.809 37.418" opacity=".8"/>
 | 
			
		||||
   <path d="m92.137 199.28-37.418-64.809" opacity=".8"/>
 | 
			
		||||
  </g>
 | 
			
		||||
  <circle transform="rotate(15)" cx="140.58" cy="115.73" r="52.917" opacity=".5" stroke="#aa00d4" stroke-linecap="round" stroke-width=".7"/>
 | 
			
		||||
 </g>
 | 
			
		||||
</svg>
 | 
			
		||||
| 
		 After Width: | Height: | Size: 1.1 KiB  | 
							
								
								
									
										68
									
								
								styles/img/ui/rdd-aiguille-horloge.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								styles/img/ui/rdd-aiguille-horloge.svg
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
		 After Width: | Height: | Size: 13 KiB  | 
@@ -77,6 +77,16 @@
 | 
			
		||||
  --gradient-violet: linear-gradient(150deg, rgba(100, 45, 124, 0.6), rgba(216, 157, 192, 0.3), rgba(177, 157, 216, 0.5), rgba(107, 62, 121, 0.3), rgba(100, 45, 124, 0.6));
 | 
			
		||||
  --gradient-purple-black: linear-gradient(150deg,  rgba(0, 0, 0, 0.7), rgba(100, 45, 124, 0.4), rgba(82, 17, 131, 0.3),rgba(100, 45, 124, 0.4), rgba(0, 0, 0, 0.7));
 | 
			
		||||
  --gradient-silver-light: linear-gradient(30deg, rgba(61, 55, 93, 0.2), rgba(178, 179, 196, 0.1), rgba(59, 62, 63, 0.2), rgba(206, 204, 199, 0.1), rgba(61, 46, 49, 0.2));
 | 
			
		||||
  --gradient-daylight: conic-gradient(
 | 
			
		||||
    from 315deg,
 | 
			
		||||
    hsla(50, 20%, 30%, 0.1) ,
 | 
			
		||||
    hsla(50, 30%, 60%, 0.7) 25%,
 | 
			
		||||
    hsla(50, 20%, 30%, 0.1) 50%,
 | 
			
		||||
    hsla(250, 20%, 30%, 0.1) 50%,
 | 
			
		||||
    hsla(250, 30%, 60%, 0.7) 75%,
 | 
			
		||||
    hsla(250, 20%, 30%, 0.1)
 | 
			
		||||
  );
 | 
			
		||||
  --gradient-daylight2: radial-gradient(210deg, hsla(50, 30%, 60%, 0.6),  hsla(50, 20%, 30%, 0.1) 50%, hsla(250, 20%, 30%, 0.1) 50%, hsla(250, 30%, 60%, 0.6));
 | 
			
		||||
 | 
			
		||||
  --background-custom-button: linear-gradient(to bottom, rgba(33, 55, 74, 0.988) 5%, rgba(21, 40, 51, 0.671) 100%);
 | 
			
		||||
  --background-custom-button-hover: linear-gradient(to bottom, rgb(128, 0, 0) 5%, rgb(62, 1, 1) 100%);
 | 
			
		||||
@@ -860,12 +870,100 @@ form.rdddialogchrono input[type=datetime-local] {
 | 
			
		||||
  color: var(--color-text-dark-primary);
 | 
			
		||||
  border-radius: 3px;
 | 
			
		||||
}
 | 
			
		||||
div.theme-astral{
 | 
			
		||||
  width: 14rem;
 | 
			
		||||
  margin: 0.4rem;
 | 
			
		||||
}
 | 
			
		||||
form.dialog-astro {
 | 
			
		||||
  width: 17rem;
 | 
			
		||||
}
 | 
			
		||||
div.astro-roue {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  left: calc(50% - 6.5rem);
 | 
			
		||||
  width: 13rem;
 | 
			
		||||
  height: 13rem;
 | 
			
		||||
}
 | 
			
		||||
div.astro-roue div.astro-heure {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  width: 2rem;
 | 
			
		||||
  height: 2rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
div.astro-roue div.astro-cercle1 {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  background: var(--gradient-daylight);
 | 
			
		||||
  border: 0.2rem solid rgba(100, 45, 124, 0.6);
 | 
			
		||||
  border-radius: calc(6.1rem);
 | 
			
		||||
  top: calc(50% - 6.1rem);
 | 
			
		||||
  left: calc(50% - 6.1rem);
 | 
			
		||||
  width: calc(100% - 0.8rem);
 | 
			
		||||
  height: calc(100% - 0.8rem);
 | 
			
		||||
}
 | 
			
		||||
div.astro-roue div.astro-disque {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  border: none;
 | 
			
		||||
  top: calc(50% - 4rem);
 | 
			
		||||
  left: calc(50% - 4rem);
 | 
			
		||||
  width: calc(100% - 5rem);
 | 
			
		||||
  height: calc(100% - 5rem);
 | 
			
		||||
}
 | 
			
		||||
div.astro-roue div.astro-horloge {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  border: none;
 | 
			
		||||
  top: calc(50% - 3.5rem);
 | 
			
		||||
  left: calc(50% - 3.5rem);
 | 
			
		||||
  width: calc(100% - 6rem);
 | 
			
		||||
  height: calc(100% - 6rem);
 | 
			
		||||
}
 | 
			
		||||
div.astro-roue div:is(.astro-disque,.astro-horloge) img { border: none; }
 | 
			
		||||
div.astro-roue div.astro-heure img.astro-heure-img {
 | 
			
		||||
  width: 2rem;
 | 
			
		||||
  height: 2rem;
 | 
			
		||||
  flex-grow: 0;
 | 
			
		||||
  padding: 0.1rem;
 | 
			
		||||
  border: 0;
 | 
			
		||||
  opacity: 0.9;
 | 
			
		||||
  border: none;
 | 
			
		||||
}
 | 
			
		||||
div.astro-roue div.astro-heure.heure-12 {  top: calc(50% - 1rem - 1.3rem);  left: calc(50% - 1rem - 4.8rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-01 {  top: calc(50% - 1rem - 3.5rem);  left: calc(50% - 1rem - 3.5rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-02 {  top: calc(50% - 1rem - 4.8rem);  left: calc(50% - 1rem - 1.3rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-03 {  top: calc(50% - 1rem - 4.8rem);  left: calc(50% - 1rem + 1.3rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-04 {  top: calc(50% - 1rem - 3.5rem);  left: calc(50% - 1rem + 3.5rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-05 {  top: calc(50% - 1rem - 1.3rem);  left: calc(50% - 1rem + 4.8rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-06 {  top: calc(50% - 1rem + 1.3rem);  left: calc(50% - 1rem + 4.8rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-07 {  top: calc(50% - 1rem + 3.5rem);  left: calc(50% - 1rem + 3.5rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-08 {  top: calc(50% - 1rem + 4.8rem);  left: calc(50% - 1rem + 1.3rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-09 {  top: calc(50% - 1rem + 4.8rem);  left: calc(50% - 1rem - 1.3rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-10 {  top: calc(50% - 1rem + 3.5rem);  left: calc(50% - 1rem - 3.5rem); }
 | 
			
		||||
div.astro-roue div.astro-heure.heure-11 {  top: calc(50% - 1rem + 1.3rem);  left: calc(50% - 1rem - 4.8rem); }
 | 
			
		||||
 | 
			
		||||
div.astro-roue div.astro-ajustement {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  width: 1rem;
 | 
			
		||||
  height: 1rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-12 {  top: calc(50% - 0.5rem - 0.8rem);  left: calc(50% - 0.5rem - 2.9rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-01 {  top: calc(50% - 0.5rem - 2.1rem);  left: calc(50% - 0.5rem - 2.1rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-02 {  top: calc(50% - 0.5rem - 2.9rem);  left: calc(50% - 0.5rem - 0.8rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-03 {  top: calc(50% - 0.5rem - 2.9rem);  left: calc(50% - 0.5rem + 0.8rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-04 {  top: calc(50% - 0.5rem - 2.1rem);  left: calc(50% - 0.5rem + 2.1rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-05 {  top: calc(50% - 0.5rem - 0.8rem);  left: calc(50% - 0.5rem + 2.9rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-06 {  top: calc(50% - 0.5rem + 0.8rem);  left: calc(50% - 0.5rem + 2.9rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-07 {  top: calc(50% - 0.5rem + 2.1rem);  left: calc(50% - 0.5rem + 2.1rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-08 {  top: calc(50% - 0.5rem + 2.9rem);  left: calc(50% - 0.5rem + 0.8rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-09 {  top: calc(50% - 0.5rem + 2.9rem);  left: calc(50% - 0.5rem - 0.8rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-10 {  top: calc(50% - 0.5rem + 2.1rem);  left: calc(50% - 0.5rem - 2.1rem); }
 | 
			
		||||
div.astro-roue div.astro-ajustement.ajustement-11 {  top: calc(50% - 0.5rem + 0.8rem);  left: calc(50% - 0.5rem - 2.9rem); }
 | 
			
		||||
 | 
			
		||||
.window-app .window-content, .window-app.sheet .window-content .sheet-body{
 | 
			
		||||
  background: rgb(245,245,240) url(img/bg_left.webp) no-repeat left top;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
section.sheet-body{padding: 0.25rem 0.5rem;}
 | 
			
		||||
section.sheet-body {
 | 
			
		||||
  padding: 0.25rem 0.5rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.sheet header.sheet-header :is(.profile-img, .profile-img-token) {
 | 
			
		||||
  object-fit: scale-down;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
{
 | 
			
		||||
  "id": "foundryvtt-reve-de-dragon",
 | 
			
		||||
  "title": "Rêve de Dragon",
 | 
			
		||||
  "version": "10.6.17",
 | 
			
		||||
  "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.17.zip",
 | 
			
		||||
  "version": "10.6.21",
 | 
			
		||||
  "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.21.zip",
 | 
			
		||||
  "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
 | 
			
		||||
  "compatibility": {
 | 
			
		||||
    "minimum": "10",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,56 +0,0 @@
 | 
			
		||||
<form class="{{cssClass}}" autocomplete="off">
 | 
			
		||||
  <header class="sheet-header">
 | 
			
		||||
      <div class="header-fields">
 | 
			
		||||
          <h1 class="charname">Horoscope</h1>
 | 
			
		||||
      </div>
 | 
			
		||||
  </header>
 | 
			
		||||
  {{!-- Sheet Body --}}
 | 
			
		||||
  <section class="sheet-body">
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
      <table class='table-nombres-astraux'>
 | 
			
		||||
        <tr class='table-nombres-astraux-td'>
 | 
			
		||||
          <th>Date</th>
 | 
			
		||||
          {{#each astrologieData as |nombreData key|}}
 | 
			
		||||
          <td class='table-nombres-astraux-td'>{{nombreData.date.jour}}{{timestamp-imgSigneHeure nombreData.date.mois}}</td>
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr class='table-nombres-astraux-td'>
 | 
			
		||||
          <th>Nombre astral</th>
 | 
			
		||||
          {{#each astrologieData as |nombreData key|}}
 | 
			
		||||
          <td class='table-nombres-astraux-td'>
 | 
			
		||||
            <ol>
 | 
			
		||||
            <b>{{nombreData.nombreAstral}}</b>
 | 
			
		||||
            {{#each nombreData.valeursFausses as |fausseVal key|}}
 | 
			
		||||
            <li>{{fausseVal.actorName}} - {{fausseVal.nombreAstral}}</li>
 | 
			
		||||
            {{/each}}
 | 
			
		||||
            </ol>
 | 
			
		||||
          </td>
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </tr>
 | 
			
		||||
      </table>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div>
 | 
			
		||||
      <table>
 | 
			
		||||
        <tr>
 | 
			
		||||
          <td></td>
 | 
			
		||||
          <td><strong>+4</strong></td>
 | 
			
		||||
          <td><strong>+2</strong></td>
 | 
			
		||||
          <td><strong>-2</strong></td>
 | 
			
		||||
          <td><strong>-4</strong></td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        {{#each heuresParActeur as |heuresDef name|}}        
 | 
			
		||||
        <tr>
 | 
			
		||||
          <td><strong>{{name}}</strong>:</td>
 | 
			
		||||
            {{#each heuresDef as |ajustement|}}
 | 
			
		||||
            <td>
 | 
			
		||||
              {{#each ajustement.heures as |heure|}}
 | 
			
		||||
              {{timestamp-imgSigneHeure heure}}
 | 
			
		||||
              {{/each}}
 | 
			
		||||
            </td>
 | 
			
		||||
            {{/each}}
 | 
			
		||||
        </tr>
 | 
			
		||||
        {{/each}}
 | 
			
		||||
      </table>
 | 
			
		||||
    </div>
 | 
			
		||||
  </section>
 | 
			
		||||
</form>
 | 
			
		||||
@@ -1,64 +0,0 @@
 | 
			
		||||
<form class="{{cssClass}}" autocomplete="off">
 | 
			
		||||
  <header class="sheet-header">
 | 
			
		||||
      <div class="header-fields">
 | 
			
		||||
          <h1 class="charname">Horoscope</h1>
 | 
			
		||||
      </div>
 | 
			
		||||
  </header>
 | 
			
		||||
  {{!-- Sheet Body --}}
 | 
			
		||||
  <section class="sheet-body">
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
      <table class='table-nombres-astraux'>
 | 
			
		||||
        <tr>
 | 
			
		||||
          <th>Date</th>
 | 
			
		||||
          {{#each astrologieData as |nombreData key|}}
 | 
			
		||||
          <th>{{nombreData.date.jour}}{{timestamp-imgSigneHeure nombreData.date.mois}}</th>
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
          <th>Nombre astral</th>
 | 
			
		||||
          {{#each astrologieData as |nombreData key|}}
 | 
			
		||||
          <td>
 | 
			
		||||
            <ol>
 | 
			
		||||
            <b>{{nombreData.nombreAstral}}</b>
 | 
			
		||||
            {{#each nombreData.valeursFausses as |fausseVal key|}}
 | 
			
		||||
            <li>{{fausseVal.actorName}} - {{fausseVal.nombreAstral}}</li>
 | 
			
		||||
            {{/each}}
 | 
			
		||||
            </ol>
 | 
			
		||||
          </td>
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </tr>
 | 
			
		||||
      </table>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div>
 | 
			
		||||
      <table class='table-nombres-astraux'>
 | 
			
		||||
        <tr>
 | 
			
		||||
          <th></th>
 | 
			
		||||
          {{#each heures as |heure|}}
 | 
			
		||||
          <th>
 | 
			
		||||
            {{timestamp-imgSigneHeure heure}}
 | 
			
		||||
          </th>
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </tr>
 | 
			
		||||
        {{#each ajustementsActeur as |ajustementActeur|}}
 | 
			
		||||
        <tr>
 | 
			
		||||
          <td>
 | 
			
		||||
            <img class="img-signe-heure" src="{{actor.img}}" title="{{actor.name}}" />
 | 
			
		||||
            {{actor.name}}
 | 
			
		||||
          </td>
 | 
			
		||||
          {{#each ajustementActeur.ajustements as |ajustement|}}
 | 
			
		||||
          <td>{{#if (ne ajustement.ajustement 0)}}
 | 
			
		||||
            <strong>
 | 
			
		||||
              {{numberFormat ajustement.ajustement decimals=0 sign=true}}
 | 
			
		||||
            </strong>
 | 
			
		||||
            {{else}}
 | 
			
		||||
            <div class="dimmed">
 | 
			
		||||
              {{timestamp-imgSigneHeure ajustement.heure}}
 | 
			
		||||
            </div>
 | 
			
		||||
            {{/if}}</td>
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </tr>
 | 
			
		||||
        {{/each}}
 | 
			
		||||
      </table>
 | 
			
		||||
    </div>
 | 
			
		||||
  </section>
 | 
			
		||||
</form>
 | 
			
		||||
@@ -1,52 +0,0 @@
 | 
			
		||||
<form class="{{cssClass}}" autocomplete="off">
 | 
			
		||||
  <header class="sheet-header">
 | 
			
		||||
      <div class="header-fields">
 | 
			
		||||
          <h1 class="charname">Astrologie</h1>
 | 
			
		||||
      </div>
 | 
			
		||||
  </header>
 | 
			
		||||
 | 
			
		||||
  <label>  Conditions</label>
 | 
			
		||||
  <select name="diffConditions" data-dtype="Number">
 | 
			
		||||
      {{#select diffConditions}}
 | 
			
		||||
      {{#each ajustementsConditions  as |key|}}
 | 
			
		||||
      <option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
      {{/select}}
 | 
			
		||||
  </select>
 | 
			
		||||
  <label>  Jours</label>
 | 
			
		||||
  <select name="joursAstrologie" data-dtype="Number">
 | 
			
		||||
      {{#select joursSuivants}}
 | 
			
		||||
      {{#each dates as |date key|}}
 | 
			
		||||
      <option value={{date.index}}>{{date.label}}</option>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
      {{/select}}
 | 
			
		||||
  </select>
 | 
			
		||||
  <label>Etat Général: {{etat}}</label>
 | 
			
		||||
  <label>  <a name="jet-astrologie">Faire un jet d'Astrologie</a></label>
 | 
			
		||||
 | 
			
		||||
  {{!-- Sheet Body --}}
 | 
			
		||||
  <section class="sheet-body">
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
      <label for="astralList">Nombres Astraux</label>
 | 
			
		||||
      <table class='table-nombres-astraux'>
 | 
			
		||||
        <tr class='table-nombres-astraux-td'>
 | 
			
		||||
          {{#each nombres as |nombreData key|}}
 | 
			
		||||
          <td class='table-nombres-astraux-td'>{{nombreData.jourlabel}}</td>
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr class='table-nombres-astraux-td'>
 | 
			
		||||
          {{#each nombres as |nombreData key|}}
 | 
			
		||||
          <td class='table-nombres-astraux-td'>
 | 
			
		||||
            <ol>
 | 
			
		||||
            {{#each nombreData.listValues as |nombreAstral key|}}
 | 
			
		||||
            <li>{{nombreAstral}}</li>
 | 
			
		||||
            {{/each}}
 | 
			
		||||
            </ol>
 | 
			
		||||
          </td>
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </tr>
 | 
			
		||||
      </table>        
 | 
			
		||||
    </div>
 | 
			
		||||
  </section>
 | 
			
		||||
  
 | 
			
		||||
</form>
 | 
			
		||||
							
								
								
									
										18
									
								
								templates/sommeil/app-astrologie.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								templates/sommeil/app-astrologie.hbs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
<form class="app-calendar-astrologie" autocomplete="off">
 | 
			
		||||
    <div class="flexrow">
 | 
			
		||||
      <div class="flex-grow">
 | 
			
		||||
        <div class="header-fields">
 | 
			
		||||
          <h1 class="charname">Astrologie {{#if isActor}}: {{actorAstrologie.actor.name}}{{/if}}</h1>
 | 
			
		||||
        </div>
 | 
			
		||||
        {{log 'astrologie' this}}
 | 
			
		||||
        {{#if isActor}}
 | 
			
		||||
        {{> 'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-joueur.hbs'}}
 | 
			
		||||
        {{else}}
 | 
			
		||||
        {{> 'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-gardien.hbs'}}
 | 
			
		||||
        {{/if}}
 | 
			
		||||
      </div>
 | 
			
		||||
      <div>
 | 
			
		||||
        {{> 'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-theme.hbs'}}
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
							
								
								
									
										57
									
								
								templates/sommeil/astrologie-gardien.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								templates/sommeil/astrologie-gardien.hbs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
			
		||||
<div>
 | 
			
		||||
  <a class="chat-card-button" name="rebuild-nombres-astraux">Réinitialiser les nombres astraux</a>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="form-group">
 | 
			
		||||
  <table class='table-nombres-astraux'>
 | 
			
		||||
    <tr>
 | 
			
		||||
      <th>Date</th>
 | 
			
		||||
      {{#each gmAstrologie.nombresAstraux as |nba|}}
 | 
			
		||||
      <th>{{nba.date.jour}}{{timestamp-imgSigneHeure nba.date.mois}}</th>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
      <th>Nombre astral</th>
 | 
			
		||||
      {{#each gmAstrologie.nombresAstraux as |nba|}}
 | 
			
		||||
      <td class="nombre-astral" data-nombre-astral="{{nba.nombreAstral}}">
 | 
			
		||||
        <ol>
 | 
			
		||||
        <b>{{nba.nombreAstral}}</b>
 | 
			
		||||
        {{#each nba.valeursFausses as |fausse|}}
 | 
			
		||||
        <li>{{fausse.actorName}} - {{fausse.nombreAstral}}</li>
 | 
			
		||||
        {{/each}}
 | 
			
		||||
        </ol>
 | 
			
		||||
      </td>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
    </tr>
 | 
			
		||||
  </table>
 | 
			
		||||
</div>
 | 
			
		||||
<div>
 | 
			
		||||
  <table class='table-nombres-astraux'>
 | 
			
		||||
    <tr>
 | 
			
		||||
      <th></th>
 | 
			
		||||
      {{#each heures as |heure|}}
 | 
			
		||||
      <td>
 | 
			
		||||
        {{timestamp-imgSigneHeure heure.heure}}
 | 
			
		||||
      </td>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
    </tr>
 | 
			
		||||
    {{#each gmAstrologie.ajustementsActors as |ajustementActeur|}}
 | 
			
		||||
    <tr class="heure-naissance" data-heure-naissance="{{actor.system.heure}}">
 | 
			
		||||
      <td>
 | 
			
		||||
        <img class="img-signe-heure" src="{{actor.img}}" title="{{actor.name}}" />
 | 
			
		||||
        {{actor.name}} {{timestamp-imgSigneHeure actor.system.heure}}
 | 
			
		||||
      </td>
 | 
			
		||||
      {{#each ajustementActeur.ajustements as |ajustement|}}
 | 
			
		||||
      <td>{{#if (ne ajustement.ajustement 0)}}
 | 
			
		||||
        <strong>
 | 
			
		||||
          {{numberFormat ajustement.ajustement decimals=0 sign=true}}
 | 
			
		||||
        </strong>
 | 
			
		||||
        {{else}}
 | 
			
		||||
        <div class="dimmed">
 | 
			
		||||
          {{timestamp-imgSigneHeure ajustement.heure}}
 | 
			
		||||
        </div>
 | 
			
		||||
        {{/if}}</td>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
    </tr>
 | 
			
		||||
    {{/each}}
 | 
			
		||||
  </table>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										43
									
								
								templates/sommeil/astrologie-joueur.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								templates/sommeil/astrologie-joueur.hbs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
<div>
 | 
			
		||||
  <label>Conditions</label>
 | 
			
		||||
  <select name="diffConditions" data-dtype="Number">
 | 
			
		||||
    {{#select '0'}}
 | 
			
		||||
    {{#each actorAstrologie.ajustements as |ajustement|}}
 | 
			
		||||
    <option value={{ajustement}}>{{ajustement}}</option>
 | 
			
		||||
    {{/each}}
 | 
			
		||||
    {{/select}}
 | 
			
		||||
  </select>
 | 
			
		||||
  <label>  Jours</label>
 | 
			
		||||
  <select name="joursAstrologie" data-dtype="Number">
 | 
			
		||||
    {{#select ''}}
 | 
			
		||||
    {{#each dates as |date|}}
 | 
			
		||||
    <option value={{date.index}}>{{date.label}}</option>
 | 
			
		||||
    {{/each}}
 | 
			
		||||
    {{/select}}
 | 
			
		||||
  </select>
 | 
			
		||||
  <label>
 | 
			
		||||
      Etat Général: {{actorAstrologie.etat}}
 | 
			
		||||
  </label>
 | 
			
		||||
  <a class="chat-card-button" name="jet-astrologie">Lire les étoiles</a>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="form-group">
 | 
			
		||||
  <label for="astralList">Nombres Astraux</label>
 | 
			
		||||
  <table class='table-nombres-astraux'>
 | 
			
		||||
    <tr class='table-nombres-astraux-td'>
 | 
			
		||||
      {{#each actorAstrologie.nombres as |nombre|}}
 | 
			
		||||
      <th class='table-nombres-astraux-td'>{{nombre.jourlabel}}</th>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr class='table-nombres-astraux-td'>
 | 
			
		||||
      {{#each actorAstrologie.nombres as |nombre|}}
 | 
			
		||||
      <td class='table-nombres-astraux-td'>
 | 
			
		||||
        <ol>
 | 
			
		||||
          {{#each nombre.listValues as |value|}}
 | 
			
		||||
          <li>{{value}}</li>
 | 
			
		||||
          {{/each}}
 | 
			
		||||
        </ol>
 | 
			
		||||
      </td>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
    </tr>
 | 
			
		||||
  </table>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										35
									
								
								templates/sommeil/astrologie-theme.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								templates/sommeil/astrologie-theme.hbs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
<div class="theme-astral">
 | 
			
		||||
  <div class="flexcol">
 | 
			
		||||
    <label for="signe-astral">Nombre Astral</label>
 | 
			
		||||
    <select name="signe-astral" class="calendar-signe-heure" data-dtype="String">
 | 
			
		||||
      {{#select "vaisseau"}}
 | 
			
		||||
      {{#each heures as |heure|}}
 | 
			
		||||
        <option value="{{heure.key}}">{{numberFormat heure.hh}} - {{heure.label}}</option>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
      {{/select}}
 | 
			
		||||
    </select>
 | 
			
		||||
    <label for="signe-naissance">Heure de Naissance</label>
 | 
			
		||||
    <select name="signe-naissance" class="calendar-signe-heure" data-dtype="String">
 | 
			
		||||
      {{#select "vaisseau"}}
 | 
			
		||||
      {{#each heures as |heure|}}
 | 
			
		||||
        <option value="{{heure.key}}">{{numberFormat heure.hh}} - {{heure.label}}</option>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
      {{/select}}
 | 
			
		||||
    </select>
 | 
			
		||||
  </div>
 | 
			
		||||
  <hr>
 | 
			
		||||
  <div><label>Heures de chance et malchance</label></div>
 | 
			
		||||
  <div class="astro-roue">
 | 
			
		||||
    <div class="astro-cercle1"></div>
 | 
			
		||||
    <div class="astro-disque">
 | 
			
		||||
      <img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/astro-disque.svg" alt="">
 | 
			
		||||
    </div>
 | 
			
		||||
    {{#each heures as |heure|}}
 | 
			
		||||
    <div class="astro-heure heure-{{heure.hh}}"><img class="astro-heure-img" src="{{heure.webp}}" title="{{heure.label}}"></div>
 | 
			
		||||
    <div class="astro-ajustement ajustement-{{heure.hh}}"></div>
 | 
			
		||||
    {{/each}}
 | 
			
		||||
    <div class="astro-horloge">
 | 
			
		||||
      <img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/rdd-aiguille-horloge.svg" alt="">
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
		Reference in New Issue
	
	Block a user