Add nan check to ragfair rating incrementor code

This commit is contained in:
Dev 2023-06-13 19:33:42 +01:00
parent 709817d4fe
commit b478a1cdad
2 changed files with 8 additions and 2 deletions

View File

@ -278,8 +278,14 @@ export class RagfairOfferHelper
*/
public increaseProfileRagfairRating(profile: IAkiProfile, amountToIncrementBy: number): void
{
profile.characters.pmc.RagfairInfo.rating += this.ragfairConfig.sell.reputation.gain * amountToIncrementBy;
profile.characters.pmc.RagfairInfo.isRatingGrowing = true;
if (isNaN(amountToIncrementBy))
{
this.logger.warning(`Unable to increment ragfair rating, value was not a number: ${amountToIncrementBy}`);
return;
}
profile.characters.pmc.RagfairInfo.rating += this.ragfairConfig.sell.reputation.gain * amountToIncrementBy;
}
/**

View File

@ -80,7 +80,7 @@ export class RagfairSellHelper
sellChancePercent = this.ragfairConfig.sell.chance.base;
}
this.logger.debug(`Rolling to sell ${itemSellCount} items (chance: ${sellChancePercent}%)`);
this.logger.debug(`Rolling to sell: ${itemSellCount} items (chance: ${sellChancePercent}%)`);
// No point rolling for a sale on a 0% chance item, exit early
if (sellChancePercent === 0)