#60 : Affichage spécial pour les joueurs non reliés à un personnage

This commit is contained in:
sladecraven 2020-12-04 10:15:55 +01:00
parent 725623374e
commit a831e8b0b2
3 changed files with 36 additions and 5 deletions

View File

@ -71,17 +71,23 @@ export class RdDActor extends Actor {
super.prepareData();
const actorData = this.data;
const data = actorData.data;
const flags = actorData.flags;
// Dynamic computing fields
this.encombrementTotal = 0;
/*
// Auto-resize token
if (this.isToken) {
let tokenSize = actorData.data.carac.taille.value/10;
this.token.update({height: tokenSize, width: tokenSize } );
}*/
// Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized.
if (actorData.type === 'personnage') this._prepareCharacterData(actorData);
if (actorData.type === 'creature') this.computeEtatGeneral(actorData);
if (actorData.type === 'humanoide') this.computeEtatGeneral(actorData);
}
/* -------------------------------------------- */

View File

@ -191,6 +191,7 @@ Hooks.once("renderApplication", () => {
messageDeBienvenue();
});
/* -------------------------------------------- */
function messageDeBienvenue(){
game.messages
.filter(it => it.user._id == game.user._id && it.data.content.match(/^Bienvenu(e)? dans le Rêve des Dragons/))
@ -208,14 +209,34 @@ function messageDeBienvenue(){
/* -------------------------------------------- */
Hooks.once("ready", function() {
/* Affiche le calendrier */
let calendrier = new RdDCalendrier();
let templatePath = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html";
let templateData = {};
//let calendrier = new RdDCalendrier();
//let templatePath = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html";
//let templateData = {};
/* DISABLEDrenderTemplate(templatePath, templateData).then(html => {
calendrier.render(true);
} ); */
// Avertissement si joueur sans personnage
if ( !game.user.isGM && game.user.character == undefined) {
ui.notifications.info( "Attention ! Vous n'êtes connecté à aucun personnage !" );
ChatMessage.create( { content:"<b>ATTENTION</b> Le joueur " + game.user.name + " n'est connecté à aucun personnage !",
user: game.user._id } );
//whisper: [ ChatMessage.getWhisperRecipients("GM") ] } );
}
});
/* -------------------------------------------- */
/* Abandonné pour l'instant
Hooks.on("preCreateToken", (scene, tokenData, options) => {
let actor = game.actors.get( tokenData.actorId )
if (actor) {
let tokenSize = actor.data.data.carac.taille.value / 10;
tokenData.width = tokenSize;
tokenData.height = tokenSize;
}
console.log("PRECREATE:", scene, tokenData, options);
});*/
/* -------------------------------------------- */
/* Foundry VTT Initialization */
/* -------------------------------------------- */

View File

@ -705,6 +705,10 @@ export class RdDUtility {
static _handleMsgDefense(data) {
let defenderToken = canvas.tokens.get(data.defenderTokenId);
if (defenderToken) {
if ( !game.user.isGM && game.user.character == undefined) { // vérification / sanity check
ui.notifications.error("Le joueur " + game.user.name + " n'est connecté à aucun personnage. Impossible de continuer.");
return;
}
if ((game.user.isGM && !defenderToken.actor.hasPlayerOwner) || (defenderToken.actor.hasPlayerOwner && (game.user.character.id == defenderToken.actor.data._id))) {
console.log("User is pushing message...", game.user.name);
game.system.rdd.rollDataHandler[data.attackerid] = duplicate(data.rollData);