#171 - Gestion potion de soins (WIP)
This commit is contained in:
@ -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 */
|
||||
|
Reference in New Issue
Block a user