Cleanup and convert
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user