diff --git a/assets/ui/classical_background_main.webp b/assets/ui/classical_background_main.webp new file mode 100644 index 0000000..e938203 Binary files /dev/null and b/assets/ui/classical_background_main.webp differ diff --git a/assets/ui/future_background_main.webp b/assets/ui/future_background_main.webp new file mode 100644 index 0000000..459d988 Binary files /dev/null and b/assets/ui/future_background_main.webp differ diff --git a/assets/ui/jazzage_background_main.webp b/assets/ui/jazz_background_main.webp similarity index 100% rename from assets/ui/jazzage_background_main.webp rename to assets/ui/jazz_background_main.webp diff --git a/assets/ui/medieval_background_main.webp b/assets/ui/medieval_background_main.webp new file mode 100644 index 0000000..0996644 Binary files /dev/null and b/assets/ui/medieval_background_main.webp differ diff --git a/assets/ui/modern_background_main.webp b/assets/ui/modern_background_main.webp new file mode 100644 index 0000000..bc443d5 Binary files /dev/null and b/assets/ui/modern_background_main.webp differ diff --git a/assets/ui/victorian_background_main.webp b/assets/ui/victorian_background_main.webp new file mode 100644 index 0000000..7cbdfa4 Binary files /dev/null and b/assets/ui/victorian_background_main.webp differ diff --git a/css/fvtt-cthulhu-eternal.css b/css/fvtt-cthulhu-eternal.css index 99902c3..2f733bf 100644 --- a/css/fvtt-cthulhu-eternal.css +++ b/css/fvtt-cthulhu-eternal.css @@ -104,7 +104,7 @@ } :root { --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");*/ --font-primary: "RozhaOne"; --font-secondary: "RozhaOne"; diff --git a/cthulhu-eternal.mjs b/cthulhu-eternal.mjs index b42b630..2984309 100644 --- a/cthulhu-eternal.mjs +++ b/cthulhu-eternal.mjs @@ -14,7 +14,7 @@ import * as applications from "./module/applications/_module.mjs" import { handleSocketEvent } from "./module/socket.mjs" import { Macros } from "./module/macros.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)}}} diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index 8fe0092..91d3e14 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -1,5 +1,34 @@ +import CthulhuEternalUtils from "../utils.mjs" + 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) { await super._preCreate(data, options, user) diff --git a/module/utils.mjs b/module/utils.mjs index 5480542..1c8cc1b 100644 --- a/module/utils.mjs +++ b/module/utils.mjs @@ -1,5 +1,5 @@ -export class CthulhuEternalUtils { +export default class CthulhuEternalUtils { static registerSettings() { 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() { Handlebars.registerHelper('isNull', function (val) { @@ -168,15 +178,16 @@ export class CthulhuEternalUtils { } 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]; if (!eraCSS) eraCSS = SYSTEM.ERA_CSS["jazz"]; document.documentElement.style.setProperty('--font-primary', eraCSS.primaryFont); 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('--background-image-base', `linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), url("../assets/ui/${era}_background_main.webp")`); } } diff --git a/styles/global.less b/styles/global.less index 3b43fd1..c4f42c3 100644 --- a/styles/global.less +++ b/styles/global.less @@ -1,7 +1,7 @@ :root { --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"); + url("../assets/ui/jazz_background_main.webp"); /*--background-image-base: url("../assets/ui/jazzage_background_main.webp");*/ --font-primary: "RozhaOne"; --font-secondary: "RozhaOne"; diff --git a/system.json b/system.json index da797e4..a45db1a 100644 --- a/system.json +++ b/system.json @@ -49,13 +49,21 @@ "archetype": { "htmlFields": ["description"] } } }, + "packs": [ + { + "name": "skills", + "banner": "", + "label": "Skills", + "system": "fvtt-cthulhu-eternal", + "path": "packs/skills", + "type": "Item" + } + ], "grid": { "distance": 10, "units": "m" }, "primaryTokenAttribute": "hp", "socket": true, - "background": "systems/fvtt-cthulhu-eternal/assets/background.webp", - "packs": [ - ] + "background": "systems/fvtt-cthulhu-eternal/assets/background.webp" }