diff --git a/Application/Application.csproj b/Application/Application.csproj
index a1fc11b2f..112c78758 100644
--- a/Application/Application.csproj
+++ b/Application/Application.csproj
@@ -6,7 +6,7 @@
2.1.5
false
RaidMax.IW4MAdmin.Application
- 2.2.2.0
+ 2.2.2.2
RaidMax
Forever None
IW4MAdmin
@@ -31,8 +31,8 @@
true
true
- 2.2.2.0
- 2.2.2.0
+ 2.2.2.2
+ 2.2.2.2
diff --git a/IW4MAdmin.sln b/IW4MAdmin.sln
index 679c734e5..e1181a734 100644
--- a/IW4MAdmin.sln
+++ b/IW4MAdmin.sln
@@ -40,7 +40,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScriptPlugins", "ScriptPlug
ProjectSection(SolutionItems) = preProject
Plugins\ScriptPlugins\SharedGUIDKick.js = Plugins\ScriptPlugins\SharedGUIDKick.js
Plugins\ScriptPlugins\VPNDetection.js = Plugins\ScriptPlugins\VPNDetection.js
- Plugins\ScriptPlugins\VpnDetectionPrivate.js = Plugins\ScriptPlugins\VpnDetectionPrivate.js
EndProjectSection
EndProject
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "GameLogServer", "GameLogServer\GameLogServer.pyproj", "{42EFDA12-10D3-4C40-A210-9483520116BC}"
diff --git a/SharedLibraryCore/Objects/EFClient.cs b/SharedLibraryCore/Objects/EFClient.cs
index 64be97a29..3de81f3d3 100644
--- a/SharedLibraryCore/Objects/EFClient.cs
+++ b/SharedLibraryCore/Objects/EFClient.cs
@@ -485,7 +485,7 @@ namespace SharedLibraryCore.Database.Models
// hack: re apply the automated offense to the reban
if (currentBan.AutomatedOffense != null)
{
- autoKickClient.AdministeredPenalties.Add(new EFPenalty()
+ autoKickClient.AdministeredPenalties?.Add(new EFPenalty()
{
AutomatedOffense = currentBan.AutomatedOffense
});
diff --git a/SharedLibraryCore/RCon/Connection.cs b/SharedLibraryCore/RCon/Connection.cs
index af1989d85..62b47918c 100644
--- a/SharedLibraryCore/RCon/Connection.cs
+++ b/SharedLibraryCore/RCon/Connection.cs
@@ -5,7 +5,6 @@ using System.Collections.Concurrent;
using System.Linq;
using System.Net;
using System.Net.Sockets;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -29,7 +28,8 @@ namespace SharedLibraryCore.RCon
static readonly ConcurrentDictionary ActiveQueries = new ConcurrentDictionary();
public IPEndPoint Endpoint { get; private set; }
public string RConPassword { get; private set; }
- ILogger Log;
+
+ private readonly ILogger Log;
public Connection(string ipAddress, int port, string password, ILogger log)
{
@@ -88,7 +88,7 @@ namespace SharedLibraryCore.RCon
byte[] response = null;
- retrySend:
+ retrySend:
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
{
//DontFragment = true,
@@ -107,7 +107,7 @@ namespace SharedLibraryCore.RCon
{
response = await SendPayloadAsync(payload, waitForResponse);
- if (response.Length == 0)
+ if (response.Length == 0 && waitForResponse)
{
throw new Exception();
}
diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs
index f7adb47ec..87c87615e 100644
--- a/SharedLibraryCore/Services/ClientService.cs
+++ b/SharedLibraryCore/Services/ClientService.cs
@@ -50,6 +50,12 @@ namespace SharedLibraryCore.Services
public async Task UpdateAlias(EFClient entity)
{
+ // todo: move this out
+ if (entity.IsBot)
+ {
+ return;
+ }
+
using (var context = new DatabaseContext())
{
context.Attach(entity);
@@ -60,10 +66,16 @@ namespace SharedLibraryCore.Services
bool hasExistingAlias = false;
// get all aliases by IP
- var aliases = await context.Aliases
+ var iqAliases = context.Aliases
.Include(a => a.Link)
- .Where(a => a.IPAddress != null && a.IPAddress == ip)
- .ToListAsync();
+ .Where(a => a.Link.Active)
+ .Where(a => (a.IPAddress != null && a.IPAddress == ip) ||
+ a.LinkId == entity.AliasLinkId);
+
+#if DEBUG == true
+ var aliasSql = iqAliases.ToSql();
+#endif
+ var aliases = await iqAliases.ToListAsync();
// see if they have a matching IP + Name but new NetworkId
var existingAlias = aliases.FirstOrDefault(a => a.Name == name);
@@ -112,6 +124,7 @@ namespace SharedLibraryCore.Services
existingAlias = alias;
aliasLink = _aliasLink;
+ await context.SaveChangesAsync();
}
// if no existing alias create new alias
@@ -128,10 +141,24 @@ namespace SharedLibraryCore.Services
entity.CurrentServer.Logger.WriteDebug($"Connecting player does not have an existing alias {entity}");
}
- entity.Level = hasExistingAlias ?
- await context.Clients.Where(c => c.AliasLinkId == existingAlias.LinkId)
- .MaxAsync(c => c.Level) :
- Permission.User;
+ else
+ {
+ var linkIds = aliases.Select(a => a.LinkId);
+
+ if (linkIds.Count() > 0)
+ {
+ var highestLevel = await context.Clients
+ .Where(c => linkIds.Contains(c.AliasLinkId))
+ .MaxAsync(c => c.Level);
+
+ if (entity.Level != highestLevel)
+ {
+ context.Update(entity);
+ entity.Level = highestLevel;
+ await context.SaveChangesAsync();
+ }
+ }
+ }
if (entity.CurrentAlias != existingAlias ||
entity.AliasLink != aliasLink)
diff --git a/SharedLibraryCore/Utilities.cs b/SharedLibraryCore/Utilities.cs
index ad8749a9b..18ab803f8 100644
--- a/SharedLibraryCore/Utilities.cs
+++ b/SharedLibraryCore/Utilities.cs
@@ -36,7 +36,8 @@ namespace SharedLibraryCore
CurrentAlias = new EFAlias()
{
Name = "IW4MAdmin"
- }
+ },
+ AdministeredPenalties = new List()
};
}