diff --git a/modules/yggdrasill-main.js b/modules/yggdrasill-main.js index 2237d5a..7b033a4 100644 --- a/modules/yggdrasill-main.js +++ b/modules/yggdrasill-main.js @@ -67,10 +67,35 @@ function welcomeMessage() { ChatMessage.create({ user: game.user.id, whisper: [game.user.id], - content: `
Bienvenue !
+ content: `
Bienvenue à Yggdrasill ! +

Yggdrasill est un Jeu de Rôle publié par 7ième Cercle : https://www.7emecercle.com/7C_site/jeux-de-roles/yggdrasill/

+
Yggdrasill est une propriété de 7ième Cercle. +
` }); } +/* -------------------------------------------- */ +// Register world usage statistics +function registerUsageCount( registerKey ) { + if ( game.user.isGM ) { + game.settings.register(registerKey, "world-key", { + name: "Unique world key", + scope: "world", + config: false, + type: String + }); + + let worldKey = game.settings.get(registerKey, "world-key") + if ( worldKey == undefined || worldKey == "" ) { + worldKey = randomID(32) + game.settings.set(registerKey, "world-key", worldKey ) + } + // Simple API counter + $.ajax(`https://jdr.lahiette.com/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.data.version}"`) + /* -------------------------------------------- */ + } +} + /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ @@ -84,7 +109,8 @@ Hooks.once("ready", function () { user: game.user._id }); } - welcomeMessage(); + registerUsageCount("fvtt-yggdrasill") + welcomeMessage() }); /* -------------------------------------------- */