Reset money transfer limit of player when they have reached/passed the nextResetTime value

This commit is contained in:
Dev 2024-09-22 11:49:55 +01:00
parent 1ba795cf66
commit c1526a4ad3

View File

@ -1,6 +1,11 @@
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { IHideoutImprovement, Productive, TraderInfo } from "@spt/models/eft/common/tables/IBotBase";
import {
IHideoutImprovement,
IMoneyTransferLimits,
Productive,
TraderInfo,
} from "@spt/models/eft/common/tables/IBotBase";
import { ProfileChange, TraderData } from "@spt/models/eft/itemEvent/IItemEventRouterBase";
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
import { TimeUtil } from "@spt/utils/TimeUtil";
@ -79,12 +84,20 @@ export class EventOutputHolder {
profileChanges.improvements = this.cloner.clone(this.getImprovementsFromProfileAndFlagComplete(pmcData));
profileChanges.traderRelations = this.constructTraderRelations(pmcData.TradersInfo);
this.resetMoneyTransferLimit(pmcData.moneyTransferLimitData);
profileChanges.moneyTransferLimitData = pmcData.moneyTransferLimitData;
// Fixes container craft from water collector not resetting after collection + removed completed normal crafts
this.cleanUpCompleteCraftsInProfile(pmcData.Hideout.Production);
}
protected resetMoneyTransferLimit(limit: IMoneyTransferLimits) {
if (limit.nextResetTime < this.timeUtil.getTimestamp()) {
limit.nextResetTime = this.timeUtil.getTimeStampFromNowDays(1);
limit.remainingLimit = limit.totalLimit;
}
}
/**
* Convert the internal trader data object into an object we can send to the client
* @param traderData server data for traders