Add new stuff

This commit is contained in:
2022-01-30 20:44:28 +01:00
parent 48ae0920b5
commit fd82c204d7
5 changed files with 38 additions and 4 deletions

View File

@ -76,4 +76,33 @@ Hooks.once('init', async function () {
// Handlebars.registerHelper('toLowerCase', function(str) {
// return str.toLowerCase();
// });
});
});
/* -------------------------------------------- */
// 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}"`)
/* -------------------------------------------- */
}
}
/* -------------------------------------------- */
Hooks.once('ready', async function () {
registerUsageCount('bol')
});