Skip to content

Commit

Permalink
fix(transmutation): add item rarity to transmutation page
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Apr 1, 2023
1 parent c19db48 commit 00a4e1c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<app-game-icon slot="start" [icon]="iconForRecipe(prospect)"></app-game-icon>

<ion-label>
<strong [ngxTippy]="tooltip">
<strong [ngxTippy]="tooltip" [ngClass]="[(rarityOutputs[prospect.startingItem] || 'Common').toLowerCase()]">
<app-real-name [name]="prospect.startingItem"></app-real-name>
</strong>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Select, Store } from '@ngxs/store';
import { sum } from 'lodash';
import { Observable, first } from 'rxjs';
import { IGameResource, IGameResourceTransform } from '../../../../../interfaces';
import { IGameItem, IGameResource, IGameResourceTransform, Rarity } from '../../../../../interfaces';
import { CharSelectState, ProspectingState } from '../../../../../stores';
import { ProspectRock } from '../../../../../stores/prospecting/prospecting.actions';
import { setDiscordStatus } from '../../../../helpers/electron';
Expand All @@ -20,6 +20,10 @@ export class ProspectingPage implements OnInit {
return this.contentService.getProspectingTransforms();
}

public allProspects: IGameResourceTransform[] = [];
public createdOutputs: Record<string, IGameItem | IGameResource> = {};
public rarityOutputs: Record<string, Rarity> = {};

@Select(ProspectingState.level) level$!: Observable<number>;
@Select(CharSelectState.activeCharacterResources) resources$!: Observable<Record<string, number>>;

Expand Down Expand Up @@ -47,12 +51,30 @@ export class ProspectingPage implements OnInit {
this.prospectTransformChances[prospect.startingItem][item.name] = (item.weight / totalChance * 100).toFixed(2);
});
});

this.setResults();
}

trackBy(index: number) {
return index;
}

setResults() {
this.rarityOutputs = {};

this.locationData.forEach((transform) => {
if(this.contentService.isItem(transform.startingItem)) {
this.createdOutputs[transform.startingItem] = this.contentService.getItemByName(transform.startingItem);
}

if(this.contentService.isResource(transform.startingItem)) {
this.createdOutputs[transform.startingItem] = this.contentService.getResourceByName(transform.startingItem);
}

this.rarityOutputs[transform.startingItem] = this.createdOutputs[transform.startingItem].rarity;
});
}

iconForRecipe(transform: IGameResourceTransform) {
return this.itemCreatorService.iconFor(transform.startingItem);
}
Expand Down

0 comments on commit 00a4e1c

Please sign in to comment.