Skip to content

Commit

Permalink
feat(inventory): allow multiple collects for collectibles and equipment
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Jul 4, 2023
1 parent b097634 commit b95bfcf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
19 changes: 12 additions & 7 deletions client/src/app/pages/inventory/inventory.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,28 @@

<ion-item
class="cursor-pointer"
*ngIf="row.type === 'collectible' && !isDiscovered(row)"
*ngIf="row.type === 'collectible'"
(click)="discoverCollectible(row); popover.dismiss()"
>
Collect
<ion-icon
slot="end"
[name]="isDiscovered(row) ? 'checkmark-circle' : 'close-circle'"
[color]="isDiscovered(row) ? 'success' : 'danger'"
></ion-icon>
</ion-item>

<ion-item
class="cursor-pointer"
*ngIf="row.type !== 'collectible' && !isDiscovered(row)"
*ngIf="row.type !== 'collectible'"
(click)="discoverEquipment(row); popover.dismiss()"
>
Collect
</ion-item>

<ion-item *ngIf="isDiscovered(row)" [disabled]>
<em>Collected</em>
<ion-icon slot="end" name="checkbox"></ion-icon>
<ion-icon
slot="end"
[name]="isDiscovered(row) ? 'checkmark-circle' : 'close-circle'"
[color]="isDiscovered(row) ? 'success' : 'danger'"
></ion-icon>
</ion-item>
</ion-list>
</ion-content>
Expand Down
6 changes: 0 additions & 6 deletions server/src/modules/discoveries/discoveries.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ export class DiscoveriesService {
if (!itemDefinition)
throw new NotFoundException('Item definition not found');

if (discoveries.collectibles?.[itemDefinition.itemId])
throw new BadRequestException('Collectible already discovered');

await this.inventoryService.removeInventoryItemForUser(userId, instanceId);

const discoveryPatches = await getPatchesAfterPropChanges<Discoveries>(
Expand Down Expand Up @@ -165,9 +162,6 @@ export class DiscoveriesService {
if (!itemDefinition)
throw new NotFoundException('Item definition not found');

if (discoveries.items?.[itemDefinition.itemId])
throw new BadRequestException('Item already discovered');

await this.inventoryService.removeInventoryItemForUser(userId, instanceId);

const discoveryPatches = await getPatchesAfterPropChanges<Discoveries>(
Expand Down

0 comments on commit b95bfcf

Please sign in to comment.