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
This commit is contained in:
Dev 2023-07-25 10:36:23 +01:00
parent 1a80d3fab8
commit 41b4bdc432

View File

@ -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);
}
}
}