public void InitializeServerStats(Server sv) { int serverId = sv.GetHashCode(); var statsSvc = ContextThreads[serverId]; var serverStats = statsSvc.ServerStatsSvc.Find(s => s.ServerId == serverId).FirstOrDefault(); if (serverStats == null) { Log.WriteDebug($"Initializing server stats for {sv}"); // server stats have never been generated before serverStats = new EFServerStatistics() { Active = true, ServerId = serverId, TotalKills = 0, TotalPlayTime = 0, }; var ieClientStats = statsSvc.ClientStatSvc.Find(cs => cs.ServerId == serverId); // set these incase they've we've imported settings serverStats.TotalKills = ieClientStats.Sum(cs => cs.Kills); serverStats.TotalPlayTime = Manager.GetClientService().GetTotalPlayTime().Result; statsSvc.ServerStatsSvc.Insert(serverStats); } }
public ServerStats(EFServer sv, EFServerStatistics st) { PlayerStats = new ConcurrentDictionary <int, EFClientStatistics>(); PlayerDetections = new ConcurrentDictionary <int, Detection>(); ServerStatistics = st; Server = sv; }
public ServerStats(EFServer sv, EFServerStatistics st, Server server) { HitCache = new List <EFClientKill>(); ServerStatistics = st; Server = sv; _server = server; OnSaving = new SemaphoreSlim(1, 1); }