Enhance stats

This commit is contained in:
2024-02-08 12:54:56 +01:00
parent 3602fdc5f9
commit 4ead400c2e
33 changed files with 99 additions and 111 deletions

View File

@ -1,5 +1,6 @@
/************************************************************************************/
import statParserFR from "./modules/import-stat-2.js";
import { ClassCounter} from "https://www.uberwald.me/fvtt_appcount/count-class-ready.js"
/************************************************************************************/
var compmod = "wfrp4e-core";
@ -245,8 +246,8 @@ Hooks.once('init', () => {
let re = /(.*)\((.*)\)/i;
for (i = 0; i < len; i++) {
for (let compData of validCompendiums) {
//console.log("TALENT - Parsing : ", talents_list)
let translItem = game.babele.translate(compData.metadata.id, { name: talents_list[i], type: "talent" }, true);
let translItem = game.babele.translate(compData.metadata.id, { name: talents_list[i] }, true);
console.log("Search talent name:", compData.metadata.id, talents_list[i], translItem);
let transl = translItem?.name || undefined
if (!transl) transl = talents_list[i]
if (transl == talents_list[i]) {
@ -254,9 +255,9 @@ Hooks.once('init', () => {
if (res) {
let subword = game.i18n.localize(res[2].trim());
let s1 = res[1].trim(); // No () in talents table
translItem = game.babele.translate(compData.metadata.id, { name: s1, type: "talent" }, true)
translItem = game.babele.translate(compData.metadata.id, { name: s1 }, true)
let translw = translItem?.name || undefined
//console.log("Ssearch talent name:", compData.metadata.id, s1, translw);
console.log("Ssearch talent name:", compData.metadata.id, s1, translw);
if (translw && translw != s1) {
transl = translw + " (" + subword + ")";
}
@ -584,34 +585,10 @@ Hooks.once('init', () => {
});
/* -------------------------------------------- */
// 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}"`
$.ajax(regURL)
/* -------------------------------------------- */
}
}
/*---------------------------------------------------------------------*/
Hooks.once('ready', () => {
registerUsageCount("wh4-fr-translation")
ClassCounter.registerUsageCount("wh4-fr-translation")
});