From 1849a60194865245d660b4801edfb5e41e5da592 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Mon, 5 Sep 2022 11:32:21 +0200 Subject: [PATCH] Vehicle - WIP --- modules/pegasus-actor.js | 11 +++++---- modules/pegasus-utility.js | 27 +++++++--------------- system.json | 6 ++--- templates/partial-roll-select-effects.html | 22 +++++++++--------- 4 files changed, 28 insertions(+), 38 deletions(-) diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index 1c59edd..4e9b845 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -210,7 +210,8 @@ export class PegasusActor extends Actor { /* -------------------------------------------- */ async manageDesires(flag) { if (flag) { - let effect = await PegasusUtility.getEffectFromCompendium("Desires") + let effect = await PegasusUtility.getEffectFromCompendium("Desire") + //console.log("EFFECT", effect) effect.system.desires = true this.createEmbeddedDocuments('Item', [effect]) } else { @@ -1265,24 +1266,24 @@ export class PegasusActor extends Actor { if (ability.system.affectedstat != "notapplicable") { let stat = duplicate(this.system.statistics[ability.system.affectedstat]) stat.mod += Number(ability.system.statmodifier) - updates[`data.statistics.${ability.system.affectedstat}`] = stat + updates[`system.statistics.${ability.system.affectedstat}`] = stat } // manage status bonus if (ability.system.statusaffected != "notapplicable") { if (ability.system.statusaffected == 'nrg') { let nrg = duplicate(this.system.nrg) nrg.mod += Number(ability.system.statusmodifier) - updates[`data.nrg`] = nrg + updates[`system.nrg`] = nrg } if (ability.system.statusaffected == 'health') { let health = duplicate(this.system.secondary.health) health.bonus += Number(ability.system.statusmodifier) - updates[`data.secondary.health`] = health + updates[`system.secondary.health`] = health } if (ability.system.statusaffected == 'delirium') { let delirium = duplicate(this.system.secondary.delirium) delirium.bonus += Number(ability.system.statusmodifier) - updates[`data.secondary.delirium`] = delirium + updates[`system.secondary.delirium`] = delirium } } if (directUpdate) { diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js index f9c5d5d..00bc077 100644 --- a/modules/pegasus-utility.js +++ b/modules/pegasus-utility.js @@ -302,14 +302,16 @@ export class PegasusUtility { /* -------------------------------------------- */ static async loadCompendiumData(compendium) { - const pack = game.packs.get(compendium); - return await pack?.getDocuments() ?? []; + const pack = game.packs.get(compendium) + console.log("PACK", pack, compendium) + return await pack?.getDocuments() ?? [] } /* -------------------------------------------- */ static async loadCompendium(compendium, filter = item => true) { - let compendiumData = await PegasusUtility.loadCompendiumData(compendium); - return compendiumData.filter(filter); + let compendiumData = await PegasusUtility.loadCompendiumData(compendium) + //console.log("Comp data", compendiumData) + return compendiumData.filter(filter) } /* -------------------------------------------- */ @@ -461,8 +463,8 @@ export class PegasusUtility { static async getEffectFromCompendium(effectName) { effectName = effectName.toLowerCase() let effect = game.items.contents.find(item => item.type == 'effect' && item.name.toLowerCase() == effectName) - if (!effect) { - let effects = await this.loadCompendium('fvtt-pegasus.effect', item => item.name.toLowerCase() == effectName) + if (!effect ) { + let effects = await this.loadCompendium('fvtt-pegasus-rpg.effects', item => item.name.toLowerCase() == effectName) let objs = effects.map(i => i.toObject()) effect = objs[0] } else { @@ -662,19 +664,6 @@ export class PegasusUtility { return chatData; } - /* -------------------------------------------- */ - static async loadCompendiumData(compendium) { - const pack = game.packs.get(compendium); - return await pack?.getDocuments() ?? []; - } - - /* -------------------------------------------- */ - static async loadCompendium(compendium, filter = item => true) { - let compendiumData = await this.loadCompendiumData(compendium); - //console.log("Compendium", compendiumData); - return compendiumData.filter(filter); - } - /* -------------------------------------------- */ static async showDiceSoNice(roll, rollMode) { if (game.modules.get("dice-so-nice")?.active) { diff --git a/system.json b/system.json index 4dc3d29..135769b 100644 --- a/system.json +++ b/system.json @@ -1,6 +1,6 @@ { "description": "Pegasus RPG system for FoundryVTT", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.3.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.4.zip", "esmodules": [ "modules/pegasus-main.js" ], @@ -281,6 +281,6 @@ "templateVersion": 112, "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "10.0.3", - "background" : "./images/ui/pegasus_welcome_page.webp" + "version": "10.0.4", + "background" : "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp" } diff --git a/templates/partial-roll-select-effects.html b/templates/partial-roll-select-effects.html index c8b33b2..bd8aa7b 100644 --- a/templates/partial-roll-select-effects.html +++ b/templates/partial-roll-select-effects.html @@ -4,10 +4,10 @@