Fix compendium

This commit is contained in:
LeRatierBretonnien 2025-01-05 23:23:37 +01:00
parent 2c32154f4e
commit ef93967ab7
12 changed files with 58 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

Before

Width:  |  Height:  |  Size: 379 KiB

After

Width:  |  Height:  |  Size: 379 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -104,7 +104,7 @@
} }
:root { :root {
--font-size-standard: 0.9rem; --font-size-standard: 0.9rem;
--background-image-base: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), url("../assets/ui/jazzage_background_main.webp"); --background-image-base: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), url("../assets/ui/jazz_background_main.webp");
/*--background-image-base: url("../assets/ui/jazzage_background_main.webp");*/ /*--background-image-base: url("../assets/ui/jazzage_background_main.webp");*/
--font-primary: "RozhaOne"; --font-primary: "RozhaOne";
--font-secondary: "RozhaOne"; --font-secondary: "RozhaOne";

View File

@ -14,7 +14,7 @@ import * as applications from "./module/applications/_module.mjs"
import { handleSocketEvent } from "./module/socket.mjs" import { handleSocketEvent } from "./module/socket.mjs"
import { Macros } from "./module/macros.mjs" import { Macros } from "./module/macros.mjs"
import { setupTextEnrichers } from "./module/enrichers.mjs" import { setupTextEnrichers } from "./module/enrichers.mjs"
import { CthulhuEternalUtils} from "./module/utils.mjs" import CthulhuEternalUtils from "./module/utils.mjs"
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)}}} 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)}}}

View File

@ -1,5 +1,34 @@
import CthulhuEternalUtils from "../utils.mjs"
export default class CthulhuEternalActor extends Actor { export default class CthulhuEternalActor extends Actor {
static async create(data, options) {
// Case of compendium global import
if (data instanceof Array) {
return super.create(data, options);
}
// If the created actor has items (only applicable to duplicated actors) bypass the new actor creation logic
if (data.items) {
let actor = super.create(data, options);
return actor;
}
if (data.type === 'protagonist') {
let era = game.settings.get("fvtt-cthulhu-eternal", "settings-era")
const skills = await CthulhuEternalUtils.loadCompendium("fvtt-cthulhu-eternal.skills")
data.items = data.items || []
for (let skill of skills) {
if (skill.system.settings === era ) {
data.items.push(skill.toObject())
}
}
}
return super.create(data, options);
}
async _preCreate(data, options, user) { async _preCreate(data, options, user) {
await super._preCreate(data, options, user) await super._preCreate(data, options, user)

View File

@ -1,5 +1,5 @@
export class CthulhuEternalUtils { export default class CthulhuEternalUtils {
static registerSettings() { static registerSettings() {
game.settings.register("fvtt-cthulhu-eternal", "settings-era", { game.settings.register("fvtt-cthulhu-eternal", "settings-era", {
@ -14,6 +14,16 @@ export class CthulhuEternalUtils {
}); });
} }
static async loadCompendiumData(compendium) {
const pack = game.packs.get(compendium)
return await pack?.getDocuments() ?? []
}
static async loadCompendium(compendium, filter = item => true) {
let compendiumData = await CthulhuEternalUtils.loadCompendiumData(compendium)
return compendiumData.filter(filter)
}
static registerHandlebarsHelpers() { static registerHandlebarsHelpers() {
Handlebars.registerHelper('isNull', function (val) { Handlebars.registerHelper('isNull', function (val) {
@ -168,15 +178,16 @@ export class CthulhuEternalUtils {
} }
static setupCSSRootVariables() { static setupCSSRootVariables() {
const era = game.settings.get("fvtt-cthulhu-eternal", "settings-era") const era = game.settings.get("fvtt-cthulhu-eternal", "settings-era")
let eraCSS = SYSTEM.ERA_CSS[era]; let eraCSS = SYSTEM.ERA_CSS[era];
if (!eraCSS) eraCSS = SYSTEM.ERA_CSS["jazz"]; if (!eraCSS) eraCSS = SYSTEM.ERA_CSS["jazz"];
document.documentElement.style.setProperty('--font-primary', eraCSS.primaryFont); document.documentElement.style.setProperty('--font-primary', eraCSS.primaryFont);
document.documentElement.style.setProperty('--font-secondary', eraCSS.secondaryFont); document.documentElement.style.setProperty('--font-secondary', eraCSS.secondaryFont);
document.documentElement.style.setProperty('--font-title', eraCSS.titleFont); document.documentElement.style.setProperty('--font-title', eraCSS.titleFont);
document.documentElement.style.setProperty('--img-icon-color-filter', eraCSS.imgFilter); document.documentElement.style.setProperty('--img-icon-color-filter', eraCSS.imgFilter);
document.documentElement.style.setProperty('--background-image-base', `linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), url("../assets/ui/${era}_background_main.webp")`);
} }
} }

View File

@ -1,7 +1,7 @@
:root { :root {
--font-size-standard: 0.9rem; --font-size-standard: 0.9rem;
--background-image-base: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), --background-image-base: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)),
url("../assets/ui/jazzage_background_main.webp"); url("../assets/ui/jazz_background_main.webp");
/*--background-image-base: url("../assets/ui/jazzage_background_main.webp");*/ /*--background-image-base: url("../assets/ui/jazzage_background_main.webp");*/
--font-primary: "RozhaOne"; --font-primary: "RozhaOne";
--font-secondary: "RozhaOne"; --font-secondary: "RozhaOne";

View File

@ -49,13 +49,21 @@
"archetype": { "htmlFields": ["description"] } "archetype": { "htmlFields": ["description"] }
} }
}, },
"packs": [
{
"name": "skills",
"banner": "",
"label": "Skills",
"system": "fvtt-cthulhu-eternal",
"path": "packs/skills",
"type": "Item"
}
],
"grid": { "grid": {
"distance": 10, "distance": 10,
"units": "m" "units": "m"
}, },
"primaryTokenAttribute": "hp", "primaryTokenAttribute": "hp",
"socket": true, "socket": true,
"background": "systems/fvtt-cthulhu-eternal/assets/background.webp", "background": "systems/fvtt-cthulhu-eternal/assets/background.webp"
"packs": [
]
} }