Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1238460cc8 | ||
|
|
d590dfce7f | ||
|
|
332da735f8 | ||
|
|
4a6913a2ba |
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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 }),
|
||||
|
||||
Reference in New Issue
Block a user