diff --git a/docs/_config.yml b/docs/_config.yml index fac4b4e1..2aea4ef6 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,4 +1,4 @@ -title: Fabricate 0.10.16 +title: Fabricate 0.10.17 email: matt@misterpotts.uk description: >- End user documentation for the Foundry Virtual Tabletop (VTT) Module, "Fabricate". diff --git a/package.json b/package.json index 979ac789..94057cb2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fabricate", - "version": "0.10.16", + "version": "0.10.17", "description": "A system-agnostic, flexible crafting module for FoundryVT", "main": "index.js", "type": "module", diff --git a/src/applications/actorCraftingApp/ActorCraftingApp.svelte b/src/applications/actorCraftingApp/ActorCraftingApp.svelte index 5ba6dc1b..c6ad8f3d 100644 --- a/src/applications/actorCraftingApp/ActorCraftingApp.svelte +++ b/src/applications/actorCraftingApp/ActorCraftingApp.svelte @@ -141,6 +141,11 @@ } } + function handleActorDetailsLoaded(event: CustomEvent<{ targetActorDetails: ActorDetails; sourceActorDetails: ActorDetails }>) { + sourceActorDetails = event.detail.sourceActorDetails; + targetActorDetails = event.detail.targetActorDetails; + } + onMount(load); @@ -155,7 +160,8 @@ + on:sourceActorChanged={handleSourceActorChanged} + on:actorDetailsLoaded={handleActorDetailsLoaded} /> {#if craftingProcess.isReady} @@ -168,6 +174,8 @@ {/if} diff --git a/src/applications/actorCraftingApp/ActorCraftingAppHeader.svelte b/src/applications/actorCraftingApp/ActorCraftingAppHeader.svelte index 632bfea9..14170250 100644 --- a/src/applications/actorCraftingApp/ActorCraftingAppHeader.svelte +++ b/src/applications/actorCraftingApp/ActorCraftingAppHeader.svelte @@ -74,30 +74,47 @@ } async function loadActorDetails() { + const sourceActor = await game.actors.get(sourceActorDetails.id); if (!sourceActor) { throw new Error(`Fabricate | ActorCraftingApp: Unable to find actor with id ${sourceActorDetails.id}`); } + sourceActorDetails = new DefaultActorDetails({ id: sourceActorDetails.id, name: sourceActor.name, avatarUrl: sourceActor.img, initials: DefaultActorDetails.getInitialsFromName(sourceActor.name) }); + if (targetActorDetails.id === sourceActorDetails.id) { targetActorDetails = sourceActorDetails; + + dispatch("actorDetailsLoaded", { + sourceActorDetails: sourceActorDetails, + targetActorDetails: targetActorDetails + }); + return; } + const targetActor = await game.actors.get(targetActorDetails.id); if (!targetActor) { throw new Error(`Fabricate | ActorCraftingApp: Unable to find actor with id ${targetActorDetails.id}`); } + targetActorDetails = new DefaultActorDetails({ id: targetActorDetails.id, name: targetActor.name, avatarUrl: targetActor.img, initials: DefaultActorDetails.getInitialsFromName(targetActor.name) }); + + dispatch("actorDetailsLoaded", { + sourceActorDetails: sourceActorDetails, + targetActorDetails: targetActorDetails + }); + } async function setSourceActor(value: ActorDetails) {