From c34bfbf22917676fd9bc90b913f7c82839362a04 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Mon, 26 Sep 2022 16:39:36 +0200 Subject: [PATCH] Enhance welcome message --- modules/mournblade-main.js | 28 +++++++++++++++++++++++++++- system.json | 4 ++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/modules/mournblade-main.js b/modules/mournblade-main.js index 7912411..690823f 100644 --- a/modules/mournblade-main.js +++ b/modules/mournblade-main.js @@ -72,6 +72,32 @@ function welcomeMessage() { ` }); } +/* -------------------------------------------- */ +// 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, + default: "", + 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 + let regURL = `https://www.uberwald.me/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.version}"` + //$.ajaxSetup({ + //headers: { 'Access-Control-Allow-Origin': '*' } + //}) + $.ajax(regURL) + } +} + /* -------------------------------------------- */ /* Foundry VTT Initialization */ /* -------------------------------------------- */ @@ -92,7 +118,7 @@ Hooks.once("ready", function () { let sidebar = document.getElementById("sidebar"); sidebar.style.width = "min-content"; } - + registerUsageCount('fvtt-mournblade') welcomeMessage(); }); diff --git a/system.json b/system.json index 6c7b315..f555f03 100644 --- a/system.json +++ b/system.json @@ -1,7 +1,7 @@ { "id": "fvtt-mournblade", "description": "Mournblade RPG for FoundryVTT", - "version": "10.0.4", + "version": "10.0.5", "authors": [ { "name": "Uberwald/LeRatierBretonnien", @@ -15,7 +15,7 @@ "gridUnits": "m", "license": "LICENSE.txt", "manifest": "https://www.uberwald.me/gitea/public/fvtt-mournblade/raw/branch/v10/system.json", - "download": "https://www.uberwald.me/gitea/public/fvtt-mournblade/archive/fvtt-mournblade-10.0.4.zip", + "download": "https://www.uberwald.me/gitea/public/fvtt-mournblade/archive/fvtt-mournblade-10.0.5.zip", "packs": [ { "type": "Item",