Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
MrVauxs committed Jul 17, 2023
1 parent fbd8b90 commit cdd1e1d
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 40 deletions.
4 changes: 2 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -73,4 +73,4 @@
}
}
}
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion packs/macros/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000227
MANIFEST-000337
16 changes: 8 additions & 8 deletions packs/macros/LOG
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 8 additions & 8 deletions packs/macros/LOG.old
Original file line number Diff line number Diff line change
@@ -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)
Binary file not shown.
10 changes: 9 additions & 1 deletion src/settings/settings.js
Original file line number Diff line number Diff line change
@@ -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);

Expand Down Expand Up @@ -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) => {
Expand Down
1 change: 0 additions & 1 deletion src/settings/settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
$sources.filter((value, index, self) => index === self.findIndex((t) => t.id === value.id));
}
lastPick = source;
foundrySummons.index = [];
}
</script>
Expand Down
22 changes: 22 additions & 0 deletions src/summon/menu/loadPacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down
19 changes: 0 additions & 19 deletions src/summon/menu/options/pf2e.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
<script>
export let openImage;
export let creature;
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;
}
</script>

{#if creature?.system?.details.level.value}
Expand All @@ -33,11 +19,6 @@
{creature.name}
</div>
<div class="traits tags width">
{#each alignmentStringToTraits(creature?.system?.details?.alignment?.value) as trait}
<span class="tag alignment">
{trait}
</span>
{/each}
{#each creature?.system?.traits.value ?? [] as trait}
<span class="tag">
{trait}
Expand Down

0 comments on commit cdd1e1d

Please sign in to comment.