Compare commits
24 Commits
foundryvtt
...
foundryvtt
Author | SHA1 | Date | |
---|---|---|---|
f2a3e1db45 | |||
b69359a47d | |||
fe6c2e2ff2 | |||
9bd13a6021 | |||
a29630f9a2 | |||
c7fd9f7596 | |||
7b18fd25c3 | |||
5c256e2c49 | |||
1c475348d5 | |||
de5d32f88f | |||
76a02d60ca | |||
724c556b9e | |||
7dfba94a11 | |||
928c7bbcfe | |||
222a06a978 | |||
b4edaf8584 | |||
3c062afd56 | |||
6de4fff403 | |||
3543f081b2 | |||
56f14e12a2 | |||
e226af5ac5 | |||
d8be37a2ec | |||
ba2d9de7b6 | |||
6b8fb3267a |
20
changelog.md
20
changelog.md
@ -1,4 +1,24 @@
|
||||
# v11.0
|
||||
## 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
|
||||
- Macro pour attaquer avec les armes des personnages
|
||||
|
||||
## v11.0.17
|
||||
- Fix: les actions de commerce ne s'appliquait pas bien aux personnages des tokens non liés
|
||||
|
||||
## v11.0.15 - L'apprentissage de Khrachtchoum
|
||||
- Fix: l'expérience ne s'appliquait plus sur certaines réussites particulières (régression depuis la 11.0.7)
|
||||
|
||||
## v11.0.14 - Les pincettes de Khrachtchoum le Problémeux
|
||||
- Correction du calcul de la place restante lors de l'ajout dans un conteneur
|
||||
|
||||
## v11.0.13 - La multiplication de l'eau de Khrachtchoum le Problémeux
|
||||
- Correction de la vente depuis un commerce ayant des quantités illimitées
|
||||
|
@ -265,7 +265,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getDraconicList() {
|
||||
return this.items.filter(it => it.isCompetencePersonnage() && it.system.categorie == 'draconic')
|
||||
return this.itemTypes[TYPES.competence].filter(it => it.system.categorie == 'draconic')
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getBestDraconic() {
|
||||
@ -275,13 +275,13 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
getDraconicOuPossession() {
|
||||
const possession = this.items.filter(it => it.type == TYPES.competencecreature && it.system.categorie == 'possession')
|
||||
const possession = this.itemTypes[TYPES.competencecreature].filter(it => it.system.categorie == 'possession')
|
||||
.sort(Misc.descending(it => it.system.niveau))
|
||||
.find(it => true);
|
||||
if (possession) {
|
||||
return possession.clone();
|
||||
return possession;
|
||||
}
|
||||
const draconics = [...this.getDraconicList().filter(it => it.system.niveau >= 0).map(it => it.clone()),
|
||||
const draconics = [...this.getDraconicList().filter(it => it.system.niveau >= 0),
|
||||
POSSESSION_SANS_DRACONIC]
|
||||
.sort(Misc.descending(it => it.system.niveau));
|
||||
return draconics[0];
|
||||
@ -1741,6 +1741,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
async consommerNourritureboisson(itemId, choix = { doses: 1, seForcer: false, supprimerSiZero: false }, userId = undefined) {
|
||||
if (userId != undefined && userId != game.user.id) {
|
||||
RdDBaseActor.remoteActorCall({
|
||||
tokenId: this.token?.id,
|
||||
actorId: this.id,
|
||||
method: 'consommerNourritureboisson',
|
||||
args: [itemId, choix, userId]
|
||||
@ -3070,29 +3071,43 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme(arme) {
|
||||
getArmeCompetence(arme, competenceName) {
|
||||
let comp = arme.system[competenceName]
|
||||
if (!comp || comp.name == "") {
|
||||
comp = arme.system[competenceName]
|
||||
}
|
||||
if ( !comp || comp.name == "") {
|
||||
comp = arme.system[competenceName]
|
||||
}
|
||||
return comp
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme(arme, competenceName = "competence") {
|
||||
let compToUse = this.getArmeCompetence(arme, competenceName)
|
||||
if (!Targets.hasTargets()) {
|
||||
RdDConfirm.confirmer({
|
||||
settingConfirmer: "confirmer-combat-sans-cible",
|
||||
content: `<p>Voulez vous faire un jet de compétence ${arme.system.competence} sans choisir de cible valide?
|
||||
content: `<p>Voulez vous faire un jet de compétence ${competenceName} sans choisir de cible valide?
|
||||
<br>Tous les jets de combats devront être gérés à la main
|
||||
</p>`,
|
||||
title: 'Ne pas utiliser les automatisation de combat',
|
||||
buttonLabel: "Pas d'automatisation",
|
||||
onAction: async () => {
|
||||
this.rollCompetence(arme.system.competence, { tryTarget: false })
|
||||
this.rollCompetence(compToUse, { tryTarget: false })
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Targets.selectOneToken(target => {
|
||||
if (Targets.isTargetEntite(target)) {
|
||||
ui.notifications.warn(`Vous ne pouvez pas attaquer une entité non incarnée avec votre ${arme.name}!!!!`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const competence = this.getCompetence(arme.system.competence)
|
||||
const competence = this.getCompetence(compToUse)
|
||||
//console.log("RollArme", competence, arme)
|
||||
if (competence.isCompetencePossession()) {
|
||||
return RdDPossession.onAttaquePossession(target, this, competence);
|
||||
}
|
||||
@ -3121,7 +3136,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
|
||||
async onRollTachePremiersSoins(blessureId, rollData) {
|
||||
if (!this.isOwner) {
|
||||
return RdDBaseActor.remoteActorCall({ actorId: this.id, method: 'onRollTachePremiersSoins', args: [blessureId, rollData] });
|
||||
return RdDBaseActor.remoteActorCall({ tokenId: this.token?.id, actorId: this.id, method: 'onRollTachePremiersSoins', args: [blessureId, rollData] });
|
||||
}
|
||||
const blessure = this.getItem(blessureId, 'blessure')
|
||||
console.log('TODO update blessure', this, blessureId, rollData, rollData.tache);
|
||||
@ -3151,7 +3166,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
|
||||
async onRollSoinsComplets(blessureId, rollData) {
|
||||
if (!this.isOwner) {
|
||||
return RdDBaseActor.remoteActorCall({ actorId: this.id, method: 'onRollSoinsComplets', args: [blessureId, rollData] });
|
||||
return RdDBaseActor.remoteActorCall({ tokenId: this.token?.id, actorId: this.id, method: 'onRollSoinsComplets', args: [blessureId, rollData] });
|
||||
}
|
||||
const blessure = this.getItem(blessureId, 'blessure')
|
||||
if (blessure && blessure.system.premierssoins.done && !blessure.system.soinscomplets.done) {
|
||||
@ -3245,6 +3260,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
const attackerId = attacker?.id;
|
||||
if (ReglesOptionnelles.isUsing('validation-encaissement-gr') && !game.user.isGM) {
|
||||
RdDBaseActor.remoteActorCall({
|
||||
tokenId: this.token?.id,
|
||||
actorId: this.id,
|
||||
method: 'appliquerEncaissement',
|
||||
args: [rollData, show, attackerId]
|
||||
|
@ -50,7 +50,13 @@ export class RdDBaseActor extends Actor {
|
||||
|
||||
static onRemoteActorCall(callData, userId) {
|
||||
if (userId == game.user.id) {
|
||||
const actor = game.actors.get(callData?.actorId);
|
||||
let actor = game.actors.get(callData?.actorId);
|
||||
if ( callData.tokenId) {
|
||||
let token = canvas.tokens.placeables.find(t => t.id == callData.tokenId)
|
||||
if (token) {
|
||||
actor = token.actor
|
||||
}
|
||||
}
|
||||
if (Misc.isOwnerPlayerOrUniqueConnectedGM(actor)) { // Seul le joueur choisi effectue l'appel: le joueur courant si propriétaire de l'actor, ou le MJ sinon
|
||||
const args = callData.args;
|
||||
console.info(`RdDBaseActor.onRemoteActorCall: pour l'Actor ${callData.actorId}, appel de RdDBaseActor.${callData.method}(`, ...args, ')');
|
||||
@ -144,9 +150,10 @@ export class RdDBaseActor extends Actor {
|
||||
.forEach(async it => await it.onFinPeriodeTemporel(oldTimestamp, newTimestamp))
|
||||
}
|
||||
|
||||
async creerObjetParMJ(object){
|
||||
async creerObjetParMJ(object) {
|
||||
if (!Misc.isUniqueConnectedGM()) {
|
||||
RdDBaseActor.remoteActorCall({
|
||||
tokenId: this.token?.id,
|
||||
actorId: this.id,
|
||||
method: 'creerObjetParMJ',
|
||||
args: [object]
|
||||
@ -220,6 +227,7 @@ export class RdDBaseActor extends Actor {
|
||||
if (fromActorId && !game.user.isGM) {
|
||||
RdDBaseActor.remoteActorCall({
|
||||
userId: Misc.connectedGMOrUser(),
|
||||
tokenId: this.token?.id,
|
||||
actorId: this.id,
|
||||
method: 'ajouterSols', args: [sols, fromActorId]
|
||||
});
|
||||
@ -262,7 +270,7 @@ export class RdDBaseActor extends Actor {
|
||||
const quantite = (achat.choix.nombreLots ?? 1) * (achat.vente.tailleLot);
|
||||
const itemVendu = vendeur?.getItem(achat.vente.item._id) ?? game.items.get(achat.vente.item._id);
|
||||
if (!itemVendu) {
|
||||
ChatUtility.notifyUser(achat.userId, 'warn', vendeur ? `Le vendeur n'a pas plus de ${achat.vente.item.name} !`: `Impossible de retrouver: ${achat.vente.item.name} !`);
|
||||
ChatUtility.notifyUser(achat.userId, 'warn', vendeur ? `Le vendeur n'a pas plus de ${achat.vente.item.name} !` : `Impossible de retrouver: ${achat.vente.item.name} !`);
|
||||
return;
|
||||
}
|
||||
if (vendeur && !vendeur.verifierQuantite(itemVendu, quantite)) {
|
||||
@ -447,62 +455,33 @@ export class RdDBaseActor extends Actor {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
conteneurPeutContenir(dest, item) {
|
||||
conteneurPeutContenir(dest, moved) {
|
||||
if (!dest) {
|
||||
return true;
|
||||
}
|
||||
if (!dest.isConteneur()) {
|
||||
return false;
|
||||
}
|
||||
const destData = dest
|
||||
if (this._isConteneurContenu(item, dest)) {
|
||||
ui.notifications.warn(`Impossible de déplacer un conteneur parent (${item.name}) dans un de ses contenus ${destData.name} !`);
|
||||
return false; // Loop detected !
|
||||
if (moved.isConteneurContenu(dest)) {
|
||||
ui.notifications.warn(`Impossible de déplacer un conteneur parent (${moved.name}) dans un de ses contenus ${dest.name} !`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calculer le total actuel des contenus
|
||||
let encContenu = this.getRecursiveEnc(dest) - Number(destData.system.encombrement);
|
||||
let newEnc = this.getRecursiveEnc(item); // Calculer le total actuel du nouvel objet
|
||||
const encContenu = dest.getEncContenu();
|
||||
const newEnc = moved.getEncTotal(); // Calculer le total actuel du nouvel objet
|
||||
const placeDisponible = Math.roundDecimals(dest.system.capacite - encContenu - newEnc, 4)
|
||||
|
||||
// Teste si le conteneur de destination a suffisament de capacité pour recevoir le nouvel objet
|
||||
if (Number(destData.system.capacite) < encContenu + newEnc) {
|
||||
if (placeDisponible < 0) {
|
||||
ui.notifications.warn(
|
||||
`Le conteneur ${dest.name} a une capacité de ${destData.system.capacite}, et contient déjà ${encContenu}.
|
||||
Impossible d'y ranger: ${item.name} d'encombrement ${newEnc}!`);
|
||||
`Le conteneur ${dest.name} a une capacité de ${dest.system.capacite}, et contient déjà ${encContenu}.
|
||||
Impossible d'y ranger: ${moved.name} d'encombrement ${newEnc}!`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_isConteneurContenu(item, conteneur) {
|
||||
if (item?.isConteneur()) { // Si c'est un conteneur, il faut vérifier qu'on ne le déplace pas vers un sous-conteneur lui appartenant
|
||||
for (let id of item.system.contenu) {
|
||||
let subObjet = this.getItem(id);
|
||||
if (subObjet?.id == conteneur.id) {
|
||||
return true; // Loop detected !
|
||||
}
|
||||
if (subObjet?.isConteneur()) {
|
||||
return this._isConteneurContenu(subObjet, conteneur);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getRecursiveEnc(objet) {
|
||||
if (!objet) {
|
||||
return 0;
|
||||
}
|
||||
const tplData = objet.system;
|
||||
if (objet.type != 'conteneur') {
|
||||
return Number(tplData.encombrement) * Number(tplData.quantite);
|
||||
}
|
||||
const encContenus = tplData.contenu.map(idContenu => this.getRecursiveEnc(this.getItem(idContenu)));
|
||||
return encContenus.reduce(Misc.sum(), 0)
|
||||
+ Number(tplData.encombrement) /* TODO? Number(tplData.quantite) -- on pourrait avoir plusieurs conteneurs...*/
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** Ajoute un item dans un conteneur, sur la base
|
||||
* de leurs ID */
|
||||
|
@ -114,7 +114,7 @@ export class DialogChronologie extends Dialog {
|
||||
heure: RdDTimestamp.definition(this.html.find("form.rdddialogchrono :input[name='chronologie.heure']").val()),
|
||||
minute: this.html.find("form.rdddialogchrono :input[name='chronologie.minute']").val(),
|
||||
},
|
||||
dateReel: this.html.find("form.rdddialogchrono :input[name='dateReel']").val()
|
||||
dateReel: this.html.find("form.rdddialogchrono :input[name='dateReel']").val().replace('T', ' ')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,6 +395,16 @@ export class RdDItem extends Item {
|
||||
return Math.max(this.system.encombrement ?? 0, 0);
|
||||
}
|
||||
|
||||
getEncContenu() {
|
||||
return this.getContenu()
|
||||
.map(it => it.getRecursiveEnc())
|
||||
.reduce(Misc.sum(), 0);
|
||||
}
|
||||
|
||||
getRecursiveEnc() {
|
||||
return this.getEncTotal() + this.getEncContenu()
|
||||
}
|
||||
|
||||
getEncHerbe() {
|
||||
switch (this.system.categorie) {
|
||||
case 'Repos': case 'Soin': case 'Alchimie':
|
||||
@ -404,6 +414,18 @@ export class RdDItem extends Item {
|
||||
|
||||
}
|
||||
|
||||
getContenu() {
|
||||
if (this.isConteneur()) {
|
||||
return this.system.contenu.map(idContenu => this.actor.getItem(idContenu));
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
isConteneurContenu(conteneur) {
|
||||
return this.getContenu()
|
||||
.find(it => it.id == conteneur.id || it.isConteneurContenu(conteneur))
|
||||
}
|
||||
|
||||
valeurTotale() {
|
||||
return (this.isService() ? 1 : this.getQuantite()) * this.valeur()
|
||||
}
|
||||
@ -675,7 +697,7 @@ export class RdDItem extends Item {
|
||||
_armeChatData() {
|
||||
return [
|
||||
`<b>Compétence</b>: ${this.system.competence}`,
|
||||
`<b>Dommages</b>: ${this.system.dommages} ${this.system.mortalite=='non-mortel'? '(Non mortel)':''}`,
|
||||
`<b>Dommages</b>: ${this.system.dommages} ${this.system.mortalite == 'non-mortel' ? '(Non mortel)' : ''}`,
|
||||
`<b>Force minimum</b>: ${this.system.force}`,
|
||||
`<b>Resistance</b>: ${this.system.resistance}`,
|
||||
...this._inventaireTemplateChatData()
|
||||
|
@ -789,7 +789,7 @@ export class RdDCombat {
|
||||
let rollData = {
|
||||
passeArme: randomID(16),
|
||||
mortalite: arme?.system.mortalite,
|
||||
competence: competence.clone(),
|
||||
competence: competence,
|
||||
surprise: this.attacker.getSurprise(true),
|
||||
surpriseDefenseur: this.defender.getSurprise(true),
|
||||
targetToken: Targets.extractTokenData(this.target),
|
||||
@ -1044,7 +1044,7 @@ export class RdDCombat {
|
||||
passeArme: attackerRoll.passeArme,
|
||||
diffLibre: attackerRoll.diffLibre,
|
||||
attackerRoll: attackerRoll,
|
||||
competence: this.defender.getCompetence(competenceParade).clone(),
|
||||
competence: this.defender.getCompetence(competenceParade),
|
||||
arme: armeParade,
|
||||
surprise: this.defender.getSurprise(true),
|
||||
needParadeSignificative: ReglesOptionnelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(attackerRoll.arme, armeParade),
|
||||
@ -1125,7 +1125,7 @@ export class RdDCombat {
|
||||
passeArme: attackerRoll.passeArme,
|
||||
diffLibre: attackerRoll.diffLibre,
|
||||
attackerRoll: attackerRoll,
|
||||
competence: competence.clone(),
|
||||
competence: competence,
|
||||
surprise: this.defender.getSurprise(true),
|
||||
surpriseDefenseur: this.defender.getSurprise(true),
|
||||
carac: this.defender.system.carac,
|
||||
|
@ -181,7 +181,7 @@ export class RdDEmpoignade {
|
||||
let rollData = {
|
||||
mode, empoignade, attacker, defender,
|
||||
isEmpoignade: true,
|
||||
competence: attacker.getCompetence("Corps à corps").clone(),
|
||||
competence: attacker.getCompetence("Corps à corps"),
|
||||
selectedCarac: attacker.system.carac.melee,
|
||||
malusTaille: RdDEmpoignade.getMalusTaille(empoignade, attacker, defender)
|
||||
}
|
||||
@ -210,7 +210,7 @@ export class RdDEmpoignade {
|
||||
mode: "immobilise",
|
||||
empoignade, attacker, defender,
|
||||
isEmpoignade: true,
|
||||
competence: attacker.getCompetence("Corps à corps").clone()
|
||||
competence: attacker.getCompetence("Corps à corps")
|
||||
}
|
||||
const msg = await ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(attacker.name),
|
||||
@ -272,7 +272,7 @@ export class RdDEmpoignade {
|
||||
mode, attacker, defender, empoignade, attackerRoll,
|
||||
diffLibre: attackerRoll.diffLibre,
|
||||
attaqueParticuliere: attackerRoll.particuliere,
|
||||
competence: defender.getCompetence(competenceName).clone(),
|
||||
competence: defender.getCompetence(competenceName),
|
||||
surprise: defender.getSurprise(true),
|
||||
carac: defender.system.carac,
|
||||
selectedCarac: defender.system.carac[carac],
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { TYPES } from "./item.js";
|
||||
|
||||
export class RdDHotbar {
|
||||
|
||||
static async addToHotbar(item, slot) {
|
||||
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}");`;
|
||||
static async createItemMacro(item, slot, armeCompetence = undefined) {
|
||||
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}"` + ((armeCompetence) ? `, "${armeCompetence}");` : `);`);
|
||||
let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command));
|
||||
if (!macro) {
|
||||
macro = await Macro.create({
|
||||
@ -15,6 +16,33 @@ export class RdDHotbar {
|
||||
await game.user.assignHotbarMacro(macro, slot);
|
||||
}
|
||||
|
||||
static async addToHotbar(item, slot) {
|
||||
switch (item?.type ?? "") {
|
||||
case TYPES.arme:
|
||||
{
|
||||
// Les armes peuvent avoir plusieurs usages
|
||||
if (item.system.competence != "") {
|
||||
await this.createItemMacro(item, slot, "competence")
|
||||
slot++
|
||||
}
|
||||
if (item.system.lancer != "") {
|
||||
await this.createItemMacro(item, slot, "lancer")
|
||||
slot++
|
||||
}
|
||||
if (item.system.tir != "") {
|
||||
await this.createItemMacro(item, slot, "lancer")
|
||||
slot++
|
||||
}
|
||||
}
|
||||
return
|
||||
case TYPES.competence:
|
||||
case TYPES.competencecreature:
|
||||
default:
|
||||
await this.createItemMacro(item, slot)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a macro when dropping an entity on the hotbar
|
||||
* Item - open roll dialog for item
|
||||
@ -27,16 +55,16 @@ export class RdDHotbar {
|
||||
|
||||
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
|
||||
if (documentData.type == "Item") {
|
||||
let item = fromUuidSync(documentData.uuid)
|
||||
if (item == undefined) {
|
||||
item = this.actor.items.get(documentData.uuid)
|
||||
}
|
||||
const item = fromUuidSync(documentData.uuid) ?? this.actor.items.get(documentData.uuid)
|
||||
console.log("DROP", documentData, item)
|
||||
if (!item || (item.type != "arme" && item.type != "competence")) {
|
||||
return true
|
||||
switch (item?.type ?? "")
|
||||
{
|
||||
case TYPES.arme:
|
||||
case TYPES.competence:
|
||||
case TYPES.competencecreature:
|
||||
this.addToHotbar(item, slot)
|
||||
return false
|
||||
}
|
||||
this.addToHotbar(item, slot)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
@ -44,12 +72,14 @@ export class RdDHotbar {
|
||||
}
|
||||
|
||||
/** Roll macro */
|
||||
static rollMacro(itemName, itemType, bypassData) {
|
||||
static rollMacro(itemName, itemType, competenceName) {
|
||||
const speaker = ChatMessage.getSpeaker();
|
||||
let actor;
|
||||
if (speaker.token) actor = game.actors.tokens[speaker.token];
|
||||
if (!actor) actor = game.actors.get(speaker.actor);
|
||||
|
||||
if (!actor) {
|
||||
return ui.notifications.warn(`Impossible de trouver le personnage concerné`);
|
||||
}
|
||||
let item = actor?.items.find(it => it.name === itemName && it.type == itemType) ?? undefined;
|
||||
if (!item) {
|
||||
return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`);
|
||||
@ -57,9 +87,10 @@ export class RdDHotbar {
|
||||
|
||||
// Trigger the item roll
|
||||
switch (item.type) {
|
||||
case "arme":
|
||||
return actor.rollArme(item);
|
||||
case "competence":
|
||||
case TYPES.arme:
|
||||
return actor.rollArme(item, competenceName);
|
||||
case TYPES.competence:
|
||||
case TYPES.competencecreature:
|
||||
return actor.rollCompetence(itemName);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -39,7 +39,7 @@ export class RdDPossession {
|
||||
let rollData = {
|
||||
mode: "attaque",
|
||||
isECNIDefender: false,
|
||||
competence: competence.clone(),
|
||||
competence: competence,
|
||||
possession: possession,
|
||||
attacker: attacker,
|
||||
defender: defender,
|
||||
|
@ -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,33 +85,22 @@ 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 maximize() {
|
||||
await super.maximize()
|
||||
this.render(true)
|
||||
}*/
|
||||
|
||||
async close() { }
|
||||
|
||||
async onUpdateSetting(setting, update, options, id) {
|
||||
@ -134,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;
|
||||
}
|
||||
|
||||
@ -144,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');
|
||||
@ -229,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: [],
|
||||
@ -272,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;
|
||||
@ -282,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;
|
||||
@ -452,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,14 +1,13 @@
|
||||
{
|
||||
"id": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"version": "11.0.13",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.0.13.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": {
|
||||
"minimum": "11",
|
||||
"verified": "11",
|
||||
"maximum": "11"
|
||||
"verified": "11"
|
||||
},
|
||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||
"authors": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{#if use.moral}}
|
||||
<span>
|
||||
Vous avez fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du déspoir{{/if}}
|
||||
Vous avez fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du désespoir{{/if}}
|
||||
{{#if (eq perteMoralEchec 'dissolution')}}et échoué, cous marquez un point de dissolution!.
|
||||
{{else if (eq perteMoralEchec 'perte')}}et échoué, votre moral baisse à {{moral}}.
|
||||
{{else}}et réussi, votre moral reste de {{moral}}.
|
||||
|
@ -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' }}
|
||||
|
Reference in New Issue
Block a user