Added default card group for new players
This commit is contained in:
@@ -12,6 +12,8 @@ namespace TOOHUCardAPI.Data
|
|||||||
public static int DailyKeyBonus { get; set; }
|
public static int DailyKeyBonus { get; set; }
|
||||||
public static int PointsPerKey { get; set; }
|
public static int PointsPerKey { get; set; }
|
||||||
public static int MaxKeyPurchaseAmount { 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)
|
public static void Init(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var fields = typeof(AppSettings).GetProperties();
|
var fields = typeof(AppSettings).GetProperties();
|
||||||
|
|||||||
@@ -48,7 +48,14 @@ namespace TOOHUCardAPI.Data.Repositories
|
|||||||
Vip = true,
|
Vip = true,
|
||||||
EndTime = DateTime.MaxValue,
|
EndTime = DateTime.MaxValue,
|
||||||
PetLevel = 1,
|
PetLevel = 1,
|
||||||
EncodedCardGroups = new List<EncodedCardGroup>()
|
EncodedCardGroups = new List<EncodedCardGroup>
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
EncodedString = AppSettings.StarterDeckGroupData,
|
||||||
|
GroupKey = AppSettings.StarterDeckGroupKey
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
await _appDbContext.Users.AddAsync(user);
|
await _appDbContext.Users.AddAsync(user);
|
||||||
await _appDbContext.SaveChangesAsync();
|
await _appDbContext.SaveChangesAsync();
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ namespace TOOHUCardAPI.Data.Services
|
|||||||
private async Task<User> HandleDailyLoginBonus(User user)
|
private async Task<User> HandleDailyLoginBonus(User user)
|
||||||
{
|
{
|
||||||
user.KeyTotal += AppSettings.DailyKeyBonus;
|
user.KeyTotal += AppSettings.DailyKeyBonus;
|
||||||
|
user.LastDailyLoginBonus = DateTime.Now;;
|
||||||
await _userRepository.UpdateUser(user);
|
await _userRepository.UpdateUser(user);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|||||||
1029
TOOHUCardAPI/Migrations/20211031180730_daily login change.Designer.cs
generated
Normal file
1029
TOOHUCardAPI/Migrations/20211031180730_daily login change.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
TOOHUCardAPI/Migrations/20211031180730_daily login change.cs
Normal file
25
TOOHUCardAPI/Migrations/20211031180730_daily login change.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace TOOHUCardAPI.Migrations
|
||||||
|
{
|
||||||
|
public partial class dailyloginchange : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "LastDailyLoginBonus",
|
||||||
|
table: "Users",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "LastDailyLoginBonus",
|
||||||
|
table: "Users");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -956,6 +956,9 @@ namespace TOOHUCardAPI.Migrations
|
|||||||
b.Property<int>("KeyUseCount")
|
b.Property<int>("KeyUseCount")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastDailyLoginBonus")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("LastFirstWin")
|
b.Property<DateTime>("LastFirstWin")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
|||||||
@@ -16,5 +16,7 @@
|
|||||||
"FirstWinBonusPointsMin": "1",
|
"FirstWinBonusPointsMin": "1",
|
||||||
"FirstWinBonusPointsMax": "5",
|
"FirstWinBonusPointsMax": "5",
|
||||||
"DailyKeyBonus": "2",
|
"DailyKeyBonus": "2",
|
||||||
"MaxKeyPurchaseAmount": "200"
|
"MaxKeyPurchaseAmount": "200",
|
||||||
|
"StarterDeckGroupKey": "cardgroup1",
|
||||||
|
"StarterDeckGroupData": "48616B7572656920536872696E65#00022#00202#00045#20054#20172#00362#00055#00212#00075#00065#00085#00154#00242#00173#00163#20122#20194#00093#00312#00272#00262#20064#20132#00192#00282#00113#00012#00032#20104#00333#00103#20164"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user