Compare commits

..
Author SHA1 Message Date
VincentVk 1238460cc8 Fix: quantité d'achat depuis commerce illimité
Lors d'un achat depuis un commerce illimité, la quantité du commerce
(non visible) était utilisée au lieux de la quantité réellement achetée
2026-08-07 15:25:35 +02:00
VincentVk d590dfce7f Fix: ne pas créer d'Item "Sans compétence" 2026-08-07 14:53:58 +02:00
fabres 332da735f8 Re-org CSS title a bit
Release Creation / build (release) Successful in 2m57s
2026-08-06 20:53:40 +02:00
fabres 4a6913a2ba fix: XP compétences négatives (base de catégorie)
Le champ base (INTEGER, min 0) rejetait les bases négatives
(-4/-6/-8/-11) : toute compétence voyait sa base forcée à 0, d'où un
total d'XP compétences fortement négatif (ex. -5790 sur un personnage
neuf).
- competence.mjs : base en INTEGER_SIGNED
- item-competence.js : _preCreate affecte la base de la catégorie
- migrations.js : migration 14.0.3 corrige les compétences existantes
- compendiums repackés (bases de catégorie présentes dans les packs)
2026-08-06 14:27:39 +02:00
6 changed files with 72 additions and 10 deletions
+15
View File
@@ -5777,6 +5777,9 @@ body {
font-size: 0.8rem;
padding: 0.15rem 0.3rem 0rem 0.3rem;
}
.system-foundryvtt-reve-de-dragon .tab:is(.combat, .connaissances, .hautreve) h4 {
margin: 0.3rem 0;
}
.system-foundryvtt-reve-de-dragon .blessure-control {
flex-grow: 1;
flex-direction: row;
@@ -6178,6 +6181,18 @@ body {
.system-foundryvtt-reve-de-dragon .prosemirror menu {
background-color: var(--color-background-chat-message);
}
.system-foundryvtt-reve-de-dragon .prosemirror menu button,
.system-foundryvtt-reve-de-dragon .prosemirror menu .pm-dropdown > span {
color: var(--rdd-color-text-primary);
}
.system-foundryvtt-reve-de-dragon .prosemirror menu button.source-code-action {
background-color: rgba(255, 255, 255, 0.4);
}
.system-foundryvtt-reve-de-dragon .prosemirror menu button:hover,
.system-foundryvtt-reve-de-dragon .prosemirror menu button.active {
background-color: rgba(255, 255, 255, 0.4);
color: var(--rdd-color-text-primary);
}
.system-foundryvtt-reve-de-dragon :is(.app, .application).sheet fieldset :is(label, input) {
font-family: CaslonAntique;
text-align: justify;
+21
View File
@@ -545,6 +545,10 @@
padding: 0.15rem 0.3rem 0rem 0.3rem;
}
.tab:is(.combat, .connaissances, .hautreve) h4 {
margin: 0.3rem 0;
}
.blessure-control {
flex-grow: 1;
flex-direction: row;
@@ -889,6 +893,23 @@
.prosemirror {
menu {
background-color: var(--color-background-chat-message);
button,
.pm-dropdown > span {
color: var(--rdd-color-text-primary);
}
button {
&.source-code-action {
background-color: rgba(255, 255, 255, 0.4);
}
&:hover,
&.active {
background-color: rgba(255, 255, 255, 0.4);
color: var(--rdd-color-text-primary);
}
}
}
}
+11 -8
View File
@@ -220,16 +220,16 @@ export class RdDBaseActor extends Actor {
await this.delayedRenderSheet('_preUpdate', changed, options)
return super._preUpdate(changed, options, user)
}
_onUpdate(changed, options, userId) {
super._onUpdate(changed, options, userId)
if (userId == game.user.id){
if (userId == game.user.id) {
this.delayedRenderSheet('_onUpdate', changed, options)
}
}
async delayedRenderSheet(caller, data, options) {
this.refreshDelayCounter = (this.refreshDelayCounter ?? 0)+1
this.refreshDelayCounter = (this.refreshDelayCounter ?? 0) + 1
if (this.refreshDelayCounter == 1) {
this.renderAfterDelay(this.refreshDelayCounter)
}
@@ -628,17 +628,20 @@ export class RdDBaseActor extends Actor {
return
}
const isItemEmpilable = "quantite" in item.system;
const baseItem = {
id: undefined,
type: item.type,
img: item.img,
name: item.name,
system: foundry.utils.mergeObject(item.system, { quantite: isItemEmpilable ? quantite : undefined }, { inplace: false })
system: foundry.utils.duplicate(item.system)
}
const createItemArray = "quantite" in item.system
? (it, qt) => { it.system.quantite = qt; return [it] }
: (it, qt) => Array.from({ length: qt }, (_, i) => it)
const newItems = isItemEmpilable ? [baseItem] : Array.from({ length: quantite }, (_, i) => baseItem);
const items = await this.createEmbeddedDocuments("Item", newItems);
return newItems.length > 0 ? items[0].id : undefined;
const newItems = createItemArray(baseItem, quantite)
const items = await this.createEmbeddedDocuments("Item", newItems)
return items.length > 0 ? items[0].id : undefined;
}
/* -------------------------------------------- */
+8 -1
View File
@@ -48,13 +48,20 @@ export class RdDItemCompetence extends RdDItem {
static get defaultIcon() { return "systems/foundryvtt-reve-de-dragon/icons/competence_defaut.webp" }
static async onReady(){
RdDItemCompetence.SANS_COMPETENCE = await Item.create(BASE_SANS_COMPETENCE, { temporary: true })
RdDItemCompetence.SANS_COMPETENCE = new RdDItemCompetence(BASE_SANS_COMPETENCE)
}
isNiveauBase() {
return this.system.niveau == this.system.base && this.system.xp == 0
}
async _preCreate(data, options, user) {
await super._preCreate(data, options, user)
if (this.system.categorie && !Number(data.system?.base)) {
this.updateSource({ 'system.base': RdDItemCompetence.getNiveauBase(this.system.categorie, this.type) })
}
}
getBaseInit() {
const carac = this.getInitCarac()
if (carac == undefined) {
+16
View File
@@ -4,6 +4,7 @@ import { Grammar } from "./grammar.js";
import { Monnaie } from "./item-monnaie.js";
import { ITEM_TYPES, ACTOR_TYPES } from "./constants.js";
import { RdDItem } from "./item.js";
import { RdDItemCompetence } from "./item-competence.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDRaretes } from "./item/raretes.js";
import { VOIES_DRACONIC } from "./item-sort.js";
@@ -720,6 +721,20 @@ class _13_0_23_OmbreCategorieFalse extends Migration {
}
}
class _14_0_3_MigrationCompetenceBase extends Migration {
get code() { return "competence-base-categorie" }
get version() { return "14.0.3" }
async migrate() {
await this.applyItemsUpdates(items => items
.filter(it => it.type == ITEM_TYPES.competence
&& it.system.categorie
&& Number(it.system.base) == 0)
.map(it => ({ _id: it.id, 'system.base': RdDItemCompetence.getNiveauBase(it.system.categorie, it.type) }))
)
}
}
export class Migrations {
static getMigrations() {
return [
@@ -748,6 +763,7 @@ export class Migrations {
new _13_0_21_AjoutAppreciation(),
new _13_0_22_PoidsDesMonnaies(),
new _13_0_23_OmbreCategorieFalse(),
new _14_0_3_MigrationCompetenceBase(),
];
}
+1 -1
View File
@@ -10,7 +10,7 @@ export default class RdDModelCompetence extends foundry.abstract.TypeDataModel {
{
niveau: new fields.NumberField({ label: "Niveau", initial: 0, ...INTEGER_SIGNED, min: -11 }),
default_diffLibre: new fields.NumberField({ label: "Difficulté libre par défaut", initial: 0, ...INTEGER_SIGNED, min: -10, max: 0 }),
base: new fields.NumberField({ label: "Base", initial: 0, ...INTEGER }),
base: new fields.NumberField({ label: "Base", initial: 0, ...INTEGER_SIGNED }),
categorie: new fields.StringField({ label: "Catégorie", initial: "", ...STRING }),
xp: new fields.NumberField({ label: "XP", initial: 0, ...INTEGER }),
defaut_carac: new fields.StringField({ label: "Caractéristique par défaut", initial: "", ...STRING }),