misc clearnup
This commit is contained in:
parent
6db1f6db07
commit
4442826bcf
@ -306,7 +306,7 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private GameEvent? ParseJoinTeamEvent(string logLine, long gameTime)
|
private GameEvent ParseJoinTeamEvent(string logLine, long gameTime)
|
||||||
{
|
{
|
||||||
var match = Configuration.JoinTeam.PatternMatcher.Match(logLine);
|
var match = Configuration.JoinTeam.PatternMatcher.Match(logLine);
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private GameEvent? ParseClientEnterMatchEvent(string logLine, long gameTime)
|
private GameEvent ParseClientEnterMatchEvent(string logLine, long gameTime)
|
||||||
{
|
{
|
||||||
var match = Configuration.Join.PatternMatcher.Match(logLine);
|
var match = Configuration.Join.PatternMatcher.Match(logLine);
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ namespace IW4MAdmin.Application.EventParsers
|
|||||||
|
|
||||||
#region DAMAGE
|
#region DAMAGE
|
||||||
|
|
||||||
private GameEvent? ParseDamageEvent(string logLine, long gameTime)
|
private GameEvent ParseDamageEvent(string logLine, long gameTime)
|
||||||
{
|
{
|
||||||
var match = Configuration.Damage.PatternMatcher.Match(logLine);
|
var match = Configuration.Damage.PatternMatcher.Match(logLine);
|
||||||
|
|
||||||
|
@ -7,10 +7,7 @@ using System.Threading.Tasks;
|
|||||||
using Data.Abstractions;
|
using Data.Abstractions;
|
||||||
using Data.Models;
|
using Data.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using SharedLibraryCore;
|
|
||||||
using SharedLibraryCore.Database.Models;
|
|
||||||
using SharedLibraryCore.Dtos;
|
using SharedLibraryCore.Dtos;
|
||||||
using SharedLibraryCore.Interfaces;
|
using SharedLibraryCore.Interfaces;
|
||||||
using SharedLibraryCore.QueryHelper;
|
using SharedLibraryCore.QueryHelper;
|
||||||
@ -22,7 +19,6 @@ public class MetaServiceV2 : IMetaServiceV2
|
|||||||
{
|
{
|
||||||
private readonly IDictionary<MetaType, List<dynamic>> _metaActions;
|
private readonly IDictionary<MetaType, List<dynamic>> _metaActions;
|
||||||
private readonly IDatabaseContextFactory _contextFactory;
|
private readonly IDatabaseContextFactory _contextFactory;
|
||||||
private readonly IServiceProvider _serviceProvider;
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public MetaServiceV2(ILogger<MetaServiceV2> logger, IDatabaseContextFactory contextFactory, IServiceProvider serviceProvider)
|
public MetaServiceV2(ILogger<MetaServiceV2> logger, IDatabaseContextFactory contextFactory, IServiceProvider serviceProvider)
|
||||||
@ -30,7 +26,6 @@ public class MetaServiceV2 : IMetaServiceV2
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
_metaActions = new Dictionary<MetaType, List<dynamic>>();
|
_metaActions = new Dictionary<MetaType, List<dynamic>>();
|
||||||
_contextFactory = contextFactory;
|
_contextFactory = contextFactory;
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetPersistentMeta(string metaKey, string metaValue, int clientId,
|
public async Task SetPersistentMeta(string metaKey, string metaValue, int clientId,
|
||||||
@ -69,26 +64,6 @@ public class MetaServiceV2 : IMetaServiceV2
|
|||||||
}
|
}
|
||||||
|
|
||||||
await context.SaveChangesAsync(token);
|
await context.SaveChangesAsync(token);
|
||||||
|
|
||||||
|
|
||||||
var manager = _serviceProvider.GetRequiredService<IManager>();
|
|
||||||
var matchingClient = manager.GetActiveClients().FirstOrDefault(client => client.ClientId == clientId);
|
|
||||||
var server = matchingClient?.CurrentServer ?? manager.GetServers().FirstOrDefault();
|
|
||||||
|
|
||||||
if (server is not null)
|
|
||||||
{
|
|
||||||
manager.AddEvent(new GameEvent
|
|
||||||
{
|
|
||||||
Type = GameEvent.EventType.MetaUpdated,
|
|
||||||
Origin = matchingClient ?? new EFClient
|
|
||||||
{
|
|
||||||
ClientId = clientId
|
|
||||||
},
|
|
||||||
Data = metaValue,
|
|
||||||
Extra = metaKey,
|
|
||||||
Owner = server
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetPersistentMetaValue<T>(string metaKey, T metaValue, int clientId,
|
public async Task SetPersistentMetaValue<T>(string metaKey, T metaValue, int clientId,
|
||||||
|
Loading…
Reference in New Issue
Block a user