mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
fix penalty list javascript loading duplicates
make bad GUID parse throw an exception so we don't have a client connect with GUID of 0 no longer print out ac debug messages fix small issue of trying to parse empty chat messages fix issue with set level on accounts with multi guid, same IP
This commit is contained in:
@ -1119,8 +1119,8 @@ namespace SharedLibraryCore.Commands
|
||||
E.Origin.PasswordSalt = hashedPassword[1];
|
||||
|
||||
// update the password for the client in privileged
|
||||
E.Owner.Manager.GetPrivilegedClients()[E.Origin.ClientId].Password = hashedPassword[0];
|
||||
E.Owner.Manager.GetPrivilegedClients()[E.Origin.ClientId].PasswordSalt = hashedPassword[1];
|
||||
E.Owner.Manager.PrivilegedClients[E.Origin.ClientId].Password = hashedPassword[0];
|
||||
E.Owner.Manager.PrivilegedClients[E.Origin.ClientId].PasswordSalt = hashedPassword[1];
|
||||
|
||||
await E.Owner.Manager.GetClientService().Update(E.Origin);
|
||||
E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_PASSWORD_SUCCESS"]);
|
||||
|
@ -6,6 +6,7 @@ using SharedLibraryCore.Services;
|
||||
using SharedLibraryCore.Configuration;
|
||||
using System.Reflection;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
@ -23,7 +24,7 @@ namespace SharedLibraryCore.Interfaces
|
||||
ClientService GetClientService();
|
||||
AliasService GetAliasService();
|
||||
PenaltyService GetPenaltyService();
|
||||
IDictionary<int, EFClient> GetPrivilegedClients();
|
||||
IDictionary<int, EFClient> PrivilegedClients { get; }
|
||||
/// <summary>
|
||||
/// Get the event handlers
|
||||
/// </summary>
|
||||
|
@ -103,7 +103,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
Data = message
|
||||
};
|
||||
|
||||
this.CurrentServer?.Manager.GetEventHandler().AddEvent(e);
|
||||
CurrentServer?.Manager.GetEventHandler().AddEvent(e);
|
||||
return e;
|
||||
}
|
||||
|
||||
@ -125,14 +125,14 @@ namespace SharedLibraryCore.Database.Models
|
||||
};
|
||||
|
||||
// enforce level restrictions
|
||||
if (this.Level > sender.Level)
|
||||
if (Level > sender.Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
this.Warnings++;
|
||||
Warnings++;
|
||||
}
|
||||
|
||||
sender.CurrentServer.Manager.GetEventHandler().AddEvent(e);
|
||||
@ -156,13 +156,13 @@ namespace SharedLibraryCore.Database.Models
|
||||
};
|
||||
|
||||
// enforce level restrictions
|
||||
if (sender.Level <= this.Level)
|
||||
if (sender.Level <= Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
return e;
|
||||
}
|
||||
|
||||
this.Warnings = 0;
|
||||
Warnings = 0;
|
||||
|
||||
sender.CurrentServer.Manager.GetEventHandler().AddEvent(e);
|
||||
return e;
|
||||
@ -188,12 +188,12 @@ namespace SharedLibraryCore.Database.Models
|
||||
|
||||
int reportCount = sender.GetAdditionalProperty<int>("_reportCount");
|
||||
|
||||
if (this.Level > sender.Level)
|
||||
if (Level > sender.Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
|
||||
else if (this.Equals(sender))
|
||||
else if (Equals(sender))
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Invalid;
|
||||
}
|
||||
@ -204,7 +204,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
}
|
||||
|
||||
else if (CurrentServer.Reports.Count(report => (report.Origin.NetworkId == sender.NetworkId &&
|
||||
report.Target.NetworkId == this.NetworkId)) > 0)
|
||||
report.Target.NetworkId == NetworkId)) > 0)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Exception;
|
||||
}
|
||||
@ -232,12 +232,12 @@ namespace SharedLibraryCore.Database.Models
|
||||
Owner = sender.CurrentServer
|
||||
};
|
||||
|
||||
if (this.Level >= sender.Level)
|
||||
if (Level >= sender.Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
|
||||
else if (this.Level == Permission.Flagged)
|
||||
else if (Level == Permission.Flagged)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Invalid;
|
||||
}
|
||||
@ -264,12 +264,12 @@ namespace SharedLibraryCore.Database.Models
|
||||
Owner = sender.CurrentServer
|
||||
};
|
||||
|
||||
if (sender.Level <= this.Level)
|
||||
if (sender.Level <= Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
|
||||
else if (this.Level != Permission.Flagged)
|
||||
else if (Level != Permission.Flagged)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Invalid;
|
||||
}
|
||||
@ -296,7 +296,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
};
|
||||
|
||||
// enforce level restrictions
|
||||
if (this.Level > sender.Level)
|
||||
if (Level > sender.Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
@ -325,7 +325,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
};
|
||||
|
||||
// enforce level restrictions
|
||||
if (sender.Level <= this.Level)
|
||||
if (sender.Level <= Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
@ -353,7 +353,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
};
|
||||
|
||||
// enforce level restrictions
|
||||
if (sender.Level <= this.Level)
|
||||
if (sender.Level <= Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
@ -381,7 +381,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
};
|
||||
|
||||
// enforce level restrictions
|
||||
if (this.Level > sender.Level)
|
||||
if (Level > sender.Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
@ -407,7 +407,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
Owner = sender.CurrentServer
|
||||
};
|
||||
|
||||
if (this.Level > sender.Level)
|
||||
if (Level > sender.Level)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
@ -675,7 +675,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
Dictionary<string, object> _additionalProperties;
|
||||
readonly Dictionary<string, object> _additionalProperties;
|
||||
|
||||
public T GetAdditionalProperty<T>(string name)
|
||||
{
|
||||
|
@ -217,7 +217,7 @@ namespace SharedLibraryCore.Services
|
||||
using (var ctx = new DatabaseContext())
|
||||
{
|
||||
var entity = await ctx.Clients
|
||||
.Where(_client => _client.AliasLinkId == temporalClient.AliasLinkId)
|
||||
.Where(_client => _client.ClientId == temporalClient.ClientId)
|
||||
.FirstAsync();
|
||||
|
||||
var oldPermission = entity.Level;
|
||||
@ -451,7 +451,7 @@ namespace SharedLibraryCore.Services
|
||||
|
||||
using (var context = new DatabaseContext(disableTracking: true))
|
||||
{
|
||||
long networkId = identifier.ConvertLong();
|
||||
long networkId = identifier.ConvertGuidToLong();
|
||||
int? ipAddress = identifier.ConvertToIP();
|
||||
|
||||
IQueryable<EFAlias> iqLinkIds = context.Aliases.Where(_alias => _alias.Active);
|
||||
|
@ -11,6 +11,7 @@
|
||||
<Authors>RaidMax</Authors>
|
||||
<Company>Forever None</Company>
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -266,33 +266,35 @@ namespace SharedLibraryCore
|
||||
}
|
||||
}
|
||||
|
||||
public static long ConvertLong(this string str)
|
||||
public static long ConvertGuidToLong(this string str)
|
||||
{
|
||||
str = str.Substring(0, Math.Min(str.Length, 16));
|
||||
int maxBots = 18;
|
||||
long id;
|
||||
|
||||
if (str.Length <= 11) // 10 numeric characters + signed character
|
||||
{
|
||||
if (long.TryParse(str, NumberStyles.Integer, CultureInfo.InvariantCulture, out id))
|
||||
{
|
||||
return (uint)id;
|
||||
}
|
||||
}
|
||||
|
||||
if (long.TryParse(str, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out id))
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
var bot = Regex.Match(str, @"bot[0-9]+").Value;
|
||||
if (!string.IsNullOrEmpty(bot))
|
||||
int maxBots = 18;
|
||||
|
||||
// this is a special case for Plutonium T6
|
||||
if (str.Length <= 11 &&
|
||||
long.TryParse(str, NumberStyles.Integer, CultureInfo.InvariantCulture, out long id)) // 10 numeric characters + signed character
|
||||
{
|
||||
id = (uint)id;
|
||||
}
|
||||
|
||||
else if (long.TryParse(str, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out id))
|
||||
{
|
||||
}
|
||||
|
||||
else if (!string.IsNullOrEmpty(bot))
|
||||
{
|
||||
// should set their GUID to the negation of their 1 based index (-1 - -18)
|
||||
return -(Convert.ToInt64(bot.Substring(3)) + 1) % maxBots;
|
||||
id = -(Convert.ToInt64(bot.Substring(3)) + 1) % maxBots;
|
||||
}
|
||||
|
||||
return long.MinValue;
|
||||
if (id == 0)
|
||||
{
|
||||
throw new FormatException($"Could not parse client GUID - {str}");
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
public static int? ConvertToIP(this string str)
|
||||
|
Reference in New Issue
Block a user