fix: Dice So Nice import v14 compat, override Foundry text colors for readability
Release Creation / build (release) Failing after 1m28s

- hooks.mjs: replace static dice-so-nice import with dynamic import
  using game.modules.get('dice-so-nice').id (path removed in v14)
- hooks.mjs: fix permission condition (|| -> &&), jQuery -> vanilla JS
- less/base.less: override --color-text-* and --button-text-color
  for both .themed.theme-dark (AppV2) and body.theme-dark (legacy apps)
- target #settings-config buttons + labels + hints for dark grays
This commit is contained in:
2026-07-12 22:05:45 +02:00
parent dcc24b47ec
commit 90de66d668
44 changed files with 516 additions and 4305 deletions
+101 -114
View File
@@ -1,5 +1,4 @@
export class TotemPicker extends Application {
export class TotemPicker extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(linkEl, actor) {
super();
@@ -7,45 +6,39 @@ export class TotemPicker extends Application {
this.actor = actor;
}
/* -------------------------------------------- */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
static get DEFAULT_OPTIONS() {
return {
id: "TOTEM_PICKER",
title: game.i18n.localize("VERMINE.totem_picker"),
template: 'systems/vermine2047/templates/applications/choose-totem.hbs',
popOut: true,
resizable: true,
height: "800",
width: "800"
});
position: { width: 800, height: 800 },
window: { title: game.i18n.localize("VERMINE.totem_picker"), resizable: true }
};
}
getData() {
// Send data to the template
return {
config: CONFIG.VERMINE,
static PARTS = {
main: {
template: 'systems/vermine2047/templates/applications/choose-totem.hbs'
}
};
_prepareContext() {
return { config: CONFIG.VERMINE };
}
activateListeners(html) {
super.activateListeners(html);
html.find('.totem').click(event => {
const totem = $(event.target).parent('a').data('totem');
if (totem != null) {
this.actor.update({ 'system.identity.totem': totem });
}
this.close();
html.querySelectorAll('.totem').forEach(el => {
el.addEventListener('click', event => {
const link = event.target.closest('a');
if (!link?.dataset.totem) return;
this.actor.update({ 'system.identity.totem': link.dataset.totem });
this.close();
});
});
}
/*async _updateObject(event, formData) {
// console.log(formData.exampleInput);
}*/
}
export class ActorPicker extends Application {
export class ActorPicker extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(linkEl, actor) {
super();
@@ -53,152 +46,146 @@ export class ActorPicker extends Application {
this.actor = actor;
}
/* -------------------------------------------- */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
static get DEFAULT_OPTIONS() {
return {
id: "ACTOR_PICKER",
title: game.i18n.localize("VERMINE.actor_picker"),
template: 'systems/vermine2047/templates/applications/choose-actor.hbs',
popOut: true,
resizable: true,
height: "350",
width: "600"
});
position: { width: 600, height: 350 },
window: { title: game.i18n.localize("VERMINE.actor_picker"), resizable: true }
};
}
static PARTS = {
main: {
template: 'systems/vermine2047/templates/applications/choose-actor.hbs'
}
};
getData() {
// Send data to the template
_prepareContext() {
const npcs = game.actors.filter(a => a.type == "npc");
const characters = game.actors.filter(a => a.type == "character");
const all = game.actors.filter(a => a.type == "npc" || a.type == 'character');
const type = $(this.linkEl).data('type');
const type = this.linkEl.dataset.type;
let actorsList = [];
if (type == 'members') {
actorsList = characters;
} else if (type == 'relations') {
actorsList = npcs;//[...npcs, ...characters];
actorsList = npcs;
} else {
actorsList = all;
}
return {
config: CONFIG.VERMINE,
actorsList: actorsList
}
};
}
async activateListeners(html) {
activateListeners(html) {
super.activateListeners(html);
html.find('.actor').click(async (event) => {
const actorId = $(event.target).parent('div').data('actor-id');
const type = $(this.linkEl).data('type');
if (!actorId) return;
let actorsList = [];
html.querySelectorAll('.actor').forEach(el => {
el.addEventListener('click', async event => {
const div = event.target.closest('div');
const actorId = div?.dataset.actorId;
const type = this.linkEl.dataset.type;
if (!actorId) return;
if (type == 'members') {
actorsList = foundry.utils.duplicate(this.actor.system.members || []);
} else if (type == 'encounters') {
actorsList = foundry.utils.duplicate(this.actor.system.encounters || []);
}
if (!Array.isArray(actorsList)) {
actorsList = [];
}
let actorsList = [];
// Add actor if not already present
if (!actorsList.includes(actorId)) {
actorsList.push(actorId);
}
if (type == 'members') {
actorsList = foundry.utils.duplicate(this.actor.system.members || []);
} else if (type == 'encounters') {
actorsList = foundry.utils.duplicate(this.actor.system.encounters || []);
}
if (type == 'members') {
await this.actor.update({ 'system.members': actorsList });
} else if (type == 'encounters') {
await this.actor.update({ 'system.encounters': actorsList });
}
this.close();
if (!Array.isArray(actorsList)) {
actorsList = [];
}
if (!actorsList.includes(actorId)) {
actorsList.push(actorId);
}
if (type == 'members') {
await this.actor.update({ 'system.members': actorsList });
} else if (type == 'encounters') {
await this.actor.update({ 'system.encounters': actorsList });
}
this.close();
});
});
}
}
export class TraitSelector extends Application {
export class TraitSelector extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(targetItem) {
super();
this.targetItem = targetItem;
this.traits = CONFIG.VERMINE.traits
this.traits = CONFIG.VERMINE.traits;
}
/* -------------------------------------------- */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["vermine2047", "trait-selector"],
title: game.i18n.localize("VERMINE.traits_selector"),
template: 'systems/vermine2047/templates/applications/choose-traits.hbs',
popOut: true,
resizable: true,
height: "500",
width: "500"
});
static get DEFAULT_OPTIONS() {
return {
id: "TRAIT_SELECTOR",
position: { width: 500, height: 500 },
window: { title: game.i18n.localize("VERMINE.traits_selector"), resizable: true },
classes: ["vermine2047", "trait-selector"]
};
}
getData() {
static PARTS = {
main: {
template: 'systems/vermine2047/templates/applications/choose-traits.hbs'
}
};
_prepareContext() {
return {
traits: this.traits,
item: this.targetItem
}
};
}
async activateListeners(html) {
super.activateListeners(html);
this.validateTraits(html);
html.find('input').change(ev => {
this.onChangeInput(ev)
})
activateListeners(html) {
super.activateListeners(html);
this._validateTraits(html);
html.querySelectorAll('input').forEach(el => {
el.addEventListener('change', ev => this._onChangeInput(ev));
});
}
async validateTraits(html) {
let checks = html.find("input.trait-selector");
for (let inp of checks) {
async _validateTraits(html) {
const checks = html.querySelectorAll("input.trait-selector");
for (const inp of checks) {
if (this.targetItem.system.traits[inp.dataset.trait]) {
if (inp.type == "checkbox") {
inp.checked = true
inp.checked = true;
}
}
}
await this.render(true)
await this.render(true);
}
async onChangeInput(ev) {
let el = ev.currentTarget;
let traitKey = el.dataset.trait; // Récupère la clé du trait à partir de l'attribut data-trait
let traitValue = parseInt(el.value) || null
let traits = this.targetItem.system.traits || {}; // Récupère les traits actuels, ou un objet vide si aucun trait n'est défini
console.log(traitKey, traitValue, traits)
async _onChangeInput(ev) {
const el = ev.currentTarget;
const traitKey = el.dataset.trait;
const traitValue = parseInt(el.value) || null;
const traits = this.targetItem.system.traits || {};
if (el.classList.contains('trait-selector')) {
if (!traits[traitKey]) {
// Si la case est cochée, ajoute le trait
await this.targetItem.update({ [`system.traits.${traitKey}`]: this.traits[traitKey] });
} else {
// Si la case est décochée, retire le trait
await this.targetItem.update({ [`system.traits.${traitKey}`]: null });
}
}
if (traitValue) {
console.log(el.value)
// Logique pour les valeurs des traits si nécessaire
el.closest("label").querySelector('.trait-selector').checked = true;
} else {
el.closest("label").querySelector('.trait-selector').checked = false;
}
this.render(true)
this.render(true);
}
}
}