Cleanup and convert

This commit is contained in:
2025-02-14 09:09:13 +01:00
parent fa21d30994
commit b29cbfb8fa
13 changed files with 108 additions and 182 deletions

View File

@@ -1,12 +1,12 @@
import { SYSTEM } from "../config/system.mjs"
export default class CthulhuEternalRoll extends Roll {
export default class FTLNomadRoll extends Roll {
/**
* The HTML template path used to render dice checks of this type
* @type {string}
*/
static CHAT_TEMPLATE = "systems/fvtt-cthulhu-eternal/templates/chat-message.hbs"
static CHAT_TEMPLATE = "systems/fvtt-ftl-nomad/templates/chat-message.hbs"
get type() {
return this.options.type
@@ -168,14 +168,14 @@ export default class CthulhuEternalRoll extends Roll {
}
return
case "weapon":
let era = game.settings.get("fvtt-cthulhu-eternal", "settings-era")
let era = game.settings.get("fvtt-ftl-nomad", "settings-era")
if (era !== options.rollItem.system.settings) {
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.WrongEra"))
ui.notifications.error(game.i18n.localize("FTLNOMAD.Notifications.WrongEra"))
console.log("WP Wrong Era", era, options.rollItem.system.weaponType)
return
}
if (!SYSTEM.WEAPON_SKILL_MAPPING[era] || !SYSTEM.WEAPON_SKILL_MAPPING[era][options.rollItem.system.weaponType]) {
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.NoWeaponType"))
ui.notifications.error(game.i18n.localize("FTLNOMAD.Notifications.NoWeaponType"))
console.log("WP Not found", era, options.rollItem.system.weaponType)
return
}
@@ -189,7 +189,7 @@ export default class CthulhuEternalRoll extends Roll {
let actor = game.actors.get(options.actorId)
options.rollItem = actor.items.find(i => i.type === "skill" && i.name.toLowerCase() === skillName.toLowerCase())
if (!options.rollItem) {
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.NoWeaponSkill"))
ui.notifications.error(game.i18n.localize("FTLNOMAD.Notifications.NoWeaponSkill"))
return
}
options.initialScore = options.rollItem.system.computeScore()
@@ -237,13 +237,13 @@ export default class CthulhuEternalRoll extends Roll {
modifier,
multiplier
}
const content = await renderTemplate("systems/fvtt-cthulhu-eternal/templates/roll-dialog.hbs", dialogContext)
const content = await renderTemplate("systems/fvtt-ftl-nomad/templates/roll-dialog.hbs", dialogContext)
const title = CthulhuEternalRoll.createTitle(options.rollType, options.rollTarget)
const label = game.i18n.localize("CTHULHUETERNAL.Roll.roll")
const label = game.i18n.localize("FTLNOMAD.Roll.roll")
const rollContext = await foundry.applications.api.DialogV2.wait({
window: { title: title },
classes: ["fvtt-cthulhu-eternal"],
classes: ["fvtt-ftl-nomad"],
content,
buttons: [
{
@@ -301,14 +301,14 @@ export default class CthulhuEternalRoll extends Roll {
rollData.targetScore = Math.min(Math.max(rollData.targetScore, 0), 100)
}
if (Hooks.call("fvtt-cthulhu-eternal.preRoll", options, rollData) === false) return
if (Hooks.call("fvtt-ftl-nomad.preRoll", options, rollData) === false) return
const roll = new this(formula, options.data, rollData)
await roll.evaluate()
roll.displayRollResult(roll, options, rollData)
if (Hooks.call("fvtt-cthulhu-eternal.Roll", options, rollData, roll) === false) return
if (Hooks.call("fvtt-ftl-nomad.Roll", options, rollData, roll) === false) return
return roll
}
@@ -358,15 +358,15 @@ export default class CthulhuEternalRoll extends Roll {
static createTitle(type, target) {
switch (type) {
case "skill":
return `${game.i18n.localize("CTHULHUETERNAL.Label.titleSkill")}`
return `${game.i18n.localize("FTLNOMAD.Label.titleSkill")}`
case "weapon":
return `${game.i18n.localize("CTHULHUETERNAL.Label.titleWeapon")}`
return `${game.i18n.localize("FTLNOMAD.Label.titleWeapon")}`
case "char":
return `${game.i18n.localize("CTHULHUETERNAL.Label.titleCharacteristic")}`
return `${game.i18n.localize("FTLNOMAD.Label.titleCharacteristic")}`
case "san":
return `${game.i18n.localize("CTHULHUETERNAL.Label.titleSAN")}`
return `${game.i18n.localize("FTLNOMAD.Label.titleSAN")}`
default:
return game.i18n.localize("CTHULHUETERNAL.Label.titleStandard")
return game.i18n.localize("FTLNOMAD.Label.titleStandard")
}
}