Improved logic of getBonusValueFromProfile()
This commit is contained in:
parent
1066a138ac
commit
2a52af1275
@ -509,9 +509,13 @@ export class ProfileHelper {
|
|||||||
*/
|
*/
|
||||||
public getBonusValueFromProfile(pmcProfile: IPmcData, desiredBonus: BonusType): number {
|
public getBonusValueFromProfile(pmcProfile: IPmcData, desiredBonus: BonusType): number {
|
||||||
const bonuses = pmcProfile.Bonuses.filter((bonus) => bonus.type === desiredBonus);
|
const bonuses = pmcProfile.Bonuses.filter((bonus) => bonus.type === desiredBonus);
|
||||||
|
if (!bonuses)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Sum all bonuses found above
|
// 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 {
|
public playerIsFleaBanned(pmcProfile: IPmcData): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user