Gestion des livres lus et des herbes
This commit is contained in:
@@ -101,6 +101,8 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
cacheTMR: this.actor.isTMRCache()
|
||||
}
|
||||
|
||||
formData.livresLus = formData.livres.filter(l => l.system.lu)
|
||||
|
||||
formData.race = actor.itemTypes[ITEM_TYPES.race].find(it => true)
|
||||
formData.subacteurs = {
|
||||
vehicules: this.actor.listeVehicules(),
|
||||
@@ -212,6 +214,11 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
this.html.find('.action-recettecuisine').click(async event => await this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event)))
|
||||
|
||||
this.html.find('.description-aleatoire').click(async event => new AppPersonnageAleatoire(this.actor).render(true))
|
||||
|
||||
this.html.find('.gerer-herbes').click(async event => {
|
||||
const { DialogGererHerbes } = await import("./dialog-gerer-herbes.js")
|
||||
DialogGererHerbes.create(this.actor)
|
||||
})
|
||||
if (game.user.isGM) {
|
||||
// experience log
|
||||
this.html.find('.experiencelog-delete').click(async event => {
|
||||
|
||||
@@ -92,6 +92,12 @@ const _LIRE = {
|
||||
actorFilter: actor => actor.isPersonnage(),
|
||||
action: (item, actor) => actor.actionLire(item)
|
||||
}
|
||||
const _MARQUER_LU = {
|
||||
code: 'item-marquer-lu', label: 'Marquer comme lu',
|
||||
icon: it => it.system.lu ? 'fa-solid fa-book-open' : 'fa-regular fa-book',
|
||||
actorFilter: actor => actor.isPersonnage(),
|
||||
action: (item, actor) => item.update({ 'system.lu': !item.system.lu })
|
||||
}
|
||||
|
||||
const _REFOULER = {
|
||||
code: 'item-refouler', label: 'Refouler', icon: 'fa-solid fa-burst',
|
||||
@@ -115,7 +121,7 @@ export const ITEM_ACTIONS = {
|
||||
ingredient: [_CUISINER, _MANGER_CRU],
|
||||
conteneur: [_OUVRIR],
|
||||
herbe: [_DECOCTION, _CUISINER, _MANGER_CRU],
|
||||
livre: [_LIRE],
|
||||
livre: [_LIRE, _MARQUER_LU],
|
||||
nourritureboisson: [_MANGER, _BOIRE],
|
||||
ombre: [_REFOULER],
|
||||
plante: [_CUISINER, _MANGER_CRU],
|
||||
|
||||
+6
-4
@@ -3,6 +3,8 @@ import { RdDItem } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { LIST_CARAC_PERSONNAGE, RdDCarac } from "../rdd-carac.js";
|
||||
|
||||
const _warn = msg => ui.notifications?.warn(msg)
|
||||
|
||||
export class RdDItemRace extends RdDItem {
|
||||
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.race }
|
||||
@@ -15,14 +17,14 @@ export class RdDItemRace extends RdDItem {
|
||||
const race = RdDItemRace.getRace(actor)
|
||||
if (code == LIST_CARAC_PERSONNAGE.force.code) {
|
||||
if (!race.isForceValid(actor, value)) {
|
||||
ui.notifications.warn(race.system.carac.force.limitmessage)
|
||||
_warn(race.system.carac.force.limitmessage)
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (code == LIST_CARAC_PERSONNAGE.taille.code) {
|
||||
const carac = RdDCarac.carac(code)
|
||||
if (race.isMax(actor, code, value - 1)) {
|
||||
ui.notifications.warn(`${value} est supérieure au maximum de ${carac.label}`)
|
||||
_warn(`${value} est supérieure au maximum de ${carac.label}`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -73,13 +75,13 @@ export class RdDItemRace extends RdDItem {
|
||||
getValidTaille(taille) {
|
||||
const min = Math.max(this.system.carac.taille.min, 0)
|
||||
if (min > taille) {
|
||||
ui.notifications.warn("La Taille est inférieur au minimum racial")
|
||||
_warn("La Taille est inférieur au minimum racial")
|
||||
return min
|
||||
}
|
||||
const raceMax = this.system.carac.taille.max == undefined ? 15 + this.system.carac.taille.value : this.system.carac.taille.max
|
||||
const max = raceMax < 0 ? taille + 1 : raceMax
|
||||
if (max < taille) {
|
||||
ui.notifications.warn("La Taille est supérieure au maximum racial")
|
||||
_warn("La Taille est supérieure au maximum racial")
|
||||
return max
|
||||
}
|
||||
return taille
|
||||
|
||||
@@ -804,6 +804,7 @@
|
||||
},
|
||||
"livre": {
|
||||
"templates": ["description", "inventaire"],
|
||||
"lu": false,
|
||||
"competence": "",
|
||||
"auteur": "",
|
||||
"difficulte": 0,
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.hbs"}}
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/jeux.hbs"}}
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.hbs"}}
|
||||
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/livres.hbs"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if options.isObserver}}{{!-- hautreve Tab --}}
|
||||
|
||||
@@ -8,4 +8,8 @@
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
|
||||
{{#if herbes.length}}
|
||||
<a class="gerer-herbes chat-card-button">Gérer ses herbes</a>
|
||||
{{/if}}
|
||||
Reference in New Issue
Block a user