Skip to content

Commit

Permalink
chore(quest-preview): show Unavailable flag (#711)
Browse files Browse the repository at this point in the history
* chore(quest-preview): show Unavailable flag

* chore(misc): wip

* chore(misc): wip
  • Loading branch information
FrancescoBorzi committed May 23, 2020
1 parent 257508f commit 6e20915
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
Expand Up @@ -3,6 +3,7 @@
<div class="preview-content quest-preview">

<h5 id="title" *ngIf="!!service.title">{{ service.title }}</h5>
<p id="unavailable" *ngIf="service.isUnavailable()" class="text-center font-weight-bold red">Unavailable</p>
<p id="level" *ngIf="!!service.level">Level: {{ service.level }}</p>
<p id="minlevel" *ngIf="!!service.minLevel">
Req. level: {{ service.minLevel }} <span *ngIf="showMaxLevel">- {{ service.maxLevel }}</span>
Expand Down
Expand Up @@ -20,10 +20,15 @@
.colored {
color: #ffd100;
}

.greyed {
color: #dbdbdb;
}

.red {
color: #f00;
}

.text-sm {
font-size: 0.8rem;
}
Expand Down
17 changes: 17 additions & 0 deletions src/app/features/quest/quest-preview/quest-preview.service.spec.ts
Expand Up @@ -674,6 +674,23 @@ describe('QuestPreviewService', () => {
expect(service.rewardSpell()).toBe(123);
});

it('isUnavailable() should correctly work', () => {
const { service, questTemplateService } = setup();
const UNAVAILABLE = 0x04000;

questTemplateService.form.controls.Flags.setValue(0);
expect(service.isUnavailable()).toBeFalse();

questTemplateService.form.controls.Flags.setValue(UNAVAILABLE);
expect(service.isUnavailable()).toBeTrue();

questTemplateService.form.controls.Flags.setValue(UNAVAILABLE + 2);
expect(service.isUnavailable()).toBeTrue();

questTemplateService.form.controls.Flags.setValue(UNAVAILABLE - 2);
expect(service.isUnavailable()).toBeFalse();
});

});

});
5 changes: 5 additions & 0 deletions src/app/features/quest/quest-preview/quest-preview.service.ts
Expand Up @@ -260,6 +260,11 @@ export class QuestPreviewService {
return this.mysqlQueryService.getQuestTitleById(this.getEnabledByQuestId());
}

public isUnavailable(): boolean {
const UNAVAILABLE = 0x04000;
return (this.questTemplate.Flags & UNAVAILABLE) === UNAVAILABLE;
}

public isRepeatable(): boolean {
return !!(this.questTemplate.Flags & QUEST_FLAG_REPEATABLE || this.questTemplateAddon.SpecialFlags & QUEST_FLAG_SPECIAL_REPEATABLE);
}
Expand Down

0 comments on commit 6e20915

Please sign in to comment.