Merge pull request 'v11.0.23 - la lumière de Khrachtchoum' (#669) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: public/foundryvtt-reve-de-dragon#669
This commit is contained in:
commit
f2a3e1db45
@ -1,5 +1,11 @@
|
||||
# v11.0
|
||||
## v11.0.21
|
||||
## v11.0.23 - la lumière de Khrachtchoum
|
||||
- ajustement automatique de la luminosité selon l'heure pour les scènes:
|
||||
- avec une vision des tokens (sinon: ce n'est pas une scène de carte pour tokens)
|
||||
- avec illumination globale (correspondant à une illumination extérieure)
|
||||
- quand lampe "allumée" dans la fenêtre du calendrier
|
||||
|
||||
## v11.0.22 - les automatismes de Khrachtchoum le Problémeux
|
||||
- Macro pour attaquer avec les compétences de créatures
|
||||
|
||||
## v11.0.20
|
||||
|
@ -59,6 +59,7 @@ import { RdDSigneDraconiqueItemSheet } from "./item/sheet-signedraconique.js";
|
||||
import { RdDItemInventaireSheet } from "./item/sheet-base-inventaire.js";
|
||||
import { AppAstrologie } from "./sommeil/app-astrologie.js";
|
||||
import { RdDItemArmure } from "./item/armure.js";
|
||||
import { AutoAdjustDarkness as AutoAdjustDarkness } from "./time/auto-adjust-darkness.js";
|
||||
|
||||
/**
|
||||
* RdD system
|
||||
@ -182,6 +183,7 @@ export class SystemReveDeDragon {
|
||||
CONFIG.Combat.documentClass = RdDCombatManager;
|
||||
|
||||
// préparation des différents modules
|
||||
AutoAdjustDarkness.init();
|
||||
RdDTimestamp.init();
|
||||
RdDCalendrier.init();
|
||||
SystemCompendiums.init();
|
||||
|
@ -128,7 +128,7 @@ export class AppAstrologie extends Application {
|
||||
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.html.find('[name="rebuild-nombres-astraux"]').click(event => this.onRebuild());
|
||||
|
||||
this.onCalculThemeAstral();
|
||||
}
|
||||
@ -144,7 +144,7 @@ export class AppAstrologie extends Application {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rebuildNombresAstraux() {
|
||||
async onRebuild() {
|
||||
game.system.rdd.calendrier.resetNombresAstraux();
|
||||
|
||||
await game.system.rdd.calendrier.rebuildNombresAstraux();
|
||||
|
34
module/time/auto-adjust-darkness.js
Normal file
34
module/time/auto-adjust-darkness.js
Normal file
@ -0,0 +1,34 @@
|
||||
import { SYSTEM_RDD } from "../constants.js";
|
||||
|
||||
export const AUTO_ADJUST_DARKNESS = "auto-adjust-darkness";
|
||||
|
||||
export class AutoAdjustDarkness {
|
||||
|
||||
static init() {
|
||||
game.settings.register(SYSTEM_RDD, AUTO_ADJUST_DARKNESS, {
|
||||
name: AUTO_ADJUST_DARKNESS,
|
||||
scope: "world",
|
||||
config: false,
|
||||
default: true,
|
||||
type: Boolean
|
||||
});
|
||||
}
|
||||
|
||||
static async adjust(darkness) {
|
||||
if (AutoAdjustDarkness.isAuto()) {
|
||||
const scene = game.scenes.viewed;
|
||||
if (scene.globalLight && scene.tokenVision) {
|
||||
await scene.update({ darkness });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static isAuto() {
|
||||
return game.settings.get(SYSTEM_RDD, AUTO_ADJUST_DARKNESS);
|
||||
}
|
||||
|
||||
static async toggle() {
|
||||
const previous = AutoAdjustDarkness.isAuto();
|
||||
await game.settings.set(SYSTEM_RDD, AUTO_ADJUST_DARKNESS, !previous)
|
||||
}
|
||||
}
|
@ -5,10 +5,11 @@ import { RdDUtility } from "../rdd-utility.js";
|
||||
import { RdDDice } from "../rdd-dice.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { DialogChronologie } from "../dialog-chronologie.js";
|
||||
import { HIDE_DICE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "../constants.js";
|
||||
import { HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "../constants.js";
|
||||
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
||||
import { DialogChateauDormant } from "../sommeil/dialog-chateau-dormant.js";
|
||||
import { APP_ASTROLOGIE_REFRESH, AppAstrologie } from "../sommeil/app-astrologie.js";
|
||||
import { AutoAdjustDarkness } from "./auto-adjust-darkness.js";
|
||||
|
||||
const TEMPLATE_CALENDRIER = "systems/foundryvtt-reve-de-dragon/templates/time/calendar.hbs";
|
||||
|
||||
@ -51,7 +52,7 @@ export class RdDCalendrier extends Application {
|
||||
if (Misc.isUniqueConnectedGM()) { // Uniquement si GM
|
||||
RdDTimestamp.setWorldTime(this.timestamp);
|
||||
this.nombresAstraux = this.getNombresAstraux();
|
||||
this.rebuildNombresAstraux(HIDE_DICE); // Ensure always up-to-date
|
||||
this.rebuildNombresAstraux(); // Ensure always up-to-date
|
||||
}
|
||||
Hooks.on('updateSetting', async (setting, update, options, id) => this.onUpdateSetting(setting, update, options, id));
|
||||
}
|
||||
@ -84,26 +85,20 @@ export class RdDCalendrier extends Application {
|
||||
}
|
||||
|
||||
display() {
|
||||
AutoAdjustDarkness.adjust(RdDTimestamp.getWorldTime().darkness);
|
||||
const pos = this.getSavePosition()
|
||||
this.render(true, { left: pos.left, top: pos.top });
|
||||
return this;
|
||||
}
|
||||
|
||||
_getHeaderButtons() {
|
||||
const buttons = [];
|
||||
if (game.user.isGM) {
|
||||
buttons.unshift({
|
||||
class: "calendar-astrologie",
|
||||
icon: "fa-solid fa-moon-over-sun",
|
||||
onclick: ev => this.showAstrologieEditor()
|
||||
},
|
||||
{
|
||||
class: "calendar-set-datetime",
|
||||
icon: "fa-solid fa-calendar-pen",
|
||||
onclick: ev => this.showCalendarEditor()
|
||||
});
|
||||
return [
|
||||
{ class: "calendar-astrologie", icon: "fa-solid fa-moon-over-sun", onclick: ev => this.showAstrologieEditor() },
|
||||
{ class: "calendar-set-datetime", icon: "fa-solid fa-calendar-pen", onclick: ev => this.showCalendarEditor() },
|
||||
]
|
||||
}
|
||||
return buttons
|
||||
return []
|
||||
}
|
||||
|
||||
async close() { }
|
||||
@ -129,6 +124,7 @@ export class RdDCalendrier extends Application {
|
||||
formData.isGM = game.user.isGM;
|
||||
formData.heures = RdDTimestamp.definitions()
|
||||
formData.horlogeAnalogique = this.horlogeAnalogique;
|
||||
formData.autoDarkness = AutoAdjustDarkness.isAuto()
|
||||
return formData;
|
||||
}
|
||||
|
||||
@ -139,6 +135,7 @@ export class RdDCalendrier extends Application {
|
||||
this.html = html;
|
||||
this.html.find('.ajout-chronologie').click(ev => DialogChronologie.create());
|
||||
this.html.find('.toggle-horloge-analogique').click(ev => this.onToggleHorlogeAnalogique())
|
||||
this.html.find('.toggle-auto-darkness').click(ev => this.onToggleAutoDarkness())
|
||||
this.html.find('.calendar-btn').click(ev => this.onCalendarButton(ev));
|
||||
this.html.find('.horloge-roue .horloge-heure').click(event => {
|
||||
const h = this.html.find(event.currentTarget)?.data('heure');
|
||||
@ -224,15 +221,8 @@ export class RdDCalendrier extends Application {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async ajouterNombreAstral(indexDate, showDice = SHOW_DICE) {
|
||||
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showDice, rollMode: "selfroll" });
|
||||
const dateFuture = RdDTimestamp.formatIndexDate(indexDate);
|
||||
if (showDice != HIDE_DICE) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatMessage.getWhisperRecipients("GM"),
|
||||
content: `Le chiffre astrologique du ${dateFuture} sera le ${nombreAstral}`
|
||||
});
|
||||
}
|
||||
async ajouterNombreAstral(indexDate) {
|
||||
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: HIDE_DICE, rollMode: "selfroll" });
|
||||
return {
|
||||
nombreAstral: nombreAstral,
|
||||
valeursFausses: [],
|
||||
@ -267,9 +257,8 @@ export class RdDCalendrier extends Application {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rebuildNombresAstraux(showDice = HIDE_DICE) {
|
||||
async rebuildNombresAstraux() {
|
||||
if (Misc.isUniqueConnectedGM()) {
|
||||
console.log("Astral rebuild")
|
||||
let newList = [];
|
||||
for (let i = 0; i < MAX_NOMBRE_ASTRAL; i++) {
|
||||
let dayIndex = this.timestamp.indexDate + i;
|
||||
@ -277,7 +266,7 @@ export class RdDCalendrier extends Application {
|
||||
if (na) {
|
||||
newList[i] = na;
|
||||
} else {
|
||||
newList[i] = await this.ajouterNombreAstral(dayIndex, showDice);
|
||||
newList[i] = await this.ajouterNombreAstral(dayIndex);
|
||||
}
|
||||
}
|
||||
this.nombresAstraux = newList;
|
||||
@ -447,4 +436,9 @@ export class RdDCalendrier extends Application {
|
||||
async showAstrologieEditor() {
|
||||
await AppAstrologie.create();
|
||||
}
|
||||
|
||||
async onToggleAutoDarkness() {
|
||||
await AutoAdjustDarkness.toggle()
|
||||
this.display()
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import { SHOW_DICE, SYSTEM_RDD } from "../constants.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDDice } from "../rdd-dice.js";
|
||||
import { AutoAdjustDarkness } from "./auto-adjust-darkness.js";
|
||||
|
||||
export const WORLD_TIMESTAMP_SETTING = "calendrier";
|
||||
|
||||
@ -15,18 +16,18 @@ export const RDD_MINUTES_PAR_JOUR = 1440; //RDD_HEURES_PAR_JOUR * RDD_MINUTES_PA
|
||||
const ROUNDS_PAR_MINUTE = 10;
|
||||
|
||||
const DEFINITION_HEURES = [
|
||||
{ key: "vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "Printemps" },
|
||||
{ key: "sirene", label: "Sirène", lettreFont: 'i', saison: "Printemps" },
|
||||
{ key: "faucon", label: "Faucon", lettreFont: 'f', saison: "Printemps" },
|
||||
{ key: "couronne", label: "Couronne", lettreFont: '', saison: "Eté" },
|
||||
{ key: "dragon", label: "Dragon", lettreFont: 'd', saison: "Eté" },
|
||||
{ key: "epees", label: "Epées", lettreFont: 'e', saison: "Eté" },
|
||||
{ key: "lyre", label: "Lyre", lettreFont: 'l', saison: "Automne" },
|
||||
{ key: "serpent", label: "Serpent", lettreFont: 's', saison: "Automne" },
|
||||
{ key: "poissonacrobate", label: "Poisson Acrobate", lettreFont: 'p', saison: "Automne" },
|
||||
{ key: "araignee", label: "Araignée", lettreFont: 'a', saison: "Hiver" },
|
||||
{ key: "roseau", label: "Roseau", lettreFont: 'r', saison: "Hiver" },
|
||||
{ key: "chateaudormant", label: "Château Dormant", lettreFont: 'c', saison: "Hiver" },
|
||||
{ key: "vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "Printemps" , darkness: 0.7},
|
||||
{ key: "sirene", label: "Sirène", lettreFont: 'i', saison: "Printemps" , darkness: 0.4},
|
||||
{ key: "faucon", label: "Faucon", lettreFont: 'f', saison: "Printemps" , darkness: 0},
|
||||
{ key: "couronne", label: "Couronne", lettreFont: '', saison: "Eté" , darkness: 0},
|
||||
{ key: "dragon", label: "Dragon", lettreFont: 'd', saison: "Eté", darkness: 0 },
|
||||
{ key: "epees", label: "Epées", lettreFont: 'e', saison: "Eté", darkness: 0},
|
||||
{ key: "lyre", label: "Lyre", lettreFont: 'l', saison: "Automne", darkness: 0.4 },
|
||||
{ key: "serpent", label: "Serpent", lettreFont: 's', saison: "Automne", darkness: 0.7 },
|
||||
{ key: "poissonacrobate", label: "Poisson Acrobate", lettreFont: 'p', saison: "Automne", darkness: 1 },
|
||||
{ key: "araignee", label: "Araignée", lettreFont: 'a', saison: "Hiver", darkness: 1 },
|
||||
{ key: "roseau", label: "Roseau", lettreFont: 'r', saison: "Hiver", darkness: 1 },
|
||||
{ key: "chateaudormant", label: "Château Dormant", lettreFont: 'c', saison: "Hiver", darkness: 1 },
|
||||
]
|
||||
|
||||
const FORMULES_DUREE = [
|
||||
@ -58,6 +59,7 @@ export class RdDTimestamp {
|
||||
type: Object
|
||||
});
|
||||
|
||||
|
||||
for (let i = 0; i < DEFINITION_HEURES.length; i++) {
|
||||
DEFINITION_HEURES[i].heure = i;
|
||||
DEFINITION_HEURES[i].hh = RdDTimestamp.hh(i);
|
||||
@ -66,7 +68,6 @@ export class RdDTimestamp {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static hh(heure) {
|
||||
return heure < 9 ? `0${heure + 1}` : `${heure + 1}`;
|
||||
}
|
||||
@ -239,6 +240,13 @@ export class RdDTimestamp {
|
||||
get angleHeure() { return this.indexMinute / RDD_MINUTES_PAR_JOUR * 360 - 45 }
|
||||
get angleMinute() { return this.indexMinute / RDD_MINUTES_PAR_HEURES * 360 + 45 }
|
||||
|
||||
get darkness() {
|
||||
const darknessDebut = RdDTimestamp.definition(this.heure).darkness *100
|
||||
const darknessFin = RdDTimestamp.definition(this.heure + 1).darkness *100
|
||||
const darknessMinute = Math.round((darknessFin - darknessDebut) * this.minute / RDD_MINUTES_PAR_HEURES);
|
||||
return (darknessDebut + darknessMinute)/100
|
||||
}
|
||||
|
||||
/**
|
||||
* Convertit le timestamp en une structure avec les informations utiles
|
||||
* pour afficher la date et l'heure
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"id": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"version": "11.0.22",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.22.zip",
|
||||
"version": "11.0.23",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.23.zip",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json",
|
||||
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
|
||||
"compatibility": {
|
||||
|
@ -16,6 +16,7 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="horloge-digitale">
|
||||
|
||||
<span>
|
||||
<a class="toggle-horloge-analogique">
|
||||
{{#if horlogeAnalogique}}
|
||||
@ -33,6 +34,15 @@
|
||||
{{#if isGM}}
|
||||
<span class="calendar-minute-texte">{{minute}} minutes</span>
|
||||
{{/if}}
|
||||
{{#if isGM}}
|
||||
<span class="toggle-auto-darkness">
|
||||
{{#if autoDarkness}}
|
||||
<i class="fa-solid fa-lightbulb"></i>
|
||||
{{else}}
|
||||
<i class="fa-regular fa-lightbulb"></i>
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="horloge-analogique {{#unless horlogeAnalogique}}horloge-analogique-hidden{{/unless}}">
|
||||
{{> 'systems/foundryvtt-reve-de-dragon/templates/time/horloge.hbs' }}
|
||||
|
Loading…
Reference in New Issue
Block a user