#171 - Gestion potion de soins (WIP)
This commit is contained in:
parent
e4f432c781
commit
a5561b7b88
@ -3049,6 +3049,13 @@ export class RdDActor extends Actor {
|
||||
await this.update({ 'data.subacteurs.suivants': newSuivants });
|
||||
await this.update({ 'data.subacteurs.montures': newMontures });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
consommerPotion( potion ) {
|
||||
const potionData = Misc.data(potion);
|
||||
console.log("Potion consommée", potionData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async onUpdateActor(update, options, actorId) {
|
||||
const updatedEndurance = update?.data?.sante?.endurance;
|
||||
|
@ -67,7 +67,7 @@ export class RdDItemCompetence extends Item {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getNiveauBase(category) {
|
||||
return categorieCompetences[category].niveau;
|
||||
return categorieCompetences[category].base;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getLabelCategorie(category) {
|
||||
|
@ -3,6 +3,7 @@ import { RdDUtility } from "./rdd-utility.js";
|
||||
import { RdDItem } from "./item-rdd.js";
|
||||
import { RdDAlchimie } from "./rdd-alchimie.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { RdDHerbes } from "./rdd-herbes.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
/**
|
||||
@ -49,7 +50,6 @@ export class RdDItemSheet extends ItemSheet {
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const objectData = Misc.data(this.object);
|
||||
console.log("3", objectData);
|
||||
|
||||
let formData ={
|
||||
title: objectData.name,
|
||||
@ -62,6 +62,8 @@ export class RdDItemSheet extends ItemSheet {
|
||||
owner: this.document.isOwner,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
isSoins: false,
|
||||
isEnchante: false
|
||||
}
|
||||
formData.categorieCompetences = RdDItemCompetence.getCategorieCompetences();
|
||||
if ( formData.type == 'tache' || formData.type == 'livre' || formData.type == 'meditation' || formData.type == 'oeuvre') {
|
||||
@ -75,6 +77,14 @@ export class RdDItemSheet extends ItemSheet {
|
||||
if ( formData.type == 'recettealchimique' ) {
|
||||
RdDAlchimie.processManipulation(objectData, this.actor && this.actor.id );
|
||||
}
|
||||
if ( formData.type == 'potion') {
|
||||
if (this.dateUpdated) {
|
||||
formData.data.prdate = this.dateUpdated;
|
||||
this.dateUpdated = undefined;
|
||||
}
|
||||
RdDHerbes.updatePotionData(formData);
|
||||
}
|
||||
|
||||
if ( this.actor ) {
|
||||
formData.isOwned = true;
|
||||
formData.actorId = this.actor.id;
|
||||
@ -94,6 +104,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
|
||||
// Select competence categorie
|
||||
html.find(".categorie").on("click", this._onClickSelectCategorie.bind(this) );
|
||||
html.find(".categoriepotion").on("click", this.render(true) );
|
||||
|
||||
html.find('.sheet-competence-xp').change((event) => {
|
||||
if ( this.object.data.type == 'competence') {
|
||||
@ -101,11 +112,22 @@ export class RdDItemSheet extends ItemSheet {
|
||||
}
|
||||
} );
|
||||
|
||||
html.find('.enchanteDate').change((event) => {
|
||||
let jour = Number($('#jourMois').val());
|
||||
let mois = $('#nomMois').val();
|
||||
this.dateUpdated = game.system.rdd.calendrier.getIndexFromDate(jour, mois);
|
||||
});
|
||||
|
||||
html.find('.creer-tache-livre').click((event) => {
|
||||
let actorId = event.currentTarget.attributes['data-actor-id'].value;
|
||||
let actor = game.actors.get( actorId );
|
||||
actor.creerTacheDepuisLivre( this.item );
|
||||
});
|
||||
html.find('.consommer-potion').click((event) => {
|
||||
let actorId = event.currentTarget.attributes['data-actor-id'].value;
|
||||
let actor = game.actors.get( actorId );
|
||||
actor.consommerPotion( this.item );
|
||||
});
|
||||
|
||||
html.find('.alchimie-tache a').click((event) => {
|
||||
let actorId = event.currentTarget.attributes['data-actor-id'].value;
|
||||
|
@ -39,7 +39,7 @@ export class RdDCalendrier extends Application {
|
||||
async initCalendrier() {
|
||||
// Calendrier
|
||||
this.calendrier = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "calendrier"));
|
||||
console.log("CALENDRIER", this.calendrier);
|
||||
//console.log("CALENDRIER", this.calendrier);
|
||||
if (this.calendrier == undefined || this.calendrier.moisRdD == undefined) {
|
||||
this.calendrier.heureRdD = 0; // Index dans heuresList
|
||||
this.calendrier.minutesRelative = 0;
|
||||
@ -88,6 +88,14 @@ export class RdDCalendrier extends Application {
|
||||
return day + " " + heuresList[month];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getNumericDateFromIndex(index = undefined) {
|
||||
if (!index) index = this.getCurrentDayIndex();
|
||||
let month = Math.floor(index / 28)
|
||||
return { month: heuresList[month],
|
||||
day: (index - (month * 28)) + 1 }
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCurrentHeure() {
|
||||
return heuresList[this.calendrier.heureRdD];
|
||||
@ -98,6 +106,10 @@ export class RdDCalendrier extends Application {
|
||||
return (this.calendrier.moisRdD * 28) + this.calendrier.jour;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getIndexFromDate(jour, mois) {
|
||||
return (heuresDef[mois].heure * 28) + (jour-1);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getJoursSuivants(num) {
|
||||
let jours = [];
|
||||
|
@ -22,13 +22,13 @@ import { RdDTokenHud } from "./rdd-token-hud.js";
|
||||
import { RdDCommands } from "./rdd-commands.js";
|
||||
import { RdDCombatManager, RdDCombat } from "./rdd-combat.js";
|
||||
import { ChatUtility } from "./chat-utility.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { StatusEffects } from "./status-effects.js";
|
||||
import { RddCompendiumOrganiser } from "./rdd-compendium-organiser.js";
|
||||
import { ReglesOptionelles } from "./regles-optionelles.js";
|
||||
import { TMRRencontres } from "./tmr-rencontres.js";
|
||||
import { RdDHotbar } from "./rdd-hotbar-drop.js"
|
||||
import { EffetsDraconiques } from "./tmr/effets-draconiques.js";
|
||||
import { RdDHerbes } from "./rdd-herbes.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
@ -186,6 +186,7 @@ function messageDeBienvenue() {
|
||||
Hooks.once("ready", function () {
|
||||
|
||||
StatusEffects.onReady();
|
||||
RdDHerbes.initializeHerbes();
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Affiche/Init le calendrier */
|
||||
|
@ -2,11 +2,11 @@
|
||||
"name": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"manifestPlusVersion": "1.0.0",
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.7.9",
|
||||
"templateVersion": 110,
|
||||
"templateVersion": 111,
|
||||
"author": "LeRatierBretonnien",
|
||||
"authors": [
|
||||
{
|
||||
|
@ -723,9 +723,11 @@
|
||||
"encombrement": 0,
|
||||
"rarete": "",
|
||||
"categorie": "",
|
||||
"soinherbe": "",
|
||||
"soinherbebonus": 0,
|
||||
"herbe": "",
|
||||
"herbebrins": 0,
|
||||
"herbebonus": 0,
|
||||
"pr": 0,
|
||||
"prpermanent": false,
|
||||
"prdate": 0,
|
||||
"cout": 0
|
||||
},
|
||||
|
@ -1,7 +1,10 @@
|
||||
<option value=""></option>
|
||||
<option value="Alchimie">Potion d'Alchimie</option>
|
||||
<option value="AlchimieEnchante">Potion d'Alchimie Enchantée</option>
|
||||
<option value="Cuisine">Potion de Cuisine</option>
|
||||
<option value="Repos">Potion de Repos</option>
|
||||
<option value="ReposEnchante">Potion de Repos Enchantée</option>
|
||||
<option value="Soin">Potion de Soin</option>
|
||||
<option value="SoinEnchante">Potion de Soin Enchantée</option>
|
||||
<option value="Autre">Potion Autre</option>
|
||||
<option value="AutreEnchante">Potion Autre Enchantée</option>
|
||||
|
@ -30,32 +30,66 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Catégorie</label>
|
||||
<select name="data.categorie" class="categorie" data-dtype="String">
|
||||
<select name="data.categorie" class="categoriepotion" data-dtype="String">
|
||||
{{#select data.categorie}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-categorie-ingredient.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
{{#if isHerbe}}
|
||||
<div class="form-group">
|
||||
<label>Herbe</label>
|
||||
<select name="data.soinherbe" class="soinherbe" data-dtype="String">
|
||||
{{#select data.soinherbe}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-herbesoin-ingredient.html"}}
|
||||
{{/select}}
|
||||
<select name="data.herbe" class="herbe" data-dtype="String">
|
||||
{{selectOptions herbesSoins selected=data.herbe localize=false}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Bonus de l'herbe</label>
|
||||
<input class="attribute-value" type="text" name="data.soinherbebonus" value="{{data.soinherbebonus}}" data-dtype="Number" />
|
||||
<label>Nombre de brins</label>
|
||||
<input class="attribute-value" type="text" name="data.herbebrins" value="{{data.herbebrins}}" data-dtype="Number" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Points de rêve investis</label>
|
||||
<label>Bonus</label>
|
||||
<input class="attribute-value" type="text" name="data.herbebonus" value="{{data.herbebonus}}" data-dtype="Number" />
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if isEnchante}}
|
||||
<div class="form-group">
|
||||
<label>Points de rêve</label>
|
||||
<input class="attribute-value" type="text" name="data.pr" value="{{data.pr}}" data-dtype="Number" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Date de l'Enchantement</label>
|
||||
<input class="attribute-value" type="text" name="data.prdate" value="{{data.prdate}}" data-dtype="Number" />
|
||||
<label for="xp">Permanente ? </label>
|
||||
<input class="attribute-value" type="checkbox" name="data.prpermanent" {{#if data.prpermanent}}checked{{/if}}/>
|
||||
</div>
|
||||
{{#if isHerbe}}
|
||||
<div class="form-group">
|
||||
<label for="xp">Points de guérison </label>
|
||||
<label for="xp">{{pointsGuerison}}</label>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="form-group">
|
||||
<label>Date de l'Enchantement : Jour/Mois (date actuelle : {{dateActuelle}})</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select name="splitDate.day" class="enchanteDate" id="jourMois" data-dtype="String">
|
||||
{{#select splitDate.day}}
|
||||
{{#each jourMoisOptions as |key|}}
|
||||
<option value="{{key}}">{{numberFormat key decimals=0}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<select name="splitDate.month" class="enchanteDate" id="nomMois" data-dtype="String">
|
||||
{{#select splitDate.month}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/heures-select-option.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if isOwned}}
|
||||
<div class="form-group">
|
||||
<span for="xp"><a class="consommer-potion" data-actor-id="{{actorId}}">Consommer cette potion</a></span>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="flexcol">
|
||||
<span><label>Description :</label></span>
|
||||
<div class="form-group editor">
|
||||
|
Loading…
Reference in New Issue
Block a user