#52 Travaux en progres....
This commit is contained in:
parent
be825ffa8a
commit
808cd7296d
@ -1414,6 +1414,7 @@ export class RdDActor extends Actor {
|
||||
dialog.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _rollCaracResult(rollData) {
|
||||
let rolled = rollData.rolled;
|
||||
|
||||
@ -1515,9 +1516,9 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
astrologieNombresAstraux( ) {
|
||||
async astrologieNombresAstraux( ) {
|
||||
// Afficher l'interface spéciale
|
||||
const myDialog = RdDAstrologieJoueur.create( this, {} );
|
||||
const myDialog = await RdDAstrologieJoueur.create( this, {} );
|
||||
myDialog.render(true);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDCalendrier } from "./rdd-calendrier.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
/**
|
||||
* Extend the base Dialog entity by defining a custom window to perform roll.
|
||||
@ -9,12 +11,16 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
/* -------------------------------------------- */
|
||||
static async create(actor, dialogConfig) {
|
||||
|
||||
let data = { nombres: actor.data.items.filter( (item) => item.type == 'nombreastral')
|
||||
let data = { nombres: actor.data.items.filter( (item) => item.type == 'nombreastral') ,
|
||||
dates: game.system.rdd.calendrier.getJoursSuivants( 10 ),
|
||||
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||
astrologie: RdDUtility.findCompetence( actor.data.items, 'Astrologie')
|
||||
}
|
||||
console.log("DATA", data);
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', data);
|
||||
let options = { classes: ["rdddialog"], width: 600, height: 500, 'z-index': 99999 };
|
||||
if (dialogConfig.options) {
|
||||
mergeObject(options, dialogConfig.options, { overwrite: true })
|
||||
mergeObject(options, dialogConfig.options, { overwrite: true });
|
||||
}
|
||||
return new RdDAstrologieJoueur(html, actor, data);
|
||||
}
|
||||
@ -23,7 +29,7 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
constructor(html, actor, data ) {
|
||||
|
||||
let myButtons = {
|
||||
saveButton: { label: "Fermer", callback: html => this.fillData() }
|
||||
saveButton: { label: "Fermer", callback: html => this.fillData() }
|
||||
};
|
||||
|
||||
// Get all n
|
||||
@ -36,6 +42,24 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
this.dataNombreAstral = duplicate(data);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
requestJetAstrologie( ) {
|
||||
let data = { id: this.actor.data._id,
|
||||
carac_vue: this.actor.data.data.carac['vue'].value,
|
||||
astrologie: this.dataNombreAstral.astrologie,
|
||||
conditions: $("#diffConditions").val(),
|
||||
date: $("#joursAstrologie").val()
|
||||
}
|
||||
if ( game.user.isGM) {
|
||||
game.system.rdd.calendrier.requestNombreAstral( data );
|
||||
} else {
|
||||
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||
msg: "msg_request_nombre_astral",
|
||||
data: data
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
fillData() {
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
import { RdDCalendrierEditeur } from "./rdd-calendrier-editeur.js";
|
||||
import { RdDAstrologieEditeur } from "./rdd-astrologie-editeur.js";
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
|
||||
@ -84,6 +86,17 @@ export class RdDCalendrier extends Application {
|
||||
return (this.calendrier.moisRdD * 28) + this.calendrier.jour;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getJoursSuivants( num) {
|
||||
let jours = [];
|
||||
let index = this.getCurrentDayIndex();
|
||||
for (let i=0; i<num; i++) {
|
||||
jours[i] = { label: this.getDateFromIndex(index), index: index };
|
||||
index += 1;
|
||||
}
|
||||
return jours;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
ajouterNombreAstral(index) {
|
||||
return {
|
||||
@ -98,7 +111,12 @@ export class RdDCalendrier extends Application {
|
||||
let index = this.getCurrentDayIndex();
|
||||
let astralData = this.listeNombreAstral.find( (nombreAstral, i) => nombreAstral.index == index );
|
||||
return astralData.nombreAstral || "N/A";
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getNombreAstral( index ) {
|
||||
let astralData = this.listeNombreAstral.find( (nombreAstral, i) => nombreAstral.index == index );
|
||||
return astralData.nombreAstral || "N/A";
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -203,6 +221,43 @@ export class RdDCalendrier extends Application {
|
||||
return data;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getLectureAstrologieDifficulte( dateIndex ) {
|
||||
let indexNow = this.getCurrentDayIndex();
|
||||
let diffDay = dateIndex - indexNow;
|
||||
return - Math.floor(diffDay / 2);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async requestNombreAstral( request) {
|
||||
if ( game.user.isGM) { // Only GM
|
||||
console.log( request );
|
||||
let jourDiff = this.getLectureAstrologieDifficulte( request.date);
|
||||
let niveau = Number(request.astrologie.data.niveau) + Number(request.conditions) + Number(jourDiff);
|
||||
let rolled = await RdDResolutionTable.roll(request.carac_vue, niveau, undefined, false);
|
||||
|
||||
let nbAstral = this.getNombreAstral( request.date );
|
||||
let nbAstralFaux = nbAstral;
|
||||
request.isValid = true;
|
||||
if ( !rolled .isSuccess ) {
|
||||
request.isValid = false;
|
||||
while ( nbAstralFaux == nbAstral ) {
|
||||
nbAstralFaux = new Roll("1d12").roll().total;
|
||||
}
|
||||
nbAstral = nbAstralFaux;
|
||||
}
|
||||
request.nbAstral = nbAstral;
|
||||
if ( game.user.isGM) {
|
||||
RdDUtility.responseNombreAstral( request );
|
||||
} else {
|
||||
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||
msg: "msg_response_nombre_astral",
|
||||
data: request
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getAjustementAstrologique(heureNaissance)
|
||||
{
|
||||
|
@ -103,9 +103,9 @@ export class RdDResolutionTable {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async roll(caracValue, finalLevel, bonus = undefined ) {
|
||||
static async roll(caracValue, finalLevel, bonus = undefined, showDice = true ) {
|
||||
let chances = this.computeChances(caracValue, finalLevel);
|
||||
chances.showDice = true;
|
||||
chances.showDice = showDice;
|
||||
this.updateChancesWithBonus( chances, bonus);
|
||||
let rolled = await this.rollChances(chances);
|
||||
rolled.caracValue = caracValue;
|
||||
|
@ -214,7 +214,6 @@ export class RdDRoll extends Dialog {
|
||||
$("#addon-message").text("");
|
||||
}
|
||||
|
||||
|
||||
let diffCompetence = 0;
|
||||
if (rollData.competence) {
|
||||
diffCompetence = Misc.toInt(rollData.competence.data.niveau);
|
||||
|
@ -718,6 +718,14 @@ export class RdDUtility {
|
||||
return defenseMsg;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async responseNombreAstral( data ) {
|
||||
let actor = game.actors.get( data.id);
|
||||
const item = {name: "Nombre Astral", type: "nombreastral", data:
|
||||
{ value: data.nbAstral, istrue: data.isvalid, jourindex: Number(data.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex( Number(data.date) ) } };
|
||||
await actor.createEmbeddedEntity("OwnedItem", item);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static performSocketMesssage( sockmsg )
|
||||
{
|
||||
@ -731,6 +739,10 @@ export class RdDUtility {
|
||||
return ChatUtility.handleGMChatMessage(sockmsg.data);
|
||||
case "msg_sync_time":
|
||||
return game.system.rdd.calendrier.syncPlayerTime( sockmsg.data );
|
||||
case "msg_request_nombre_astral":
|
||||
return game.system.rdd.calendrier.requestNombreAstral( sockmsg.data );
|
||||
case "msg_response_nombre_astral":
|
||||
return RdDUtility.responseNombreAstral( sockmsg.data );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -571,6 +571,7 @@ ul, li {
|
||||
.arme-label,
|
||||
.generic-label,
|
||||
.competence-label,
|
||||
.astrologie-label,
|
||||
.description-label {
|
||||
flex-grow: 2;
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
"name": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.7",
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.7.8",
|
||||
"templateVersion": 61,
|
||||
"templateVersion": 66,
|
||||
"author": "LeRatierBretonnien",
|
||||
"esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ],
|
||||
"styles": ["styles/simple.css"],
|
||||
|
@ -531,7 +531,7 @@
|
||||
}
|
||||
},
|
||||
"Item": {
|
||||
"types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", "tete", "competencecreature", "tarot", "monnaie"],
|
||||
"types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", "tete", "competencecreature", "tarot", "monnaie", "nombreastral"],
|
||||
"objet": {
|
||||
"description": "",
|
||||
"quantite": 1,
|
||||
@ -690,7 +690,8 @@
|
||||
"nombreastral": {
|
||||
"value": 0,
|
||||
"istrue": false,
|
||||
"jourindex": 1
|
||||
"jourindex": 1,
|
||||
"jourlabel": ""
|
||||
},
|
||||
"monnaie": {
|
||||
"quantite": "",
|
||||
|
@ -541,7 +541,7 @@
|
||||
</span>
|
||||
</li>
|
||||
<li class="item flexrow" >
|
||||
<span class="competence-label"><a id="jet-astrologie">Astrologie : Nombres Astraux</a></span>
|
||||
<span class="astrologie-label"><a id="jet-astrologie">Astrologie : Nombres Astraux</a></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -5,19 +5,37 @@
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<label for="categorie"> Conditions</label>
|
||||
<select name="diffConditions" id="diffConditions" data-dtype="number">
|
||||
{{#select diffConditions}}
|
||||
{{#each ajustementsConditions as |key|}}
|
||||
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<label for="categorie"> Jours</label>
|
||||
<select name="joursAstrologie" id="joursAstrologie" data-dtype="number">
|
||||
{{#select joursSuivants}}
|
||||
{{#each dates as |date key|}}
|
||||
<option value={{date.index}}>{{date.label}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<label for="categorie"> <a id='jet-astrologie'>Faire un jet d'Astrologie</a></label>
|
||||
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
<div class="form-group">
|
||||
<label for="astralList">Nombres Astraux</label>
|
||||
<table border=1>
|
||||
<tr>
|
||||
{{#each astrologieData as |nombreData key|}}
|
||||
<td align="center">{{nombreData.humanDate}}</td>
|
||||
{{#each nombres as |nombreData key|}}
|
||||
<td align="center">{{nombreData.data.jourlabel}}</td>
|
||||
{{/each}}
|
||||
</tr>
|
||||
<tr>
|
||||
{{#each astrologieData as |nombreData key|}}
|
||||
<td align="center">{{nombreData.nombreAstral}}</td>
|
||||
{{#each nombres as |nombreData key|}}
|
||||
<td align="center">{{nombreData.data.value}}</td>
|
||||
{{/each}}
|
||||
</tr>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user