fix issue with certain penalties not linking
This commit is contained in:
parent
3539101a40
commit
8730a3fab8
@ -172,9 +172,10 @@ namespace IW4MAdmin.Application.Misc
|
||||
{
|
||||
if (pluginObject.isParser)
|
||||
{
|
||||
await OnLoadAsync(manager);
|
||||
IsParser = true;
|
||||
IEventParser eventParser = (IEventParser)_scriptEngine.GetValue("eventParser").ToObject();
|
||||
IRConParser rconParser = (IRConParser)_scriptEngine.GetValue("rconParser").ToObject();
|
||||
var eventParser = (IEventParser)_scriptEngine.GetValue("eventParser").ToObject();
|
||||
var rconParser = (IRConParser)_scriptEngine.GetValue("rconParser").ToObject();
|
||||
manager.AdditionalEventParsers.Add(eventParser);
|
||||
manager.AdditionalRConParsers.Add(rconParser);
|
||||
}
|
||||
|
@ -381,9 +381,10 @@ namespace SharedLibraryCore.Commands
|
||||
public override async Task ExecuteAsync(GameEvent E)
|
||||
{
|
||||
// todo: don't do the lookup here
|
||||
var penalties = await E.Owner.Manager.GetPenaltyService().GetActivePenaltiesAsync(E.Target.AliasLinkId);
|
||||
if (penalties.Where(p => p.Type == EFPenalty.PenaltyType.Ban || p.Type == EFPenalty.PenaltyType.TempBan)
|
||||
.FirstOrDefault() != null)
|
||||
var penalties = await E.Owner.Manager.GetPenaltyService().GetActivePenaltiesAsync(E.Target.AliasLinkId, E.Target.CurrentAliasId);
|
||||
if (penalties
|
||||
.FirstOrDefault(p =>
|
||||
p.Type == EFPenalty.PenaltyType.Ban || p.Type == EFPenalty.PenaltyType.TempBan) != null)
|
||||
{
|
||||
switch ((await E.Target.Unban(E.Data, E.Origin)
|
||||
.WaitAsync(Utilities.DefaultCommandTimeout, E.Owner.Manager.CancellationToken)).FailReason)
|
||||
@ -897,7 +898,7 @@ namespace SharedLibraryCore.Commands
|
||||
public override async Task ExecuteAsync(GameEvent E)
|
||||
{
|
||||
var existingPenalties = await E.Owner.Manager.GetPenaltyService()
|
||||
.GetActivePenaltiesAsync(E.Target.AliasLinkId, E.Target.IPAddress);
|
||||
.GetActivePenaltiesAsync(E.Target.AliasLinkId, E.Target.CurrentAliasId, E.Target.IPAddress);
|
||||
var penalty = existingPenalties.FirstOrDefault(b => b.Type > EFPenalty.PenaltyType.Kick);
|
||||
|
||||
if (penalty == null)
|
||||
@ -1247,4 +1248,4 @@ namespace SharedLibraryCore.Commands
|
||||
E.Origin.Tell(await GetNextMap(E.Owner, _translationLookup));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
|
||||
// we want to get any penalties that are tied to their IP or AliasLink (but not necessarily their GUID)
|
||||
var activePenalties = await CurrentServer.Manager.GetPenaltyService()
|
||||
.GetActivePenaltiesAsync(AliasLinkId, ipAddress);
|
||||
.GetActivePenaltiesAsync(AliasLinkId, CurrentAliasId, ipAddress);
|
||||
var banPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.Ban);
|
||||
var tempbanPenalty =
|
||||
activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.TempBan);
|
||||
@ -740,4 +740,4 @@ namespace SharedLibraryCore.Database.Models
|
||||
return IsBot ? ClientNumber : (int)NetworkId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ namespace SharedLibraryCore.Services
|
||||
return await iqPenalties.Distinct().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<EFPenalty>> GetActivePenaltiesAsync(int linkId, int? ip = null,
|
||||
public async Task<List<EFPenalty>> GetActivePenaltiesAsync(int linkId, int currentAliasId, int? ip = null,
|
||||
bool includePunisherName = false)
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
@ -178,7 +178,7 @@ namespace SharedLibraryCore.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
var aliasIps = await context.Aliases.Where(alias => alias.LinkId == linkId && alias.IPAddress != null)
|
||||
/* var aliasIps = await context.Aliases.Where(alias => (alias.LinkId == linkId || alias.AliasId == currentAliasId) && alias.IPAddress != null)
|
||||
.Select(alias => alias.IPAddress)
|
||||
.ToListAsync();
|
||||
|
||||
@ -205,7 +205,19 @@ namespace SharedLibraryCore.Services
|
||||
else
|
||||
{
|
||||
iqIpPenalties = Enumerable.Empty<EFPenalty>().AsQueryable();
|
||||
}
|
||||
}*/
|
||||
|
||||
var usedIps = await context.Aliases.AsNoTracking()
|
||||
.Where(alias => (alias.LinkId == linkId || alias.AliasId == currentAliasId) && alias.IPAddress != null)
|
||||
.Select(alias => alias.IPAddress).ToListAsync();
|
||||
|
||||
var aliasedIds = await context.Aliases.AsNoTracking().Where(alias => usedIps.Contains(alias.IPAddress))
|
||||
.Select(alias => alias.LinkId)
|
||||
.ToListAsync();
|
||||
|
||||
iqIpPenalties = context.Penalties.AsNoTracking()
|
||||
.Where(penalty => aliasedIds.Contains(penalty.LinkId))
|
||||
.Where(filter);
|
||||
}
|
||||
|
||||
var activeLinkPenalties = await iqLinkPenalties.ToListAsync();
|
||||
|
@ -37,7 +37,7 @@ namespace WebfrontCore.Controllers
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var activePenalties = (await Manager.GetPenaltyService().GetActivePenaltiesAsync(client.AliasLinkId, client.IPAddress));
|
||||
var activePenalties = await Manager.GetPenaltyService().GetActivePenaltiesAsync(client.AliasLinkId, client.CurrentAliasId, client.IPAddress);
|
||||
|
||||
var tag = await _metaService.GetPersistentMeta(EFMeta.ClientTag, client);
|
||||
if (tag?.LinkedMeta != null)
|
||||
|
Loading…
Reference in New Issue
Block a user