Skip to content

Commit

Permalink
closes #35
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Aug 15, 2024
1 parent 3dcd3d7 commit 4754e44
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export const typePropSets: Record<string, string[]> = {
Book: ['bookPages', 'bookItemFilter', 'bookFindablePages'],
Trap: ['trapUses'],
Rock: ['canUpgradeWith'],
Scroll: ['bookPage'],
Scroll: ['bookPage', 'recipe'],
Twig: ['type'],
};

Expand Down
3 changes: 3 additions & 0 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { InputQuesttypeComponent } from './components/input-questtype/input-ques
import { InputQuestrewardComponent } from './components/input-questreward/input-questreward.component';
import { InputMapnpcComponent } from './components/input-mapnpc/input-mapnpc.component';
import { SpriteWithInlineNameComponent } from './components/sprite-with-inline-name/sprite-with-inline-name.component';
import { InputRecipeComponent } from './components/input-recipe/input-recipe.component';

Check failure on line 47 in src/app/shared/shared.module.ts

View workflow job for this annotation

GitHub Actions / build (20)

Cannot find module './components/input-recipe/input-recipe.component' or its corresponding type declarations.

Check failure on line 47 in src/app/shared/shared.module.ts

View workflow job for this annotation

GitHub Actions / build (20)

Cannot find module './components/input-recipe/input-recipe.component' or its corresponding type declarations.

Check failure on line 47 in src/app/shared/shared.module.ts

View workflow job for this annotation

GitHub Actions / build (20)

Cannot find module './components/input-recipe/input-recipe.component' or its corresponding type declarations.

@NgModule({
declarations: [
Expand Down Expand Up @@ -84,6 +85,7 @@ import { SpriteWithInlineNameComponent } from './components/sprite-with-inline-n
InputQuestrewardComponent,
InputMapnpcComponent,
SpriteWithInlineNameComponent,
InputRecipeComponent,
],
imports: [
CommonModule,
Expand Down Expand Up @@ -132,6 +134,7 @@ import { SpriteWithInlineNameComponent } from './components/sprite-with-inline-n
InputQuestrewardComponent,
InputMapnpcComponent,
SpriteWithInlineNameComponent,
InputRecipeComponent,
],
})
export class SharedModule {}
7 changes: 7 additions & 0 deletions src/app/tabs/items/items-editor/items-editor.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@
}
}

@case('recipe') {
<div class="form-row">
<app-input-recipe [defaultValue]="editingData.recipe" (change)="editingData.recipe = $event"
[onlyLearnable]="true"></app-input-recipe>
</div>
}

@default {
{{ prop }} ({{ propTypes[prop] }}) has no editor.
}
Expand Down
7 changes: 7 additions & 0 deletions src/app/tabs/items/items-editor/items-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class ItemsEditorComponent
| 'damageClass'
| 'succorInfo'
| 'containedItems'
| 'recipe'
>
> = {
tier: 'number',
Expand All @@ -66,6 +67,7 @@ export class ItemsEditorComponent
returnsOnThrow: 'boolean',
canShoot: 'boolean',
ounces: 'number',
bookPage: 'number',
bookPages: 'number',
bookFindablePages: 'number',
bookItemFilter: 'string',
Expand All @@ -74,6 +76,7 @@ export class ItemsEditorComponent
damageClass: 'damageClass',
succorInfo: 'succorInfo',
containedItems: 'containedItems',
recipe: 'recipe',
};

public currentItem = signal<IItemDefinition | undefined>(undefined);
Expand Down Expand Up @@ -179,9 +182,12 @@ export class ItemsEditorComponent
const extraPropSets = typePropSets[newItemClass];
if (extraPropSets) {
extraPropSets.forEach((prop) => {
if (prop === 'recipe') return;

if (prop === 'containedItems') {
return;
}

if (prop === 'succorInfo') {
if (this.editing().succorInfo) return;

Expand All @@ -191,6 +197,7 @@ export class ItemsEditorComponent
}));
return;
}

if (prop === 'stats') {
Object.keys(typePropDefaults[newItemClass].stats).forEach(
(statKey) => {
Expand Down

0 comments on commit 4754e44

Please sign in to comment.