Fixed ragfair failing when purchasing non-trader items

This commit is contained in:
Dev 2024-11-01 13:19:54 +00:00
parent a56d33b5f2
commit ad9ae4fb52
2 changed files with 15 additions and 3 deletions

View File

@ -52,7 +52,13 @@ export class TraderHelper {
* @param sessionID Players id
* @returns Trader base
*/
public getTrader(traderID: string, sessionID: string): ITraderBase | undefined {
public getTrader(traderID: string, sessionID: string): ITraderBase | any {
if (traderID === "ragfair") {
return {
currency: "RUB",
};
}
const pmcData = this.profileHelper.getPmcProfile(sessionID);
if (!pmcData) {
throw new error(this.localisationService.getText("trader-unable_to_find_profile_with_id", sessionID));

View File

@ -100,7 +100,11 @@ export class PaymentService {
this.handbookHelper.inRUB(currencyAmount, currencyTpl),
this.paymentHelper.getCurrency(trader.currency),
);
pmcData.TradersInfo[request.tid].salesSum += costOfPurchaseInCurrency;
// Only update traders
if (this.traderHelper.traderEnumHasKey(request.tid)) {
pmcData.TradersInfo[request.tid].salesSum += costOfPurchaseInCurrency;
}
}
}
@ -116,7 +120,9 @@ export class PaymentService {
pmcData.TradersInfo[request.tid].salesSum += costOfPurchaseInCurrency;
}
this.traderHelper.lvlUp(request.tid, pmcData);
if (this.traderHelper.traderEnumHasKey(request.tid)) {
this.traderHelper.lvlUp(request.tid, pmcData);
}
this.logger.debug("Item(s) taken. Status OK.");
}