From 38b921a7e4e34754d30d720d7fbbbe93e0fbe844 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 25 Jul 2023 11:17:54 +0100 Subject: [PATCH] Move gift checks into `GiftService.sendPraporStartingGift` --- project/src/controllers/GameController.ts | 18 ++++++------------ project/src/services/GiftService.ts | 10 ++++++++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/project/src/controllers/GameController.ts b/project/src/controllers/GameController.ts index 8cf50af5..cd4a3603 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -475,22 +475,16 @@ export class GameController const oneDaySeconds = this.timeUtil.getHoursAsSeconds(24); const currentTimeStamp = this.timeUtil.getTimestamp(); - if (!this.profileHelper.playerHasRecievedGift(pmcProfile.aid, "PraporGiftDay1")) + // One day post-profile creation + if (currentTimeStamp > (timeStampProfileCreated + oneDaySeconds)) { - // One day post-profile creation - if (currentTimeStamp > (timeStampProfileCreated + oneDaySeconds)) - { - this.giftService.sendPraporStartingGift(pmcProfile.aid, 1); - } + this.giftService.sendPraporStartingGift(pmcProfile.aid, 1); } - if (!this.profileHelper.playerHasRecievedGift(pmcProfile.aid, "PraporGiftDay2")) + // Two day post-profile creation + if (currentTimeStamp > (timeStampProfileCreated + (oneDaySeconds * 2))) { - // Two day post-profile creation - if (currentTimeStamp > (timeStampProfileCreated + (oneDaySeconds * 2))) - { - this.giftService.sendPraporStartingGift(pmcProfile.aid, 2); - } + this.giftService.sendPraporStartingGift(pmcProfile.aid, 2); } } diff --git a/project/src/services/GiftService.ts b/project/src/services/GiftService.ts index 020b1399..67d5a045 100644 --- a/project/src/services/GiftService.ts +++ b/project/src/services/GiftService.ts @@ -180,10 +180,16 @@ export class GiftService switch (day) { case 1: - this.sendGiftToPlayer(sessionId, "PraporGiftDay1"); + if (this.profileHelper.playerHasRecievedGift(sessionId, "PraporGiftDay1")) + { + this.sendGiftToPlayer(sessionId, "PraporGiftDay1"); + } break; case 2: - this.sendGiftToPlayer(sessionId, "PraporGiftDay2"); + if (this.profileHelper.playerHasRecievedGift(sessionId, "PraporGiftDay2")) + { + this.sendGiftToPlayer(sessionId, "PraporGiftDay2"); + } break; }