From 41b4bdc432f05699e705211c1f128b1fdeeca16f Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 25 Jul 2023 10:36:23 +0100 Subject: [PATCH] Fix bug that casued prapor to send new player gifts regardless of how old profile was Surround gift sending code with gift recieved check first --- project/src/controllers/GameController.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/project/src/controllers/GameController.ts b/project/src/controllers/GameController.ts index 2fd3e68c..8cf50af5 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -465,22 +465,32 @@ export class GameController } } + /** + * Send starting gifts to profile after x days + * @param pmcProfile Profile to add gifts to + */ protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void { const timeStampProfileCreated = pmcProfile.Info.RegistrationDate; const oneDaySeconds = this.timeUtil.getHoursAsSeconds(24); const currentTimeStamp = this.timeUtil.getTimestamp(); - // One day post-profile creation - if ((timeStampProfileCreated + oneDaySeconds) > currentTimeStamp) + if (!this.profileHelper.playerHasRecievedGift(pmcProfile.aid, "PraporGiftDay1")) { - this.giftService.sendPraporStartingGift(pmcProfile.aid, 1); + // One day post-profile creation + if (currentTimeStamp > (timeStampProfileCreated + oneDaySeconds)) + { + this.giftService.sendPraporStartingGift(pmcProfile.aid, 1); + } } - // Two day post-profile creation - if ((timeStampProfileCreated + (oneDaySeconds * 2)) > currentTimeStamp) + if (!this.profileHelper.playerHasRecievedGift(pmcProfile.aid, "PraporGiftDay2")) { - this.giftService.sendPraporStartingGift(pmcProfile.aid, 2); + // Two day post-profile creation + if (currentTimeStamp > (timeStampProfileCreated + (oneDaySeconds * 2))) + { + this.giftService.sendPraporStartingGift(pmcProfile.aid, 2); + } } }