diff --git a/libs/features/quest/src/index.ts b/libs/features/quest/src/index.ts index 9a7c36713f..792d404928 100644 --- a/libs/features/quest/src/index.ts +++ b/libs/features/quest/src/index.ts @@ -4,6 +4,7 @@ export * from './gameobject-questender/gameobject-questender.component'; export * from './gameobject-queststarter/gameobject-queststarter.component'; export * from './quest-offer-reward/quest-offer-reward.component'; export * from './quest-preview/quest-preview.component'; +export * from './quest-preview/quest-objectives.component'; export * from './quest-request-items/quest-request-items.component'; export * from './quest-template/quest-template.component'; export * from './quest-template-addon/quest-template-addon.component'; diff --git a/libs/features/quest/src/quest-preview/quest-objectives.component.html b/libs/features/quest/src/quest-preview/quest-objectives.component.html new file mode 100644 index 0000000000..c1ff30b1d2 --- /dev/null +++ b/libs/features/quest/src/quest-preview/quest-objectives.component.html @@ -0,0 +1,39 @@ +
Objectives
+ ++ {{ areaDescription() }} +
+ } + ++ • {{ obj.text$ | async }} {{ obj.count }} +
+ } +
+ •
+ • {{ f.name$ | async }} + {{ f.value }} +
+ } +Objectives
- -- {{ service.questTemplate.AreaDescription }} -
- } - -- • {{ !!service.getObjText(i) ? service.getObjText(i) : (service.getObjective$(i) | async) }} - {{ service.getObjectiveCount(i) }} -
- } - } -
- •
- • {{ service.sqliteQueryService.getFactionNameById(reqFaction) | async }} - {{ service.getFactionByValue(i) }} -
- } - } -Description diff --git a/libs/features/quest/src/quest-preview/quest-preview.component.ts b/libs/features/quest/src/quest-preview/quest-preview.component.ts index c405187bb7..c0c96a2967 100644 --- a/libs/features/quest/src/quest-preview/quest-preview.component.ts +++ b/libs/features/quest/src/quest-preview/quest-preview.component.ts @@ -1,6 +1,12 @@ import { AsyncPipe } from '@angular/common'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, inject, OnInit } from '@angular/core'; import { IconComponent } from '@keira/shared/base-editor-components'; +import { + FactionRequirement, + ItemObjective, + NpcOrGoObjective, + QuestObjectivesComponent, +} from './quest-objectives.component'; import { RacesTextKey, RacesTextValue } from '@keira/shared/constants'; import { PreviewHelperService } from '@keira/shared/preview'; import { CollapseModule } from 'ngx-bootstrap/collapse'; @@ -13,7 +19,7 @@ import { QuestPreviewService } from './quest-preview.service'; selector: 'keira-quest-preview', templateUrl: './quest-preview.component.html', styleUrls: ['./quest-preview.component.scss'], - imports: [IconComponent, CollapseModule, AsyncPipe], + imports: [IconComponent, CollapseModule, AsyncPipe, QuestObjectivesComponent], }) export class QuestPreviewComponent implements OnInit { private readonly changeDetectorRef = inject(ChangeDetectorRef); @@ -72,4 +78,45 @@ export class QuestPreviewComponent implements OnInit { hasPrevOrNext(questLists: { prev?: Quest[] | null; next?: Quest[] | null }): boolean { return !!(questLists.prev && questLists.prev.length > 0) || !!(questLists.next && questLists.next.length > 0); } + + get npcObjectivesData(): NpcOrGoObjective[] { + const array: NpcOrGoObjective[] = []; + for (let i = 1; i <= 4; i++) { + if (this.service.isNpcOrGoObj(i)) { + const text = this.service.getObjText(i); + const text$ = text ? Promise.resolve(text) : this.service.getObjective$(i); + array.push({ text$, count: this.service.getObjectiveCount(i) }); + } + } + return array; + } + + get itemObjectivesData(): ItemObjective[] { + const array: ItemObjective[] = []; + for (let i = 1; i <= 6; i++) { + const reqItem = this.service.questTemplate['RequiredItemId' + i]; + if (reqItem) { + array.push({ + id: reqItem, + name$: this.service.mysqlQueryService.getItemNameById(reqItem), + count: this.service.getObjItemCount(i), + }); + } + } + return array; + } + + get factionRequirementsData(): FactionRequirement[] { + const array: FactionRequirement[] = []; + for (let i = 1; i <= 2; i++) { + const reqFaction = this.service.questTemplate['RequiredFactionId' + i]; + if (reqFaction) { + array.push({ + name$: this.service.sqliteQueryService.getFactionNameById(reqFaction), + value: this.service.getFactionByValue(i), + }); + } + } + return array; + } }