Compare commits

..

13 Commits

Author SHA1 Message Date
285937c201 Merge pull request 'Version 10.7.6 - L'origine des maux de Sémolosse' (#640) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10
Reviewed-on: #640
2023-03-31 07:22:28 +02:00
93965ce91a Version 10.7.6 2023-03-31 01:42:25 +02:00
18aba9adff Pas de bordure pour les boutons avance rapide 2023-03-31 01:32:52 +02:00
0a5662ff71 Couleurs jour nuit plus visibles 2023-03-31 01:32:24 +02:00
bf98e4eae2 Fix toggle horloge
Affiche/masque correctement l'horloge pour le MJ et les joueurs
2023-03-31 01:31:09 +02:00
e32a1d25f6 Ne pas fermer l'horloge sur escape
Surcharge de la méthode close pour empêcher la fermeture
2023-03-31 00:51:05 +02:00
327943c4aa Fix mise à jour sur action des herbes/potions
Par exemple, la mise à jour de quantité d'herbe ne se faisait pas
dans les liste d'équipement des feuilles de conteneurs, lors d'une
fabrication de potion dans les items
2023-03-31 00:47:25 +02:00
de56fa909a Ajout bouton Item diminuer quantité
Pour diminuer la quantité des objets multiples sans avoir à éditer
2023-03-30 02:56:06 +02:00
2aa62cffe9 Bonus de sorts en fleuve
Le bonus de sort en fleuve est identique pour toutes les cases fleuve.
2023-03-30 01:31:41 +02:00
c57f140c54 Ajout de l'origine d'une blessure
En combat, indication de l'origine des blessures
2023-03-30 00:19:18 +02:00
9cf14f8b75 Merge pull request 'Version 10.7.5 - La montre-gousset de Sémolosse' (#639) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10
Reviewed-on: #639
2023-03-29 23:06:31 +02:00
b8e7b21e14 Version 10.7.5
La montre-gousset de Sémolosse
2023-03-29 23:00:23 +02:00
c1d02d9fda Ajout d'une horloge analogique
Amélioration de la fenêtre calendrier:
* plus compacte
* horloge analogique
* normalement compatible pop-out
* minimisable (juste la barre de titre)
2023-03-29 23:00:23 +02:00
36 changed files with 628 additions and 729 deletions

View File

@@ -117,7 +117,10 @@ export class RdDActorSheet extends RdDBaseActorSheet {
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
this.html.find('.item-action').click(async event => RdDSheetUtility.getItem(event, this.actor)?.actionPrincipale(this.actor));
this.html.find('.item-action').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor);
item?.actionPrincipale(this.actor, async () => this.render())
});
this.html.find('.subacteur-delete').click(async event => {
const li = RdDSheetUtility.getEventElement(event);

View File

@@ -33,7 +33,7 @@ import { RdDRencontre } from "./item/rencontre.js";
import { Targets } from "./targets.js";
import { DialogRepos } from "./sommeil/dialog-repos.js";
import { RdDBaseActor } from "./actor/base-actor.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDItemBlessure } from "./item/blessure.js";
import { AppAstrologie } from "./sommeil/app-astrologie.js";
@@ -1625,11 +1625,6 @@ export class RdDActor extends RdDBaseActor {
new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true);
}
/* -------------------------------------------- */
async actionItem(item, onActionItem = async () => { }) {
item.actionPrincipale(this, onActionItem);
}
async actionNourritureboisson(item, onActionItem) {
switch (item.getUtilisationCuisine()) {
case 'brut': {
@@ -1662,9 +1657,9 @@ export class RdDActor extends RdDBaseActor {
await this.rollTache(tache.id);
}
}
async actionHerbe(item) {
async actionHerbe(item, onActionItem = async () => {}) {
if (item.isHerbeAPotion()) {
return this.dialogFabriquerPotion(item);
return DialogFabriquerPotion.create(this, item, onActionItem);
}
return;
}
@@ -3209,10 +3204,6 @@ export class RdDActor extends RdDBaseActor {
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
return;
}
this.validerEncaissement(rollData, show);
}
async validerEncaissement(rollData, show) {
if (ReglesOptionelles.isUsing('validation-encaissement-gr') && !game.user.isGM) {
RdDBaseActor.remoteActorCall({
actorId: this.id,
@@ -3223,18 +3214,18 @@ export class RdDActor extends RdDBaseActor {
}
const armure = await this.computeArmure(rollData);
if (ReglesOptionelles.isUsing('validation-encaissement-gr')) {
DialogValidationEncaissement.validerEncaissement(this, rollData, armure, show, (encaissement, show) => this._appliquerEncaissement(encaissement, show));
DialogValidationEncaissement.validerEncaissement(this, rollData, armure, show, (encaissement, show) => this._appliquerEncaissement(encaissement, show, attacker));
}
else {
let encaissement = await RdDUtility.jetEncaissement(rollData, armure, { showDice: SHOW_DICE });
await this._appliquerEncaissement(encaissement, show)
await this._appliquerEncaissement(encaissement, show, attacker)
}
}
async _appliquerEncaissement(encaissement, show) {
async _appliquerEncaissement(encaissement, show, attacker) {
let santeOrig = duplicate(this.system.sante);
const blessure = await this.ajouterBlessure(encaissement); // Will upate the result table
const blessure = await this.ajouterBlessure(encaissement, attacker); // Will update the result table
const perteVie = this.isEntite()
? { newValue: 0 }
: await this.santeIncDec("vie", -encaissement.vie);
@@ -3268,7 +3259,7 @@ export class RdDActor extends RdDBaseActor {
}
/* -------------------------------------------- */
async ajouterBlessure(encaissement) {
async ajouterBlessure(encaissement, attacker = undefined) {
if (this.isEntite()) return; // Une entité n'a pas de blessures
if (encaissement.gravite < 0) return;
if (encaissement.gravite > 0) {
@@ -3281,7 +3272,7 @@ export class RdDActor extends RdDBaseActor {
}
}
const endActuelle = Number(this.system.sante.endurance.value);
const blessure = await RdDItemBlessure.createBlessure(this, encaissement.gravite, encaissement.dmg.loc.label);
const blessure = await RdDItemBlessure.createBlessure(this, encaissement.gravite, encaissement.dmg.loc.label, attacker);
if (blessure.isCritique()) {
encaissement.endurance = endActuelle;
}
@@ -3534,7 +3525,7 @@ export class RdDActor extends RdDBaseActor {
for (let blessure of blessures) {
if (pointsGuerison >= blessure.system.gravite) {
pointsGuerison -= blessure.system.gravite;
guerisonData.list.push(`1 Blessure ${blessure.system.labelGravite} (${blessure.system.gravite} points)`);
guerisonData.list.push(`1 Blessure ${blessure.system.label} (${blessure.system.gravite} points)`);
ids.push(blessure.id)
}
}
@@ -3611,12 +3602,6 @@ export class RdDActor extends RdDBaseActor {
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.html`, potionData)
});
}
/* -------------------------------------------- */
dialogFabriquerPotion(herbe) {
DialogFabriquerPotion.create(this, herbe, {
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.html',
}, []);
}
/* -------------------------------------------- */
async fabriquerPotion(herbeData) {

View File

@@ -152,6 +152,8 @@ export class RdDBaseActorSheet extends ActorSheet {
const item = this.getItem(event);
RdDSheetUtility.splitItem(item, this.actor);
});
this.html.find('.item-quantite-plus').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), 1));
this.html.find('.item-quantite-moins').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), -1));
this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, this.getItem(event)));
this.html.find('.item-vendre').click(async event => this.vendre(this.getItem(event)));
@@ -161,12 +163,6 @@ export class RdDBaseActorSheet extends ActorSheet {
this.html.find('.nettoyer-conteneurs').click(async event => {
this.actor.nettoyerConteneurs();
});
this.html.find('.monnaie-plus').click(async event => {
this.actor.monnaieIncDec(this.getItemId(event), 1);
});
this.html.find('.monnaie-moins').click(async event => {
this.actor.monnaieIncDec(this.getItemId(event), -1);
});
}
_rechercherKeyup(event) {

View File

@@ -150,11 +150,11 @@ export class RdDBaseActor extends Actor {
}
/* -------------------------------------------- */
async monnaieIncDec(id, value) {
let monnaie = this.getMonnaie(id);
if (monnaie) {
const quantite = Math.max(0, monnaie.system.quantite + value);
await this.updateEmbeddedDocuments('Item', [{ _id: monnaie.id, 'system.quantite': quantite }]);
async itemQuantiteIncDec(id, value) {
let item = this.getItem(id);
if (item && item.isInventaire()) {
const quantite = Math.max(0, item.system.quantite + value);
await this.updateEmbeddedDocuments('Item', [{ _id: item.id, 'system.quantite': quantite }]);
}
}

View File

@@ -1,7 +1,7 @@
import { SYSTEM_RDD } from "./constants.js";
import { Grammar } from "./grammar.js";
import { HtmlUtility } from "./html-utility.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
const LATEST_USED_JOURNAL_ID = "chronologie-dernier-journal";

View File

@@ -5,7 +5,7 @@ import { RdDUtility } from "./rdd-utility.js";
export class DialogFabriquerPotion extends Dialog {
/* -------------------------------------------- */
static async create(actor, item, dialogConfig) {
static async create(actor, item, onActionItem) {
const min = DialogFabriquerPotion.nombreBrinsMinimum(item);
if (item.system.quantite < min) {
ui.notifications.warn(`Vous avez ${item.system.quantite} brins de ${item.name}, il en faut au moins ${min} pour faire une potion!`);
@@ -13,12 +13,10 @@ export class DialogFabriquerPotion extends Dialog {
}
let potionData = DialogFabriquerPotion.prepareData(actor, item);
const html = await renderTemplate(dialogConfig.html, potionData);
const html = await renderTemplate( 'systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.html', potionData);
let options = { classes: ["dialogfabriquerpotion"], width: 600, height: 160, 'z-index': 99999 };
mergeObject(options, dialogConfig.options ?? {}, { overwrite: true })
new DialogFabriquerPotion(actor, potionData, html, options).render(true);
new DialogFabriquerPotion(actor, potionData, onActionItem, html, options).render(true);
}
/* -------------------------------------------- */
@@ -34,14 +32,14 @@ export class DialogFabriquerPotion extends Dialog {
}
/* -------------------------------------------- */
constructor(actor, potionData, html, options) {
constructor(actor, potionData, onActionItem, html, options) {
const conf = {
title: `Fabriquer une potion de ${potionData.system.categorie}`,
content: html,
default: 'fabriquer',
buttons: {
'fabriquer': {
label: potionData.buttonName, callback: it => this.onFabriquer(html)
label: potionData.buttonName, callback: it => this.onFabriquer()
}
}
};
@@ -50,6 +48,7 @@ export class DialogFabriquerPotion extends Dialog {
this.actor = actor;
this.potionData = potionData;
this.onActionItem = onActionItem;
}
/* -------------------------------------------- */
@@ -64,10 +63,11 @@ export class DialogFabriquerPotion extends Dialog {
}
/* -------------------------------------------- */
async onFabriquer(html) {
async onFabriquer() {
await this.html.find("[name='nbBrins']").change();
this.actor.fabriquerPotion(this.potionData);
await this.actor.fabriquerPotion(this.potionData);
this.close();
await this.onActionItem()
}
static nombreBrinsMinimum(herbeData) {

View File

@@ -23,7 +23,7 @@ export class DialogValidationEncaissement extends Dialog {
constructor(html, actor, rollData, armure, encaissement, show, onEncaisser) {
// Common conf
let buttons = {
"valider": { label: "Valider", callback: html => this.validerEncaissement() },
"valider": { label: "Valider", callback: html => this.onValider() },
"annuler": { label: "Annuler", callback: html => { } },
};
@@ -64,7 +64,7 @@ export class DialogValidationEncaissement extends Dialog {
});
}
async validerEncaissement() {
async onValider() {
this.encaissement = await RdDUtility.jetEncaissement(this.rollData, this.armure, { showDice: SHOW_DICE, forceDiceResult: this.forceDiceResult});
this.onEncaisser(this.encaissement, this.show)
}

View File

@@ -10,7 +10,7 @@ import { SYSTEM_RDD } from "./constants.js";
import { RdDSheetUtility } from "./rdd-sheet-utility.js";
import { SystemCompendiums } from "./settings/system-compendiums.js";
import { Misc } from "./misc.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
/**
* Extend the basic ItemSheet for RdD specific items
@@ -188,7 +188,7 @@ export class RdDItemSheet extends ItemSheet {
});
this.html.find('.creer-tache-livre').click((event) => this._getEventActor(event).creerTacheDepuisLivre(this.item));
this.html.find('.consommer-potion').click((event) => this._getEventActor(event).consommerPotion(this.item));
this.html.find('.consommer-potion').click((event) => this._getEventActor(event).consommerPotion(this.item, this.getActionRenderItem()));
this.html.find('.creer-potion-base').click((event) => this._getEventActor(event).dialogFabriquerPotion(this.item));
this.html.find('.alchimie-tache a').click((event) => {
@@ -203,12 +203,23 @@ export class RdDItemSheet extends ItemSheet {
}
});
this.html.find('.item-split').click(async event => RdDSheetUtility.splitItem(RdDSheetUtility.getItem(event, this.actor), this.actor, async () => this.render(true)));
this.html.find('.item-edit').click(async event => RdDSheetUtility.getItem(event, this.actor)?.sheet.render(true));
this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, RdDSheetUtility.getItem(event, this.actor)));
this.html.find('.item-vendre').click(async event => RdDSheetUtility.getItem(event, this.actor)?.proposerVente());
this.html.find('.item-montrer').click(async event => RdDSheetUtility.getItem(event, this.actor)?.postItemToChat());
this.html.find('.item-action').click(async event => RdDSheetUtility.getItem(event, this.actor)?.actionPrincipale(this.actor, async () => this.render(true)));
if (this.actor) {
this.html.find('.item-split').click(async event => RdDSheetUtility.splitItem(RdDSheetUtility.getItem(event, this.actor), this.actor, this.getActionRenderItem()));
this.html.find('.item-edit').click(async event => RdDSheetUtility.getItem(event, this.actor)?.sheet.render(true));
this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, RdDSheetUtility.getItem(event, this.actor)));
this.html.find('.item-vendre').click(async event => RdDSheetUtility.getItem(event, this.actor)?.proposerVente());
this.html.find('.item-montrer').click(async event => RdDSheetUtility.getItem(event, this.actor)?.postItemToChat());
this.html.find('.item-action').click(async event => RdDSheetUtility.getItem(event, this.actor)?.actionPrincipale(this.actor, this.getActionRenderItem()));
this.html.find('.item-quantite-plus').click(async event => {
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), 1)
this.render();
});
this.html.find('.item-quantite-moins').click(async event => {
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), -1)
this.render();
});
}
const updateItemTimestamp = (path, timestamp) => this.item.update({ [path]: duplicate(timestamp) })
@@ -216,6 +227,16 @@ export class RdDItemSheet extends ItemSheet {
RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.fin', updateItemTimestamp);
}
getActionRenderItem() {
return async () => {
let item = this.item;
while (item) {
await item.sheet?.render()
item = this.actor.getContenant(item)
}
}
}
_getEventActor(event) {
let actorId = event.currentTarget.attributes['data-actor-id'].value;
let actor = game.actors.get(actorId);
@@ -239,9 +260,8 @@ export class RdDItemSheet extends ItemSheet {
_updateObject(event, formData) {
if (this.item.type == 'sort') {
// Données de bonus de cases ?
formData['system.bonuscase'] = RdDItemSort.buildBonusCaseStringFromFormData(formData.bonusValue, formData.caseValue);
formData['system.bonuscase'] = RdDItemSort.buildBonuscaseFromArrays(formData.bonusValue, formData.caseValue);
}
return this.item.update(formData);
}

View File

@@ -1,4 +1,3 @@
/* -------------------------------------------- */
import { Misc } from "./misc.js";
import { TMRUtility } from "./tmr-utility.js";
@@ -14,9 +13,9 @@ export class RdDItemSort extends Item {
static isCoutVariable(sort) {
return sort && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
}
/* -------------------------------------------- */
static setCoutReveReel(sort){
static setCoutReveReel(sort) {
if (sort) {
sort.system.ptreve_reel = this.isCoutVariable(sort) ? 1 : sort.system.ptreve;
}
@@ -25,94 +24,91 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */
static getDifficulte(sort, variable) {
if (sort && !RdDItemSort.isDifficulteVariable(sort)) {
return Misc.toInt(sort.system.difficulte);
return Misc.toInt(sort.system.difficulte);
}
return variable;
}
/* -------------------------------------------- */
static buildBonusCaseList( caseBonusString, newCase ) {
if (caseBonusString == undefined) {
return [];
}
let bonusCaseList = [];
let bonusCaseArray = caseBonusString == undefined ? [] : caseBonusString.split(',');
for( let bonusCase of bonusCaseArray) {
let bonusSplit = bonusCase.split(':');
bonusCaseList.push( { case: bonusSplit[0], bonus: bonusSplit[1] } );
}
if ( newCase )
bonusCaseList.push( {case: "Nouvelle", bonus: 0} );
return bonusCaseList;
static buildBonusCaseList(bonuscase, newCase) {
const list = RdDItemSort._bonuscaseStringToList(bonuscase)
if (newCase) {
return list.concat({ case: "Nouvelle", bonus: 0 });
}
/* -------------------------------------------- */
return list;
}
/**
* Retourne une liste de bonus/case pour un item-sheet
* @param {} item
*/
static getBonusCaseList( item, newCase = false ) {
static getBonusCaseList(item, newCase = false) {
// Gestion spéciale case bonus
if ( item.type == 'sort') {
return this.buildBonusCaseList(item.system.bonuscase, newCase );
if (item.type == 'sort') {
return RdDItemSort.buildBonusCaseList(item.system.bonuscase, newCase);
}
return undefined;
}
/* -------------------------------------------- */
/** Met à jour les données de formulaire
* si static des bonus de cases sont présents
* */
static buildBonusCaseStringFromFormData( bonuses, cases ) {
if ( bonuses ) {
let list = [];
let caseCheck = {};
for (let i=0; i<bonuses.length; i++) {
let coord = cases[i]?.toUpperCase() || 'A1';
let bonus = bonuses[i] || 0;
if ( TMRUtility.verifyTMRCoord( coord ) && bonus > 0 && caseCheck[coord] == undefined ) {
static buildBonuscaseFromArrays(bonuses, coords) {
if (bonuses) {
const list = [];
const caseCheck = {};
for (let i = 0; i < bonuses.length && i < coords.length; i++) {
const coord = coords[i] == 'Fleuve' ? 'Fleuve' : (coords[i]?.toUpperCase() ?? 'A1');
const bonus = bonuses[i] || 0;
if (TMRUtility.verifyTMRCoord(coord) && bonus > 0 && caseCheck[coord] == undefined) {
caseCheck[coord] = bonus;
list.push( coord+":"+bonus );
list.push({ case: coord, bonus: bonus });
}
}
return list.toString();
return RdDItemSort._bonuscaseListToString(list);
}
return undefined;
}
/* -------------------------------------------- */
static incrementBonusCase( actor, sort, coord ) {
let bonusCaseList = this.buildBonusCaseList(sort.system.bonuscase, false);
//console.log("ITEMSORT", sort, bonusCaseList);
let found = false;
let StringList = [];
for( let bc of bonusCaseList) {
if (bc.case == coord) { // Case existante
found = true;
bc.bonus = Number(bc.bonus) + 1;
}
StringList.push( bc.case+':'+bc.bonus );
}
if ( !found) { //Nouvelle case, bonus de 1
StringList.push(coord+':1');
}
// Sauvegarde/update
let bonuscase = StringList.toString();
//console.log("Bonus cae :", bonuscase);
actor.updateEmbeddedDocuments('Item', [{ _id: sort._id, 'system.bonuscase': bonuscase }] );
}
/* -------------------------------------------- */
static getCaseBonus( sort, coord) {
let bonusCaseList = this.buildBonusCaseList(sort.system.bonuscase, false);
for( let bc of bonusCaseList) {
if (bc.case == coord) { // Case existante
return Number(bc.bonus);
}
static incrementBonusCase(actor, sort, coord) {
if (TMRUtility.getTMR(coord).type == "fleuve") {
coord = 'Fleuve';
}
return 0;
const list = RdDItemSort.buildBonusCaseList(sort.system.bonuscase, false);
const bonus = Number(list.find(it => it.case == coord)?.bonus ?? 0);
const modified = { case: coord, bonus: bonus + 1 };
const bonuscase = RdDItemSort._bonuscaseListToString(
list.filter(it => it.case != coord).concat(modified)
);
// Sauvegarde/update
actor.updateEmbeddedDocuments('Item', [{ _id: sort._id, 'system.bonuscase': bonuscase }]);
}
/* -------------------------------------------- */
static getCaseBonus(sort, coord) {
const isFleuve = TMRUtility.getTMR(coord).type == "fleuve";
let bc = RdDItemSort.buildBonusCaseList(sort.system.bonuscase, false)
.filter(it => it.case == coord || (isFleuve && it.case == 'Fleuve'))
.find(it => true)
return Number(bc?.bonus ?? 0);
}
static _bonuscaseListToString(list) {
return list.map(it => `${it.case}:${it.bonus}`)
.sort(Misc.ascending())
.join(',');
}
static _bonuscaseStringToList(bonuscase) {
return (bonuscase ?? '').split(',').map(it => {
const b = it.split(':');
return { case: b[0], bonus: b[1] };
});
}
}

View File

@@ -2,7 +2,7 @@ import { DialogItemVente } from "./dialog-item-vente.js";
import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
import { RdDHerbes } from "./rdd-herbes.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDUtility } from "./rdd-utility.js";
import { SystemCompendiums } from "./settings/system-compendiums.js";
import { RdDRaretes } from "./item/raretes.js";
@@ -411,7 +411,7 @@ export class RdDItem extends Item {
case 'potion': return await actor.consommerPotion(this, onActionItem);
case 'livre': return await actor.actionLire(this);
case 'conteneur': return await this.sheet.render(true);
case 'herbe': return await actor.actionHerbe(this);
case 'herbe': return await actor.actionHerbe(this, onActionItem);
case 'queue': case 'ombre': return await actor.actionRefoulement(this);
}
}

View File

@@ -1,6 +1,6 @@
import { RdDItem } from "../item.js";
import { Misc } from "../misc.js";
import { RdDTimestamp } from "../rdd-timestamp.js";
import { RdDTimestamp } from "../time/rdd-timestamp.js";
const BASE_TACHE_SOIN_BLESSURE = {
type: "tache",
@@ -14,11 +14,11 @@ const TACHES_SOIN_BLESSURE = {
}
const definitionsBlessures = [
{ type: "contusion", gravite: 0, labelGravite: 'Contusion/éraflure', max: 100, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/eraflure.webp" },
{ type: "legere", gravite: 2, labelGravite: 'Légère', max: 5, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
{ type: "grave", gravite: 4, labelGravite: 'Grave', max: 2, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
{ type: "critique", gravite: 6, labelGravite: 'Critique', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
{ type: "mort", gravite: 8, labelGravite: 'Mort', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/mort.webp" }
{ type: "contusion", gravite: 0, label: 'Contusion/éraflure', max: 100, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/eraflure.webp" },
{ type: "legere", gravite: 2, label: 'Légère', max: 5, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
{ type: "grave", gravite: 4, label: 'Grave', max: 2, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
{ type: "critique", gravite: 6, label: 'Critique', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/blessure.webp" },
{ type: "mort", gravite: 8, label: 'Mort', max: 1, icon: "systems/foundryvtt-reve-de-dragon/icons/sante/mort.webp" }
]
export class RdDItemBlessure extends RdDItem {
@@ -29,7 +29,7 @@ export class RdDItemBlessure extends RdDItem {
prepareDerivedData() {
super.prepareDerivedData();
this.system.labelGravite = this.getLabelGravite()
this.system.label = this.getLabelGravite()
}
static prepareTacheSoin(gravite) {
@@ -40,19 +40,19 @@ export class RdDItemBlessure extends RdDItem {
}
return mergeObject(duplicate(BASE_TACHE_SOIN_BLESSURE), tache)
}
static async createBlessure(actor, gravite, localisation = '') {
static async createBlessure(actor, gravite, localisation = '', attacker) {
const definition = RdDItemBlessure.getDefinition(gravite)
const blessure = {
name: definition.labelGravite,
name: definition.label,
type: 'blessure',
img: definition.icon,
system: {
gravite: gravite,
difficulte: - gravite,
localisation: localisation
localisation: localisation,
origine: attacker?.name ?? ""
}
}
const blessures = await actor.createEmbeddedDocuments('Item', [blessure])
return blessures[0]
}
@@ -100,12 +100,12 @@ export class RdDItemBlessure extends RdDItem {
const gravite = this.system.gravite;
const graviteMoindre = gravite - 2;
const moindres = blessures.filter(it => it.system.gravite == graviteMoindre, 'blessures').length
const labelGravite = this.getLabelGravite();
const label = this.getLabelGravite();
let rolled = await actor.jetRecuperationConstitution(this.system.soinscomplets.bonus, message);
if (rolled.isETotal) {
message.content += ` -- une blessure ${labelGravite} s'infecte (temps de guérison augmenté de ${gravite} jours, perte de vie)`;
message.content += ` -- une blessure ${label} s'infecte (temps de guérison augmenté de ${gravite} jours, perte de vie)`;
await actor.santeIncDec("vie", -1);
mergeObject(update, {
system: { fin: { indexDate: timestamp.addJours(gravite).indexDate } }
@@ -113,13 +113,13 @@ export class RdDItemBlessure extends RdDItem {
}
else {
if (!isMaladeEmpoisonne && rolled.isSuccess && this.peutRetrograder(graviteMoindre, moindres)) {
message.content += ` -- une blessure ${labelGravite} cicatrise`;
message.content += ` -- une blessure ${label} cicatrise`;
mergeObject(update, {
system: { gravite: graviteMoindre, fin: { indexDate: timestamp.addJours(graviteMoindre).indexDate } }
});
}
else {
message.content += ` -- une blessure ${labelGravite} reste stable`;
message.content += ` -- une blessure ${label} reste stable`;
}
}
await this.update(update);
@@ -152,7 +152,7 @@ export class RdDItemBlessure extends RdDItem {
}
getLabelGravite() {
return RdDItemBlessure.getDefinition(this.system.gravite).labelGravite
return RdDItemBlessure.getDefinition(this.system.gravite).label
}
static getDefinition(gravite) {
@@ -178,4 +178,22 @@ export class RdDItemBlessure extends RdDItem {
isMort() {
return this.system.gravite > 6
}
getProprietes() {
return [
RdDItem.propertyIfDefined('Causée par', this.system.origine, this.system.origine),
`<b>Heure et Date</b>: ${new RdDTimestamp(this.system.temporel.debut).formatDateHeure()}`,
RdDItem.propertyIfDefined('Blessé', this.parent?.name, this.parent),
`<b>Localisation</b>: ${this.system.localisation}`,
`<b>Gravité</b>: ${RdDItemBlessure.getDefinition(this.system.gravite).label}`,
`<b>Difficulté des soins</b>: ${this.system.difficulte}`,
(this.system.soinscomplets.done ?
`<b>Bonus soins complets</b>: ${this.system.soinscomplets.bonus}` :
(this.system.premierssoins.done ?
`<b>Bonus premiers soins</b>: ${this.system.premierssoins.bonus}` :
`<b>Points de tâche</b>: ${this.system.premierssoins.tache}`
)
),
];
}
}

View File

@@ -1,6 +1,6 @@
import { RdDItem } from "../item.js";
import { Misc } from "../misc.js";
import { RdDTimestamp } from "../rdd-timestamp.js";
import { RdDTimestamp } from "../time/rdd-timestamp.js";
export class RdDItemMaladie extends RdDItem {

View File

@@ -2,7 +2,7 @@ import { RdDItem, defaultItemImg } from "../item.js";
import { Misc } from "../misc.js";
import { RdDDice } from "../rdd-dice.js";
import { RdDRollTables } from "../rdd-rolltables.js";
import { RdDTimestamp } from "../rdd-timestamp.js";
import { RdDTimestamp } from "../time/rdd-timestamp.js";
import { TMRType, TMRUtility } from "../tmr-utility.js";
const tableSignesIndicatifs = [

View File

@@ -3,7 +3,7 @@ import { LOG_HEAD, SYSTEM_RDD } from "./constants.js";
import { Grammar } from "./grammar.js";
import { Monnaie } from "./item-monnaie.js";
import { RdDItem } from "./item.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDRaretes } from "./item/raretes.js";
class Migration {
@@ -452,8 +452,7 @@ class _10_7_0_MigrationBlessures extends Migration {
fin: { indexDate: datePremiereRecup.indexDate, indexMinute: 0 },
premierssoins: { done: blessure.psdone, bonus: blessure.premiers_soins },
soinscomplets: { done: blessure.scdone, bonus: blessure.soins_complets },
localisation: blessure.localisation,
jours: blessure.jours
localisation: blessure.localisation
}
}
}

View File

@@ -239,4 +239,15 @@ export class Misc {
}
return subset;
}
static cssRotation(angle) {
const rotation = `rotate(${angle}deg)`;
return {
'transform': rotation,
'-ms-transform': rotation,
'-moz-transform': rotation,
'-webkit-transform': rotation,
'-o-transform': rotation
};
}
}

View File

@@ -1,6 +1,6 @@
import { Grammar } from "./grammar.js";
import { SystemCompendiums } from "./settings/system-compendiums.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
/* -------------------------------------------- */
export class RdDHerbes extends Item {

View File

@@ -4,8 +4,8 @@ import { Migrations } from './migrations.js';
import { RdDUtility } from "./rdd-utility.js";
import { TMRUtility } from "./tmr-utility.js";
import { TMRRencontres } from "./tmr-rencontres.js";
import { RdDCalendrier } from "./rdd-calendrier.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDCalendrier } from "./time/rdd-calendrier.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { DialogChronologie } from "./dialog-chronologie.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
@@ -181,6 +181,7 @@ export class SystemReveDeDragon {
// préparation des différents modules
RdDTimestamp.init();
RdDCalendrier.init();
SystemCompendiums.init();
DialogChronologie.init();
ReglesOptionelles.init();
@@ -216,25 +217,6 @@ export class SystemReveDeDragon {
default: "avant-encaissement"
});
/* -------------------------------------------- */
game.settings.register(SYSTEM_RDD, "liste-nombre-astral", {
name: "liste-nombre-astral",
scope: "world",
config: false,
default: [],
type: Object
});
/* -------------------------------------------- */
game.settings.register(SYSTEM_RDD, "calendrier-pos", {
name: "calendrierPos",
scope: "client",
config: false,
default: RdDCalendrier.createCalendrierPos(),
type: Object
});
/* -------------------------------------------- */
game.settings.register(SYSTEM_RDD, "supprimer-dialogues-combat-chat", {
name: "Supprimer les dialogues de combat",
@@ -280,9 +262,11 @@ export class SystemReveDeDragon {
let sidebar = document.getElementById("sidebar");
sidebar.style.width = "min-content";
}
game.system.rdd.calendrier = new RdDCalendrier();
if (Misc.isUniqueConnectedGM()) {
game.system.rdd.calendrier = new RdDCalendrier();
new Migrations().migrate();
this.messageDeBienvenue();
this.registerUsageCount(SYSTEM_RDD);
}
StatusEffects.onReady();
@@ -290,8 +274,7 @@ export class SystemReveDeDragon {
RdDDice.onReady();
/* -------------------------------------------- */
/* Affiche/Init le calendrier */
game.system.rdd.calendrier = new RdDCalendrier().display();
game.system.rdd.calendrier.display();
// Avertissement si joueur sans personnage
if (!game.user.isGM && game.user.character == undefined) {
ui.notifications.info("Attention ! Vous n'êtes connecté à aucun personnage !");
@@ -300,10 +283,6 @@ export class SystemReveDeDragon {
user: game.user.id
});
}
if (Misc.isUniqueConnectedGM()) {
this.messageDeBienvenue();
this.registerUsageCount(SYSTEM_RDD);
}
}
/* -------------------------------------------- */

View File

@@ -16,8 +16,7 @@ import { ReglesOptionelles } from "./settings/regles-optionelles.js";
import { RdDDice } from "./rdd-dice.js";
import { STATUSES } from "./settings/status-effects.js";
import { RdDRencontre } from "./item/rencontre.js";
import { RdDCalendrier } from "./rdd-calendrier.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
/* -------------------------------------------- */

View File

@@ -13,7 +13,7 @@ import { RdDNameGen } from "./rdd-namegen.js";
import { RdDConfirm } from "./rdd-confirm.js";
import { RdDItemCompetence } from "./item-competence.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDRaretes } from "./item/raretes.js";
/* -------------------------------------------- */
@@ -196,6 +196,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html',
// Partials
'systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats-recherche.hbs',
'systems/foundryvtt-reve-de-dragon/templates/time/horloge.hbs',
'systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs',
'systems/foundryvtt-reve-de-dragon/templates/common/periodicite.hbs',
'systems/foundryvtt-reve-de-dragon/templates/common/enum-duree.hbs',
@@ -231,9 +232,6 @@ export class RdDUtility {
'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',
// HUD
'systems/foundryvtt-reve-de-dragon/templates/hud-actor-init.html',
'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html',

View File

@@ -1,6 +1,6 @@
import { SYSTEM_RDD } from "../constants.js";
import { Misc } from "../misc.js";
import { RDD_MINUTES_PAR_HEURES, RDD_MINUTES_PAR_JOUR, RdDTimestamp } from "../rdd-timestamp.js";
import { RdDTimestamp } from "../time/rdd-timestamp.js";
export const APP_ASTROLOGIE_REFRESH = `${SYSTEM_RDD}-refresh-astrologie`
@@ -22,6 +22,7 @@ export class AppAstrologie extends Application {
title: "Astrologie",
width: 'fit-content',
height: 'fit-content',
classes: ['calendar-astrologie'],
popOut: true,
resizable: false
});
@@ -155,30 +156,19 @@ export class AppAstrologie extends Application {
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.heure-${dh.hh}`).text(txtAjustement)
this.html.find(`div.horloge-ajustement.heure-${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 - 45;
this.html.find(`div.astro-roue div.astro-disque img`).css(this.cssRotation(angleAstrologie));
this.html.find(`div.horloge-roue div.disque-astro img`).css(Misc.cssRotation(angleAstrologie));
const timestamp = game.system.rdd.calendrier.getTimestamp();
this.html.find(`div.astro-roue div.astro-horloge-heure img`).css(this.cssRotation(timestamp.angleHeure));
this.html.find(`div.astro-roue div.astro-horloge-minute img`).css(this.cssRotation(timestamp.angleMinute));
}
cssRotation(angleAstrologie) {
const rotation = `rotate(${angleAstrologie}deg)`;
return {
'transform': rotation,
'-ms-transform': rotation,
'-moz-transform': rotation,
'-webkit-transform': rotation,
'-o-transform': rotation
};
this.html.find(`div.horloge-roue div.horloge-aiguille-heure img`).css(Misc.cssRotation(timestamp.angleHeure));
this.html.find(`div.horloge-roue div.horloge-aiguille-minute img`).css(Misc.cssRotation(timestamp.angleMinute));
}
requestJetAstrologie() {

View File

@@ -4,7 +4,7 @@ import { RdDTimestamp } from "./rdd-timestamp.js";
* Extend the base Dialog entity by defining a custom window to perform roll.
* @extends {Dialog}
*/
export class RdDCalendrierEditeur extends Dialog {
export class RdDCalendrierEditor extends Dialog {
/* -------------------------------------------- */
constructor(html, calendrier, calendrierData) {
@@ -30,8 +30,8 @@ export class RdDCalendrierEditeur extends Dialog {
this.html.find("input[name='calendar.annee']").val(this.calendrierData.annee);
this.html.find("select[name='calendar.mois']").val(this.calendrierData.mois.key);
this.html.find("select[name='calendar.heure']").val(this.calendrierData.heure.key);
RdDCalendrierEditeur.setLimited(this.html.find("input[name='calendar.jourDuMois']"), this.calendrierData.jourDuMois, 1, 28);
RdDCalendrierEditeur.setLimited(this.html.find("input[name='calendar.minute']"), this.calendrierData.minute, 0, 119);
RdDCalendrierEditor.setLimited(this.html.find("input[name='calendar.jourDuMois']"), this.calendrierData.jourDuMois, 1, 28);
RdDCalendrierEditor.setLimited(this.html.find("input[name='calendar.minute']"), this.calendrierData.minute, 0, 119);
}
static setLimited(input, init, min, max) {

View File

@@ -1,78 +1,152 @@
import { RdDCalendrierEditeur } from "./rdd-calendrier-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 { 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";
import { APP_ASTROLOGIE_REFRESH, AppAstrologie } from "./sommeil/app-astrologie.js";
import { RdDCalendrierEditor } from "./rdd-calendrier-editor.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 { DialogChronologie } from "../dialog-chronologie.js";
import { HIDE_DICE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "../constants.js";
import { ReglesOptionelles } from "../settings/regles-optionelles.js";
import { DialogChateauDormant } from "../sommeil/dialog-chateau-dormant.js";
import { APP_ASTROLOGIE_REFRESH, AppAstrologie } from "../sommeil/app-astrologie.js";
const TEMPLATE_CALENDRIER = "systems/foundryvtt-reve-de-dragon/templates/time/calendar.hbs";
const INITIAL_CALENDAR_POS = { top: 200, left: 200, horlogeAnalogique: true };
/* -------------------------------------------- */
export class RdDCalendrier extends Application {
static init() {
game.settings.register(SYSTEM_RDD, "liste-nombre-astral", {
name: "liste-nombre-astral",
scope: "world",
config: false,
default: [],
type: Object
});
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html",
popOut: false,
resizable: false
game.settings.register(SYSTEM_RDD, "calendrier-pos", {
name: "calendrierPos",
scope: "client",
config: false,
default: INITIAL_CALENDAR_POS,
type: Object
});
}
static createCalendrierPos() {
return { top: 200, left: 200 };
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
title: "Calendrier",
template: TEMPLATE_CALENDRIER,
classes: ["calendar"],
popOut: true,
resizable: false,
width: 'fit-content',
height: 'fit-content',
});
}
constructor() {
super();
// position
this.calendrierPos = duplicate(game.settings.get(SYSTEM_RDD, "calendrier-pos"));
if (this.calendrierPos == undefined || this.calendrierPos.top == undefined) {
this.calendrierPos = RdDCalendrier.createCalendrierPos();
game.settings.set(SYSTEM_RDD, "calendrier-pos", this.calendrierPos);
}
// Calendrier
this.timestamp = RdDTimestamp.getWorldTime();
if (Misc.isUniqueConnectedGM()) { // Uniquement si GM
RdDTimestamp.setWorldTime(this.timestamp);
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.nombresAstraux);
Hooks.on('updateSetting', async (setting, update, options, id) => this.onUpdateSetting(setting, update, options, id));
}
display() {
let templatePath = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html";
renderTemplate(templatePath, {}).then(html => {
this.render(true);
get title() {
const calendrier = this.timestamp.toCalendrier();
return `${calendrier.heure.label}, ${calendrier.jourDuMois} ${calendrier.mois.label} ${calendrier.annee} (${calendrier.mois.saison})`;
}
savePosition() {
game.settings.set(SYSTEM_RDD, "calendrier-pos", {
top: this.position.top,
left: this.position.left,
horlogeAnalogique: this.horlogeAnalogique
});
}
getSavePosition() {
const pos = game.settings.get(SYSTEM_RDD, "calendrier-pos");
if (pos?.top == undefined) {
return INITIAL_CALENDAR_POS;
}
this.horlogeAnalogique = pos.horlogeAnalogique;
return pos
}
setPosition(position) {
super.setPosition(position)
this.savePosition()
}
display() {
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 buttons
}
async maximize() {
await super.maximize()
this.render(true)
}
async close() { }
async onUpdateSetting(setting, update, options, id) {
if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) {
this.timestamp = RdDTimestamp.getWorldTime();
this.updateDisplay();
this.positionAiguilles()
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
}
}
getData() {
const formData = super.getData();
this.fillCalendrierData(formData);
return formData;
}
/* -------------------------------------------- */
fillCalendrierData(formData = {}) {
mergeObject(formData, this.timestamp.toCalendrier());
formData.isGM = game.user.isGM;
formData.heures = RdDTimestamp.definitions()
formData.horlogeAnalogique = this.horlogeAnalogique;
return formData;
}
/* -------------------------------------------- */
/** @override */
async activateListeners(html) {
super.activateListeners(html);
this.html = html;
this.updateDisplay();
this.html.find('.ajout-chronologie').click(ev => DialogChronologie.create());
this.html.find('.toggle-horloge-analogique').click(ev => this.onToggleHorlogeAnalogique())
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');
this.positionnerHeure(Number(h));
})
this.html.find('.calendar-set-datetime').click(ev => {
ev.preventDefault();
this.showCalendarEditor();
@@ -82,77 +156,21 @@ export class RdDCalendrier extends Application {
ev.preventDefault();
this.showAstrologieEditor();
});
this.html.find('.calendar-title').mousedown(ev => {
ev.preventDefault();
ev = ev || window.event;
let isRightMB = false;
if ("which" in ev) { // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
isRightMB = ev.which == 3;
} else if ("button" in ev) { // IE, Opera
isRightMB = ev.button == 2;
}
if (!isRightMB) {
dragElement(document.getElementById("calendar-time-container"));
let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
function dragElement(elmnt) {
elmnt.onmousedown = dragMouseDown;
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
document.onmousemove = elementDrag;
}
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
// calculate the new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
elmnt.style.bottom = undefined
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
}
function closeDragElement() {
// stop moving when mouse button is released:
elmnt.onmousedown = undefined;
document.onmouseup = undefined;
document.onmousemove = undefined;
let xPos = (elmnt.offsetLeft - pos1) > window.innerWidth ? window.innerWidth - 200 : (elmnt.offsetLeft - pos1);
let yPos = (elmnt.offsetTop - pos2) > window.innerHeight - 20 ? window.innerHeight - 100 : (elmnt.offsetTop - pos2)
xPos = xPos < 0 ? 0 : xPos;
yPos = yPos < 0 ? 0 : yPos;
if (xPos != (elmnt.offsetLeft - pos1) || yPos != (elmnt.offsetTop - pos2)) {
elmnt.style.top = (yPos) + "px";
elmnt.style.left = (xPos) + "px";
}
game.system.rdd.calendrier.calendrierPos.top = yPos;
game.system.rdd.calendrier.calendrierPos.left = xPos;
if (game.user.isGM) {
game.settings.set(SYSTEM_RDD, "calendrier-pos", duplicate(game.system.rdd.calendrier.calendrierPos));
}
}
}
} else if (isRightMB) {
game.system.rdd.calendrier.calendrierPos.top = 200;
game.system.rdd.calendrier.calendrierPos.left = 200;
if (game.user.isGM) {
game.settings.set(SYSTEM_RDD, "calendrier-pos", duplicate(game.system.rdd.calendrier.calendrierPos));
}
this.setPos(game.system.rdd.calendrier.calendrierPos);
}
});
this.positionAiguilles()
}
positionAiguilles() {
const timestamp = this.getTimestamp();
this.html.find(`div.horloge-roue div.horloge-aiguille-heure img`).css(Misc.cssRotation(timestamp.angleHeure));
this.html.find(`div.horloge-roue div.horloge-aiguille-minute img`).css(Misc.cssRotation(timestamp.angleMinute));
}
onToggleHorlogeAnalogique() {
this.horlogeAnalogique = !this.horlogeAnalogique;
this.savePosition()
this.display()
}
/* -------------------------------------------- */
getNombresAstraux() {
return game.settings.get(SYSTEM_RDD, "liste-nombre-astral") ?? [];
@@ -226,7 +244,6 @@ export class RdDCalendrier extends Application {
});
}
/* -------------------------------------------- */
/**
*
* @param {*} indexDate la date pour laquelle obtenir le nombre astral. Si undefined, on prend la date du jour
@@ -280,7 +297,8 @@ export class RdDCalendrier extends Application {
}
this.timestamp = newTimestamp;
await this.rebuildNombresAstraux();
this.updateDisplay();
this.positionAiguilles()
this.display();
}
/* -------------------------------------------- */
@@ -294,13 +312,15 @@ export class RdDCalendrier extends Application {
else if (calendarSet) {
this.positionnerHeure(Number(calendarSet.value));
}
this.updateDisplay();
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
this.positionAiguilles()
}
/* -------------------------------------------- */
async incrementTime(minutes = 0) {
await this.setNewTimestamp(this.timestamp.addMinutes(minutes));
if (game.user.isGM) {
await this.setNewTimestamp(this.timestamp.addMinutes(minutes));
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
}
}
/* -------------------------------------------- */
@@ -310,17 +330,13 @@ 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);
await this.setNewTimestamp(newTimestamp)
}
/* -------------------------------------------- */
fillCalendrierData(formData = {}) {
mergeObject(formData, this.timestamp.toCalendrier());
formData.isGM = game.user.isGM;
return formData;
if (game.user.isGM) {
const indexDate = this.timestamp.indexDate;
const addDay = this.timestamp.heure < heure ? 0 : 1;
const newTimestamp = new RdDTimestamp({ indexDate: indexDate + addDay }).addHeures(heure);
await this.setNewTimestamp(newTimestamp)
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
}
}
/* -------------------------------------------- */
@@ -376,14 +392,14 @@ export class RdDCalendrier extends Application {
}
addNbAstralIncorect(actorId, date, nbAstral) {
let astralData = this.nombresAstraux.find((nombreAstral, i) => nombreAstral.index == date);
const 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.nombresAstraux);
}
/* -------------------------------------------- */
getAjustementAstrologique(heureNaissance, name = undefined) {
let defHeure = RdDTimestamp.findHeure(heureNaissance);
const defHeure = RdDTimestamp.findHeure(heureNaissance);
if (defHeure) {
return RdDTimestamp.ajustementAstrologiqueHeure(defHeure.heure, this.getNombreAstral(), this.timestamp.heure);
}
@@ -396,56 +412,6 @@ export class RdDCalendrier extends Application {
return 0;
}
/* -------------------------------------------- */
getData() {
let formData = super.getData();
this.fillCalendrierData(formData);
this.setPos(this.calendrierPos);
return formData;
}
/* -------------------------------------------- */
setPos(pos) {
return new Promise(resolve => {
function check() {
let elmnt = document.getElementById("calendar-time-container");
if (elmnt) {
elmnt.style.bottom = undefined;
let xPos = (pos.left) > window.innerWidth ? window.innerWidth - 200 : pos.left;
let yPos = (pos.top) > window.innerHeight - 20 ? window.innerHeight - 100 : pos.top;
elmnt.style.top = (yPos) + "px";
elmnt.style.left = (xPos) + "px";
resolve();
} else {
setTimeout(check, 30);
}
}
check();
});
}
/* -------------------------------------------- */
updateDisplay() {
let calendrier = this.fillCalendrierData();
// Rebuild text du calendrier
let dateHTML = `${calendrier.jourDuMois} ${calendrier.mois.label} (${calendrier.mois.saison}) de l'année ${calendrier.annee}`
if (game.user.isGM) {
dateHTML = dateHTML + "<br>Nombre Astral: " + (this.getNombreAstral() ?? "?");
}
for (let handle of document.getElementsByClassName("calendar-title")) {
handle.innerHTML = dateHTML;
}
for (let heure of document.getElementsByClassName("calendar-heure-texte")) {
heure.innerHTML = calendrier.heure.label;
}
for (const minute of document.getElementsByClassName("calendar-minute-texte")) {
minute.innerHTML = `${calendrier.minute} minutes`;
}
for (const heureImg of document.getElementsByClassName("calendar-heure-img")) {
heureImg.src = calendrier.heure.icon;
}
}
/* -------------------------------------------- */
async saveEditeur(calendrierData) {
const newTimestamp = RdDTimestamp.timestamp(
@@ -460,10 +426,10 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */
async showCalendarEditor() {
let calendrierData = this.fillCalendrierData();
const calendrierData = this.fillCalendrierData();
if (this.editeur == undefined) {
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-editor-template.html', calendrierData);
this.editeur = new RdDCalendrierEditeur(html, this, calendrierData)
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/time/calendar-editor.hbs', calendrierData);
this.editeur = new RdDCalendrierEditor(html, this, calendrierData)
}
this.editeur.updateData(calendrierData);
this.editeur.render(true);
@@ -473,4 +439,4 @@ export class RdDCalendrier extends Application {
async showAstrologieEditor() {
await AppAstrologie.create();
}
}
}

View File

@@ -1,7 +1,7 @@
import { SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js";
import { SHOW_DICE, SYSTEM_RDD } from "../constants.js";
import { Grammar } from "../grammar.js";
import { Misc } from "../misc.js";
import { RdDDice } from "../rdd-dice.js";
export const WORLD_TIMESTAMP_SETTING = "calendrier";
@@ -47,7 +47,6 @@ const FORMULES_PERIODE = [
{ code: 'jour', label: "Jours", calcul: async (t, nombre) => t.addJours(nombre) },
]
export class RdDTimestamp {
static init() {
@@ -229,6 +228,14 @@ export class RdDTimestamp {
this.indexMinute = indexMinute ?? 0
}
get annee() { return Math.floor(this.indexDate / RDD_JOURS_PAR_AN) }
get mois() { return Math.floor((this.indexDate % RDD_JOURS_PAR_AN) / RDD_JOURS_PAR_MOIS) }
get jour() { return (this.indexDate % RDD_JOURS_PAR_AN) % RDD_JOURS_PAR_MOIS }
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 angleHeure() { return this.indexMinute / RDD_MINUTES_PAR_JOUR * 360 - 45 }
get angleMinute() { return this.indexMinute / RDD_MINUTES_PAR_HEURES * 360 + 45 }
/**
* Convertit le timestamp en une structure avec les informations utiles
@@ -246,15 +253,6 @@ export class RdDTimestamp {
};
}
get annee() { return Math.floor(this.indexDate / RDD_JOURS_PAR_AN) }
get mois() { return Math.floor((this.indexDate % RDD_JOURS_PAR_AN) / RDD_JOURS_PAR_MOIS) }
get jour() { return (this.indexDate % RDD_JOURS_PAR_AN) % RDD_JOURS_PAR_MOIS }
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 angleHeure() { return this.indexMinute / RDD_MINUTES_PAR_JOUR * 360 - 45 }
get angleMinute() { return this.indexMinute / RDD_MINUTES_PAR_HEURES * 360 + 45}
formatDate() {
const jour = this.jour + 1;
const mois = RdDTimestamp.definition(this.mois).label;
@@ -262,6 +260,10 @@ export class RdDTimestamp {
return `${jour} ${mois}` + (annee ? ' ' + annee : '');
}
formatDateHeure() {
return `${RdDTimestamp.definition(this.heure).label}, ${this.formatDate()}`;
}
nouveauJour() { return new RdDTimestamp({ indexDate: this.indexDate + 1, indexMinute: 0 }) }
nouvelleHeure() {

View File

@@ -226,9 +226,6 @@ export const TMRType = {
desolation: { name: "désolation", genre: "f" }
}
/* -------------------------------------------- */
const caseSpecificModes = ["attache", "trounoir", "debordement", "reserve_extensible", "maitrisee"];
/* -------------------------------------------- */
const tmrRandomMovePatten =
[{ name: 'top', col: 0, row: -1 },
@@ -239,8 +236,6 @@ const tmrRandomMovePatten =
{ name: 'topleft', col: -1, row: -1 }
]
/* -------------------------------------------- */
/* -------------------------------------------- */
export class TMRUtility {
static init() {
@@ -258,32 +253,25 @@ export class TMRUtility {
/* -------------------------------------------- */
static verifyTMRCoord(coord) {
let TMRregexp = new RegExp(/([A-M])(\d+)/g);
let res = TMRregexp.exec(coord);
if (res && res[1] && res[2]) {
if (res[2] > 0 && res[2] < 16) {
return true;
}
}
return false;
return Grammar.equalsInsensitive(coord, 'Fleuve') || TMRUtility.getTMR(coord);
}
/* -------------------------------------------- */
static getTMR(coord) {
return TMRMapping[coord];
return coord == 'Fleuve' ? TMRMapping['D1'] : TMRMapping[coord];
}
static getTMRLabel(coord) {
return TMRMapping[coord]?.label ?? (coord + ": case inconnue");
return TMRUtility.getTMR(coord)?.label ?? (coord + ": case inconnue");
}
static getTMRType(coord) {
const tmr = TMRMapping[coord];
const tmr = TMRUtility.getTMR(coord);
return Misc.upperFirst(TMRType[tmr.type].name);
}
static getTMRDescr(coord) {
const tmr = TMRMapping[coord];
const tmr = TMRUtility.getTMR(coord);
return Grammar.articleDetermine(tmr.type) + ' ' + tmr.label;
}

View File

@@ -79,13 +79,13 @@
--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 0deg,
hsla(50, 50%, 80%, 0.7),
hsla(50, 50%, 80%, 0.1) 25%,
hsla(250, 50%, 20%, 0.1) 25%,
hsla(250, 50%, 20%, 0.5) 50%,
hsla(250, 50%, 20%, 0.1) 75%,
hsla(50, 50%, 80%, 0.1) 75%,
hsla(50, 50%, 80%, 0.7)
hsla(50, 100%, 80%, 0.7),
hsla(30, 30%, 40%, 0.1) 25%,
hsla(250, 50%, 40%, 0.1) 25%,
hsla(250, 30%, 30%, 0.7) 50%,
hsla(250, 50%, 40%, 0.1) 75%,
hsla(30, 30%, 40%, 0.1) 75%,
hsla(50, 100%, 80%, 0.7)
);
--background-custom-button: linear-gradient(to bottom, rgba(33, 55, 74, 0.988) 5%, rgba(21, 40, 51, 0.671) 100%);
@@ -876,120 +876,29 @@ form.rdddialogchrono input[type=datetime-local] {
color: var(--color-text-dark-primary);
border-radius: 3px;
}
div.theme-astral{
.app-calendar-astrologie div.theme-astral{
width: 14rem;
margin: 0.4rem;
}
form.dialog-astro {
width: 17rem;
}
div.astro-roue {
.app-calendar-astrologie div.horloge-roue {
position: relative;
left: calc(50% - 6.5rem);
width: 13rem;
height: 13rem;
}
div.astro-roue div.astro-heure {
.app-calendar-astrologie div.horloge-roue div.horloge-heure {
position: absolute;
width: 1.8rem;
height: 1.8rem;
}
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(6rem);
top: calc(50% - 6rem);
left: calc(50% - 6rem);
width: calc(100% - 1rem);
height: calc(100% - 1rem);
}
div.astro-roue div.astro-cercle2 {
position: absolute;
border: 0.1rem solid rgba(100, 45, 124, 0.4);
border-radius: calc(6.1rem);
top: calc(50% - 4.5rem);
left: calc(50% - 4.5rem);
width: calc(100% - 4rem);
height: calc(100% - 4rem);
}
div.astro-roue div.astro-disque {
position: absolute;
border: none;
top: calc(50% - 3.4rem);
left: calc(50% - 3.4rem);
width: calc(100% - 6.2rem);
height: calc(100% - 6.2rem);
}
div.astro-roue div.astro-horloge-heure {
position: absolute;
border: none;
top: calc(50% - 2.5rem);
left: calc(50% - 2.5rem);
width: calc(100% - 8rem);
height: calc(100% - 8rem);
}
div.astro-roue div.astro-horloge-minute {
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.astro-ajustement {
position: absolute;
width: 0.8rem;
height: 0.8rem;
color: hsl(120, 50%, 15%);
font-size: 0.8rem;
text-align: center;
vertical-align: middle;
border-radius: 0.4rem;
background-color: hsla(300, 100%, 95%, 0.3);
}
div.astro-roue div.astro-disque img { border: none; }
div.astro-roue div:is(.astro-horloge-heure, .astro-horloge-minute) img {
border: none;
text-shadow: #403f3e;
}
div.astro-roue div.astro-heure img.astro-heure-img {
.app-calendar-astrologie div.horloge-roue div.horloge-heure img.horloge-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-01 { top: calc(50% - 1rem + sin(-180deg) * 5rem); left: calc(50% - 1rem + cos(-180deg) * 5rem); }
div.astro-roue div.astro-heure.heure-02 { top: calc(50% - 1rem + sin(-150deg) * 5rem); left: calc(50% - 1rem + cos(-150deg) * 5rem); }
div.astro-roue div.astro-heure.heure-03 { top: calc(50% - 1rem + sin(-120deg) * 5rem); left: calc(50% - 1rem + cos(-120deg) * 5rem); }
div.astro-roue div.astro-heure.heure-04 { top: calc(50% - 1rem + sin(-90deg) * 5rem); left: calc(50% - 1rem + cos(-90deg) * 5rem); }
div.astro-roue div.astro-heure.heure-05 { top: calc(50% - 1rem + sin(-60deg) * 5rem); left: calc(50% - 1rem + cos(-60deg) * 5rem); }
div.astro-roue div.astro-heure.heure-06 { top: calc(50% - 1rem + sin(-30deg) * 5rem); left: calc(50% - 1rem + cos(-30deg) * 5rem); }
div.astro-roue div.astro-heure.heure-07 { top: calc(50% - 1rem + sin(-0deg) * 5rem); left: calc(50% - 1rem + cos(-0deg) * 5rem); }
div.astro-roue div.astro-heure.heure-08 { top: calc(50% - 1rem + sin(30deg) * 5rem); left: calc(50% - 1rem + cos(30deg) * 5rem); }
div.astro-roue div.astro-heure.heure-09 { top: calc(50% - 1rem + sin(60deg) * 5rem); left: calc(50% - 1rem + cos(60deg) * 5rem); }
div.astro-roue div.astro-heure.heure-10 { top: calc(50% - 1rem + sin(90deg) * 5rem); left: calc(50% - 1rem + cos(90deg) * 5rem); }
div.astro-roue div.astro-heure.heure-11 { top: calc(50% - 1rem + sin(120deg) * 5rem); left: calc(50% - 1rem + cos(120deg) * 5rem); }
div.astro-roue div.astro-heure.heure-12 { top: calc(50% - 1rem + sin(150deg) * 5rem); left: calc(50% - 1rem + cos(150deg) * 5rem); }
div.astro-roue div.astro-ajustement.heure-01 { top: calc(50% - 0.4rem + sin(180deg) * 3.9rem); left: calc(50% - 0.4rem + cos(180deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-02 { top: calc(50% - 0.4rem + sin(-150deg) * 3.9rem); left: calc(50% - 0.4rem + cos(-150deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-03 { top: calc(50% - 0.4rem + sin(-120deg) * 3.9rem); left: calc(50% - 0.4rem + cos(-120deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-04 { top: calc(50% - 0.4rem + sin(-90deg) * 3.9rem); left: calc(50% - 0.4rem + cos(-90deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-05 { top: calc(50% - 0.4rem + sin(-60deg) * 3.9rem); left: calc(50% - 0.4rem + cos(-60deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-06 { top: calc(50% - 0.4rem + sin(-30deg) * 3.9rem); left: calc(50% - 0.4rem + cos(-30deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-07 { top: calc(50% - 0.4rem + sin(0deg) * 3.9rem); left: calc(50% - 0.4rem + cos(0deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-08 { top: calc(50% - 0.4rem + sin(30deg) * 3.9rem); left: calc(50% - 0.4rem + cos(30deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-09 { top: calc(50% - 0.4rem + sin(60deg) * 3.9rem); left: calc(50% - 0.4rem + cos(60deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-10 { top: calc(50% - 0.4rem + sin(90deg) * 3.9rem); left: calc(50% - 0.4rem + cos(90deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-11 { top: calc(50% - 0.4rem + sin(120deg) * 3.9rem); left: calc(50% - 0.4rem + cos(120deg) * 3.9rem); }
div.astro-roue div.astro-ajustement.heure-12 { top: calc(50% - 0.4rem + sin(150deg) * 3.9rem); left: calc(50% - 0.4rem + cos(150deg) * 3.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;
}
@@ -1698,178 +1607,211 @@ table.table-nombres-astraux tr:hover {
border-image-outset: 0px;
}
/*--------------------------------------------------------------------------*/
/* CALENDAR STUFF */
#calendar-time-container{
position: absolute;
display: block;
}
.calendar {
min-width: 250px;
width: fit-content;
display: grid;
grid-row: 2;
grid-column: 9;
min-height: 5rem;
height: fit-content;
.window-app.calendar {
background: none;
margin: 0;
padding: 0;
box-shadow: none;
pointer-events: none;
}
.window-app.calendar header.window-header {
pointer-events: all;
}
.window-app.calendar .window-content {
margin: 0;
padding: 0;
border: 1px solid #000;
border-radius: 0.3rem;
background: hsla(0, 0%, 0%, 0.5);
font-family: "GoudyAcc";
z-index: 100;
flex-direction: column;
min-width: 250px;
height: fit-content;
background: hsla(0, 0%, 0%, 0.0);
font-family: "GoudyAcc";
pointer-events: none;
}
.calendar-title {
grid-column: 1 / span 7;
grid-row: 1;
color: #CCC;
opacity: 90;
font-size: 0.9rem;
text-align: center;
}
.calendar-options {
grid-column: 8 / span 2;
}
.calendar-title,.calendar-options{
border-bottom: 1px solid hsla(0, 0%, 80%, 0.5);
.window-app.calendar .window-content > div {
pointer-events: all;
}
.calendar-avance-heure {
grid-column: 1 / span 3;
.window-app.calendar div.horloge-roue {
position: relative;
margin-bottom: 7px;
left: 0;
width: 8rem;
height: 8rem;
}
.calendar-change-heure {
grid-column: 9 / span 1;
.window-app.calendar div.horloge-roue div.horloge-heure {
width: 1.4rem;
height: 1.4rem;
}
.window-app.calendar div.horloge-roue div.horloge-heure img.horloge-heure-img {
width: 1.4rem;
height: 1.4rem;
}
.calendar-change-heure .calendar-change-heure-grid {
div.horloge-roue div {
position: absolute;
border: none;
pointer-events: all;
}
div.horloge-roue div.horloge-cercle {
background: hsl(60, 20%, 95%) url(img/bg_left.webp) no-repeat left top;
top: 2%; left: 2%; width: 96%; height: 96%; border-radius: 50%;
}
div.horloge-roue div.horloge-cercle1 {
background: var(--gradient-daylight);
border: 0.2rem solid rgba(100, 45, 124, 0.6);
top: 2%; left: 2%; width: 96%; height: 96%; border-radius: 50%;
}
div.horloge-roue div.horloge-cercle2 {
border: 0.1rem solid rgba(100, 45, 124, 0.4);
top: 17%; left: 17%; width: 66%; height: 66%; border-radius: 50%;
}
div.horloge-roue div.disque-astro {
top: 28%; left: 28%; width: 44%; height: 44%;
}
div.horloge-roue div.horloge-aiguille-heure {
top: 25%; left: 25%; width: 50%; height: 50%;
}
div.horloge-roue div.horloge-aiguille-minute {
top: 20%; left: 20%; width: 60%; height: 60%;
}
div.horloge-roue div.horloge-ajustement {
width: 0.8rem;
height: 0.8rem;
color: hsl(120, 50%, 15%);
background-color: hsla(300, 100%, 95%, 0.4);
font-size: 0.8rem;
text-align: center;
vertical-align: middle;
border-radius: 0.3rem;
}
div.horloge-roue div img {
border: none;
}
.window-app.calendar div.horloge-heure.heure-01 { top: calc(50% - 0.7rem + sin(-180deg) *38%); left: calc(50% - 0.7rem + cos(-180deg) *38%); }
.window-app.calendar div.horloge-heure.heure-02 { top: calc(50% - 0.7rem + sin(-150deg) *38%); left: calc(50% - 0.7rem + cos(-150deg) *38%); }
.window-app.calendar div.horloge-heure.heure-03 { top: calc(50% - 0.7rem + sin(-120deg) *38%); left: calc(50% - 0.7rem + cos(-120deg) *38%); }
.window-app.calendar div.horloge-heure.heure-04 { top: calc(50% - 0.7rem + sin(-90deg) *38%); left: calc(50% - 0.7rem + cos(-90deg) *38%); }
.window-app.calendar div.horloge-heure.heure-05 { top: calc(50% - 0.7rem + sin(-60deg) *38%); left: calc(50% - 0.7rem + cos(-60deg) *38%); }
.window-app.calendar div.horloge-heure.heure-06 { top: calc(50% - 0.7rem + sin(-30deg) *38%); left: calc(50% - 0.7rem + cos(-30deg) *38%); }
.window-app.calendar div.horloge-heure.heure-07 { top: calc(50% - 0.7rem + sin(-0deg) *38%); left: calc(50% - 0.7rem + cos(-0deg) *38%); }
.window-app.calendar div.horloge-heure.heure-08 { top: calc(50% - 0.7rem + sin(30deg) *38%); left: calc(50% - 0.7rem + cos(30deg) *38%); }
.window-app.calendar div.horloge-heure.heure-09 { top: calc(50% - 0.7rem + sin(60deg) *38%); left: calc(50% - 0.7rem + cos(60deg) *38%); }
.window-app.calendar div.horloge-heure.heure-10 { top: calc(50% - 0.7rem + sin(90deg) *38%); left: calc(50% - 0.7rem + cos(90deg) *38%); }
.window-app.calendar div.horloge-heure.heure-11 { top: calc(50% - 0.7rem + sin(120deg) *38%); left: calc(50% - 0.7rem + cos(120deg) *38%); }
.window-app.calendar div.horloge-heure.heure-12 { top: calc(50% - 0.7rem + sin(150deg) *38%); left: calc(50% - 0.7rem + cos(150deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-01 { top: calc(50% - 1rem + sin(-180deg) *41%); left: calc(50% - 1rem + cos(-180deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-02 { top: calc(50% - 1rem + sin(-150deg) *41%); left: calc(50% - 1rem + cos(-150deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-03 { top: calc(50% - 1rem + sin(-120deg) *41%); left: calc(50% - 1rem + cos(-120deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-04 { top: calc(50% - 1rem + sin(-90deg) *41%); left: calc(50% - 1rem + cos(-90deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-05 { top: calc(50% - 1rem + sin(-60deg) *41%); left: calc(50% - 1rem + cos(-60deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-06 { top: calc(50% - 1rem + sin(-30deg) *41%); left: calc(50% - 1rem + cos(-30deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-07 { top: calc(50% - 1rem + sin(-0deg) *41%); left: calc(50% - 1rem + cos(-0deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-08 { top: calc(50% - 1rem + sin(30deg) *41%); left: calc(50% - 1rem + cos(30deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-09 { top: calc(50% - 1rem + sin(60deg) *41%); left: calc(50% - 1rem + cos(60deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-10 { top: calc(50% - 1rem + sin(90deg) *41%); left: calc(50% - 1rem + cos(90deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-11 { top: calc(50% - 1rem + sin(120deg) *41%); left: calc(50% - 1rem + cos(120deg) *41%); }
.window-app.calendar-astrologie div.horloge-heure.heure-12 { top: calc(50% - 1rem + sin(150deg) *41%); left: calc(50% - 1rem + cos(150deg) *41%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-01 { top: calc(50% - 0.4rem + sin(180deg) * 28%); left: calc(50% - 0.4rem + cos(180deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-02 { top: calc(50% - 0.4rem + sin(-150deg) * 28%); left: calc(50% - 0.4rem + cos(-150deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-03 { top: calc(50% - 0.4rem + sin(-120deg) * 28%); left: calc(50% - 0.4rem + cos(-120deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-04 { top: calc(50% - 0.4rem + sin(-90deg) * 28%); left: calc(50% - 0.4rem + cos(-90deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-05 { top: calc(50% - 0.4rem + sin(-60deg) * 28%); left: calc(50% - 0.4rem + cos(-60deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-06 { top: calc(50% - 0.4rem + sin(-30deg) * 28%); left: calc(50% - 0.4rem + cos(-30deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-07 { top: calc(50% - 0.4rem + sin(0deg) * 28%); left: calc(50% - 0.4rem + cos(0deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-08 { top: calc(50% - 0.4rem + sin(30deg) * 28%); left: calc(50% - 0.4rem + cos(30deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-09 { top: calc(50% - 0.4rem + sin(60deg) * 28%); left: calc(50% - 0.4rem + cos(60deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-10 { top: calc(50% - 0.4rem + sin(90deg) * 28%); left: calc(50% - 0.4rem + cos(90deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-11 { top: calc(50% - 0.4rem + sin(120deg) * 28%); left: calc(50% - 0.4rem + cos(120deg) * 28%); }
.window-app.calendar-astrologie div.horloge-ajustement.heure-12 { top: calc(50% - 0.4rem + sin(150deg) * 28%); left: calc(50% - 0.4rem + cos(150deg) * 28%); }
.window-app.calendar header.window-header h4 {
font-size: 0.8rem;
}
.window-app.calendar section.window-content div.calendar-boutons-heure {
display: grid;
grid-column: 1;
grid-row: 2;
margin: 2px;
grid-row-gap: 3px;
color: hsla(0, 0%, 80%, 0.5);
background: hsla(0, 0%, 20%, 1);
color: hsla(0, 0%, 80%, 0.8);
grid-row: 1;
grid-column: 10;
}
.calendar-avance-heure .calendar-avance-heure-grid {
display: grid;
grid-column: 3;
grid-row: 2;
margin: 2px;
grid-row-gap: 3px;
color: hsla(0, 0%, 80%, 0.5);
}
.calendar-avance-heure .calendar-avance-heure-grid:hover {
color: #FFF;
cursor: pointer;
}
.calendar-affiche-heure {
grid-column: 4 / span 4;
grid-row: 2;
}
.calendar-affiche-heure .calendar-horloge {
display: grid;
max-width: 100px;
float: left;
padding-top: 0px;
padding-bottom: 0px;
margin: 0 0.3rem 0 0.3rem;
color: #CCC;
text-align: center;
}
.calendar-affiche-heure .calendar-horloge .calendar-heure-texte {
font-size: 1.1rem;
}
.calendar-affiche-heure .calendar-horloge .calendar-minute-texte {
margin: 0;
}
.calendar-affiche-heure .calendar-horloge .calendar-heure-img{
width: 2rem;
height: 2rem;
float: left;
flex-grow: 0;
padding: 0.1rem;
border: 0;
opacity: 0.9;
.calendar-boutons-heure .calendar-btn:is(.calendar-lyre,.calendar-vaisseau) img {
color: hsla(0, 0%, 100%, 0.5);
border: none;
vertical-align: bottom;
max-width: 1.2em;
max-height: 1.2em;
margin: 1px;
}
.calendar :is(.calendar-astrologie,.calendar-set-datetime) {
grid-row: 1;
grid-column: 1;
}
.calendar :is(.calendar-astrologie,.calendar-set-datetime,.calendar-btn) {
color: hsla(0, 0%, 100%, 0.5);
border: 1px solid rgba(0, 0, 0, 0);
}
.calendar :is(.calendar-astrologie,.calendar-set-datetime,.calendar-btn):hover {
color: var(--color-controls-hover);
border: 1px solid var(--color-control-border-hover);
cursor: pointer;
}
.calendar .calendar-affiche-heure .calendar-horloge a {
.calendar-boutons-heure i {
border: 1px solid rgba(0, 0, 0, 0);
}
.calendar .calendar-affiche-heure .calendar-horloge a:hover {
.calendar-boutons-heure i:hover {
color: var(--color-controls-hover);
border: 1px solid var(--color-control-border-hover);
cursor: pointer;
}
.calendar-avance-heure .calendar-1min {
grid-row: 1;
grid-column: 1;
.calendar-1min { grid-column: 1;}
.calendar-5min { grid-column: 2;}
.calendar-15min { grid-column: 3;}
.calendar-30min { grid-column: 4;}
.calendar-60min { grid-column: 5;}
.calendar-1heure { grid-column: 6;}
.calendar-lyre { grid-column: 7;}
.calendar-vaisseau { grid-column: 8;}
.calendar-set-datetime { grid-column: 9;}
.calendar-astrologie { grid-column: 10;}
div.horloge-analogique {
border: none;
margin: 0;
width: fit-content;
height: fit-content;
align-content: center;
vertical-align: middle;
pointer-events: none;
}
.calendar-avance-heure .calendar-5min {
grid-row: 1;
grid-column: 2;
div.horloge-analogique.horloge-analogique-hidden {
visibility: hidden;
}
.calendar-avance-heure .calendar-15min {
grid-row: 1;
grid-column: 3;
}
.calendar-avance-heure .calendar-30min {
grid-row: 2;
grid-column: 1;
}
.calendar-avance-heure .calendar-60min {
grid-row: 2;
grid-column: 2;
}
.calendar-avance-heure .calendar-1heure {
grid-row: 2;
grid-column: 3;
div.horloge-digitale {
color: #CCC;
background: hsla(0, 0%, 20%, 1);
text-align: center;
width: 100%;
}
.calendar-lyre{
grid-row: 1;
grid-column: 1;
div.horloge-digitale :is(.calendar-heure-texte,.calendar-minute-texte) {
font-size: 1rem;
pointer-events: all;
margin: 0;
}
.calendar-vaisseau {
grid-row: 2;
grid-column: 1;
div.horloge-digitale a {
border: 1px solid rgba(0, 0, 0, 0);
}
.calendar-change-heure .calendar-btn:is(.calendar-lyre,.calendar-vaisseau) img {
color: hsla(0, 0%, 100%, 0.5);
vertical-align: bottom;
max-width: 1.2em;
max-height: 1.2em;
border-width: 0;
div.horloge-digitale a:hover {
color: var(--color-controls-hover);
border: 1px solid var(--color-control-border-hover);
cursor: pointer;
}
div.calendar-timestamp-edit select.calendar-signe-heure {

View File

@@ -1,8 +1,8 @@
{
"id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"version": "10.7.4",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.7.4.zip",
"version": "10.7.6",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.7.6.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": {
"minimum": "10",

View File

@@ -620,7 +620,7 @@
"bonus": 0
},
"localisation": "",
"jours": 0
"origine": ""
},
"maladie": {
"templates": ["description", "temporel"],

View File

@@ -1,8 +1,8 @@
<li class="item item-blessure flexrow list-item blessure-active-{{lowercase system.labelGravite}}" data-item-id="{{id}}">
<li class="item item-blessure flexrow list-item blessure-active-{{lowercase system.label}}" data-item-id="{{id}}">
<span class="blessure-control">
<img class="sheet-competence-img" src="{{img}}" />
<i class="fas fa-skull-crossbones"></i>
{{system.labelGravite}}
{{system.label}}
</span>
{{#if (gt system.gravite 6)}}
<span class="flexrow"></span>
@@ -30,7 +30,8 @@
</span>
{{/if}}
<span>
{{system.localisation}}
{{#if system.origine}}<span>Par {{system.origine}}</span>{{/if}}
{{#if system.localisation}}<span>{{system.localisation}}</span>{{/if}}
</span>
<span class="item-controls">
<a class="item-edit" title="Editer"><i class="fas fa-edit"></i></a>

View File

@@ -15,7 +15,11 @@
</a>
{{/if}}
</span>
<span class="equipement-detail">{{item.system.quantite}}
<span class="equipement-detail">
{{#if (gt item.system.quantite 1)}}
<a class="item-quantite-moins"><i class="fas fa-minus-square"></i></a>
{{/if}}
{{item.system.quantite}}
{{#if (gt item.system.quantite 1)}}
<a class="item-split" title="Séparer"><i class="fas fa-unlink"></i></a>
{{/if}}

View File

@@ -10,7 +10,7 @@
</span>
{{#if @root.options.isOwner}}
<span class="equipement-button item-controls">
<a class="monnaie-moins"><i class="fas fa-minus-square"></i></a>
<a class="item-quantite-moins"><i class="fas fa-minus-square"></i></a>
</span>
{{/if}}
<span class="equipement-detail">
@@ -18,7 +18,7 @@
</span>
{{#if @root.options.isOwner}}
<span class="equipement-button item-controls">
<a class="monnaie-plus"><i class="fas fa-plus-square"></i></a>
<a class="item-quantite-plus"><i class="fas fa-plus-square"></i></a>
</span>
{{/if}}
<span class="equipement-actions item-controls">

View File

@@ -1,47 +0,0 @@
<div id="calendar-time-container">
<div class="calendar">
<div class="calendar-title" title="Deplacer">{{jourDuMois}} {{mois.label}} ({{mois.saison}})</div>
<div class="calendar-options">
{{#if isGM}}
<i class="calendar-set-datetime fa-solid fa-calendar-pen" title="Editer"></i>
<i class="calendar-astrologie fa-solid fa-moon-over-sun" title="Astrologie"></i>
{{/if}}
</div>
<div class="calendar-avance-heure">
<div class="calendar-avance-heure-grid">
{{#if isGM}}
<i class="calendar-btn calendar-1min" data-calendar-avance="1" title="Avancer de 1 minute">+1</i>
<i class="calendar-btn calendar-5min" data-calendar-avance="5" title="Avancer de 5 minutes">+5</i>
<i class="calendar-btn calendar-15min" data-calendar-avance="15" title="Avancer de 15 minutes">+15</i>
<i class="calendar-btn calendar-30min" data-calendar-avance="30" title="Avancer de 30 minutes">+30</i>
<i class="calendar-btn calendar-60min" data-calendar-avance="60" title="Avancer de 60 minutes" >+60</i>
<i class="calendar-btn calendar-1heure" data-calendar-avance="120" title="Avancer d'1 heure" >+1h</i>
{{else}}
{{/if}}
</div>
</div>
<div class="calendar-affiche-heure">
<div class="calendar-horloge">
<a class="ajout-chronologie">
<img class="calendar-heure-img" src="{{heure.icon}}" alt="{{nomHeure}}"/>
<span class="calendar-heure-texte">{{heure.label}}</span>
</a>
{{#if isGM}}
<p class="calendar-minute-texte">{{minute}} minutes</p>
{{/if}}
</div>
</div>
<div class="calendar-change-heure">
<div class="calendar-change-heure-grid">
{{#if isGM}}
<i class="calendar-btn calendar-lyre fas fa-forward" data-calendar-set="6" title="Avancer à Lyre">
<img src="systems/foundryvtt-reve-de-dragon/icons/heures/hd07.svg" alt="Avancer à Lyre"/>
</i>
<i class="calendar-btn calendar-vaisseau fas fa-forward" data-calendar-set="0" title="Avancer au Vaisseau">
<img src="systems/foundryvtt-reve-de-dragon/icons/heures/hd01.svg" alt="Avancer au Vaisseau"/>
</i>
{{/if}}
</div>
</div>
</div>
</div>

View File

@@ -17,6 +17,10 @@
<label for="system.localisation">Localisation</label>
<input class="attribute-value" type="text" name="system.localisation" value="{{system.localisation}}" data-dtype="String"/>
</div>
<div class="form-group">
<label for="system.origine">Causée par</label>
<input class="attribute-value" type="text" name="system.origine" value="{{system.origine}}" data-dtype="String"/>
</div>
{{#if (lt system.gravite 7)}}
<div class="form-group">
<label for="system.difficulte">Difficulté des soins</label>
@@ -35,7 +39,6 @@
<label for="system.premierssoins.tache">Points de tâches</label>
<input class="attribute-value number-x" type="text" name="system.premierssoins.tache" value="{{system.premierssoins.tache}}" data-dtype="Number"/>
{{/if}}
</div>
{{#if system.premierssoins.done}}

View File

@@ -19,21 +19,5 @@
</div>
<hr>
<div><label>Heures de chance et malchance</label></div>
<div class="astro-roue">
<div class="astro-cercle1"></div>
{{#each heures as |heure|}}
<div class="astro-ajustement heure-{{heure.hh}}"></div>
<div class="astro-heure heure-{{heure.hh}}"><img class="astro-heure-img" src="{{heure.webp}}" title="{{heure.label}}"></div>
{{/each}}
<div class="astro-cercle2"></div>
<div class="astro-disque">
<img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/astro-disque.svg" alt="">
</div>
<div class="astro-horloge-heure">
<img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/rdd-aiguille-horloge.svg" alt="">
</div>
<div class="astro-horloge-minute">
<img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/rdd-aiguille-minute.svg" alt="">
</div>
</div>
{{> 'systems/foundryvtt-reve-de-dragon/templates/time/horloge.hbs'}}
</div>

View File

@@ -0,0 +1,40 @@
<div class="calendar-horloge">
{{#if isGM}}
<div class="calendar-boutons-heure">
<i class="calendar-btn calendar-1min" data-calendar-avance="1" title="Avancer de 1 minute">+1</i>
<i class="calendar-btn calendar-5min" data-calendar-avance="5" title="Avancer de 5 minutes">+5</i>
<i class="calendar-btn calendar-15min" data-calendar-avance="15" title="Avancer de 15 minutes">+15</i>
<i class="calendar-btn calendar-30min" data-calendar-avance="30" title="Avancer de 30 minutes">+30</i>
<i class="calendar-btn calendar-60min" data-calendar-avance="60" title="Avancer de 60 minutes" >+60</i>
<i class="calendar-btn calendar-1heure" data-calendar-avance="120" title="Avancer d'1 heure" >+1h</i>
<i class="calendar-btn calendar-lyre fas fa-forward" data-calendar-set="6" title="Avancer à Lyre">
<img src="systems/foundryvtt-reve-de-dragon/icons/heures/hd07.svg" alt="Avancer à Lyre"/>
</i>
<i class="calendar-btn calendar-vaisseau fas fa-forward" data-calendar-set="0" title="Avancer au Vaisseau">
<img src="systems/foundryvtt-reve-de-dragon/icons/heures/hd01.svg" alt="Avancer au Vaisseau"/>
</i>
</div>
{{/if}}
<div class="horloge-digitale">
<span>
<a class="toggle-horloge-analogique">
{{#if horlogeAnalogique}}
<i class="fa-solid fa-chevrons-up"></i>
{{else}}
<i class="fa-solid fa-chevrons-down"></i>
{{/if}}
</a>
</span>
<span class="calendar-heure-texte">
<a class="ajout-chronologie">
{{heure.label}}
</a>
</span>
{{#if isGM}}
<span class="calendar-minute-texte">{{minute}} minutes</span>
{{/if}}
</div>
<div class="horloge-analogique {{#unless horlogeAnalogique}}horloge-analogique-hidden{{/unless}}">
{{> 'systems/foundryvtt-reve-de-dragon/templates/time/horloge.hbs' }}
</div>
</div>

View File

@@ -0,0 +1,22 @@
<div class="horloge-roue">
<div class="horloge-cercle"></div>
<div class="horloge-cercle1"></div>
{{#if theme}}
{{#each heures as |heure|}}
<div class="horloge-ajustement heure-{{heure.hh}}"></div>
{{/each}}
<div class="disque-astro">
<img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/astro-disque.svg" alt="">
</div>
{{/if}}
{{#each heures as |heure|}}
<div class="horloge-heure heure-{{heure.hh}}" data-heure="{{heure.heure}}"><img class="horloge-heure-img" src="{{heure.webp}}" title="{{heure.label}}"></div>
{{/each}}
<div class="horloge-cercle2"></div>
<div class="horloge-aiguille-heure">
<img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/rdd-aiguille-horloge.svg" alt="">
</div>
<div class="horloge-aiguille-minute">
<img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/rdd-aiguille-minute.svg" alt="">
</div>
</div>