Update for Foundry v13

This commit is contained in:
2025-05-09 21:54:10 +02:00
parent c2f9934f5f
commit e1cea78059
122 changed files with 303 additions and 390 deletions

View File

@@ -12,8 +12,8 @@ export class BoLTokenHud {
/* -------------------------------------------- */
static async removeExtensionHud(app, html, tokenId) {
html.find('.control-icon.bol-roll').remove()
html.find('.control-icon.bol-action').remove()
$(html).find('.control-icon.bol-roll').remove()
$(html).find('.control-icon.bol-action').remove()
}
/* -------------------------------------------- */
@@ -25,7 +25,7 @@ export class BoLTokenHud {
const hudData = { actor: actor, actionsList: actor.buildListeActions(), rollsList: actor.buildRollList() }
const controlIconActions = html.find('.control-icon[data-action=combat]');
const controlIconActions = $(html).find('.control-icon[data-action=combat]');
// initiative
await BoLTokenHud._configureSubMenu(controlIconActions, 'systems/bol/templates/token/hud-actor-actions.hbs', hudData,
(event) => {
@@ -43,7 +43,7 @@ export class BoLTokenHud {
}
})
const controlIconTarget = html.find('.control-icon[data-action=target]');
const controlIconTarget = $(html).find('.control-icon[data-action=target]');
// att+apt+career
await BoLTokenHud._configureSubMenu(controlIconTarget, 'systems/bol/templates/token/hud-actor-rolls.hbs', hudData,
(event) => {
@@ -59,7 +59,7 @@ export class BoLTokenHud {
/* -------------------------------------------- */
static async addTokenHudExtensions(app, html, tokenId) {
const controlIconCombat = html.find('.control-icon[data-action=combat]')
const controlIconCombat = $(html).find('.control-icon[data-action=combat]')
if (controlIconCombat.length > 0) {
BoLTokenHud.addExtensionHud(app, html, tokenId);
}

View File

@@ -221,10 +221,10 @@ export class BoLCalendar extends Application {
let hn = defHeure.heure;
let chiffreAstral = this.getCurrentNombreAstral() ?? 0;
heuresChancesMalchances[0] = { value : "+4", heures: [this.getHeureNumber((hn + chiffreAstral) % RDD_HEURES_PAR_JOUR).label]};
heuresChancesMalchances[1] = { value : "+2", heures: [this.getHeureNumber((hn + chiffreAstral+4) % RDD_HEURES_PAR_JOUR).label,
heuresChancesMalchances[1] = { value : "+2", heures: [this.getHeureNumber((hn + chiffreAstral+4) % RDD_HEURES_PAR_JOUR).label,
this.getHeureNumber((hn + chiffreAstral + 8) % RDD_HEURES_PAR_JOUR).label ] };
heuresChancesMalchances[2] = { value : "-4", heures: [this.getHeureNumber((hn + chiffreAstral+6) % RDD_HEURES_PAR_JOUR).label]};
heuresChancesMalchances[3] = { value : "-2", heures: [this.getHeureNumber((hn + chiffreAstral+3) % RDD_HEURES_PAR_JOUR).label,
heuresChancesMalchances[3] = { value : "-2", heures: [this.getHeureNumber((hn + chiffreAstral+3) % RDD_HEURES_PAR_JOUR).label,
this.getHeureNumber((hn + chiffreAstral + 9) % RDD_HEURES_PAR_JOUR).label ]};
}
return heuresChancesMalchances;
@@ -331,7 +331,7 @@ export class BoLCalendar extends Application {
calendrierData.jourMoisOptions = RdDCalendrier.buildJoursMois();
calendrierData.heuresOptions = [0, 1];
calendrierData.minutesOptions = Array(RDD_MINUTES_PAR_HEURES).fill().map((item, index) => 0 + index);
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-editor-template.html', calendrierData);
let html = await foundry.applications.handlebars.renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-editor-template.html', calendrierData);
this.editeur = new RdDCalendrierEditeur(html, this, calendrierData)
}
this.editeur.updateData(calendrierData);
@@ -360,7 +360,7 @@ export class BoLCalendar extends Application {
let heureNaissance = actor.getHeureNaissance();
if ( heureNaissance) {
heuresParActeur[actor.name] = this.getHeuresChanceMalchance(heureNaissance);
}
}
}
//console.log("ASTRO", astrologieArray);
calendrierData.astrologieData = astrologieArray;
@@ -398,7 +398,7 @@ export class BoLCalendar extends Application {
let isRightMB = false;
if ("which" in ev) { // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
isRightMB = ev.which == 3;
} else if ("button" in ev) { // IE, Opera
} else if ("button" in ev) { // IE, Opera
isRightMB = ev.button == 2;
}

View File

@@ -28,7 +28,7 @@ export class BoLUtility {
})
game.settings.register("bol", "auto-remove-dead", {
name: game.i18n.localize("BOL.settings.removeDead"),
hint: game.i18n.localize("BOL.settings.removeDeadTooltip"),
hint: game.i18n.localize("BOL.settings.removeDeadTooltip"),
scope: "world",
config: true,
default: false,
@@ -344,7 +344,7 @@ export class BoLUtility {
/* -------------------------------------------- */
static async chatMessageHandler(message, html, data) {
const chatCard = html.find('.flavor-text')
const chatCard = $(html).find('.flavor-text')
if (chatCard.length > 0) {
// If the user is the message author or the actor owner, proceed
const actor = game.actors.get(data.message.speaker.actor)
@@ -381,6 +381,8 @@ export class BoLUtility {
/* -------------------------------------------- */
static async chatListeners(html) {
html = $(html);
// Damage handling
html.on("click", '.chat-damage-apply', event => {
let rollData = BoLUtility.getRollDataFromMessage(event)

View File

@@ -15,7 +15,7 @@ export default function registerHooks() {
}))
Hooks.on('renderChatLog', (log, html, data) => BoLUtility.chatListeners(html))
Hooks.on('renderChatMessage', (message, html, data) => BoLUtility.chatMessageHandler(message, html, data))
Hooks.on('renderChatMessageHTML', (message, html, data) => BoLUtility.chatMessageHandler(message, html, data))
/**
* Create a macro when dropping an entity on the hotbar
@@ -73,8 +73,8 @@ export default function registerHooks() {
button.addEventListener('click', () => {
game.bol.charSummary.render(true)
})
html.find('.header-actions').after(button)
$(html).find('.header-actions').after(button)
}
})
}

View File

@@ -60,11 +60,11 @@ export const preloadHandlebarsTemplates = async function () {
"systems/bol/templates/dialogs/effect-roll-part.hbs",
"systems/bol/templates/dialogs/boons-roll-part.hbs",
"systems/bol/templates/dialogs/flaws-roll-part.hbs",
"systems/bol/templates/dialogs/total-roll-part.hbs",
"systems/bol/templates/dialogs/total-roll-part.hbs",
"systems/bol/templates/dialogs/fightoptions-roll-part.hbs",
"systems/bol/templates/dialogs/horoscope-roll-part.hbs"
];
// Load the template parts
return loadTemplates(templatePaths);
return foundry.applications.handlebars.loadTemplates(templatePaths);
};