Skip to content

Commit

Permalink
Add list of recipes to items that are crafters
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasKunnen committed Jan 13, 2024
1 parent 3076463 commit ed53a1b
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/data.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface Crafter {
}

export interface Item {
crafter: string | undefined;
displayName: string;
icon: string;
description: string | undefined;
Expand Down
3 changes: 3 additions & 0 deletions src/routes/Items/[item]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export const load = async ({params}) => {
throw new Error('404');
}

const crafter = item.crafter === undefined ? undefined : data.crafters[item.crafter];

return {
crafts: crafter?.recipes.map(r => getRecipe(r, data)) ?? [],
item: item,
ingredientIn: item.ingredientIn.map(r => getRecipe(r, data)),
recipes: item.recipes.map(r => getRecipe(r, data)),
Expand Down
11 changes: 11 additions & 0 deletions src/routes/Items/[item]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@
{/each}
</div>

{#if data.crafts.length > 0}
<h2>Crafts</h2>
<div class="recipes">
{#each data.crafts as recipe}
<div class="recipe">
<Recipe recipe={recipe}></Recipe>
</div>
{/each}
</div>
{/if}

<style>
.icon {
--game-icon-width: 128px;
Expand Down
1 change: 1 addition & 0 deletions tools/summarize/item-static.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export interface ItemStaticRow {
CraftingExperience?: number;
Manual_Tags?: Tags;
Generated_Tags?: Tags;
Processing?: Ref;
}
1 change: 1 addition & 0 deletions tools/summarize/summarize-game-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ for (const item of itemsStatic.Rows) {
}

mappedItems[item.Name] = {
crafter: item.Processing?.RowName,
displayName: displayName,
icon: processIcon(itemable.Icon),
description: extractTranslation(itemable.Description),
Expand Down
Loading

0 comments on commit ed53a1b

Please sign in to comment.