Fix release numbering

This commit is contained in:
2026-06-14 23:25:24 +02:00
parent 709e69fac8
commit e43487b727
35 changed files with 391 additions and 152 deletions
+62 -23
View File
@@ -159,11 +159,42 @@ Hooks.on('tokenActionHudCoreApiReady', async () => {
})
Hooks.on("renderChatMessageHTML", (message, html, data) => {
const alreadyUsedLabel = game.i18n.localize("CTHULHUETERNAL.Label.alreadyUsed")
// Helper: disable all action buttons in the message
function disableChatActions(container) {
$(container).find(".chat-action-button").each((i, btn) => {
btn.setAttribute("disabled", "disabled")
btn.setAttribute("data-tooltip", alreadyUsedLabel)
btn.style.opacity = "0.5"
btn.style.cursor = "not-allowed"
btn.style.pointerEvents = "none"
})
}
// If an action was already used on this message, disable all buttons immediately
if (message.getFlag("fvtt-cthulhu-eternal", "actionUsed")) {
disableChatActions(html)
}
// Wrapper: click any action button → disable all + persist flag
function withActionLock(handler) {
return async (event) => {
const container = $(event.currentTarget).closest(".chat-message, .message-content, div[class]")[0] || html
disableChatActions(container)
message.setFlag("fvtt-cthulhu-eternal", "actionUsed", true).catch(() => { })
await handler(event)
}
}
// Affichage des boutons de jet de dés uniquement pour les joueurs
if (message.author.id === game.user.id || game.user.isGM) {
$(html).find(".nudge-roll").each((i, btn) => {
btn.style.display = "inline"
})
$(html).find(".nudge-to-success").each((i, btn) => {
btn.style.display = "inline-flex"
})
$(html).find(".damage-roll").each((i, btn) => {
btn.style.display = "inline"
})
@@ -178,47 +209,55 @@ Hooks.on("renderChatMessageHTML", (message, html, data) => {
btn.style.display = "inline"
})
}
$(html).find(".nudge-roll").click((event) => {
$(html).find(".nudge-roll").click(withActionLock(() => {
CthulhuEternalUtils.nudgeRoll(message)
})
$(html).find(".damage-roll").click((event) => {
}))
$(html).find(".nudge-to-success").click(withActionLock(() => {
CthulhuEternalUtils.nudgeToSuccess(message)
}))
$(html).find(".damage-roll").click(withActionLock((event) => {
let formula = $(event.currentTarget).data("roll-value")
CthulhuEternalUtils.damageRoll(message, formula)
})
$(html).find(".healing-roll").click((event) => {
}))
$(html).find(".healing-roll").click(withActionLock(() => {
CthulhuEternalUtils.healingRoll(message)
})
$(html).find(".worn-weapon-check").click((event) => {
}))
$(html).find(".worn-weapon-check").click(withActionLock(() => {
CthulhuEternalUtils.wornWeaponCheck(message)
})
$(html).find(".san-loose").click((event) => {
}))
$(html).find(".san-loose").click(withActionLock((event) => {
CthulhuEternalUtils.applySANLoss(message, event)
})
$(html).find(".san-type").click((event) => {
}))
$(html).find(".san-type").click(withActionLock((event) => {
CthulhuEternalUtils.applySANType(message, event)
})
$(html).find(".opposed-roll").click((event) => {
}))
$(html).find(".opposed-roll").click(withActionLock((event) => {
CthulhuEternalUtils.opposedRollManagement(message, event)
})
}))
}
if (game.user.isGM) {
$(html).find(".li-apply-wounds").each((i, btn) => {
btn.style.display = "block"
})
$(html).find(".apply-wounds-btn").click((event) => {
$(html).find(".apply-wounds-btn").click(withActionLock((event) => {
CthulhuEternalUtils.applyWounds(message, event)
})
}))
$(html).find(".apply-wounds-btn").hover(
function (event) {
// Mouse enter - select the token
let combatantId = $(this).data("combatant-id")
// Mouse enter - highlight the token on the canvas
const tokenId = $(this).data("token-id")
if (tokenId) {
const token = canvas.tokens.get(tokenId)
if (token) token.control({ releaseOthers: true })
return
}
// Legacy: resolve via combatant
const combatantId = $(this).data("combatant-id")
if (combatantId && game.combat) {
let combatant = game.combat.combatants.get(combatantId)
const combatant = game.combat.combatants.get(combatantId)
if (combatant?.token) {
let token = canvas.tokens.get(combatant.token.id)
if (token) {
token.control({ releaseOthers: true })
}
const token = canvas.tokens.get(combatant.token.id)
if (token) token.control({ releaseOthers: true })
}
}
},