From 567fd455aec03e2ec3b9af8e67321d7ece0f5f13 Mon Sep 17 00:00:00 2001 From: Kyle Kemp Date: Thu, 15 Aug 2024 15:36:39 -0500 Subject: [PATCH] closes #42 --- .../components/input-item/input-item.component.html | 6 ++++-- .../shared/components/input-item/input-item.component.ts | 8 +++++++- .../sprite-with-inline-name.component.html | 2 ++ .../tabs/items/items-editor/items-editor.component.html | 2 +- src/app/tabs/items/items-editor/items-editor.component.ts | 4 +++- src/app/tabs/npcs/npcs-editor/npcs-editor.component.html | 4 ++-- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/app/shared/components/input-item/input-item.component.html b/src/app/shared/components/input-item/input-item.component.html index 717560a..52250ed 100644 --- a/src/app/shared/components/input-item/input-item.component.html +++ b/src/app/shared/components/input-item/input-item.component.html @@ -4,7 +4,7 @@
- @if(item.data) { + @if(item.data.sprite) { } @@ -16,8 +16,10 @@
+ @if(item.data.sprite) { + }
{{ item.data.name }}
@@ -26,4 +28,4 @@ {{ label() }} -
+
\ No newline at end of file diff --git a/src/app/shared/components/input-item/input-item.component.ts b/src/app/shared/components/input-item/input-item.component.ts index 54465c8..2bda81e 100644 --- a/src/app/shared/components/input-item/input-item.component.ts +++ b/src/app/shared/components/input-item/input-item.component.ts @@ -23,18 +23,24 @@ export class InputItemComponent implements OnInit { public item = model(); public label = input('Item'); public defaultValue = input(); + public allowNone = input(false); public change = output(); public values = computed(() => { const mod = this.modService.mod(); return [ + this.allowNone() + ? { category: 'Default', data: { name: 'none' }, value: 'none' } + : undefined, ...mod.items.map((i) => ({ category: 'My Mod Items', data: i, value: i.name, })), - ]; + ] + .flat() + .filter(Boolean) as ItemModel[]; }); ngOnInit() { diff --git a/src/app/shared/components/sprite-with-inline-name/sprite-with-inline-name.component.html b/src/app/shared/components/sprite-with-inline-name/sprite-with-inline-name.component.html index 557e756..2ef7b74 100644 --- a/src/app/shared/components/sprite-with-inline-name/sprite-with-inline-name.component.html +++ b/src/app/shared/components/sprite-with-inline-name/sprite-with-inline-name.component.html @@ -1,5 +1,7 @@
+ @if(sprite() !== -1) { + } {{ name() }}
\ No newline at end of file diff --git a/src/app/tabs/items/items-editor/items-editor.component.html b/src/app/tabs/items/items-editor/items-editor.component.html index 90a0e4d..881e1b3 100644 --- a/src/app/tabs/items/items-editor/items-editor.component.html +++ b/src/app/tabs/items/items-editor/items-editor.component.html @@ -273,7 +273,7 @@
- +
diff --git a/src/app/tabs/items/items-editor/items-editor.component.ts b/src/app/tabs/items/items-editor/items-editor.component.ts index a5815ee..448bc0a 100644 --- a/src/app/tabs/items/items-editor/items-editor.component.ts +++ b/src/app/tabs/items/items-editor/items-editor.component.ts @@ -112,8 +112,8 @@ export class ItemsEditorComponent }); ngOnInit() { - this.extractStats(this.editing()); this.resetProps(this.editing()); + this.extractStats(this.editing()); this.addItemClassMissingProps(this.editing().itemClass); super.ngOnInit(); @@ -126,6 +126,8 @@ export class ItemsEditorComponent item.breakEffect ??= { name: '', potency: 0 }; item.requirements ??= { baseClass: undefined, level: 0 }; item.cosmetic ??= { name: '', isPermanent: false }; + item.trait ??= { name: '', level: 0 }; + item.randomTrait ??= { name: [], level: { min: 0, max: 0 } }; this.editing.set(item); } diff --git a/src/app/tabs/npcs/npcs-editor/npcs-editor.component.html b/src/app/tabs/npcs/npcs-editor/npcs-editor.component.html index a21976f..71e52cc 100644 --- a/src/app/tabs/npcs/npcs-editor/npcs-editor.component.html +++ b/src/app/tabs/npcs/npcs-editor/npcs-editor.component.html @@ -433,7 +433,7 @@
-
@@ -800,4 +800,4 @@ {{ editingData | json }} - + \ No newline at end of file