From d3ae59f70d0f6b29d0cb1677c80125cc747bc1d5 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sun, 17 Jul 2022 18:20:05 +0200 Subject: [PATCH] Allow configurable logo --- css/bol.css | 2 +- images/.directory | 4 ++++ module/actor/actor-sheet.js | 7 ++++++ module/bol.js | 2 ++ module/system/bol-utility.js | 38 ++++++++++++++++++++++++++++----- system.json | 4 ++-- templates/actor/actor-sheet.hbs | 6 ++++-- 7 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 images/.directory diff --git a/css/bol.css b/css/bol.css index d704283..1de5c34 100644 --- a/css/bol.css +++ b/css/bol.css @@ -769,7 +769,7 @@ body.system-bol img#logo { min-height: 700px; height: 700px; } -.bol.sheet.actor .window-content form { +.bol.sheet.actor .window-content .bol-actor-form { background-image: url("/systems/bol/ui/logo.webp"); background-repeat: no-repeat; background-size: 190px 115px; diff --git a/images/.directory b/images/.directory new file mode 100644 index 0000000..6243d4b --- /dev/null +++ b/images/.directory @@ -0,0 +1,4 @@ +[Dolphin] +Timestamp=2022,7,17,14,58,4.757 +Version=4 +VisibleRoles=Details_text,Details_size,Details_modificationtime,Details_creationtime,CustomizedDetails diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 0b03b11..bb3f277 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -25,6 +25,13 @@ export class BoLActorSheet extends ActorSheet { activateListeners(html) { super.activateListeners(html); + function onLoad() { + let logoSheet = BoLUtility.getLogoActorSheet() + $(".bol-actor-form").css("backgroundImage",`url(${logoSheet})`) + } + // Setup everything onload + $(function () { onLoad(); }); + // Everything below here is only needed if the sheet is editable if (!this.options.editable) return; diff --git a/module/bol.js b/module/bol.js index 5774af6..7132dc0 100644 --- a/module/bol.js +++ b/module/bol.js @@ -109,8 +109,10 @@ function welcomeMessage() { /* -------------------------------------------- */ Hooks.once('ready', async function () { + BoLUtility.ready() registerUsageCount('bol') + welcomeMessage() }) diff --git a/module/system/bol-utility.js b/module/system/bol-utility.js index 8388fea..7af8853 100644 --- a/module/system/bol-utility.js +++ b/module/system/bol-utility.js @@ -18,7 +18,7 @@ export class BoLUtility { default: true, type: Boolean, onChange: lang => window.location.reload() - }); + }) game.settings.register("bol", "useBougette", { name: "Utiliser la Bougette (règle fan-made)", hint: "Utilise un indicateur de Bougette, comme décrit dans l'aide de jeu Gold&Glory du RatierBretonnien (https://www.lahiette.com/leratierbretonnien/)", @@ -27,14 +27,32 @@ export class BoLUtility { default: false, type: Boolean, onChange: lang => window.location.reload() - }); + }) + game.settings.register("bol", "logoActorSheet", { + name: "Chemin du logo des fiches de perso", + hint: "Vous pouvez changer le logo BoL des fiches de perso, pour jouer dans un autre univers (idéalement 346 x 200, défaut : /systems/bol/ui/logo.webp)", + scope: "world", + config: true, + default: "/systems/bol/ui/logo.webp", + type: String, + onChange: lang => window.location.reload() + }) + game.settings.register("bol", "logoTopLeft", { + name: "Chemin du logo haut gauche", + hint: "Vous pouvez changer le logo BoL en haut à gauche de chaque écran (idéalement 718 x 416, défaut : /systems/bol/ui/logo2.webp)", + scope: "world", + config: true, + default: "/systems/bol/ui/logo2.webp", + type: String, + onChange: lang => window.location.reload() + }) this.rollArmor = game.settings.get("bol", "rollArmor") // Roll armor or not this.useBougette = game.settings.get("bol", "useBougette") // Use optionnal bougette rules - + this.actorSheetLogo = game.settings.get("bol", "logoActorSheet") || "/systems/bol/ui/logo.webp" + this.logoTopLeft = game.settings.get("bol", "logoTopLeft") || "/systems/bol/ui/logo2.webp" } - /* -------------------------------------------- */ static getRollArmor() { return this.rollArmor @@ -43,9 +61,19 @@ export class BoLUtility { static getUseBougette() { return this.useBougette } - + /* -------------------------------------------- */ + static getLogoActorSheet() { + return this.actorSheetLogo + } + /* -------------------------------------------- */ + static getLogoTopLeft() { + return this.logoTopLeft + } + /* -------------------------------------------- */ static async ready() { + //$("#logo").attr("src", this.getLogoTopLeft() ) + $("#logo").css("content",`url(${this.getLogoTopLeft()})`) } /* -------------------------------------------- */ diff --git a/system.json b/system.json index 22ec1b1..ab3fddd 100644 --- a/system.json +++ b/system.json @@ -14,7 +14,7 @@ "url": "https://www.uberwald.me/gitea/public/bol", "license": "LICENSE.txt", "flags": {}, - "version": "1.5.1", + "version": "1.5.2", "templateVersion": 10, "minimumCoreVersion": "0.8.6", "compatibleCoreVersion": "9", @@ -183,7 +183,7 @@ "dependencies": [], "socket": true, "manifest": "https://www.uberwald.me/gitea/public/bol/raw/master/system.json", - "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v1.5.1.zip", + "download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v1.5.2.zip", "protected": false, "background": "images/map_lemurie.webp", "gridDistance": 1.5, diff --git a/templates/actor/actor-sheet.hbs b/templates/actor/actor-sheet.hbs index ff3a378..c54549a 100644 --- a/templates/actor/actor-sheet.hbs +++ b/templates/actor/actor-sheet.hbs @@ -1,8 +1,10 @@ -
+ + +
{{!-- Sidebar --}} -