login logout logs

This commit is contained in:
hydrant
2021-04-19 12:17:56 +02:00
parent 06de6ef1a4
commit f0b2eca560
8 changed files with 2211 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ using ReallifeGamemode.Server.Report;
using ReallifeGamemode.Server.Factions.Medic;
using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.Inventory;
using ReallifeGamemode.Database.Entities.Logs;
/**
* @overview Life of German Reallife - Event Login (Login.cs)
@@ -40,6 +41,19 @@ namespace ReallifeGamemode.Server.Events
return;
}
var logEntry = new LoginLogoutLogEntry()
{
LoginLogout = false,
User = user,
PlayerId = player.Handle.Value,
Username = player.Name,
SocialClubName = player.SocialClubName,
IpAddress = player.Address,
Time = DateTime.Now,
};
saveUser.LoginLogoutLogs.Add(logEntry);
if (type == DisconnectionType.Left)
{
NAPI.Util.ConsoleOutput(player.Name + " left");

View File

@@ -13,6 +13,7 @@ using ReallifeGamemode.Database.Entities;
using System;
using System.Collections.Generic;
using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Database.Entities.Logs;
/**
* @overview Life of German Reallife - Event Login (Login.cs)
@@ -56,6 +57,20 @@ namespace ReallifeGamemode.Server.Events
return;
}
var logEntry = new LoginLogoutLogEntry()
{
IpAddress = player.Address,
User = user,
PlayerId = player.Handle.Value,
SocialClubName = player.SocialClubName,
Username = player.Name,
LoginLogout = true,
Time = DateTime.Now
};
dbContext.LoginLogoutLogs.Add(logEntry);
dbContext.SaveChanges();
player.SetData("dbId", user.Id);
player.Name = username;
player.TriggerEvent("SERVER:Login_Success");

View File

@@ -6,6 +6,7 @@ using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Util;
using System;
using ReallifeGamemode.Database.Entities.Logs;
/**
* @overview Life of German Reallife - Event Register (Register.cs)
@@ -51,7 +52,20 @@ namespace ReallifeGamemode.Server.Events
}
};
var logEntry = new LoginLogoutLogEntry()
{
IpAddress = player.Address,
User = user,
PlayerId = player.Handle.Value,
SocialClubName = player.SocialClubName,
Username = player.Name,
LoginLogout = true,
Time = DateTime.Now
};
dbContext.Users.Add(user);
dbContext.LoginLogoutLogs.Add(logEntry);
dbContext.SaveChanges();
player.SetData("dbId", user.Id);