Update for Foundry v13
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import { BoLRoll } from "../controllers/bol-rolls.js";
|
||||
import { BoLUtility } from "../system/bol-utility.js";
|
||||
|
||||
export class BoLActorSheet extends ActorSheet {
|
||||
export class BoLActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
@@ -59,7 +59,7 @@ export class BoLActorSheet extends ActorSheet {
|
||||
let system = foundry.utils.duplicate(game.bol.config.defaultNaturalProtection)
|
||||
this.actor.createEmbeddedDocuments('Item', [{ name: game.i18n.localize("BOL.ui.newNaturalProtection"), type: "item", system }], { renderSheet: true });
|
||||
});
|
||||
|
||||
|
||||
html.find(".toggle-fight-option").click((ev) => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
this.actor.toggleFightOption(li.data("itemId"))
|
||||
@@ -170,8 +170,8 @@ export class BoLActorSheet extends ActorSheet {
|
||||
formData.charType = this.actor.getCharType()
|
||||
formData.villainy = this.actor.getVillainy()
|
||||
formData.isUndead = this.actor.isUndead()
|
||||
formData.biography = await TextEditor.enrichHTML(this.object.system.details?.biography || "", { async: true })
|
||||
formData.notes = await TextEditor.enrichHTML(this.object.system.details.notes || "", { async: true })
|
||||
formData.biography = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.details?.biography || "", { async: true })
|
||||
formData.notes = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.details.notes || "", { async: true })
|
||||
formData.isSorcerer = this.actor.isSorcerer()
|
||||
formData.isAlchemist = this.actor.isAlchemist()
|
||||
formData.isAstrologer = this.actor.isAstrologer()
|
||||
|
@@ -5,7 +5,7 @@
|
||||
import { BoLRoll } from "../controllers/bol-rolls.js";
|
||||
import { BoLUtility } from "../system/bol-utility.js";
|
||||
|
||||
export class BoLHordeSheet extends ActorSheet {
|
||||
export class BoLHordeSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
@@ -116,7 +116,7 @@ export class BoLHordeSheet extends ActorSheet {
|
||||
formData.options = this.options
|
||||
formData.owner = this.document.isOwner
|
||||
formData.editScore = this.options.editScore
|
||||
formData.description = await TextEditor.enrichHTML(this.actor.system.description, {async: true})
|
||||
formData.description = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.actor.system.description, {async: true})
|
||||
|
||||
formData.isGM = game.user.isGM
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
import { BoLRoll } from "../controllers/bol-rolls.js";
|
||||
import { BoLUtility } from "../system/bol-utility.js";
|
||||
|
||||
export class BoLVehicleSheet extends ActorSheet {
|
||||
export class BoLVehicleSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
@@ -127,7 +127,7 @@ export class BoLVehicleSheet extends ActorSheet {
|
||||
formData.options = this.options
|
||||
formData.owner = this.document.isOwner
|
||||
formData.editScore = this.options.editScore
|
||||
formData.description = await TextEditor.enrichHTML(this.actor.system.description, {async: true})
|
||||
formData.description = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.actor.system.description, {async: true})
|
||||
|
||||
formData.isGM = game.user.isGM
|
||||
|
||||
|
@@ -31,7 +31,7 @@ Hooks.once('init', async function () {
|
||||
config: BOL
|
||||
};
|
||||
|
||||
// Game socket
|
||||
// Game socket
|
||||
game.socket.on("system.bol", sockmsg => {
|
||||
BoLUtility.onSocketMessage(sockmsg);
|
||||
})
|
||||
@@ -51,13 +51,13 @@ Hooks.once('init', async function () {
|
||||
CONFIG.Combat.documentClass = BoLCombatManager;
|
||||
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet);
|
||||
Actors.registerSheet("bol", BoLActorSheet, { types: ["character", "encounter"], makeDefault: true })
|
||||
Actors.registerSheet("bol", BoLVehicleSheet, { types: ["vehicle"], makeDefault: true })
|
||||
Actors.registerSheet("bol", BoLHordeSheet, { types: ["horde"], makeDefault: true })
|
||||
foundry.documents.collections.Actors.unregisterSheet("core", foundry.appv1.sheets.ActorSheet);
|
||||
foundry.documents.collections.Actors.registerSheet("bol", BoLActorSheet, { types: ["character", "encounter"], makeDefault: true })
|
||||
foundry.documents.collections.Actors.registerSheet("bol", BoLVehicleSheet, { types: ["vehicle"], makeDefault: true })
|
||||
foundry.documents.collections.Actors.registerSheet("bol", BoLHordeSheet, { types: ["horde"], makeDefault: true })
|
||||
|
||||
Items.unregisterSheet("core", ItemSheet);
|
||||
Items.registerSheet("bol", BoLItemSheet, { makeDefault: true });
|
||||
foundry.documents.collections.Items.unregisterSheet("core", foundry.appv1.sheets.ItemSheet);
|
||||
foundry.documents.collections.Items.registerSheet("bol", BoLItemSheet, { makeDefault: true });
|
||||
|
||||
// Inot useful stuff
|
||||
BoLUtility.init()
|
||||
@@ -78,7 +78,7 @@ Hooks.once('init', async function () {
|
||||
Babele.get().setSystemTranslationsDir("compendiums");
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ function welcomeMessage() {
|
||||
game.i18n.localize("BOL.chat.welcome4") + "</p><p>" +
|
||||
game.i18n.localize("BOL.chat.welcome5") + "</p>" +
|
||||
game.i18n.localize("BOL.chat.welcome6")
|
||||
|
||||
|
||||
let rulebook = game.modules.find( m => m.id === "bol-rulebook")
|
||||
if ( !rulebook ) {
|
||||
content += "<p>" + game.i18n.localize("BOL.chat.bolRulebookMessage") + "</p>"
|
||||
@@ -101,7 +101,7 @@ function welcomeMessage() {
|
||||
whisper: [game.user.id],
|
||||
content: content
|
||||
})
|
||||
|
||||
|
||||
if (game.user.isGM && game.i18n.lang == 'en' && !game.modules.find(m => m.id == "babele") ){
|
||||
ChatMessage.create({
|
||||
user: game.user.id,
|
||||
@@ -109,7 +109,7 @@ function welcomeMessage() {
|
||||
content: `<div id="welcome-message-bol"><span class="rdd-roll-part">
|
||||
<strong>WARNING ! English language selected, but Babele module is not installed !<br>Please install babele from the module tab in Foundry interface.`
|
||||
} )
|
||||
ui.notifications.warn("WARNING ! English language selected, but babele module is not installed !<br>Please install babele from the module tab in Foundry interface.")
|
||||
ui.notifications.warn("WARNING ! English language selected, but babele module is not installed !<br>Please install babele from the module tab in Foundry interface.")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -166,13 +166,11 @@ Hooks.once('ready', async function () {
|
||||
"d6B": "d6H (Bonus)",
|
||||
"d6BB": "d6H + Bonus die",
|
||||
}
|
||||
|
||||
|
||||
if (game.i18n.lang === "fr") {
|
||||
game.bol.config.damageValues = damageFR;
|
||||
} else {
|
||||
game.bol.config.damageValues = damageEN;
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
@@ -305,7 +305,7 @@ export class BoLRoll {
|
||||
// Keep track of the final effect modifier
|
||||
this.rollData.effectModifier = effectModifier
|
||||
|
||||
// Final number of dices
|
||||
// Final number of dices
|
||||
this.rollData.nbDice = 2 + Math.abs(this.rollData.bmDice)
|
||||
// Bonus or Malus ?
|
||||
if (this.rollData.bmDice == 0) {
|
||||
@@ -489,7 +489,7 @@ export class BoLRoll {
|
||||
if (defender) { // If target is selected
|
||||
rollData.defence = defender.defenseValue
|
||||
rollData.armorMalus = defender.armorMalusValue
|
||||
rollData.defenderHeroPoints = defender.getHeroPoints()
|
||||
rollData.defenderHeroPoints = defender.getHeroPoints()
|
||||
rollData.shieldBlock = 'none'
|
||||
let shields = defender.shields
|
||||
//console.log("Defender stats", defender)
|
||||
@@ -535,7 +535,7 @@ export class BoLRoll {
|
||||
rollData.weaponModifier = 0
|
||||
rollData.attackBonusDice = false
|
||||
rollData.armorMalus = 0
|
||||
// Specific stuff
|
||||
// Specific stuff
|
||||
this.preProcessWeapon(rollData, defender)
|
||||
this.preProcessFightOption(rollData)
|
||||
this.updateArmorMalus(rollData)
|
||||
@@ -551,7 +551,7 @@ export class BoLRoll {
|
||||
console.log("ROLLDATA", rollData)
|
||||
|
||||
// Then display+process the dialog
|
||||
const rollOptionContent = await renderTemplate(rollOptionTpl, rollData);
|
||||
const rollOptionContent = await foundry.applications.handlebars.renderTemplate(rollOptionTpl, rollData);
|
||||
let d = new Dialog({
|
||||
title: rollData.label,
|
||||
content: rollOptionContent,
|
||||
@@ -582,7 +582,7 @@ export class BoLRoll {
|
||||
rollbase = 0
|
||||
}
|
||||
let diceData = BoLUtility.getDiceData()
|
||||
let malusInit = rollData.combatData?.malusInit || 0
|
||||
let malusInit = rollData.combatData?.malusInit || 0
|
||||
const modifiers = rollbase + rollData.careerBonus + rollData.mod + rollData.weaponModifier - rollData.defence - rollData.modArmorMalus + rollData.shieldMalus + rollData.attackModifier + rollData.appliedArmorMalus + rollData.effectModifier - malusInit
|
||||
const formula = (isMalus) ? rollData.nbDice + "d" + diceData.diceFormula + "kl2 + " + modifiers : rollData.nbDice + "d" + diceData.diceFormula + "kh2 + " + modifiers
|
||||
rollData.formula = formula
|
||||
@@ -635,15 +635,15 @@ export class BoLDefaultRoll {
|
||||
this.rollData.roll = r
|
||||
this.rollData.isFumble = (diceTotal <= diceData.criticalFailureValue)
|
||||
if ( this.rollData.isFumble ) {
|
||||
this.rollData.isSuccess = false
|
||||
this.rollData.isSuccess = false
|
||||
this.rollData.isCritical = false
|
||||
this.rollData.isRealCritical = false
|
||||
this.rollData.isHeroic = false
|
||||
this.rollData.isFailure = true
|
||||
this.rollData.isFailure = true
|
||||
} else {
|
||||
this.rollData.isCritical = (diceTotal >= diceData.criticalSuccessValue)
|
||||
if ( this.rollData.isCritical) {
|
||||
this.rollData.isSuccess = true
|
||||
this.rollData.isSuccess = true
|
||||
} else {
|
||||
this.rollData.isSuccess = (r.total >= diceData.successValue)
|
||||
}
|
||||
@@ -805,13 +805,13 @@ export class BoLDefaultRoll {
|
||||
/* -------------------------------------------- */
|
||||
_buildDamageChatMessage(rollData) {
|
||||
const rollMessageTpl = 'systems/bol/templates/chat/rolls/damage-roll-card.hbs';
|
||||
return renderTemplate(rollMessageTpl, rollData)
|
||||
return foundry.applications.handlebars.renderTemplate(rollMessageTpl, rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_buildChatMessage(rollData) {
|
||||
const rollMessageTpl = 'systems/bol/templates/chat/rolls/default-roll-card.hbs'
|
||||
return renderTemplate(rollMessageTpl, rollData)
|
||||
return foundry.applications.handlebars.renderTemplate(rollMessageTpl, rollData)
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import { BoLUtility } from "../system/bol-utility.js";
|
||||
* Extend the basic ItemSheet with some very simple modifications
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class BoLItemSheet extends ItemSheet {
|
||||
export class BoLItemSheet extends foundry.appv1.sheets.ItemSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
@@ -27,7 +27,7 @@ export class BoLItemSheet extends ItemSheet {
|
||||
data.category = itemData.system.category
|
||||
data.isGM = game.user.isGM;
|
||||
data.itemProperties = this.item.itemProperties;
|
||||
data.description = await TextEditor.enrichHTML(this.object.system.description, { async: true })
|
||||
data.description = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.object.system.description, { async: true })
|
||||
if (data.document.actor) {
|
||||
data.careers = data.document.actor.careers
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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);
|
||||
};
|
||||
|
Reference in New Issue
Block a user