diff --git a/src/dump.ts b/src/dump.ts index 41c9303..66dc353 100644 --- a/src/dump.ts +++ b/src/dump.ts @@ -1,7 +1,8 @@ import { copyFile, readFile, writeFile } from 'fs/promises'; -import type { BigCraftable, Boots, Clothing, ClothingType, Furniture, FurnitureType, Hat, MeleeWeapon, MeleeWeaponType, ObjectInformation, ObjectType, RangedWeapon, Tool } from './types/items'; +import type { BigCraftable, Boots, Clothing, ClothingType, Furniture, FurnitureType, Hat, MeleeWeapon, MeleeWeaponType, ObjectInformation, RangedWeapon, Tool } from './types/items'; // @ts-expect-error import { GetSprite } from './lib/Spritesheet.ts'; +import type { TypeEnum } from '$types/save/1.5'; const objects = JSON.parse(await readFile('./content/Data/ObjectInformation.json', 'utf-8')) as Record; const objectsArray = Object.entries(objects).map(([key, value]) => { @@ -16,7 +17,7 @@ const objectsArray = Object.entries(objects).map(([key, value]) => { name: props[0], price: Number(props[1]), edibility: Number(props[2]), - type: type as ObjectType, + type: type as TypeEnum, category: Number(category), displayName: props[4], description: props[5], @@ -42,7 +43,7 @@ const bigCraftablesArray = Object.entries(bigCraftables).map(([key, value]) => { name: props[0], price: Number(props[1]), edibility: Number(props[2]), - type: props[3].split(' ')[0] as ObjectType, + type: props[3].split(' ')[0] as TypeEnum, category: -9, description: props[4], outdoors: props[5] === 'true', diff --git a/src/routes/(backups)/backups/+layout.svelte b/src/routes/(backups)/backups/+layout.svelte index df2c9bf..1ec69aa 100644 --- a/src/routes/(backups)/backups/+layout.svelte +++ b/src/routes/(backups)/backups/+layout.svelte @@ -6,16 +6,17 @@ import SidebarButton from '../../SidebarButton.svelte'; import { tooltip } from '$lib/Tooltip'; import { browser } from '$app/environment'; + import { base } from '$app/paths'; // https://github.com/sveltejs/kit/issues/5434 - page.subscribe((p) => browser && p.url.pathname === '/' && get(SaveGame) && goto('/inventory')); + page.subscribe((p) => browser && p.url.pathname === '/' && get(SaveGame) && goto(base + '/inventory'));
diff --git a/src/routes/(edit)/(list)/cooking/+page.ts b/src/routes/(edit)/(list)/cooking/+page.ts index 6dd2994..c453f4d 100644 --- a/src/routes/(edit)/(list)/cooking/+page.ts +++ b/src/routes/(edit)/(list)/cooking/+page.ts @@ -1,7 +1,8 @@ +import { base } from '$app/paths'; import type { PageLoad } from './$types'; export const load: PageLoad = async ({ fetch }) => { - const data = await fetch('/cookingrecipes.json'); + const data = await fetch(base + '/cookingrecipes.json'); const recipes = await data.json() as Array; return { diff --git a/src/routes/(edit)/(list)/crafting/+page.ts b/src/routes/(edit)/(list)/crafting/+page.ts index 9e91d12..7926e1c 100644 --- a/src/routes/(edit)/(list)/crafting/+page.ts +++ b/src/routes/(edit)/(list)/crafting/+page.ts @@ -1,7 +1,8 @@ +import { base } from '$app/paths'; import type { PageLoad } from './$types'; export const load: PageLoad = async ({ fetch }) => { - const data = await fetch('/craftingrecipes.json'); + const data = await fetch(base + '/craftingrecipes.json'); const recipes = await data.json() as Array; return { diff --git a/src/routes/(edit)/+layout.svelte b/src/routes/(edit)/+layout.svelte index 94c913c..5e799f0 100644 --- a/src/routes/(edit)/+layout.svelte +++ b/src/routes/(edit)/+layout.svelte @@ -9,11 +9,12 @@ import Router from './Router.svelte'; import { tooltip } from '$lib/Tooltip'; import { browser } from '$app/environment'; + import { base } from '$app/paths'; export let data: LayoutData; // If the save changes for whatever reason, go back to the main screen - const unsub = page.subscribe(() => browser && get(SaveGame) == undefined && goto('/')); + const unsub = page.subscribe(() => browser && get(SaveGame) == undefined && goto(base + '/')); onDestroy(() => unsub()); // Set the context for the item data for components to use @@ -24,7 +25,7 @@ const cancel = () => { SaveGame.set(undefined); FileName.set(undefined); - goto('/'); + goto(base + '/'); }; // Download the save file diff --git a/src/routes/(edit)/+layout.ts b/src/routes/(edit)/+layout.ts index c94b24e..e75bf48 100644 --- a/src/routes/(edit)/+layout.ts +++ b/src/routes/(edit)/+layout.ts @@ -1,8 +1,9 @@ +import { base } from "$app/paths"; import type { ItemInformation } from "$types/items"; // Prefetch dumped data export const load = async ({ fetch }) => { - const data = await fetch('/iteminfo.json'); + const data = await fetch(base + '/iteminfo.json'); const Items = new Map(await data.json() as any); return { diff --git a/src/routes/(edit)/Router.svelte b/src/routes/(edit)/Router.svelte index 78b7a58..0da8381 100644 --- a/src/routes/(edit)/Router.svelte +++ b/src/routes/(edit)/Router.svelte @@ -1,16 +1,17 @@