private static void ProcessXP(SpringBattleContext result, ZkLobbyServer.ZkLobbyServer server, ZkDataContext db, SpringBattle sb) { sb.DispenseXP(); foreach (var u in sb.SpringBattlePlayers.Where(x => !x.IsSpectator)) { u.Account.CheckLevelUp(); } db.SaveChanges(); if (sb.ApplicableRatings == 0) { try { foreach (Account a in sb.SpringBattlePlayers.Where(x => !x.IsSpectator).Select(x => x.Account)) { server.PublishAccountUpdate(a); server.PublishUserProfileUpdate(a); } } catch (Exception ex) { Trace.TraceError("error updating extension data: {0}", ex); } } }
private static void ProcessElos(SpringBattleContext result, ZkLobbyServer.ZkLobbyServer server, ZkDataContext db, SpringBattle sb) { bool noElo = result.OutputExtras.Any(x => x?.StartsWith("noElo", true, System.Globalization.CultureInfo.CurrentCulture) == true); sb.CalculateAllElo(noElo); if (!noElo) { RatingSystems.ProcessResult(sb); } foreach (var u in sb.SpringBattlePlayers.Where(x => !x.IsSpectator)) { u.Account.CheckLevelUp(); } db.SaveChanges(); try { foreach (Account a in sb.SpringBattlePlayers.Where(x => !x.IsSpectator).Select(x => x.Account)) { server.PublishAccountUpdate(a); server.PublishUserProfileUpdate(a); } } catch (Exception ex) { Trace.TraceError("error updating extension data: {0}", ex); } }