diff --git a/src/components/molecules/Footer.svelte b/src/components/molecules/Footer.svelte index 6f13734..c974907 100644 --- a/src/components/molecules/Footer.svelte +++ b/src/components/molecules/Footer.svelte @@ -17,7 +17,8 @@ isMultiClass, pointBuy, abilityRolls, - isStandardArrayValues + isStandardArrayValues, + subClassesForClass } from "~/src/helpers/store"; // import { prepareItemForDrop } from "~/src/helpers/Utility"; import ProgressBar from "~/src/components/molecules/ProgressBar.svelte"; @@ -64,6 +65,8 @@ // Derive the progress value from the store states const progress = derived(stores, ($stores) => { const [race, characterClass, characterSubClass, background, abilityGenerationMethod, pointBuy, abilityRolls, isStandardArrayValues] = $stores; + //- @why: some classes don't have subclasses until later levels + const length = $subClassesForClass.length > 0 ? 5 : 4; const total = $stores.slice(0, 5).length; // Only count the main five stores for total const completed = $stores.slice(0, 5).filter((value, index) => { if (index === 4) { // Index of abilityGenerationMethod diff --git a/src/components/organisms/dnd5e/Tabs/Class.svelte b/src/components/organisms/dnd5e/Tabs/Class.svelte index a402e6e..9cb3eff 100644 --- a/src/components/organisms/dnd5e/Tabs/Class.svelte +++ b/src/components/organisms/dnd5e/Tabs/Class.svelte @@ -13,6 +13,7 @@ characterSubClass, level, tabs, + subClassesForClass } from "~/src/helpers/store"; import { localize } from "#runtime/svelte/helper"; import { TJSSelect } from "@typhonjs-fvtt/svelte-standard/component"; @@ -106,6 +107,8 @@ await tick(); subClassesIndex = await getFilteredSubclassIndex(); + $subClassesForClass = subClassesIndex; + await tick(); importClassAdvancements(); richHTML = await TextEditor.enrichHTML(html); diff --git a/src/helpers/store.js b/src/helpers/store.js index d209fc4..f00d445 100644 --- a/src/helpers/store.js +++ b/src/helpers/store.js @@ -81,6 +81,7 @@ export const tabs = writable(initialTabs); export const levelUpTabs = writable(upTabs); export const actorInGame = writable(false); export const abilityGenerationMethod = writable(null); +export const subClassesForClass = writable([]); export const isMultiClass = derived([characterClass, activeClass, newClassLevel], ([$characterClass, $characterSubClass, $newClassLevel]) => { if($newClassLevel) return false; @@ -110,4 +111,6 @@ export function resetStores() { isActorCreated.set(false); actorInGame.set(false); abilityGenerationMethod.set(null); + subClassesForClass = writable([]); + } \ No newline at end of file