public static void CalculateWn7(this AccountInfoStatistics account) { double avdFrags = (double)account.Frags / account.Battles; double avgDamage = (double)account.DamageDealt / account.Battles; double avgSpot = (double)account.Spotted / account.Battles; double avgDef = (double)account.DroppedCapturePoints / account.Battles; double winRate = (100 * (double)account.Wins / account.Battles); // - 48; account.Wn7 = CalculateWn7(account.Battles, account.AvgTier, avdFrags, avgDamage, avgSpot, avgDef, winRate); }
public static double CalculateEffectivity(this AccountInfoStatistics account) { double avgFrags = (double)account.Frags / account.Battles; double avgDamage = (double)account.DamageDealt / account.Battles; double avgSpot = (double)account.Spotted / account.Battles; double avgCap = (double)account.CapturePoints / account.Battles; double avgDef = (double)account.DroppedCapturePoints / account.Battles; double tier = account.AvgTier; return(Effectivity(avgDamage, tier, avgFrags, avgSpot, avgCap, avgDef)); }
public static void CalculateMiddleTier(this AccountInfoStatistics account, IList <AccountTankStatistics> allTanks, Dictionary <long, double> tankTires) { double x = 0d; foreach (var tank in allTanks) { if (tankTires.ContainsKey(tank.TankId) && tank.Battles > 0) { x += tankTires[tank.TankId] * tank.Battles; } } if (account.Battles > 0) { x /= account.Battles; } account.AvgTier = x; }
public async Task SaveAccountStatisticsAsync(AccountInfoStatistics accountInfoStatistics) { await _dbContext.AccountInfoStatistics.AddAsync(accountInfoStatistics); await _dbContext.SaveChangesAsync(); }