From cdd1e1d769e61e80c99b2652fda57d63d924442e Mon Sep 17 00:00:00 2001 From: mrvauxs Date: Mon, 17 Jul 2023 20:51:09 +0000 Subject: [PATCH] a --- lang/en.json | 4 ++-- packs/macros/{000229.log => 000339.log} | 0 packs/macros/CURRENT | 2 +- packs/macros/LOG | 16 ++++++------- packs/macros/LOG.old | 16 ++++++------- .../{MANIFEST-000227 => MANIFEST-000337} | Bin 176 -> 176 bytes src/settings/settings.js | 10 +++++++- src/settings/settings.svelte | 1 - src/summon/menu/loadPacks.js | 22 ++++++++++++++++++ src/summon/menu/options/pf2e.svelte | 19 --------------- 10 files changed, 50 insertions(+), 40 deletions(-) rename packs/macros/{000229.log => 000339.log} (100%) rename packs/macros/{MANIFEST-000227 => MANIFEST-000337} (72%) diff --git a/lang/en.json b/lang/en.json index 391d84e..71a344f 100644 --- a/lang/en.json +++ b/lang/en.json @@ -24,7 +24,7 @@ "summonToken": "Select the Summoning Token:", "howMany": "How Many Creatures:", "loading": "Loading…", - "nothing": "No Creatures Found!", + "nothing": "No Creatures Found! Refine your search filters or sources.", "error": "Something went wrong: {error}", "summon": "Summon" }, @@ -73,4 +73,4 @@ } } } -} +} \ No newline at end of file diff --git a/packs/macros/000229.log b/packs/macros/000339.log similarity index 100% rename from packs/macros/000229.log rename to packs/macros/000339.log diff --git a/packs/macros/CURRENT b/packs/macros/CURRENT index ca06e10..8a4a963 100644 --- a/packs/macros/CURRENT +++ b/packs/macros/CURRENT @@ -1 +1 @@ -MANIFEST-000227 +MANIFEST-000337 diff --git a/packs/macros/LOG b/packs/macros/LOG index 4e666ef..b699061 100644 --- a/packs/macros/LOG +++ b/packs/macros/LOG @@ -1,8 +1,8 @@ -2023/07/08-03:23:14.259365 ffff96ffd160 Recovering log #225 -2023/07/08-03:23:14.270965 ffff96ffd160 Delete type=0 #225 -2023/07/08-03:23:14.270996 ffff96ffd160 Delete type=3 #223 -2023/07/09-17:21:26.093914 fffe7686c160 Level-0 table #230: started -2023/07/09-17:21:26.093953 fffe7686c160 Level-0 table #230: 0 bytes OK -2023/07/09-17:21:26.097783 fffe7686c160 Delete type=0 #228 -2023/07/09-17:21:26.101506 fffe7686c160 Manual compaction at level-0 from '!macros!Ix6ye8207xMySmjN' @ 72057594037927935 : 1 .. '!macros!mnKNj84r6ZmGZyX3' @ 0 : 0; will stop at (end) -2023/07/09-17:21:26.108296 fffe7686c160 Manual compaction at level-1 from '!macros!Ix6ye8207xMySmjN' @ 72057594037927935 : 1 .. '!macros!mnKNj84r6ZmGZyX3' @ 0 : 0; will stop at (end) +2023/07/17-20:40:53.216901 ffff987f8160 Recovering log #335 +2023/07/17-20:40:53.228691 ffff987f8160 Delete type=3 #333 +2023/07/17-20:40:53.228725 ffff987f8160 Delete type=0 #335 +2023/07/17-20:51:04.712945 ffff94a1c160 Level-0 table #340: started +2023/07/17-20:51:04.712995 ffff94a1c160 Level-0 table #340: 0 bytes OK +2023/07/17-20:51:04.715891 ffff94a1c160 Delete type=0 #338 +2023/07/17-20:51:04.721853 ffff94a1c160 Manual compaction at level-0 from '!macros!Ix6ye8207xMySmjN' @ 72057594037927935 : 1 .. '!macros!mnKNj84r6ZmGZyX3' @ 0 : 0; will stop at (end) +2023/07/17-20:51:04.721951 ffff94a1c160 Manual compaction at level-1 from '!macros!Ix6ye8207xMySmjN' @ 72057594037927935 : 1 .. '!macros!mnKNj84r6ZmGZyX3' @ 0 : 0; will stop at (end) diff --git a/packs/macros/LOG.old b/packs/macros/LOG.old index d5037ab..80e71e4 100644 --- a/packs/macros/LOG.old +++ b/packs/macros/LOG.old @@ -1,8 +1,8 @@ -2023/07/08-02:46:35.224290 ffff97fff160 Recovering log #221 -2023/07/08-02:46:35.235468 ffff97fff160 Delete type=3 #219 -2023/07/08-02:46:35.235504 ffff97fff160 Delete type=0 #221 -2023/07/08-03:23:09.684743 fffe7686c160 Level-0 table #226: started -2023/07/08-03:23:09.684771 fffe7686c160 Level-0 table #226: 0 bytes OK -2023/07/08-03:23:09.687368 fffe7686c160 Delete type=0 #224 -2023/07/08-03:23:09.687470 fffe7686c160 Manual compaction at level-0 from '!macros!Ix6ye8207xMySmjN' @ 72057594037927935 : 1 .. '!macros!mnKNj84r6ZmGZyX3' @ 0 : 0; will stop at (end) -2023/07/08-03:23:09.687503 fffe7686c160 Manual compaction at level-1 from '!macros!Ix6ye8207xMySmjN' @ 72057594037927935 : 1 .. '!macros!mnKNj84r6ZmGZyX3' @ 0 : 0; will stop at (end) +2023/07/17-20:24:51.552373 ffff98ff9160 Recovering log #331 +2023/07/17-20:24:51.566047 ffff98ff9160 Delete type=0 #331 +2023/07/17-20:24:51.566078 ffff98ff9160 Delete type=3 #329 +2023/07/17-20:38:46.708563 ffff94a1c160 Level-0 table #336: started +2023/07/17-20:38:46.709203 ffff94a1c160 Level-0 table #336: 0 bytes OK +2023/07/17-20:38:46.712210 ffff94a1c160 Delete type=0 #334 +2023/07/17-20:38:46.718161 ffff94a1c160 Manual compaction at level-0 from '!macros!Ix6ye8207xMySmjN' @ 72057594037927935 : 1 .. '!macros!mnKNj84r6ZmGZyX3' @ 0 : 0; will stop at (end) +2023/07/17-20:38:46.720988 ffff94a1c160 Manual compaction at level-1 from '!macros!Ix6ye8207xMySmjN' @ 72057594037927935 : 1 .. '!macros!mnKNj84r6ZmGZyX3' @ 0 : 0; will stop at (end) diff --git a/packs/macros/MANIFEST-000227 b/packs/macros/MANIFEST-000337 similarity index 72% rename from packs/macros/MANIFEST-000227 rename to packs/macros/MANIFEST-000337 index f257fec61124bc944955cced7a7414b64c60ee3d..8a7a7571b4ab522da42d8458356e1ee6f3c5b6ff 100644 GIT binary patch delta 41 scmdnMxPfs(pAy$B*~?rEj7*o9I2o8PGqG^b-BlP361WT!xC#^i0Pkc8{{R30 delta 41 scmdnMxPfs(pOTZ$VQnr3My4l>oD9rQ8CkeDJ_=<82|NV}JO>H@0Pd;@^#A|> diff --git a/src/settings/settings.js b/src/settings/settings.js index 2ab57c8..c280b36 100644 --- a/src/settings/settings.js +++ b/src/settings/settings.js @@ -1,8 +1,9 @@ import { TJSGameSettings } from '@typhonjs-fvtt/svelte-standard/store'; import Svelttings from './settings.svelte'; -import { moduleID } from '../utils'; +import { debug, moduleID } from '../utils'; import { createBlanks } from './templateActors/index.js'; import { registerSystemSettings, selectDefaultSources, setDefaultIndexFields } from './systemSpecific'; +import loadPacks from '../summon/menu/loadPacks'; export const gameSettings = new TJSGameSettings(moduleID); @@ -107,6 +108,13 @@ Hooks.once('ready', () => { setDefaultIndexFields(); createBlanks(); + + gameSettings.getStore('sources').subscribe(() => { + if (foundrySummons?.index?.length) { + console.log('Foundry Summons | Updating Index'); + loadPacks(true); + } + }); }); Hooks.on('renderSettingsConfig', (app, html) => { diff --git a/src/settings/settings.svelte b/src/settings/settings.svelte index 3bb6f66..f581303 100644 --- a/src/settings/settings.svelte +++ b/src/settings/settings.svelte @@ -44,7 +44,6 @@ $sources.filter((value, index, self) => index === self.findIndex((t) => t.id === value.id)); } lastPick = source; - foundrySummons.index = []; } diff --git a/src/summon/menu/loadPacks.js b/src/summon/menu/loadPacks.js index e23f171..04a7b8b 100644 --- a/src/summon/menu/loadPacks.js +++ b/src/summon/menu/loadPacks.js @@ -50,10 +50,32 @@ export default async function loadPacks(refresh = false, packs = game.settings.g const systemPath = game.pf2e.system.moduleArt; await systemPath.refresh(); + packIndex = packIndex.filter((x) => x?.system?.traits); packIndex = packIndex.map((x) => { + // Handle Images const actorArt = systemPath.map.get(x.uuid)?.img; x.img = actorArt ?? x.img; if (x.img === '') x.img = 'icons/svg/mystery-man.svg'; + + // Handle Traits + + function alignmentStringToTraits(alignment) { + if (typeof alignment !== 'string') return []; + // returns an array of traits for the alignment string + // e.g. "LG" -> ["lawful", "good"] + + let traits = []; + if (alignment.includes('L')) traits.push('lawful'); + if (alignment.includes('N')) traits.push('neutral'); + if (alignment.includes('C')) traits.push('chaotic'); + if (alignment.includes('G')) traits.push('good'); + if (alignment.includes('E')) traits.push('evil'); + return traits; + } + + if (x.system.details?.alignment?.value) { + x.system.traits.value.push(...alignmentStringToTraits(x.system.details.alignment.value)); + } return x; }); diff --git a/src/summon/menu/options/pf2e.svelte b/src/summon/menu/options/pf2e.svelte index 75f6c29..8e28669 100644 --- a/src/summon/menu/options/pf2e.svelte +++ b/src/summon/menu/options/pf2e.svelte @@ -1,20 +1,6 @@ {#if creature?.system?.details.level.value} @@ -33,11 +19,6 @@ {creature.name}
- {#each alignmentStringToTraits(creature?.system?.details?.alignment?.value) as trait} - - {trait} - - {/each} {#each creature?.system?.traits.value ?? [] as trait} {trait}