From b29cbfb8facfbe82fc59b2f2a7d780705403cf67 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Fri, 14 Feb 2025 09:09:13 +0100 Subject: [PATCH] Cleanup and convert --- ftl-nomad.mjs | 89 +++++++------------ module/applications/_module.mjs | 2 + .../sheets/{npc.mjs => npc-sheet.mjs} | 0 module/applications/sheets/vehicle-sheet.mjs | 8 +- module/config/system.mjs | 35 +++++--- module/documents/_module.mjs | 8 +- module/documents/actor.mjs | 43 ++------- module/documents/chat-message.mjs | 6 +- module/documents/item.mjs | 20 ++--- module/documents/roll.mjs | 32 +++---- module/models/character.mjs | 2 +- module/models/weapon.mjs | 23 +++-- styles/archetype.less | 22 ----- 13 files changed, 108 insertions(+), 182 deletions(-) rename module/applications/sheets/{npc.mjs => npc-sheet.mjs} (100%) delete mode 100644 styles/archetype.less diff --git a/ftl-nomad.mjs b/ftl-nomad.mjs index b8ef0a6..4111845 100644 --- a/ftl-nomad.mjs +++ b/ftl-nomad.mjs @@ -12,15 +12,15 @@ import * as documents from "./module/documents/_module.mjs" import * as applications from "./module/applications/_module.mjs" import { handleSocketEvent } from "./module/socket.mjs" -import CthulhuEternalUtils from "./module/utils.mjs" +import FTLNomadUtils from "./module/utils.mjs" export class ClassCounter { static printHello() { console.log("Hello") } static sendJsonPostRequest(e, s) { const t = { method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json" }, body: JSON.stringify(s) }; return fetch(e, t).then((e => { if (!e.ok) throw new Error("La requête a échoué avec le statut " + e.status); return e.json() })).catch((e => { throw console.error("Erreur envoi de la requête:", e), e })) } static registerUsageCount(e = game.system.id, s = {}) { if (game.user.isGM) { game.settings.register(e, "world-key", { name: "Unique world key", scope: "world", config: !1, default: "", type: String }); let t = game.settings.get(e, "world-key"); null != t && "" != t && "NONE" != t && "none" != t.toLowerCase() || (t = foundry.utils.randomID(32), game.settings.set(e, "world-key", t)); let a = { name: e, system: game.system.id, worldKey: t, version: game.system.version, language: game.settings.get("core", "language"), remoteAddr: game.data.addresses.remote, nbInstalledModules: game.modules.size, nbActiveModules: game.modules.filter((e => e.active)).length, nbPacks: game.world.packs.size, nbUsers: game.users.size, nbScenes: game.scenes.size, nbActors: game.actors.size, nbPlaylist: game.playlists.size, nbTables: game.tables.size, nbCards: game.cards.size, optionsData: s, foundryVersion: `${game.release.generation}.${game.release.build}` }; this.sendJsonPostRequest("https://www.uberwald.me/fvtt_appcount/count_post.php", a) } } } Hooks.once("init", function () { - console.info("Cthulhu Eternal RPG | Initializing System") + console.info("FTL Nomad RPG | Initializing System") console.info(SYSTEM.ASCII) - globalThis.CthulhuEternal = game.system + globalThis.FTLNomad = game.system game.system.CONST = SYSTEM // Expose the system API @@ -30,56 +30,44 @@ Hooks.once("init", function () { documents, } - CONFIG.Actor.documentClass = documents.CthulhuEternalActor + CONFIG.Actor.documentClass = documents.FTLNomadActor CONFIG.Actor.dataModels = { - protagonist: models.CthulhuEternalProtagonist, - vehicle: models.CthulhuEternalVehicle, - creature: models.CthulhuEternalCreature + protagonist: models.FTLNomadCharacter, + vehicle: models.FTLNomadVehicle, + creature: models.FTLNomadNPC } - CONFIG.Item.documentClass = documents.CthulhuEternalItem + CONFIG.Item.documentClass = documents.FTLNomadItem CONFIG.Item.dataModels = { - skill: models.CthulhuEternalSkill, - injury: models.CthulhuEternalInjury, - weapon: models.CthulhuEternalWeapon, - armor: models.CthulhuEternalArmor, - motivation: models.CthulhuEternalMotivation, - mentaldisorder: models.CthulhuEternalMentalDisorder, - bond: models.CthulhuEternalBond, - arcane: models.CthulhuEternalArcane, - gear: models.CthulhuEternalGear, - archetype: models.CthulhuEternalArchetype, - ritual: models.CthulhuEternalRitual, - tome: models.CthulhuEternalTome + psionic: models.FTLNomadPsionic, + weapon: models.FTLNomadWeapon, + armor: models.FTLNomadArmor, + talent: models.FTLNomadTalent, + language: models.FTLNomadLanguage, + equipment: models.FTLNomadEquipment } // Register sheet application classes Actors.unregisterSheet("core", ActorSheet) - Actors.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalProtagonistSheet, { types: ["protagonist"], makeDefault: true }) - Actors.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalVehicleSheet, { types: ["vehicle"], makeDefault: true }) - Actors.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalCreatureSheet, { types: ["creature"], makeDefault: true }) + Actors.registerSheet("fvtt-ftl-nomad", applications.FTLNomadCharacterSheet , { types: ["character"], makeDefault: true }) + Actors.registerSheet("fvtt-ftl-nomad", applications.FTLNomadVehicleSheet, { types: ["vehicle"], makeDefault: true }) + Actors.registerSheet("fvtt-ftl-nomad", applications.FTLNomadNPCSheet, { types: ["npc"], makeDefault: true }) Items.unregisterSheet("core", ItemSheet) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalSkillSheet, { types: ["skill"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalInjurySheet, { types: ["injury"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalMotivationSheet, { types: ["motivation"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalMentalDisorderSheet, { types: ["mentaldisorder"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalWeaponSheet, { types: ["weapon"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalArcaneSheet, { types: ["arcane"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalArmorSheet, { types: ["armor"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalBondSheet, { types: ["bond"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalGearSheet, { types: ["gear"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalArchetypeSheet, { types: ["archetype"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalRitualSheet, { types: ["ritual"], makeDefault: true }) - Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalTomeSheet, { types: ["tome"], makeDefault: true }) + Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadPsionicSheet, { types: ["psionic"], makeDefault: true }) + Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadTalentSheet, { types: ["talent"], makeDefault: true }) + Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadLanguageSheet, { types: ["language"], makeDefault: true }) + Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadWeaponSheet, { types: ["weapon"], makeDefault: true }) + Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadArmorSheet, { types: ["armor"], makeDefault: true }) + Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadEquipmentSheet, { types: ["equipment"], makeDefault: true }) // Other Document Configuration - CONFIG.ChatMessage.documentClass = documents.CthulhuEternalChatMessage + CONFIG.ChatMessage.documentClass = documents.FTLNomadChatMessage // Dice system configuration - CONFIG.Dice.rolls.push(documents.CthulhuEternalRoll) + CONFIG.Dice.rolls.push(documents.FTLNomadRoll) - game.settings.register("fvtt-cthulhu-eternal", "worldKey", { + game.settings.register("fvtt-ftl-nomad", "worldKey", { name: "Unique world key", scope: "world", config: false, @@ -90,11 +78,11 @@ Hooks.once("init", function () { // Activate socket handler game.socket.on(`system.${SYSTEM.id}`, handleSocketEvent) - CthulhuEternalUtils.registerSettings() - CthulhuEternalUtils.registerHandlebarsHelpers() - CthulhuEternalUtils.setupCSSRootVariables() + FTLNomadUtils.registerSettings() + FTLNomadUtils.registerHandlebarsHelpers() + FTLNomadUtils.setupCSSRootVariables() - console.info("CTHULHU ETERNAL | System Initialized") + console.info("FTL Nomad | System Initialized") }) @@ -112,30 +100,17 @@ function preLocalizeConfig() { } Hooks.once("ready", function () { - console.info("CTHULHU ETERNAL | Ready") + console.info("FTL Nomad | Ready") if (game.user.isGM) { - ClassCounter.registerUsageCount("fvtt-cthulhu-eternal", {}) + ClassCounter.registerUsageCount("fvtt-ftl-nomad", {}) } preLocalizeConfig() }) Hooks.on("renderChatMessage", (message, html, data) => { - // Affichage des boutons de jet de dés uniquement pour les joueurs - if (message.author.id === game.user.id) { - html.find(".nudge-roll").each((i, btn) => { - btn.style.display = "inline" - }) - html.find(".nudge-roll").click((event) => { - CthulhuEternalUtils.nudgeRoll(message) - }) - } }) -// Dice-so-nice Ready -Hooks.once("diceSoNiceReady", (dice3d) => { - //configureDiceSoNice(dice3d) -}) /** * Create a macro when dropping an entity on the hotbar diff --git a/module/applications/_module.mjs b/module/applications/_module.mjs index 0cdea31..25658e4 100644 --- a/module/applications/_module.mjs +++ b/module/applications/_module.mjs @@ -4,5 +4,7 @@ export { default as FTLNomadVehicleSheet } from "./sheets/vehicle-sheet.mjs" export { default as FTLNomadPsionicSheet } from "./sheets/psionic-sheet.mjs" export { default as FTLNomadLanguageSheet } from "./sheets/language-sheet.mjs" export { default as FTLNomadTalentSheet } from "./sheets/talent-sheet.mjs" +export { default as FTLNomadCharacterSheet } from "./sheets/character-sheet.mjs" +export { default as FTLNomadEquipmentSheet } from "./sheets/equipment-sheet.mjs" export { default as FTLNomadNPCSheet } from "./sheets/npc-sheet.mjs" diff --git a/module/applications/sheets/npc.mjs b/module/applications/sheets/npc-sheet.mjs similarity index 100% rename from module/applications/sheets/npc.mjs rename to module/applications/sheets/npc-sheet.mjs diff --git a/module/applications/sheets/vehicle-sheet.mjs b/module/applications/sheets/vehicle-sheet.mjs index 5f358e3..d2ef880 100644 --- a/module/applications/sheets/vehicle-sheet.mjs +++ b/module/applications/sheets/vehicle-sheet.mjs @@ -44,8 +44,8 @@ export default class FTLNomadVehicleSheet extends FTLNomadActorSheet { */ #getTabs() { const tabs = { - equipment: { id: "equipment", group: "sheet", icon: "fa-solid fa-shapes", label: "CTHULHUETERNAL.Label.equipment" }, - description: { id: "description", group: "sheet", icon: "fa-solid fa-book", label: "CTHULHUETERNAL.Label.description" }, + equipment: { id: "equipment", group: "sheet", icon: "fa-solid fa-shapes", label: "FTLNOMAD.Label.equipment" }, + description: { id: "description", group: "sheet", icon: "fa-solid fa-book", label: "FTLNOMAD.Label.description" }, } for (const v of Object.values(tabs)) { v.active = this.tabGroups[v.group] === v.id @@ -94,11 +94,11 @@ export default class FTLNomadVehicleSheet extends FTLNomadActorSheet { * @param {HTMLElement} target The current target of the event listener. */ static #onCreateGear(event, target) { - this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newGear"), type: "gear" }]) + this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newGear"), type: "gear" }]) } static #onCreateWeapon(event, target) { - this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newWeapon"), type: "weapon" }]) + this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newWeapon"), type: "weapon" }]) } diff --git a/module/config/system.mjs b/module/config/system.mjs index 224daa7..8f29b6e 100644 --- a/module/config/system.mjs +++ b/module/config/system.mjs @@ -1,17 +1,30 @@ export const SYSTEM_ID = "fvtt-ftl-nomad" export const ASCII = ` -▄████▄ ▄▄▄█████▓ ██░ ██ █ ██ ██▓ ██░ ██ █ ██ ▓█████▄▄▄█████▓▓█████ ██▀███ ███▄ █ ▄▄▄ ██▓ -▒██▀ ▀█ ▓ ██▒ ▓▒▓██░ ██▒ ██ ▓██▒▓██▒ ▓██░ ██▒ ██ ▓██▒ ▓█ ▀▓ ██▒ ▓▒▓█ ▀ ▓██ ▒ ██▒ ██ ▀█ █ ▒████▄ ▓██▒ -▒▓█ ▄ ▒ ▓██░ ▒░▒██▀▀██░▓██ ▒██░▒██░ ▒██▀▀██░▓██ ▒██░ ▒███ ▒ ▓██░ ▒░▒███ ▓██ ░▄█ ▒▓██ ▀█ ██▒▒██ ▀█▄ ▒██░ -▒▓▓▄ ▄██▒░ ▓██▓ ░ ░▓█ ░██ ▓▓█ ░██░▒██░ ░▓█ ░██ ▓▓█ ░██░ ▒▓█ ▄░ ▓██▓ ░ ▒▓█ ▄ ▒██▀▀█▄ ▓██▒ ▐▌██▒░██▄▄▄▄██ ▒██░ -▒ ▓███▀ ░ ▒██▒ ░ ░▓█▒░██▓▒▒█████▓ ░██████▒░▓█▒░██▓▒▒█████▓ ░▒████▒ ▒██▒ ░ ░▒████▒░██▓ ▒██▒▒██░ ▓██░ ▓█ ▓██▒░██████▒ -░ ░▒ ▒ ░ ▒ ░░ ▒ ░░▒░▒░▒▓▒ ▒ ▒ ░ ▒░▓ ░ ▒ ░░▒░▒░▒▓▒ ▒ ▒ ░░ ▒░ ░ ▒ ░░ ░░ ▒░ ░░ ▒▓ ░▒▓░░ ▒░ ▒ ▒ ▒▒ ▓▒█░░ ▒░▓ ░ - ░ ▒ ░ ▒ ░▒░ ░░░▒░ ░ ░ ░ ░ ▒ ░ ▒ ░▒░ ░░░▒░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░▒ ░ ▒░░ ░░ ░ ▒░ ▒ ▒▒ ░░ ░ ▒ ░ -░ ░ ░ ░░ ░ ░░░ ░ ░ ░ ░ ░ ░░ ░ ░░░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ▒ ░ ░ -░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ -░ -` +░ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ +▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░▌ ▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌ +▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀█░█▀▀▀▀ ▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌░▌ ▐░▌ ▐░▌ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌ ▀▀▀▀█░█▀▀▀▀ +▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ +▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌ ▐░▌ +▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌ +▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀▀▀▀▀▀█░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀█░█▀▀ ▐░▌ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ ▐░▌ +▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ +▐░▌ ▐░▌ ▐░▌ ▄▄▄▄▄▄▄▄▄█░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▄▄▄▄█░█▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▐░▌ +▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░▌ + ▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀ + ▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄ ▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄ +▐░░▌ ▐░▌▐░░░░░░░░░░░▌▐░░▌ ▐░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ +▐░▌░▌ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌░▌ ▐░▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ +▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ +▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ +▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌ +▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▀ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ +▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ +▐░▌ ▐░▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌ +▐░▌ ▐░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░░░░░░░░░░▌ + ▀ ▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀ + ` + export const SKILLS = { "combat": { id: "combat", label: "FTLNOMAD.Skill.Combat" }, "knowledge": { id: "knowledge", label: "FTLNOMAD.Skill.Knowledge" }, diff --git a/module/documents/_module.mjs b/module/documents/_module.mjs index a95fe8c..af95a4a 100644 --- a/module/documents/_module.mjs +++ b/module/documents/_module.mjs @@ -1,4 +1,4 @@ -export { default as CthulhuEternalActor } from "./actor.mjs" -export { default as CthulhuEternalItem } from "./item.mjs" -export { default as CthulhuEternalRoll } from "./roll.mjs" -export { default as CthulhuEternalChatMessage } from "./chat-message.mjs" +export { default as FTLNomadActor } from "./actor.mjs" +export { default as FTLNomadItem } from "./item.mjs" +export { default as FTLNomadRoll } from "./roll.mjs" +export { default as FTLNomadChatMessage } from "./chat-message.mjs" diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index 3a65e52..4b3e95d 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -1,6 +1,6 @@ -import CthulhuEternalUtils from "../utils.mjs" +import FTLNomadUtils from "../utils.mjs" -export default class CthulhuEternalActor extends Actor { +export default class FTLNomadActor extends Actor { static async create(data, options) { @@ -14,17 +14,7 @@ export default class CthulhuEternalActor extends Actor { return actor; } - if (data.type === 'protagonist') { - let era = game.settings.get("fvtt-cthulhu-eternal", "settings-era") - const skills = await CthulhuEternalUtils.loadCompendium("fvtt-cthulhu-eternal.skills") - data.items = data.items || [] - for (let skill of skills) { - if (skill.system.settings === era) { - data.items.push(skill.toObject()) - } - } - data.items.push({ type:"weapon", img: "systems/fvtt-cthulhu-eternal/assets/icons/icon_fist.svg", - name: game.i18n.localize("CTHULHUETERNAL.Label.Unarmed"), system: { damage: "1d4-1", weaponType: "unarmed" } }) + if (data.type === 'character') { } return super.create(data, options); @@ -37,43 +27,20 @@ export default class CthulhuEternalActor extends Actor { user: userId, speaker: { alias: this.name }, rollMode: "selfroll", - content: game.i18n.localize("CTHULHUETERNAL.ChatMessage.exhausted"), + content: game.i18n.localize("FTLNOMAD.ChatMessage.exhausted"), type: CONST.CHAT_MESSAGE_STYLES.OTHER }) } return super._onUpdate(changed, options, userId) } - async createEmbeddedDocuments(embeddedName, data, operation) { - let newData = [] - if (embeddedName === "Item") { - for (let i of data) { - if (i.type === "skill") { - if (this.items.find(item => item.name.toLowerCase() === i.name.toLowerCase())) { - ui.notifications.warn(game.i18n.localize("CTHULHUETERNAL.Notifications.skillAlreadyExists")) - continue - } - } - if (i.type === "bond") { - if (i.system.bondType === "individual") { - i.system.value = this.system.characteristics.cha.value - } else { - i.system.value = Math.floor(this.system.resources.permanentRating / 2) - } - } - newData.push(i) - } - return super.createEmbeddedDocuments(embeddedName, newData, operation) - } - return super.createEmbeddedDocuments(embeddedName, data, operation) - } async _preCreate(data, options, user) { await super._preCreate(data, options, user) // Configure prototype token settings const prototypeToken = {} - if (this.type === "protagonist") { + if (this.type === "character") { Object.assign(prototypeToken, { sight: { enabled: true }, actorLink: true, diff --git a/module/documents/chat-message.mjs b/module/documents/chat-message.mjs index 8180c39..9d2f1a3 100644 --- a/module/documents/chat-message.mjs +++ b/module/documents/chat-message.mjs @@ -1,9 +1,9 @@ -import CthulhuEternalRoll from "./roll.mjs" +import FTLNomadRoll from "./roll.mjs" -export default class CthulhuEternalChatMessage extends ChatMessage { +export default class FTLNomadChatMessage extends ChatMessage { async _renderRollContent(messageData) { const data = messageData.message - if (this.rolls[0] instanceof CthulhuEternalRoll) { + if (this.rolls[0] instanceof FTLNomadRoll) { const isPrivate = !this.isContentVisible // _renderRollHTML va appeler render sur tous les rolls const rollHTML = await this._renderRollHTML(isPrivate) diff --git a/module/documents/item.mjs b/module/documents/item.mjs index c9a5991..be0d53f 100644 --- a/module/documents/item.mjs +++ b/module/documents/item.mjs @@ -1,19 +1,13 @@ export const defaultItemImg = { - weapon: "systems/fvtt-cthulhu-eternal/assets/icons/icon_weapon.svg", - armor: "systems/fvtt-cthulhu-eternal/assets/icons/icon_armor.svg", - gear: "systems/fvtt-cthulhu-eternal/assets/icons/icon_equipment.svg", - skill: "systems/fvtt-cthulhu-eternal/assets/icons/icon_skill.svg", - archetype: "systems/fvtt-cthulhu-eternal/assets/icons/icon_archetype.svg", - bond: "systems/fvtt-cthulhu-eternal/assets/icons/icon_bond.svg", - mentaldisorder: "systems/fvtt-cthulhu-eternal/assets/icons/icon_mental_disorder.svg", - arcane: "systems/fvtt-cthulhu-eternal/assets/icons/icon_arcane.svg", - injury: "systems/fvtt-cthulhu-eternal/assets/icons/icon_injury.svg", - motivation: "systems/fvtt-cthulhu-eternal/assets/icons/icon_motivation.svg", - ritual: "systems/fvtt-cthulhu-eternal/assets/icons/icon_ritual.svg", - tome: "systems/fvtt-cthulhu-eternal/assets/icons/icon_tome.svg", + weapon: "systems/fvtt-ftl-nomad/assets/icons/icon_weapon.svg", + armor: "systems/fvtt-ftl-nomad/assets/icons/icon_armor.svg", + equipment: "systems/fvtt-ftl-nomad/assets/icons/icon_equipment.svg", + psionic: "systems/fvtt-ftl-nomad/assets/icons/icon_psionic.svg", + talent: "systems/fvtt-ftl-nomad/assets/icons/icon_talent.svg", + language: "systems/fvtt-ftl-nomad/assets/icons/icon_language.svg" } -export default class CthulhuEternalItem extends Item { +export default class FTLNomadItem extends Item { constructor(data, context) { if (!data.img) { data.img = defaultItemImg[data.type]; diff --git a/module/documents/roll.mjs b/module/documents/roll.mjs index 05de50f..5e7e0a9 100644 --- a/module/documents/roll.mjs +++ b/module/documents/roll.mjs @@ -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") } } diff --git a/module/models/character.mjs b/module/models/character.mjs index 3fdec8a..98a7da7 100644 --- a/module/models/character.mjs +++ b/module/models/character.mjs @@ -99,7 +99,7 @@ export default class FTLNomadProtagonist extends foundry.abstract.TypeDataModel } // Get Unnatural skill for MAX SAN - let unnatural = this.parent.items.find(i => i.type === "skill" && i.name.toLowerCase() === game.i18n.localize("CTHULHUETERNAL.Skill.Unnatural").toLowerCase()) + let unnatural = this.parent.items.find(i => i.type === "skill" && i.name.toLowerCase() === game.i18n.localize("FTLNOMAD.Skill.Unnatural").toLowerCase()) let minus = 0 if (unnatural) { minus = unnatural.system.skillTotal diff --git a/module/models/weapon.mjs b/module/models/weapon.mjs index 94dfb35..c5b611e 100644 --- a/module/models/weapon.mjs +++ b/module/models/weapon.mjs @@ -8,23 +8,20 @@ export default class FTLNomadWeapon extends foundry.abstract.TypeDataModel { schema.description = new fields.HTMLField({ required: true, textSearch: true }) - let setting = game.settings.get("fvtt-cthulhu-eternal", "settings-era") || "modern" - schema.settings = new fields.StringField({ required: true, initial: setting, choices: SYSTEM.AVAILABLE_SETTINGS }) - schema.weaponType = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_TYPE }) - schema.hasDirectSkill = new fields.BooleanField({ required: true, initial: false }) - schema.directSkillValue = new fields.NumberField({ required: true, initial: 0, min: 0, max:99 }) schema.damage = new fields.StringField({required: true, initial: "1d6"}) - schema.baseRange = new fields.StringField({required: true, initial: ""}) - schema.rangeUnit = new fields.StringField({ required: true, initial: "yard", choices: SYSTEM.WEAPON_RANGE_UNIT }) - schema.lethality = new fields.NumberField({ required: true, initial: 0, min: 0 }) - schema.killRadius = new fields.NumberField({ required: true, initial: 0, min: 0 }) - schema.armorPiercing = new fields.NumberField({ required: true, initial: 0, min: 0 }) - schema.weaponSubtype = new fields.StringField({ required: true, initial: "basicfirearm", choices: SYSTEM.WEAPON_SUBTYPE }) - schema.state = new fields.StringField({ required: true, initial: "pristine", choices: SYSTEM.EQUIPMENT_STATES }) + schema.range = new fields.SchemaField({ + close: new fields.NumberField({ ...requiredInteger, initial: 0 }), + near: new fields.NumberField({ ...requiredInteger, initial: 0 }), + far: new fields.NumberField({ ...requiredInteger, initial: 0 }), + dist: new fields.NumberField({ ...requiredInteger, initial: 0 }), + }) - schema.resourceLevel = new fields.NumberField({ required: true, initial: 0, min: 0 }) + schema.enc = new fields.NumberField({ required: true, initial: 0, min: 0 }) + schema.aspect = new fields.StringField({ required: true, initial: ""}) + + schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 }) return schema } diff --git a/styles/archetype.less b/styles/archetype.less deleted file mode 100644 index 646f83a..0000000 --- a/styles/archetype.less +++ /dev/null @@ -1,22 +0,0 @@ -.archetype-content { - .sheet-common(); - .item-sheet-common(); - - fieldset { - margin-top: 8px; - background-color: var(--color-light-1); - } - - .header { - background-color: var(--color-light-1); - display: flex; - img { - width: 50px; - height: 50px; - } - } - - label { - flex: 10%; - } -}