Attempt to add HUD core
This commit is contained in:
@@ -14,6 +14,9 @@ import * as applications from "./module/applications/_module.mjs"
|
||||
import { handleSocketEvent } from "./module/socket.mjs"
|
||||
import CthulhuEternalUtils from "./module/utils.mjs"
|
||||
|
||||
import { SystemManager } from './module/applications/hud/system-manager.js'
|
||||
import { MODULE, REQUIRED_CORE_MODULE_VERSION } from './module/applications/hud/constants.js'
|
||||
|
||||
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 () {
|
||||
@@ -142,9 +145,22 @@ Hooks.once("ready", function () {
|
||||
|
||||
})
|
||||
|
||||
|
||||
Hooks.on('tokenActionHudCoreApiReady', async () => {
|
||||
/**
|
||||
* Return the SystemManager and requiredCoreModuleVersion to Token Action HUD Core
|
||||
*/
|
||||
let module = {} // game.modules.get(MODULE.ID)
|
||||
module.api = {
|
||||
requiredCoreModuleVersion: REQUIRED_CORE_MODULE_VERSION,
|
||||
SystemManager
|
||||
}
|
||||
Hooks.call('tokenActionHudSystemReady', module)
|
||||
})
|
||||
|
||||
Hooks.on("renderChatMessageHTML", (message, html, data) => {
|
||||
// Affichage des boutons de jet de dés uniquement pour les joueurs
|
||||
if (message.author.id === game.user.id) {
|
||||
if (message.author.id === game.user.id || game.user.isGM) {
|
||||
$(html).find(".nudge-roll").each((i, btn) => {
|
||||
btn.style.display = "inline"
|
||||
})
|
||||
@@ -154,6 +170,11 @@ Hooks.on("renderChatMessageHTML", (message, html, data) => {
|
||||
$(html).find(".healing-roll").each((i, btn) => {
|
||||
btn.style.display = "inline"
|
||||
})
|
||||
if (game.user.isGM) {
|
||||
$(html).find(".opposed-roll").each((i, btn) => {
|
||||
btn.style.display = "inline"
|
||||
})
|
||||
}
|
||||
$(html).find(".nudge-roll").click((event) => {
|
||||
CthulhuEternalUtils.nudgeRoll(message)
|
||||
})
|
||||
@@ -170,6 +191,9 @@ Hooks.on("renderChatMessageHTML", (message, html, data) => {
|
||||
$(html).find(".san-type").click((event) => {
|
||||
CthulhuEternalUtils.applySANType(message, event)
|
||||
})
|
||||
$(html).find(".opposed-roll").click((event) => {
|
||||
CthulhuEternalUtils.opposedRollManagement(message, event)
|
||||
})
|
||||
}
|
||||
if (game.user.isGM) {
|
||||
$(html).find(".li-apply-wounds").each((i, btn) => {
|
||||
|
||||
Reference in New Issue
Block a user