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)
|
if (pluginObject.isParser)
|
||||||
{
|
{
|
||||||
|
await OnLoadAsync(manager);
|
||||||
IsParser = true;
|
IsParser = true;
|
||||||
IEventParser eventParser = (IEventParser)_scriptEngine.GetValue("eventParser").ToObject();
|
var eventParser = (IEventParser)_scriptEngine.GetValue("eventParser").ToObject();
|
||||||
IRConParser rconParser = (IRConParser)_scriptEngine.GetValue("rconParser").ToObject();
|
var rconParser = (IRConParser)_scriptEngine.GetValue("rconParser").ToObject();
|
||||||
manager.AdditionalEventParsers.Add(eventParser);
|
manager.AdditionalEventParsers.Add(eventParser);
|
||||||
manager.AdditionalRConParsers.Add(rconParser);
|
manager.AdditionalRConParsers.Add(rconParser);
|
||||||
}
|
}
|
||||||
|
@ -381,9 +381,10 @@ namespace SharedLibraryCore.Commands
|
|||||||
public override async Task ExecuteAsync(GameEvent E)
|
public override async Task ExecuteAsync(GameEvent E)
|
||||||
{
|
{
|
||||||
// todo: don't do the lookup here
|
// todo: don't do the lookup here
|
||||||
var penalties = await E.Owner.Manager.GetPenaltyService().GetActivePenaltiesAsync(E.Target.AliasLinkId);
|
var penalties = await E.Owner.Manager.GetPenaltyService().GetActivePenaltiesAsync(E.Target.AliasLinkId, E.Target.CurrentAliasId);
|
||||||
if (penalties.Where(p => p.Type == EFPenalty.PenaltyType.Ban || p.Type == EFPenalty.PenaltyType.TempBan)
|
if (penalties
|
||||||
.FirstOrDefault() != null)
|
.FirstOrDefault(p =>
|
||||||
|
p.Type == EFPenalty.PenaltyType.Ban || p.Type == EFPenalty.PenaltyType.TempBan) != null)
|
||||||
{
|
{
|
||||||
switch ((await E.Target.Unban(E.Data, E.Origin)
|
switch ((await E.Target.Unban(E.Data, E.Origin)
|
||||||
.WaitAsync(Utilities.DefaultCommandTimeout, E.Owner.Manager.CancellationToken)).FailReason)
|
.WaitAsync(Utilities.DefaultCommandTimeout, E.Owner.Manager.CancellationToken)).FailReason)
|
||||||
@ -897,7 +898,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
public override async Task ExecuteAsync(GameEvent E)
|
public override async Task ExecuteAsync(GameEvent E)
|
||||||
{
|
{
|
||||||
var existingPenalties = await E.Owner.Manager.GetPenaltyService()
|
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);
|
var penalty = existingPenalties.FirstOrDefault(b => b.Type > EFPenalty.PenaltyType.Kick);
|
||||||
|
|
||||||
if (penalty == null)
|
if (penalty == null)
|
||||||
@ -1247,4 +1248,4 @@ namespace SharedLibraryCore.Commands
|
|||||||
E.Origin.Tell(await GetNextMap(E.Owner, _translationLookup));
|
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)
|
// 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()
|
var activePenalties = await CurrentServer.Manager.GetPenaltyService()
|
||||||
.GetActivePenaltiesAsync(AliasLinkId, ipAddress);
|
.GetActivePenaltiesAsync(AliasLinkId, CurrentAliasId, ipAddress);
|
||||||
var banPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.Ban);
|
var banPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.Ban);
|
||||||
var tempbanPenalty =
|
var tempbanPenalty =
|
||||||
activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.TempBan);
|
activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.TempBan);
|
||||||
@ -740,4 +740,4 @@ namespace SharedLibraryCore.Database.Models
|
|||||||
return IsBot ? ClientNumber : (int)NetworkId;
|
return IsBot ? ClientNumber : (int)NetworkId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ namespace SharedLibraryCore.Services
|
|||||||
return await iqPenalties.Distinct().ToListAsync();
|
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)
|
bool includePunisherName = false)
|
||||||
{
|
{
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
@ -178,7 +178,7 @@ namespace SharedLibraryCore.Services
|
|||||||
}
|
}
|
||||||
else
|
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)
|
.Select(alias => alias.IPAddress)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
@ -205,7 +205,19 @@ namespace SharedLibraryCore.Services
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
iqIpPenalties = Enumerable.Empty<EFPenalty>().AsQueryable();
|
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();
|
var activeLinkPenalties = await iqLinkPenalties.ToListAsync();
|
||||||
|
@ -37,7 +37,7 @@ namespace WebfrontCore.Controllers
|
|||||||
return NotFound();
|
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);
|
var tag = await _metaService.GetPersistentMeta(EFMeta.ClientTag, client);
|
||||||
if (tag?.LinkedMeta != null)
|
if (tag?.LinkedMeta != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user