Improved logic of getBonusValueFromProfile()
(cherry picked from commit 2a52af1275
)
This commit is contained in:
parent
d97e717f76
commit
0e1094d775
@ -509,9 +509,13 @@ export class ProfileHelper {
|
||||
*/
|
||||
public getBonusValueFromProfile(pmcProfile: IPmcData, desiredBonus: BonusType): number {
|
||||
const bonuses = pmcProfile.Bonuses.filter((bonus) => bonus.type === desiredBonus);
|
||||
if (!bonuses)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Sum all bonuses found above
|
||||
return bonuses?.reduce((sum, curr) => sum + (curr.value ?? 0), 100) ?? 0;
|
||||
return bonuses.reduce((sum, curr) => sum + (curr.value ?? 0), 0);
|
||||
}
|
||||
|
||||
public playerIsFleaBanned(pmcProfile: IPmcData): boolean {
|
||||
|
Loading…
Reference in New Issue
Block a user