Added default card group for new players

This commit is contained in:
2021-10-31 14:28:48 -04:00
parent e33aaa5f7b
commit e8a027b229
7 changed files with 1071 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ namespace TOOHUCardAPI.Data
public static int DailyKeyBonus { get; set; }
public static int PointsPerKey { get; set; }
public static int MaxKeyPurchaseAmount { get; set; }
public static string StarterDeckGroupKey { get; set; }
public static string StarterDeckGroupData { get; set; }
public static void Init(IConfiguration configuration)
{
var fields = typeof(AppSettings).GetProperties();

View File

@@ -48,7 +48,14 @@ namespace TOOHUCardAPI.Data.Repositories
Vip = true,
EndTime = DateTime.MaxValue,
PetLevel = 1,
EncodedCardGroups = new List<EncodedCardGroup>()
EncodedCardGroups = new List<EncodedCardGroup>
{
new()
{
EncodedString = AppSettings.StarterDeckGroupData,
GroupKey = AppSettings.StarterDeckGroupKey
}
}
};
await _appDbContext.Users.AddAsync(user);
await _appDbContext.SaveChangesAsync();

View File

@@ -33,6 +33,7 @@ namespace TOOHUCardAPI.Data.Services
private async Task<User> HandleDailyLoginBonus(User user)
{
user.KeyTotal += AppSettings.DailyKeyBonus;
user.LastDailyLoginBonus = DateTime.Now;;
await _userRepository.UpdateUser(user);
return user;
}