Correction cuisiner

- icone de l'action différente de "manger"
- correction tooltip dans fenêtre de jet
- support d'images svg pour les item-actions
- prise en compte de la difficulté de préparation brute
This commit is contained in:
2025-12-19 23:50:37 +01:00
parent c305f9712c
commit bf2b7567ca
8 changed files with 48 additions and 25 deletions

View File

@@ -8,7 +8,9 @@
- correction des boutons pour lancer les maladresses
- utilisation des tables de compendium
- correction des droits pour mise à jour du message
- correction de la cuisine
- reprise de l'image de cuisine dans l'équipement
- prise en compte de la difficulté pour préparer la nourriture brute
## 13.0.23 - Le marché d'Illysis

View File

@@ -1528,6 +1528,7 @@ body {
}
.system-foundryvtt-reve-de-dragon .item-actions-controls img,
.system-foundryvtt-reve-de-dragon .item-controls img {
vertical-align: text-bottom;
display: inline;
max-width: 1rem;
max-height: 1rem;
@@ -1540,10 +1541,17 @@ body {
font-size: 0.8em;
color: var(--color-controls-light);
}
.system-foundryvtt-reve-de-dragon .item-actions-controls img:hover,
.system-foundryvtt-reve-de-dragon .item-controls img:hover,
.system-foundryvtt-reve-de-dragon .item-actions-controls i:is(.fas, .far, .fa-solid, .fa-regular):hover,
.system-foundryvtt-reve-de-dragon .item-controls i:is(.fas, .far, .fa-solid, .fa-regular):hover {
.system-foundryvtt-reve-de-dragon .item-actions-controls a:hover,
.system-foundryvtt-reve-de-dragon .item-controls a:hover {
text-shadow: 1px 0px 0px #ff6600;
}
.system-foundryvtt-reve-de-dragon .item-actions-controls a img:hover,
.system-foundryvtt-reve-de-dragon .item-controls a img:hover {
opacity: 0.6;
filter: drop-shadow(1px 1px 1px #009966) invert(0.8);
}
.system-foundryvtt-reve-de-dragon .item-actions-controls a i:is(.fas, .far, .fa-solid, .fa-regular):hover,
.system-foundryvtt-reve-de-dragon .item-controls a i:is(.fas, .far, .fa-solid, .fa-regular):hover {
opacity: 0.6;
}
.system-foundryvtt-reve-de-dragon .rdd-roll-dialog .description-sort {

View File

@@ -852,6 +852,7 @@
// }
img {
vertical-align: text-bottom;
display: inline;
max-width: 1rem;
max-height: 1rem;
@@ -865,8 +866,16 @@
color: var(--color-controls-light);
}
img:hover,
i:is(.fas, .far, .fa-solid, .fa-regular):hover {
a:hover {
text-shadow: 1px 0px 0px #ff6600;
}
a img:hover{
opacity: 0.6;
filter: drop-shadow(1px 1px 1px #009966) invert(0.8);
}
a i:is(.fas, .far, .fa-solid, .fa-regular):hover {
opacity: 0.6;
}
}

View File

@@ -48,7 +48,9 @@ const _EQUIPER = {
}
const _CUISINER = {
code: 'item-cuisiner', label: 'Cuisiner', icon: it => 'fa-solid fa-utensils',
code: 'item-cuisiner', label: 'Cuisiner',
img: it => 'systems/foundryvtt-reve-de-dragon/assets/actions/cuisine.svg',
// icon: it => 'fa-solid fa-spoon',
filter: it => it.getUtilisation() == 'cuisine' && it.system.sust > 0,
action: (item, actor) => actor.preparerNourriture(item)
}
@@ -94,7 +96,7 @@ const _SORT_RESERVE = {
}
export const COMMON_ACTIONS = [_EQUIPER]
export const DEFAULT_ACTIONS = [_ACHETER, _SPACEHOLDER, _SPLIT, _VENDRE, _MONTRER, _EDIT, _DELETE]
export const DEFAULT_ACTIONS = [_ACHETER, _SPLIT, _SPACEHOLDER, _VENDRE, _MONTRER, _EDIT, _DELETE]
export const ITEM_ACTIONS = {
faune: [_CUISINER, _MANGER_CRU],
@@ -119,11 +121,18 @@ export class ItemAction {
&& (!action.optionsFilter || action.optionsFilter(options))
}
static icon(action, item) {
if (action && action.icon) {
return action.icon(item)
static img(action, item) {
if (action.placeholder){
return ""
}
return undefined
if (action?.img) {
return `<img src="${action.img(item)}" />`
}
if (action?.icon) {
return `<i class="${action.icon(item)}"></i>`
}
return action.label
}
static async onActionItem(event, actor, options) {

View File

@@ -348,7 +348,7 @@ export class RdDUtility {
// Items
Handlebars.registerHelper('rarete-getChamp', (rarete, field) => RdDRaretes.getChamp(rarete, field));
Handlebars.registerHelper('item-action-applies', (action, item, options) => ItemAction.applies(action, item, options))
Handlebars.registerHelper('item-action-icon', (action, item) => ItemAction.icon(action, item))
Handlebars.registerHelper('item-action-img', (action, item) => new Handlebars.SafeString(ItemAction.img(action, item)))
Handlebars.registerHelper('item-name', (item) => item.nameDisplay)
// TMRs

View File

@@ -156,6 +156,7 @@ export class RollPartCuisine extends RollPartSelect {
})
inputDiff?.addEventListener("change", e => {
current.value = parseInt(e.currentTarget.value)
rollDialog.render()
})
inputProportions?.addEventListener("change", e => {
current.proportions = parseInt(e.currentTarget.value)

View File

@@ -7,7 +7,7 @@ import { RollType } from "./roll-type.mjs"
export class RollTypeCuisine extends RollType {
get code() { return ROLL_TYPE_CUISINE }
get name() { return `Interpréter une oeuvre` }
get name() { return `Cuisiner un plat` }
visible(rollData) { return rollData.active.actor.isPersonnage() }
title(rollData) {

View File

@@ -1,15 +1,9 @@
<span class="item-actions-controls item-controls">
{{#each item.actions as |action|}}
{{#if action.placeholder}}
&nbsp;
{{/if}}
{{#if (item-action-applies action ../item ../options)}}
{{#if action.placeholder}}&nbsp;
{{else if (item-action-applies action ../item ../options)}}
<a class="actionItem" data-tooltip="{{action.label}}" data-code="{{action.code}}">
{{#if (item-action-icon action ../item)}}
<i class="{{item-action-icon action ../item}}"></i>
{{else}}
{{action.label}}
{{/if}}
{{item-action-img action ../item}}
</a>
{{/if}}
{{/each}}