add game to client
This commit is contained in:
parent
7b3ddd58c6
commit
0a8e415af8
@ -431,6 +431,7 @@ namespace IW4MAdmin
|
|||||||
Clients[E.Origin.ClientNumber] = E.Origin;
|
Clients[E.Origin.ClientNumber] = E.Origin;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
E.Origin.GameName = (Reference.Game?)GameName;
|
||||||
E.Origin = await OnClientConnected(E.Origin);
|
E.Origin = await OnClientConnected(E.Origin);
|
||||||
E.Target = E.Origin;
|
E.Target = E.Origin;
|
||||||
}
|
}
|
||||||
@ -952,6 +953,8 @@ namespace IW4MAdmin
|
|||||||
!string.IsNullOrEmpty(client.Name) && (client.Ping != 999 || client.IsBot)))
|
!string.IsNullOrEmpty(client.Name) && (client.Ping != 999 || client.IsBot)))
|
||||||
{
|
{
|
||||||
client.CurrentServer = this;
|
client.CurrentServer = this;
|
||||||
|
client.GameName = (Reference.Game?)GameName;
|
||||||
|
|
||||||
var e = new GameEvent
|
var e = new GameEvent
|
||||||
{
|
{
|
||||||
Type = GameEvent.EventType.PreConnect,
|
Type = GameEvent.EventType.PreConnect,
|
||||||
@ -959,7 +962,7 @@ namespace IW4MAdmin
|
|||||||
Owner = this,
|
Owner = this,
|
||||||
IsBlocking = true,
|
IsBlocking = true,
|
||||||
Extra = client.GetAdditionalProperty<string>("BotGuid"),
|
Extra = client.GetAdditionalProperty<string>("BotGuid"),
|
||||||
Source = GameEvent.EventSource.Status
|
Source = GameEvent.EventSource.Status,
|
||||||
};
|
};
|
||||||
|
|
||||||
Manager.AddEvent(e);
|
Manager.AddEvent(e);
|
||||||
|
1636
Data/Migrations/MySql/20220422202702_AddGameToEFClient.Designer.cs
generated
Normal file
1636
Data/Migrations/MySql/20220422202702_AddGameToEFClient.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
Data/Migrations/MySql/20220422202702_AddGameToEFClient.cs
Normal file
25
Data/Migrations/MySql/20220422202702_AddGameToEFClient.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Data.Migrations.MySql
|
||||||
|
{
|
||||||
|
public partial class AddGameToEFClient : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "GameName",
|
||||||
|
table: "EFClients",
|
||||||
|
type: "int",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GameName",
|
||||||
|
table: "EFClients");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -64,6 +64,9 @@ namespace Data.Migrations.MySql
|
|||||||
b.Property<DateTime>("FirstConnection")
|
b.Property<DateTime>("FirstConnection")
|
||||||
.HasColumnType("datetime(6)");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
b.Property<int?>("GameName")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<DateTime>("LastConnection")
|
b.Property<DateTime>("LastConnection")
|
||||||
.HasColumnType("datetime(6)");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
1693
Data/Migrations/Postgresql/20220422203121_AddGameToEFClient.Designer.cs
generated
Normal file
1693
Data/Migrations/Postgresql/20220422203121_AddGameToEFClient.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Data.Migrations.Postgresql
|
||||||
|
{
|
||||||
|
public partial class AddGameToEFClient : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "GameName",
|
||||||
|
table: "EFClients",
|
||||||
|
type: "integer",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GameName",
|
||||||
|
table: "EFClients");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -71,6 +71,9 @@ namespace Data.Migrations.Postgresql
|
|||||||
b.Property<DateTime>("FirstConnection")
|
b.Property<DateTime>("FirstConnection")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
b.Property<int?>("GameName")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("LastConnection")
|
b.Property<DateTime>("LastConnection")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
1634
Data/Migrations/Sqlite/20220422202315_AddGameToEFClient.Designer.cs
generated
Normal file
1634
Data/Migrations/Sqlite/20220422202315_AddGameToEFClient.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
Data/Migrations/Sqlite/20220422202315_AddGameToEFClient.cs
Normal file
25
Data/Migrations/Sqlite/20220422202315_AddGameToEFClient.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Data.Migrations.Sqlite
|
||||||
|
{
|
||||||
|
public partial class AddGameToEFClient : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "GameName",
|
||||||
|
table: "EFClients",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "GameName",
|
||||||
|
table: "EFClients");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -62,6 +62,9 @@ namespace Data.Migrations.Sqlite
|
|||||||
b.Property<DateTime>("FirstConnection")
|
b.Property<DateTime>("FirstConnection")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int?>("GameName")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<DateTime>("LastConnection")
|
b.Property<DateTime>("LastConnection")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
@ -805,7 +808,7 @@ namespace Data.Migrations.Sqlite
|
|||||||
b.Property<string>("SearchableIPAddress")
|
b.Property<string>("SearchableIPAddress")
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
.ValueGeneratedOnAddOrUpdate()
|
||||||
.HasColumnType("TEXT")
|
.HasColumnType("TEXT")
|
||||||
.HasComputedColumnSql("((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)");
|
.HasComputedColumnSql("((IPAddress & 255) || '.' || ((IPAddress >> 8) & 255)) || '.' || ((IPAddress >> 16) & 255) || '.' || ((IPAddress >> 24) & 255)", true);
|
||||||
|
|
||||||
b.Property<string>("SearchableName")
|
b.Property<string>("SearchableName")
|
||||||
.HasMaxLength(24)
|
.HasMaxLength(24)
|
||||||
|
@ -63,6 +63,7 @@ namespace Data.Models.Client
|
|||||||
public DateTime FirstConnection { get; set; }
|
public DateTime FirstConnection { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime LastConnection { get; set; }
|
public DateTime LastConnection { get; set; }
|
||||||
|
public Reference.Game? GameName { get; set; } = Reference.Game.UKN;
|
||||||
public bool Masked { get; set; }
|
public bool Masked { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int AliasLinkId { get; set; }
|
public int AliasLinkId { get; set; }
|
||||||
|
@ -626,6 +626,8 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
Utilities.DefaultLogger.LogInformation("Client {client} is joining the game from {source}", ToString(),
|
Utilities.DefaultLogger.LogInformation("Client {client} is joining the game from {source}", ToString(),
|
||||||
ipAddress.HasValue ? "Status" : "Log");
|
ipAddress.HasValue ? "Status" : "Log");
|
||||||
|
|
||||||
|
GameName = (Reference.Game)CurrentServer.GameName;
|
||||||
|
|
||||||
if (ipAddress != null)
|
if (ipAddress != null)
|
||||||
{
|
{
|
||||||
IPAddress = ipAddress;
|
IPAddress = ipAddress;
|
||||||
|
@ -103,7 +103,8 @@ namespace SharedLibraryCore.Services
|
|||||||
Level = Permission.User,
|
Level = Permission.User,
|
||||||
FirstConnection = DateTime.UtcNow,
|
FirstConnection = DateTime.UtcNow,
|
||||||
LastConnection = DateTime.UtcNow,
|
LastConnection = DateTime.UtcNow,
|
||||||
NetworkId = entity.NetworkId
|
NetworkId = entity.NetworkId,
|
||||||
|
GameName = (Reference.Game)entity.CurrentServer.GameName
|
||||||
};
|
};
|
||||||
|
|
||||||
_logger.LogDebug("[create] adding {entity} to context", entity.ToString());
|
_logger.LogDebug("[create] adding {entity} to context", entity.ToString());
|
||||||
@ -283,6 +284,8 @@ namespace SharedLibraryCore.Services
|
|||||||
entity.PasswordSalt = temporalClient.PasswordSalt;
|
entity.PasswordSalt = temporalClient.PasswordSalt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entity.GameName ??= temporalClient.GameName;
|
||||||
|
|
||||||
// update in database
|
// update in database
|
||||||
await context.SaveChangesAsync();
|
await context.SaveChangesAsync();
|
||||||
return entity.ToPartialClient();
|
return entity.ToPartialClient();
|
||||||
@ -357,7 +360,8 @@ namespace SharedLibraryCore.Services
|
|||||||
Level = Permission.User,
|
Level = Permission.User,
|
||||||
FirstConnection = DateTime.UtcNow,
|
FirstConnection = DateTime.UtcNow,
|
||||||
LastConnection = DateTime.UtcNow,
|
LastConnection = DateTime.UtcNow,
|
||||||
NetworkId = entity.NetworkId
|
NetworkId = entity.NetworkId,
|
||||||
|
GameName = (Reference.Game)entity.CurrentServer.GameName
|
||||||
};
|
};
|
||||||
|
|
||||||
if (existingAlias == null)
|
if (existingAlias == null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user