Foundry v13 migration
All checks were successful
Release Creation / build (release) Successful in 58s

This commit is contained in:
2025-05-14 10:02:08 +02:00
parent aaef4dd896
commit b4d6616cb4
76 changed files with 356 additions and 421 deletions

View File

@ -22,28 +22,28 @@ export default class LethalFantasyUtils {
static setHookListeners() {
Hooks.on('renderTokenHUD', async (hud, html, token) => {
const lossHPButton = await renderTemplate('systems/fvtt-lethal-fantasy/templates/loss-hp-hud.hbs', {} )
html.find('div.left').append(lossHPButton);
html.find('img.lethal-hp-loss-hud').click((event) => {
const lossHPButton = await foundry.applications.handlebars.renderTemplate('systems/fvtt-lethal-fantasy/templates/loss-hp-hud.hbs', {} )
$(html).find('div.left').append(lossHPButton);
$(html).find('img.lethal-hp-loss-hud').click((event) => {
event.preventDefault();
let hpMenu = html.find('.hp-loss-wrap')[0]
let hpMenu = $(html).find('.hp-loss-wrap')[0]
if (hpMenu.classList.contains("hp-loss-hud-disabled")) {
html.find('.hp-loss-wrap')[0].classList.add('hp-loss-hud-active');
html.find('.hp-loss-wrap')[0].classList.remove('hp-loss-hud-disabled');
html.find('.hp-loss-wrap')[1].classList.add('hp-loss-hud-active');
html.find('.hp-loss-wrap')[1].classList.remove('hp-loss-hud-disabled');
html.find('.hp-loss-wrap')[2].classList.add('hp-loss-hud-active');
html.find('.hp-loss-wrap')[2].classList.remove('hp-loss-hud-disabled');
$(html).find('.hp-loss-wrap')[0].classList.add('hp-loss-hud-active');
$(html).find('.hp-loss-wrap')[0].classList.remove('hp-loss-hud-disabled');
$(html).find('.hp-loss-wrap')[1].classList.add('hp-loss-hud-active');
$(html).find('.hp-loss-wrap')[1].classList.remove('hp-loss-hud-disabled');
$(html).find('.hp-loss-wrap')[2].classList.add('hp-loss-hud-active');
$(html).find('.hp-loss-wrap')[2].classList.remove('hp-loss-hud-disabled');
} else {
html.find('.hp-loss-wrap')[0].classList.remove('hp-loss-hud-active');
html.find('.hp-loss-wrap')[0].classList.add('hp-loss-hud-disabled');
html.find('.hp-loss-wrap')[1].classList.remove('hp-loss-hud-active');
html.find('.hp-loss-wrap')[1].classList.add('hp-loss-hud-disabled');
html.find('.hp-loss-wrap')[2].classList.remove('hp-loss-hud-active');
html.find('.hp-loss-wrap')[2].classList.add('hp-loss-hud-disabled');
$(html).find('.hp-loss-wrap')[0].classList.remove('hp-loss-hud-active');
$(html).find('.hp-loss-wrap')[0].classList.add('hp-loss-hud-disabled');
$(html).find('.hp-loss-wrap')[1].classList.remove('hp-loss-hud-active');
$(html).find('.hp-loss-wrap')[1].classList.add('hp-loss-hud-disabled');
$(html).find('.hp-loss-wrap')[2].classList.remove('hp-loss-hud-active');
$(html).find('.hp-loss-wrap')[2].classList.add('hp-loss-hud-disabled');
}
})
html.find('.loss-hp-hud-click').click((event) => {
$(html).find('.loss-hp-hud-click').click((event) => {
event.preventDefault();
let hpLoss = event.currentTarget.dataset.hpValue;
if (token) {
@ -51,12 +51,12 @@ export default class LethalFantasyUtils {
console.log(tokenFull, token)
let actor = tokenFull.actor;
actor.applyDamage(Number(hpLoss));
html.find('.hp-loss-wrap')[0].classList.remove('hp-loss-hud-active');
html.find('.hp-loss-wrap')[0].classList.add('hp-loss-hud-disabled');
html.find('.hp-loss-wrap')[1].classList.remove('hp-loss-hud-active');
html.find('.hp-loss-wrap')[1].classList.add('hp-loss-hud-disabled');
html.find('.hp-loss-wrap')[2].classList.remove('hp-loss-hud-active');
html.find('.hp-loss-wrap')[2].classList.add('hp-loss-hud-disabled');
$(html).find('.hp-loss-wrap')[0].classList.remove('hp-loss-hud-active');
$(html).find('.hp-loss-wrap')[0].classList.add('hp-loss-hud-disabled');
$(html).find('.hp-loss-wrap')[1].classList.remove('hp-loss-hud-active');
$(html).find('.hp-loss-wrap')[1].classList.add('hp-loss-hud-disabled');
$(html).find('.hp-loss-wrap')[2].classList.remove('hp-loss-hud-active');
$(html).find('.hp-loss-wrap')[2].classList.add('hp-loss-hud-disabled');
}
})
})