bank account refactor
This commit is contained in:
@@ -18,29 +18,29 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
if (!dbContext.Users.Any(u => u.Name.ToLower() == username.ToLower().Trim()))
|
||||
if (dbContext.Users.Where(u => u.SocialClubName == player.SocialClubName).Count() >= 3)
|
||||
{
|
||||
var user = new Database.Entities.User
|
||||
player.TriggerEvent("SERVER:Login_Error", "Es sind schon 3 Konten mit dieser Socialclub-ID registriert.");
|
||||
}
|
||||
else if (!dbContext.Users.Any(u => u.Name.ToLower() == username.ToLower().Trim()))
|
||||
{
|
||||
var user = new User
|
||||
{
|
||||
Name = player.Name,
|
||||
SocialClubName = player.SocialClubName,
|
||||
Password = NAPI.Util.GetHashSha256(password),
|
||||
PositionX = Main.DEFAULT_SPAWN_POSITION.X,
|
||||
PositionY = Main.DEFAULT_SPAWN_POSITION.Y,
|
||||
PositionZ = Main.DEFAULT_SPAWN_POSITION.Z
|
||||
PositionZ = Main.DEFAULT_SPAWN_POSITION.Z,
|
||||
BankAccount = new UserBankAccount
|
||||
{
|
||||
Balance = 5000,
|
||||
Active = true
|
||||
}
|
||||
};
|
||||
|
||||
dbContext.Users.Add(user);
|
||||
dbContext.SaveChanges();
|
||||
var userBankAccount = new Database.Entities.UserBankAccount
|
||||
{
|
||||
UserId = user.Id,
|
||||
Balance = 5000,
|
||||
Active = true
|
||||
};
|
||||
|
||||
dbContext.UserBankAccounts.Add(userBankAccount);
|
||||
dbContext.SaveChanges();
|
||||
|
||||
player.TriggerEvent("SERVER:Login_Success");
|
||||
player.SetData("isLoggedIn", true);
|
||||
@@ -54,10 +54,6 @@ namespace ReallifeGamemode.Server.Events
|
||||
player.Position = new Vector3(402.8664, -996.4108, -99.00027);
|
||||
//player.Position = new Vector3(user.PositionX, user.PositionY, user.PositionZ);
|
||||
}
|
||||
else if (dbContext.Users.Where(u => u.SocialClubName == player.SocialClubName).Count() >= 3)
|
||||
{
|
||||
player.TriggerEvent("SERVER:Login_Error", "Es sind schon 3 Konten mit dieser Socialclub-ID registriert.");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.TriggerEvent("SERVER:Login_Error", "Dieser Benutzername kann nicht registriert werden.");
|
||||
|
||||
Reference in New Issue
Block a user