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,24 +465,34 @@ export class GameController
} }
} }
/**
* Send starting gifts to profile after x days
* @param pmcProfile Profile to add gifts to
*/
protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void
{ {
const timeStampProfileCreated = pmcProfile.Info.RegistrationDate; const timeStampProfileCreated = pmcProfile.Info.RegistrationDate;
const oneDaySeconds = this.timeUtil.getHoursAsSeconds(24); const oneDaySeconds = this.timeUtil.getHoursAsSeconds(24);
const currentTimeStamp = this.timeUtil.getTimestamp(); const currentTimeStamp = this.timeUtil.getTimestamp();
if (!this.profileHelper.playerHasRecievedGift(pmcProfile.aid, "PraporGiftDay1"))
{
// One day post-profile creation // One day post-profile creation
if ((timeStampProfileCreated + oneDaySeconds) > currentTimeStamp) 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 // Two day post-profile creation
if ((timeStampProfileCreated + (oneDaySeconds * 2)) > currentTimeStamp) if (currentTimeStamp > (timeStampProfileCreated + (oneDaySeconds * 2)))
{ {
this.giftService.sendPraporStartingGift(pmcProfile.aid, 2); this.giftService.sendPraporStartingGift(pmcProfile.aid, 2);
} }
} }
}
/** /**
* Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long * Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long