Jets de carac/compétences sur feuille encart

This commit is contained in:
Vincent Vandemeulebrouck 2024-10-05 12:41:28 +02:00
parent d439d73636
commit 40b0d7e6dc
14 changed files with 91 additions and 41 deletions

View File

@ -2,6 +2,8 @@
## 12.0.12 - L'étalage d'Astrobazzarh
- Fix: On peut de nouveau vendre des items sans propriétaire, depuis les compendiums ou depuis l'onglet des Objets
- Début de Feuille PNJ au format des encarts Scriptarium
- support des jets de caractéristiques
- support des jets de compétences
## 12.0.11 - Le scriptorium d'Astrobazzarh
- ajout d'un bouton pour générer les éléments de description d'un personnage

View File

@ -25,8 +25,8 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
if (!this.options.editable) return;
this.html.find('.encaisser-direct').click(async event => this.actor.encaisser())
this.html.find('.carac-label a').click(async event => this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes.name.value)));
this.html.find('a.competence-label').click(async event => this.actor.rollCompetence(RdDSheetUtility.getItemId(event)));
this.html.find('.roll-carac').click(async event => this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes.name.value)));
this.html.find('.roll-competence').click(async event => this.actor.rollCompetence(RdDSheetUtility.getItemId(event)));
this.html.find('.endurance-plus').click(async event => this.actor.santeIncDec("endurance", 1));
this.html.find('.endurance-moins').click(async event => this.actor.santeIncDec("endurance", -1));

View File

@ -296,6 +296,9 @@ export class RdDBaseActorReve extends RdDBaseActor {
/* -------------------------------------------- */
async rollCarac(caracName, jetResistance = undefined) {
if (Grammar.equalsInsensitive(caracName, 'taille')){
return
}
RdDEmpoignade.checkEmpoignadeEnCours(this)
let selectedCarac = this.getCaracByName(caracName)
await this.openRollDialog({

View File

@ -2,7 +2,7 @@ import { RdDActorSheet } from "../../actor-sheet.js"
import { SYSTEM_RDD } from "../../constants.js";
import { Misc } from "../../misc.js";
import { ExportScriptarium } from "./export-scriptarium.js";
import { Mapping } from "./mapping.js";
import { CATEGORIES_COMPETENCES, CATEGORIES_DRACONIC, Mapping } from "./mapping.js";
export class RdDActorExportSheet extends RdDActorSheet {
static async init() {
@ -10,6 +10,7 @@ export class RdDActorExportSheet extends RdDActorSheet {
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/competences.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/protection.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs",
@ -31,12 +32,45 @@ export class RdDActorExportSheet extends RdDActorSheet {
async getData() {
const formData = await super.getData()
const values = Mapping.getAsObject(this.actor);
// Add any structured, precomputed list of data
formData.export = values
formData.export = this.getMappingValues();
formData.competences = this.getCompetences(CATEGORIES_COMPETENCES)
formData.draconic = this.getCompetences(CATEGORIES_DRACONIC)
return formData
}
getMappingValues() {
const context = Mapping.prepareContext(this.actor)
return Object.fromEntries(Mapping.getMapping().map(it => [it.column, {
colName: it.colName ?? it.column,
column: it.column,
value: it.getter(this.actor, context)
}]))
}
getCompetences(categories) {
const competences = Mapping.getCompetencesCategorie(this.actor, categories)
if (competences.length == 0) {
return ''
}
const byCategories = Mapping.competencesByCategoriesByNiveau(competences, categories)
const listByCategories = Object.values(byCategories)
.map(it => it.competencesParNiveau)
.map(byNiveau => {
const niveaux = Object.keys(byNiveau).map(it => Number(it)).sort(Misc.ascending())
if (niveaux.length == 0) {
return undefined
}
const listCategorieByNiveau = niveaux.map(niveau => {
const list = byNiveau[niveau].sort(Misc.ascending(it => it.name))
return {niveau, list}
})
return Misc.concat(listCategorieByNiveau)
}).filter(it => it != undefined)
return Misc.concat(listByCategories)
}
activateListeners(html) {
super.activateListeners(html);
this.html.find('.button-export').click(async event => {

View File

@ -9,13 +9,13 @@ import { RdDBonus } from "../../rdd-bonus.js"
import { TMRType } from "../../tmr-utility.js"
const CATEGORIES_COMPETENCES = [
export const CATEGORIES_COMPETENCES = [
"generale",
"particuliere",
"specialisee",
"connaissance",
]
const CATEGORIES_DRACONIC = [
export const CATEGORIES_DRACONIC = [
"draconic",
]
@ -306,8 +306,8 @@ export class Mapping {
if (competences.length == 0) {
return ''
}
const byCartegories = Mapping.competencesByCategoriesByNiveau(competences, categories)
const txtByCategories = Object.values(byCartegories)
const byCategories = Mapping.competencesByCategoriesByNiveau(competences, categories)
const txtByCategories = Object.values(byCategories)
.map(it => it.competencesParNiveau)
.map(byNiveau => {
const niveaux = Object.keys(byNiveau).map(it => Number(it)).sort(Misc.ascending())

View File

@ -680,6 +680,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
}
.carac-label {
font-weight: bold;
flex-basis: 40%;
}
.rdd.sheet .window-content .sheet-body .carac-list .caracteristique > .utiliser-attribut {
@ -1188,9 +1189,6 @@ ul.chat-list li:nth-child(odd) {
padding: 0.5rem;
cursor: pointer;
}
.carac-label {
font-weight: bold;
}
.list-item {
margin: 0.1rem;
box-shadow: inset 0px 0px 1px #00000096;

View File

@ -7,7 +7,7 @@
<label class="carac-xp"/>
{{else}}
{{#if carac.derivee}}
<span class="carac-label" name="system.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span>
<span class="carac-label roll-carac" name="system.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span>
<label class="competence-value">{{carac.value}}</label>
<label class="carac-xp"/>
{{else}}
@ -22,7 +22,7 @@
</a>
</span>
{{else}}
<span class="carac-label tooltip" name="system.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span>
<span class="carac-label roll-carac tooltip" name="system.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span>
{{/if}}
<input class="carac-value" type="text" name="system.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.options.vueDetaillee}}disabled{{/unless}} />
<span class="carac-xp tooltip">

View File

@ -32,7 +32,7 @@
<li class="item flexrow list-item" data-item-id="{{esq._id}}"
data-tooltip="{{esq.name}}: niveau {{plusMoins esq.system.niveau}}">
<span class="competence-label">
<a class="competence-label" name="{{esq.name}}">
<a class="roll-competence" name="{{esq.name}}">
<img class="sheet-competence-img" src="{{esq.img}}" />
<span>{{esq.name}}</span>
</a>

View File

@ -1,7 +1,7 @@
<ol class="item-list alterne-list">
{{#each (trier competences) as |comp key|}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}">
<a class="competence-label">
<a class="competence-label roll-competence">
<img class="sheet-competence-img" src="{{comp.img}}" data-tooltip="{{comp.name}}"/>
<span>{{comp.name}}</span>
</a>

View File

@ -1,6 +1,6 @@
{{#unless system.isHidden}}
<li class="item flexrow list-item {{#if system.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}">
<a class="competence-label" name="{{name}}" data-tooltip="Niveau {{plusMoins system.niveau}} en {{name}}">
<a class="competence-label roll-competence" name="{{name}}" data-tooltip="Niveau {{plusMoins system.niveau}} en {{name}}">
<img class="sheet-competence-img" src="{{img}}"/>
<span>{{name}}</span>
</a>

View File

@ -12,29 +12,29 @@
<hr>
<div class="grid-2col">
<div class="flexcol flex-group-top">
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.taille}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.apparence}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.constitution}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.force}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.agilite}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.dexterite}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.vue}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.ouie}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.odoratgout}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.volonte}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.empathie}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.intellect}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.reve}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.chance}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.taille}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.apparence}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.constitution}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.force}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.agilite}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.dexterite}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.vue}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.ouie}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.odoratgout}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.volonte}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.empathie}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.intellect}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.reve}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" carac=export.chance}}
</div>
<div class="flexcol flex-group-top">
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.melee}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.tir}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.lancer}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.derobee}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.vie}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.endurance}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.plusdom}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" carac=export.melee}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" carac=export.tir}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" carac=export.lancer}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" carac=export.derobee}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" carac=export.vie}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" carac=export.endurance}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" carac=export.plusdom}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/protection.hbs" export}}
</div>
</div>
@ -58,7 +58,7 @@
</div>
<hr>
<div>
{{export.competences.value}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/competences.hbs" competences= competences}}
</div>
<hr>
<div>

View File

@ -1 +1 @@
<div class="flexrow"><div>{{upperFirst colName}}</div><div class="flex-group-right">{{value}}</div></div>
<div class="flexrow"><div>{{upperFirst carac.colName}}</div><div class="flex-group-right">{{carac.value}}</div></div>

View File

@ -1 +1,4 @@
<div class="flexrow"><div>{{upper colName}}</div><div class="flex-group-right">{{value}}</div></div>
<div class="flexrow">
<div><a class="roll-carac" name="{{carac.column}}">{{upper carac.colName}}</a></div>
<div class="flex-group-right">{{carac.value}}</div>
</div>

View File

@ -0,0 +1,10 @@
{{#each competences as |group|}}
{{#if @index}}/{{/if}}
{{#each group.list as |comp|}}
{{#if @index}}, {{/if}}
<span class="item" data-item-id="{{comp._id}}">
<a class="roll-competence">{{comp.name}}</a>
</span>
{{/each}}
{{numberFormat group.niveau decimals=0 sign=true}}
{{/each}}