public static string AchievementsHTML(WOTStats stats) { string html = @"<table class='b-gray-text' width='100%'><tbody>"; using (Achievements ach = new Achievements()) { foreach (KeyValuePair <int, Achievement> item in ach.OrderBy(x => x.Key)) { int total = 0; int completed = 0; foreach (string tank in item.Value.Tanks) { total += (from x in stats.tanks.Select(h => h.FragList.Where(f => f.CountryID + "_" + f.TankID == tank).Select(g => g.frags).Sum()) select x).Sum(); } while (total >= item.Value.Value) { total -= item.Value.Value; completed++; } html += @"<tr><th class='th1' align='center' width=100% colspan='2'>" + item.Value.Name + @"</th></tr> <tr><th class='th1' align='center' width=100% colspan='2'>" + Translations.TranslationGet("STR_ACHIEVED", "DE", "Achieved: ") + completed + @"</th> </tr>"; html += @"<tr><td width=100%><table width=100%><tr><td align='center' width=" + Math.Round((decimal)total / (decimal)item.Value.Value * (decimal)100, 0) + "% bgColor=green><font><strong>" + (total == 0 ? "" : total.ToString()) + @"</strong></font></td>"; html += @"<td align='center' width=" + ((decimal)100 - Math.Round((decimal)total / (decimal)item.Value.Value * (decimal)100, 0)) + "% bgColor=red><font ><strong>" + ((item.Value.Value - total) == 0 ? "" : (item.Value.Value - total).ToString()) + @"</strong></font></td></tr></table></td></tr>"; } } html += @"</tbody></table>"; return(html); }
private string BattleExperience(WOTStats stats, WOTStatsDelta delta) { string html = @"<table class=o width=100%> <thead> </thead> <tbody> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_TOTALEXP", "DE", "Total Experience:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(Math.Round(stats.Experience, 2), 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.Experience, 2), "", 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_AVGEXP", "DE", "Average Experience per Battle:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(Math.Round(stats.AverageExperiencePerBattle, 2), 2) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.AverageExperiencePerBattle, 2), "", 2) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_MAXEXP", "DE", "Maximum Experience per Battle:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(Math.Round(stats.MaxExperience, 2), 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.MaxExperience, 2), "", 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_DMGCAUSED", "DE", "Damage Dealt:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.DamageDealt, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.DamageDealt, 2), "", 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_DMGASSRADIO", "DE", "Damage Assisted Radio:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.DamageAssistedRadio, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.DamageAssistedRadio, 2), "", 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_DMGASSTRACK", "DE", "Damage Assisted Track:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.DamageAssistedTracks, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.DamageAssistedTracks, 2), "", 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_DMGREC", "DE", "Damage Received:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.DamageReceived, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.DamageReceived, 2), "", 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_COMP_AVGDAM", "DE", "Average Damage:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(Math.Round(stats.AverageDamageDealtPerBattle, 2), 2) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.AverageDamagePerBattle, 2), "", 2) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_DMGRATIO", "DE", "Damage Ratio:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(Math.Round(stats.DamageRatio, 2), 2) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.DamageRatio, 2), "", 2) + @"</td> </tr> </tbody> </table>"; return html; }
public string GlobalHTML(WOTStats stats, WOTStats prevStats, WOTStatsDelta delta) { string html = @"<div id='toolTipLayer' style='position:absolute; visibility: hidden;left:0;right:0;'></div> <table class='b-gray-text' Border=0 width=100%> <thead> <tr> <th align=center width=33.33%><strong>" + Translations.TranslationGet("HTML_HEAD_OVRESULTS", "DE", "Overall Results") + @"<strong></th> <th align=center width=33.33%><strong>" + Translations.TranslationGet("HTML_HEAD_BATPERFORMANCE", "DE", "Battle Performance") + @"<strong></th> <th align=center width=33.33%><strong>" + Translations.TranslationGet("HTML_HEAD_BATEXPERIENCE", "DE", "Battle Experience") + @"<strong></th> </tr> </thead> <tbody> <tr> <td class='td-1' class=r valign=top>" + OverallResults(stats, delta) + @"</td> <td class='td-1' class=r valign=top>" + BattlePerformance(stats, delta) + @"</td> <td class='td-1' class=r valign=top>" + BattleExperience(stats, delta) + @"</td> </tr> <tr> <td class='td-1' COLSPAN=3 Height=20px> </TD> </tr> <tr> <th align=center colspan=3><strong>" + Translations.TranslationGet("HTML_HEAD_COUNTRYSTATS", "DE", "Country Statistics") + @"<strong></th> </tr> <tr> <td class='td-1' class=r valign=top colspan=3>" + CountryStats(stats, prevStats, delta) + @"</td> </tr> <tr> <td class='td-1' COLSPAN=3 Height=20px> </TD> </tr> <tr> <th align=center colspan=3><strong>" + Translations.TranslationGet("HTML_HEAD_TANKCLASSSTATS", "DE", "Tank Class Statistics") + @"<strong></th> </tr> <tr> <td class='td-1' class=r valign=top colspan=3>" + TankTypeStats(stats, prevStats, delta) + @"</td> </tr> <tr> <td class='td-1' COLSPAN=3 Height=20px> </TD> </tr> <tr> <th align=center colspan=1><strong>" + Translations.TranslationGet("HTML_HEAD_TIEREFF", "DE", "Tier WN7") + @"<strong></th> <th align=center colspan=1><strong>" + Translations.TranslationGet("HTML_HEAD_TOPEFF", "DE", "Top 7 Efficiency") + @"<strong></th> <th align=center colspan=1><strong>" + Translations.TranslationGet("HTML_HEAD_TOPEXP", "DE", "Top 7 Experience") + @"<strong></th> </tr> <tr> <td class='td-1' class=r valign=top colspan=1>" + TierEfficiency(stats, prevStats) + @"</td> <td class='td-1' class=r valign=top colspan=1>" + Top05Eff(stats) + @"</td> <td class='td-1' class=r valign=top colspan=1>" + Top05Experience(stats) + @"</td> </tr> </tbody> </table>"; stats = null; delta = null; return html; }
private static double GetStatValue(string StatName, WOTStats wotStats) { /* * Kill Ratio * Kill/Death Ratio * */ switch (StatName) { case "Damage Taken : Total": return(wotStats.DamageReceived); case "Damage Dealt : Total": return(wotStats.DamageDealt); case "Damage Dealt : Average": return(wotStats.AverageDamageDealtPerBattle); case "Damage Taken : Average": return(wotStats.AverageDamageReceivedPerBattle); case "Efficiency": return(wotStats.RatingEff); case "Battle Rating": return(wotStats.RatingBR); case "WN7": return(wotStats.RatingWN7); case "WN8": return(wotStats.RatingWN8); case "Win Ratio": return(wotStats.Victory_Ratio * 100); case "Experience : Total": return(wotStats.Experience); case "Experience : Average": return(wotStats.AverageExperiencePerBattle); case "Kill Ratio": return(wotStats.Kills / wotStats.BattlesCount); case "Kill/Death Ratio": return(wotStats.Kills / (wotStats.BattlesCount - wotStats.Survived)); default: return(0); } }
private static double GetTankStatValue(string tankID, string StatName, WOTStats wotStats) { int countryID = int.Parse(tankID.Split('_')[0]); int tempTankID = int.Parse(tankID.Split('_')[1]); switch (StatName) { case "Damage Taken : Total": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.Data.DamageReceived)); case "Damage Dealt : Total": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.Data.DamageDealt)); case "Efficiency": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.RatingEff)); case "Battle Rating": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.RatingBR)); case "WN7": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.RatingWN7)); case "WN8": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.RatingWN8)); case "Win Ratio": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.Data.VictoryPercentage)); case "Experience : Total": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.Data.Xp)); case "Damage Dealt : Average": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.Data.AverageDamageDealt)); case "Damage Taken : Average": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.Data.AverageDamageReceived)); case "Experience : Average": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.Data.AverageXP)); case "Kill Ratio": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.Data.KillperBattle)); case "Kill/Death Ratio": return(wotStats.tanks.Where(x => x.CountryID == countryID && x.TankID == tempTankID).Sum(y => y.Data.KillperDeaths)); default: return(0); } }
private string TankTypeStats(WOTStats stats, WOTStats prevStats, WOTStatsDelta delta) { using (TankTypeDescription tankTypes = new TankTypeDescription(_message)) { string html = @"<table class=o width=100%> <thead> </thead> <tbody> <tr> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_VEHICLECLASS", "DE", "Vehicle Class") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_BATTLES", "DE", "Battles") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_VICTORIES", "DE", "Victories") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DEFEATS", "DE", "Defeats") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DRAWS", "DE", "Draws") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_LASTPLAY", "DE", "Last Played") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_KILLS", "DE", "Kills") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DMGCAUSED", "DE", "Damage Dealt") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DMGASSRADIO", "DE", "Damage Assisted Radio") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DMGASSTRACK", "DE", "Damage Assisted Track") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DMGREC", "DE", "Damage Received") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("STR_WN7_Caption", "DE", "WN7") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> </tr>"; foreach (KeyValuePair<string, string> tankType in tankTypes) { double tier = 0; for (int i = 1; i <= 10; i++) { double var = (from x in stats.tanks where x.Tier == i && x.TankClass == tankType.Key select x.Data.BattlesCount).Sum() * i; tier += var; } double frags = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.Frags).Sum(); double victories = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.Victories).Sum(); double defeats = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.Defeats).Sum(); double draws = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.Draws).Sum(); double damage = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.DamageDealt).Sum(); double damageAssistedRadio = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.DamageAssistedRadio).Sum(); double damageAssistedTrack = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.DamageAssistedTracks).Sum(); double damageReceived = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.DamageReceived).Sum(); double spotted = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.Spotted).Sum(); double defence = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.DefencePoints).Sum(); double capture = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.CapturePoints).Sum(); double battles = (from x in stats.tanks where x.TankClass == tankType.Key select x.Data.BattlesCount).Sum(); //double efficiency = (frags * (350.0 - (Math.Round(tier / battles, 2)) * 20.0) + damage * (0.2 + 1.5 / (Math.Round(tier / battles, 2))) + 200.0 * spotted + 150.0 * defence + 150.0 * capture) / battles; //double efficiency = ((damage / battles) * (10 / (Math.Round(tier / battles, 2) + 2)) * (0.23 + 2 * Math.Round(tier / battles, 2) / 100)) + ((frags / battles) * 250) + ((spotted / battles) * 150) + ((Math.Log((capture / battles) + 1, 1.732)) * 150) + ((defence / battles) * 150); RatingStructure ratingStructs = new RatingStructure(); ratingStructs.countryID =0; ratingStructs.tankID = 0; ratingStructs.tier = tier; ratingStructs.globalTier = tier; ratingStructs.singleTank = false; ratingStructs.battlesCount = Convert.ToInt32(battles); ratingStructs.battlesCount8_8 = 0; ratingStructs.capturePoints = capture; ratingStructs.defencePoints = defence; ratingStructs.damageAssistedRadio = damageAssistedRadio; ratingStructs.damageAssistedTracks = damageAssistedTrack; ratingStructs.damageDealt = damage; ratingStructs.frags = frags; ratingStructs.spotted = spotted; ratingStructs.wins=victories; ratingStructs.gWinRate = ratingStructs.winRate; double efficiency = WOTStatistics.Core.Ratings.GetRatingWN7(ratingStructs).Value; //ScriptWrapper.GetEFFValue(battles, damage, Math.Round(tier / battles, 2), frags, spotted, capture, defence, (victories / battles) * 100, true, stats.AverageTier, stats.AverageDefencePoints, stats.BattlesCount, damageAssistedRadio, damageAssistedTrack); //double delTier = 0; //for (int i = 1; i <= 10; i++) //{ //double delVar = (from x in delta.tanks // where x.Tier == i && x.TankClass == tankType.Key // select x.Data.BattlesCount).Sum() * i; //delTier += delVar; //} //double delFrags = (from x in delta.tanks // where x.TankClass == tankType.Key // select x.Data.Frags).Sum(); //double delDamage = (from x in delta.tanks // where x.TankClass == tankType.Key // select x.Data.DamageDealt).Sum(); //double delSpotted = (from x in delta.tanks // where x.TankClass == tankType.Key // select x.Data.Spotted).Sum(); //double delDefence = (from x in delta.tanks // where x.TankClass == tankType.Key // select x.Data.DefencePoints).Sum(); //double delCapture = (from x in delta.tanks // where x.TankClass == tankType.Key // select x.Data.CapturePoints).Sum(); //double delBattles = (from x in delta.tanks // where x.TankClass == tankType.Key // select x.Data.BattlesCount).Sum(); double prevTier = 0; for (int i = 1; i <= 10; i++) { double prevVar = (from x in prevStats.tanks where x.Tier == i && x.TankClass == tankType.Key select x.Data.BattlesCount).Sum() * i; prevTier += prevVar; } double prevFrags = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.Frags).Sum(); double prevVictories = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.Victories).Sum(); double prevDefeats = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.Defeats).Sum(); double prevDraws = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.Draws).Sum(); double prevDamage = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.DamageDealt).Sum(); double prevDamageAssistedRadio = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.DamageAssistedRadio).Sum(); double prevDamageAssistedTrack = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.DamageAssistedTracks).Sum(); double prevDamageReceived = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.DamageReceived).Sum(); double prevSpotted = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.Spotted).Sum(); double prevDefence = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.DefencePoints).Sum(); double prevCapture = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.CapturePoints).Sum(); double prevBattles = (from x in prevStats.tanks where x.TankClass == tankType.Key select x.Data.BattlesCount).Sum(); // double delEfficiency = ((frags - delFrags) * (350.0 - (Math.Round((tier - delTier) / (battles - delBattles), 2)) * 20.0) + (damage - delDamage) * (0.2 + 1.5 / (Math.Round((tier - delTier) / (battles - delBattles), 2))) + 200.0 * (spotted - delSpotted) + 150.0 * (defence - delDefence) + 150.0 * (capture - delCapture)) / (battles - delBattles); //double delEfficiency = ((prevDamage / prevBattles) * (10 / (Math.Round(prevTier / prevBattles, 2) + 2)) * (0.23 + 2 * Math.Round(prevTier / prevBattles, 2) / 100)) + ((prevFrags / prevBattles) * 250) + ((prevSpotted / prevBattles) * 150) + ((Math.Log((prevCapture / prevBattles) + 1, 1.732)) * 150) + ((prevDefence / prevBattles) * 150); //EffCalcProperties f = new EffCalcProperties(DateTime.Now) { battles = 1, winRate = 50 }; ratingStructs.countryID = 0; ratingStructs.tankID = 0; ratingStructs.tier = prevTier; ratingStructs.globalTier = prevTier; ratingStructs.singleTank = false; ratingStructs.battlesCount = Convert.ToInt32(prevBattles); ratingStructs.battlesCount8_8 = 0; ratingStructs.capturePoints = prevCapture; ratingStructs.defencePoints = prevDefence; ratingStructs.damageAssistedRadio = prevDamageAssistedRadio; ratingStructs.damageAssistedTracks = prevDamageAssistedTrack; ratingStructs.damageDealt = prevDamage; ratingStructs.frags = prevFrags; ratingStructs.spotted = prevSpotted; ratingStructs.wins= prevVictories; ratingStructs.gWinRate = ratingStructs.winRate; double prevEfficiency = WOTStatistics.Core.Ratings.GetRatingWN7(ratingStructs).Value; //double prevEfficiency = -356; //ScriptWrapper.GetEFFValue(prevBattles, prevDamage, Math.Round(prevTier / prevBattles, 2), prevFrags, prevSpotted, prevCapture, prevDefence, (prevVictories / prevBattles) * 100, true, prevStats.AverageTier, prevStats.AverageDefencePoints, stats.BattlesCount, prevDamageAssistedRadio, prevDamageAssistedTrack); html += @" <tr> <td class='td-1' align=leff>" + tankType.Value + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(battles, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(battles - prevBattles, "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(victories, 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(victories - prevVictories, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round((victories / battles * 100) - (prevVictories / prevBattles * 100), 2), "%", 2) + ")</span>" + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(defeats, 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(defeats - prevDefeats, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round((defeats / battles * 100) - (prevDefeats / prevBattles * 100), 2), "%", 2, true) + ")</span>" + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(draws, 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(draws - prevDraws, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round((draws / battles * 100) - (prevDraws / prevBattles * 100), 2), "%", 2, true) + ")</span>" + "</td>"; try { html += @"<td class='td-1' align=right>" + stats.tanks.Where(x => x.TankClass == tankType.Key).Max(y => y.Updated_Friendly).ToString(UserSettings.DateFormat + (UserSettings.TimeStamp ? " " + UserSettings.TimeFormat : "")) + "</td>"; } catch { html += @"<td class='td-1' align=right> </td>"; } html += @" <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(frags, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(frags - prevFrags, 2), "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(damage, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(damage - prevDamage, 2), "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(damageAssistedRadio, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(damageAssistedRadio - prevDamageAssistedTrack, 2), "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(damageAssistedRadio, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(damageAssistedTrack - prevDamageAssistedTrack, 2), "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(damageReceived, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(damageReceived - prevDamageReceived, 2), "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(Math.Round(efficiency, 2), 2) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(efficiency, 2) - Math.Round(prevEfficiency, 2), "", 2) + @"</td> </tr>"; } html += @"</tbody> </table>"; return html; } }
private string OverallResults(WOTStats stats, WOTStatsDelta delta) { string html = @"<table class=o width=100%> <thead> </thead> <tbody> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_BATTLESPART", "DE", "Battles Participated:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.BattlesCount, 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(Math.Round((double)delta.BattlesCount, 2), 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_VICTORIES", "DE", "Victories:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.Victories, 0) + @" <span style='white-space: nowrap;'>(" + WOTHelper.FormatNumberToString(Math.Round(stats.Victory_Percentage, 2), 2) + "%)</span>" + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(delta.TotalVictories, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round(delta.WinPercentage, 2), "%", 2) + @")</span></td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_DEFEATS", "DE", "Defeats:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.Losses, 0) + @" <span style='white-space: nowrap;'>(" + WOTHelper.FormatNumberToString(Math.Round(stats.Losses_Percentage, 2), 2) + "%)</span>" + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(delta.TotalLosses, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round(delta.LossPercentage, 2), "%", 2, true) + @")</span></td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_DRAWS", "DE", "Draws:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.Draws, 0) + @" <span style='white-space: nowrap;'>(" + WOTHelper.FormatNumberToString(Math.Round(stats.Draws_Percentage, 2), 2) + "%)</span>" + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(delta.TotalDraws, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round(delta.DrawPercentage, 2), "%", 2, true) + @")</span></td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_SURVIVAL", "DE", "Survival:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.Survived, 0) + @" <span style='white-space: nowrap;'>(" + WOTHelper.FormatNumberToString(Math.Round(stats.Survived_Percentage, 2), 2) + "%)</span>" + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(delta.Survived, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round(delta.Survived_Percentage, 2), "%", 2) + @")</span></td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_TOTALBT", "DE", "Total Battle Time:") + @"</td> <td class='td-1' align=right>" + FormatBattleTime(TotalBattleTime(stats)) + @"</td> <td class='td-1' align=right>" + FormatBattleTime(TotalBattleTimeDelta(delta)) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_AVGBT", "DE", "Average Battle Time:") + @"</td> <td class='td-1' align=right>" + FormatBattleTime(AverageBattleTime(stats)) + @"</td> <td/> </tr> <!-- tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_TOTALMILEAGE", "DE", "Total Mileage") + @"</td> <td class='td-1' align=right>" + FormatBattleTime(AverageBattleTime(stats)) + @"</td> <td/> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_AVGMILEAGE", "DE", "Average Mileage") + @"</td> <td class='td-1' align=right>" + FormatBattleTime(AverageBattleTime(stats)) + @"</td> <td/> </tr --> </tbody> </table>"; return html; }
private string CountryStats(WOTStats stats, WOTStats prevStats, WOTStatsDelta delta) { CountryDescriptions countries = new CountryDescriptions(_message); string html = @"<table class=o width=100%> <thead> </thead> <tbody> <tr> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_COUNTRY", "DE", "Country") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_BATTLES", "DE", "Battles") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_VICTORIES", "DE", "Victories") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DEFEATS", "DE", "Defeats") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DRAWS", "DE", "Draws") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_LASTPLAY", "DE", "Last Played") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_KILLS", "DE", "Kills") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DMGCAUSED", "DE", "Damage Caused") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_CONT_DMGREC", "DE", "Damage Received") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("STR_WN7_Caption", "DE", "WN7") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> </tr>"; foreach (KeyValuePair<int, string> country in countries) { double tier = 0; for (int i = 1; i <= 10; i++) { double var = (from x in stats.tanks where x.Tier == i && x.CountryID == country.Key select x.Data.BattlesCount).Sum() * i; tier += var; } double frags = (from x in stats.tanks where x.CountryID == country.Key select x.Data.Frags).Sum(); double victories = (from x in stats.tanks where x.CountryID == country.Key select x.Data.Victories).Sum(); double defeats = (from x in stats.tanks where x.CountryID == country.Key select x.Data.Defeats).Sum(); double draws = (from x in stats.tanks where x.CountryID == country.Key select x.Data.Draws).Sum(); double damage = (from x in stats.tanks where x.CountryID == country.Key select x.Data.DamageDealt).Sum(); double damageAssistedRadio = (from x in stats.tanks where x.CountryID == country.Key select x.Data.DamageAssistedRadio).Sum(); double damageAssistedTrack = (from x in stats.tanks where x.CountryID == country.Key select x.Data.DamageAssistedTracks).Sum(); double damageReceived = (from x in stats.tanks where x.CountryID == country.Key select x.Data.DamageReceived).Sum(); double spotted = (from x in stats.tanks where x.CountryID == country.Key select x.Data.Spotted).Sum(); double defence = (from x in stats.tanks where x.CountryID == country.Key select x.Data.DefencePoints).Sum(); double capture = (from x in stats.tanks where x.CountryID == country.Key select x.Data.CapturePoints).Sum(); double battles = (from x in stats.tanks where x.CountryID == country.Key select x.Data.BattlesCount).Sum(); //double efficiency = (frags * (350.0 - (Math.Round(tier / battles, 2)) * 20.0) + damage * (0.2 + 1.5 / (Math.Round(tier / battles, 2))) + 200.0 * spotted + 150.0 * defence + 150.0 * capture) / battles; //double efficiency = ((damage / battles) * (10 / (Math.Round(tier / battles, 2) + 2)) * (0.23 + 2 * Math.Round(tier / battles, 2) / 100)) + ((frags / battles) * 250) + ((spotted / battles) * 150) + ((Math.Log((capture / battles) + 1, 1.732)) * 150) + ((defence / battles) * 150); RatingStructure ratingStruct = new RatingStructure(); ratingStruct.WN8ExpectedTankList = WN8ExpectedTankList; ratingStruct.countryID = -1; ratingStruct.tankID = -1; ratingStruct.tier = tier; ratingStruct.globalTier = tier; ratingStruct.singleTank = true; ratingStruct.battlesCount = Convert.ToInt32(battles); ratingStruct.battlesCount8_8 = 0; ratingStruct.capturePoints = capture; ratingStruct.defencePoints = defence; ratingStruct.damageAssistedRadio = 0; ratingStruct.damageAssistedTracks = 0; ratingStruct.damageDealt = damage; ratingStruct.frags = frags; ratingStruct.spotted = spotted; ratingStruct.wins = victories; ratingStruct.gWinRate = ratingStruct.winRate; double RatingWN7 = WOTStatistics.Core.Ratings.GetRatingWN7(ratingStruct).Value; //double delTier = 0; //for (int i = 1; i <= 10; i++) //{ //double delVar = (from x in delta.tanks // where x.Tier == i && x.CountryID == country.Key // select x.Data.BattlesCount).Sum() * i; //delTier += delVar; //} //double delFrags = (from x in delta.tanks // where x.CountryID == country.Key // select x.Data.Frags).Sum(); //double delDamage = (from x in delta.tanks // where x.CountryID == country.Key // select x.Data.DamageDealt).Sum(); //double delSpotted = (from x in delta.tanks // where x.CountryID == country.Key // select x.Data.Spotted).Sum(); //double delDefence = (from x in delta.tanks // where x.CountryID == country.Key // select x.Data.DefencePoints).Sum(); //double delCapture = (from x in delta.tanks // where x.CountryID == country.Key // select x.Data.CapturePoints).Sum(); //double delBattles = (from x in delta.tanks // where x.CountryID == country.Key // select x.Data.BattlesCount).Sum(); double prevTier = 0; for (int i = 1; i <= 10; i++) { double prevVar = (from x in prevStats.tanks where x.Tier == i && x.CountryID == country.Key select x.Data.BattlesCount).Sum() * i; prevTier += prevVar; } double prevFrags = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.Frags).Sum(); double prevVictories = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.Victories).Sum(); double prevDefeats = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.Defeats).Sum(); double prevDraws = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.Draws).Sum(); double prevDamage = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.DamageDealt).Sum(); double prevDamageAssistedRadio = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.DamageAssistedRadio).Sum(); double prevDamageAssistedTrack = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.DamageAssistedTracks).Sum(); double prevDamageReceived = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.DamageReceived).Sum(); double prevSpotted = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.Spotted).Sum(); double prevDefence = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.DefencePoints).Sum(); double prevCapture = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.CapturePoints).Sum(); double prevBattles = (from x in prevStats.tanks where x.CountryID == country.Key select x.Data.BattlesCount).Sum(); // double delEfficiency = ((frags - delFrags) * (350.0 - (Math.Round((tier - delTier) / (battles - delBattles), 2)) * 20.0) + (damage - delDamage) * (0.2 + 1.5 / (Math.Round((tier - delTier) / (battles - delBattles), 2))) + 200.0 * (spotted - delSpotted) + 150.0 * (defence - delDefence) + 150.0 * (capture - delCapture)) / (battles - delBattles); //double delEfficiency = ((prevDamage / prevBattles) * (10 / (Math.Round(prevTier / prevBattles, 2) + 2)) * (0.23 + 2 * Math.Round(prevTier / prevBattles, 2) / 100)) + ((prevFrags / prevBattles) * 250) + ((prevSpotted / prevBattles) * 150) + ((Math.Log((prevCapture / prevBattles) + 1, 1.732)) * 150) + ((prevDefence / prevBattles) * 150); ratingStruct = new RatingStructure(); ratingStruct.WN8ExpectedTankList = WN8ExpectedTankList; ratingStruct.countryID = -1; ratingStruct.tankID = -1; ratingStruct.tier = tier; ratingStruct.globalTier = tier; ratingStruct.singleTank = true; ratingStruct.battlesCount = Convert.ToInt32(prevBattles); ratingStruct.battlesCount8_8 = 0; ratingStruct.capturePoints = prevCapture; ratingStruct.defencePoints = prevDefence; ratingStruct.damageAssistedRadio = 0; ratingStruct.damageAssistedTracks = 0; ratingStruct.damageDealt = prevDamage; ratingStruct.frags = prevFrags; ratingStruct.spotted = prevSpotted; ratingStruct.wins = prevVictories; ratingStruct.gWinRate = ratingStruct.winRate; double prevRatingWN7 = WOTStatistics.Core.Ratings.GetRatingWN7(ratingStruct).Value; html += @" <tr> <td class='" + CountryFlag(country.Key) + @" td-armory-icon'> <div class='wrapper'> <span class='MiddleCenter'><a class='b-gray-text'>" + country.Value + @"</a></span> </div> </td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(battles, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(battles - prevBattles, "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(victories, 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(victories - prevVictories, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round((victories / battles * 100) - (prevVictories / prevBattles * 100), 2), "%", 2) + ")</span>" + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(defeats, 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(defeats - prevDefeats, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round((defeats / battles * 100) - (prevDefeats / prevBattles * 100), 2), "%", 2, true) + ")</span>" + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(draws, 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(draws - prevDraws, 0) + @" <span style='white-space: nowrap;'>(" + GetDelta(Math.Round((draws / battles * 100) - (prevDraws / prevBattles * 100), 2), "%", 2, true) + ")</span>" + "</td>"; try { html += @"<td class='td-1' align=right>" + stats.tanks.Where(x => x.CountryID == country.Key).Max(y => y.Updated_Friendly).ToString(UserSettings.DateFormat + (UserSettings.TimeStamp ? " " + UserSettings.TimeFormat : "")) + "</td>"; } catch { html += @"<td class='td-1' align=right> </td>"; } html += @" <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(frags, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(frags - prevFrags, 2), "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(damage, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(damage - prevDamage, 2), "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(damageReceived, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(damageReceived - prevDamageReceived, 2), "", 0) + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(Math.Round(RatingWN7, 2), 2) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(RatingWN7, 2) - Math.Round(prevRatingWN7, 2), "", 2) + @"</td> </tr>"; } html += @"</tbody> </table>"; return html; }
private string BattlePerformance(WOTStats stats, WOTStatsDelta delta) { string html = @"<table class=o width=100%> <thead> </thead> <tbody> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_KILLS", "DE", "Kills:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.Destroyed, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.Destroyed, 2), "", 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_KILLRATIO", "DE", "Kill Ratio:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(((double)stats.Destroyed / (double)stats.BattlesCount), 2) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.Destroyed / (double)stats.BattlesCount, 2), "", 2) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_DETECTED", "DE", "Detected:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.Detected, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.Detected, 2), "", 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_HITRATIO", "DE", "Hit Ratio:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(Math.Round(stats.HitRatio, 2), 2) + "%" + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.HitRatio, 2), "%", 2) + @"</td> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_CAPPOINTS", "DE", "Capture Points:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.CapturePoints, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.CapturePoints, 2), "", 0) + @"</td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_DEFPOINTS", "DE", "Defense Points:") + @"</td> <td class='td-1' align=right>" + WOTHelper.FormatNumberToString(stats.DefencePoints, 0) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.DefencePoints, 2), "", 0) + @"</td> </tr> <!-- tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_EFFICIENCY", "DE", "Eff") + @"</td> <td class='td-1' align=right>" + EfficiencyDescription(stats.OverallRatingEff) + " - " + WOTHelper.FormatNumberToString(Math.Round(stats.OverallRatingEff, 2), 2) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.OverallRatingEff, 2), "", 2) + @"</td> </tr --> <!-- tr> <td class='td-1' >" + Translations.TranslationGet("HTML_CONT_BATTLERATING", "DE", "Battle Rating") + @"</td> <td class='td-1' align=right>" + EfficiencyDescription(stats.OverallRatingBR) + " - " + WOTHelper.FormatNumberToString(Math.Round(stats.OverallRatingBR, 2), 2) + @"</td> <td class='td-1' align=right>" + GetDelta(Math.Round(delta.OverallRatingBR, 2), "", 2) + @"</td> </tr --> <tr> <td class='td-1' >" + Translations.TranslationGet("STR_WN7_Caption", "DE", "WN7") + @"</td> <td class='td-1' align=right>" + WN7ColorScaleDescription(stats.OverallRatingWN7) + " - " + WOTHelper.FormatNumberToString(Math.Round(stats.OverallRatingWN7, 2), 2) + @"</td> <td class='td-1' align=right> </td> </tr> <tr> <td class='td-1' >" + Translations.TranslationGet("STR_WN8_Caption", "DE", "WN8") + @"</td> <td class='td-1' align=right>" + WN8ColorScaleDescription(stats.OverallRatingWN8) + " - " + WOTHelper.FormatNumberToString(Math.Round(stats.OverallRatingWN8, 2), 2) + @"</td> <td class='td-1' align=right> </td> </tr> </tbody> </table>"; //" + GetDelta(delta.OverallRatingWN7, "", 2) + @" return html; }
void CompareItemB_LinkClicked(object sender, NavBarLinkEventArgs e) { WOTCompare wotCompare; _currentStatsFile.TryGetValue(dockPanel4.Text.Replace("_", "*"), out wotCompare); WOTStats ws = wotCompare.WOTCurrent; _compareStatB = ws; _compareTankIDB = e.Link.ItemName; if (_compareStatA != null) _browser.DocumentText = new WOTHtml(_message).CompareHTML(dockPanel3.Text, _compareTankIDA, _compareStatA, dockPanel4.Text, e.Link.ItemName, ws); }
private void barRatingSystem_EditValueChanged(object sender, EventArgs e) { try { splashScreenManagerWaitForm.ShowWaitForm(); } catch { } //UserSettings.RatingSystem = barRatingSystem.EditValue.ToString(); DossierManager dm; dictPlayers.TryGetValue(_currentPlayer.Replace("_", "*"), out dm); dm.RefreshDossier(); if (_currentPage == "Compare") { WOTCompare wotA; _currentStatsFile.TryGetValue(_currentPlayer.Replace("_", "*"), out wotA); _compareStatA = wotA.WOTCurrent; WOTCompare wotB; _currentStatsFile.TryGetValue(_currentComparePlayer, out wotB); _compareStatB = wotB.WOTCurrent; FillCompare(wotA.WOTCurrent, wotB.WOTCurrent); try { if (_compareStatA != null) _browser.DocumentText = new WOTHtml(_message).CompareHTML(dockPanel3.Text, _compareTankIDA, _compareStatA, dockPanel4.Text, _compareTankIDB, wotB.WOTCurrent); } catch { try { NavBarGroup groupA = navBarControl3.ActiveGroup; groupA.ItemLinks[0].PerformClick(); } catch { } } try { if (_compareStatB != null) _browser.DocumentText = new WOTHtml(_message).CompareHTML(dockPanel3.Text, _compareTankIDA, wotA.WOTCurrent, dockPanel4.Text, _compareTankIDB, _compareStatB); } catch { try { NavBarGroup groupB = navBarControl4.ActiveGroup; groupB.ItemLinks[0].PerformClick(); } catch { } } } try { if (splashScreenManagerWaitForm.IsSplashFormVisible) splashScreenManagerWaitForm.CloseWaitForm(); } catch { } }
private void FillListView(WOTStats ws) { navBarControl2.Items.Clear(); navBarControl2.Groups.Clear(); NavBarGroup group = null; NavBarItem groupItem = null; foreach (Tank tank in ws.tanks.OrderBy(y => y.CountryID).ThenByDescending(x => x.Tier)) { try { if (!tankimage.Images.ContainsKey(String.Format("{0}_{1}", tank.CountryID, tank.TankID))) tankimage.Images.Add(String.Format("{0}_{1}", tank.CountryID, tank.TankID), Image.FromFile(String.Format(@"{0}", WOTHelper.GetImagePath(tank.CountryID + "_" + tank.TankID + "_Large.png")))); if (!tankimage.Images.ContainsKey(String.Format("{0}", tank.CountryID))) tankimage.Images.Add(String.Format("{0}", tank.CountryID), Image.FromFile(String.Format(@"{0}\Images\Countries\{1}.png", WOTHelper.GetEXEPath(), tank.CountryID))); } catch { } if (group == null) { group = new NavBarGroup(tank.Country_Description); group.Name = "group_" + tank.CountryID; if (tankimage.Images[String.Format("{0}", tank.CountryID)] != null) group.SmallImage = tankimage.Images[String.Format("{0}", tank.CountryID)]; navBarControl2.Groups.Add(group); } if (group.Name != "group_" + tank.CountryID) { group = new NavBarGroup(tank.Country_Description); group.Name = "group_" + tank.CountryID; group.SmallImage = tankimage.Images[String.Format("{0}", tank.CountryID)]; navBarControl2.Groups.Add(group); groupItem = new NavBarItem(tank.Tank_Description); groupItem.Name = String.Format("{0}_{1}", tank.CountryID, tank.TankID); if (tankimage.Images[String.Format("{0}_{1}", tank.CountryID, tank.TankID)] != null) groupItem.SmallImage = tankimage.Images[String.Format("{0}_{1}", tank.CountryID, tank.TankID)]; group.ItemLinks.Add(groupItem); } else { groupItem = new NavBarItem(tank.Tank_Description); groupItem.Name = String.Format("{0}_{1}", tank.CountryID, tank.TankID); if (tankimage.Images[String.Format("{0}_{1}", tank.CountryID, tank.TankID)] != null) groupItem.SmallImage = tankimage.Images[String.Format("{0}_{1}", tank.CountryID, tank.TankID)]; group.ItemLinks.Add(groupItem); } groupItem.LinkClicked += groupItem_LinkClicked; } }
private void FillCompare(WOTStats wsA, WOTStats wsB) { navBarControl3.Items.Clear(); navBarControl3.Groups.Clear(); navBarControl4.Items.Clear(); navBarControl4.Groups.Clear(); tankimage.ColorDepth = ColorDepth.Depth32Bit; tankimage.ImageSize = new Size(50, 24); NavBarGroup group = null; NavBarItem groupItem = null; foreach (Tank tank in wsA.tanks.OrderBy(y => y.CountryID).ThenByDescending(x => x.Tier)) { try { if (!tankimage.Images.ContainsKey(String.Format("{0}_{1}", tank.CountryID, tank.TankID))) tankimage.Images.Add(String.Format("{0}_{1}", tank.CountryID, tank.TankID), Image.FromFile(String.Format(@"{0}", WOTHelper.GetImagePath(tank.CountryID + "_" + tank.TankID + "_Large.png")))); if (!tankimage.Images.ContainsKey(String.Format("{0}", tank.CountryID))) tankimage.Images.Add(String.Format("{0}", tank.CountryID), Image.FromFile(String.Format(@"{0}\Images\Countries\{1}.png", WOTHelper.GetEXEPath(), tank.CountryID))); } catch { } if (group == null) { group = new NavBarGroup(tank.Country_Description); group.Name = "group_" + tank.CountryID; if (tankimage.Images[String.Format("{0}", tank.CountryID)] != null) group.SmallImage = tankimage.Images[String.Format("{0}", tank.CountryID)]; navBarControl3.Groups.Add(group); } if (group.Name != "group_" + tank.CountryID) { group = new NavBarGroup(tank.Country_Description); group.Name = "group_" + tank.CountryID; group.SmallImage = tankimage.Images[String.Format("{0}", tank.CountryID)]; navBarControl3.Groups.Add(group); groupItem = new NavBarItem(tank.Tank_Description); groupItem.Name = String.Format("{0}_{1}", tank.CountryID, tank.TankID); if (tankimage.Images[String.Format("{0}_{1}", tank.CountryID, tank.TankID)] != null) groupItem.SmallImage = tankimage.Images[String.Format("{0}_{1}", tank.CountryID, tank.TankID)]; group.ItemLinks.Add(groupItem); } else { groupItem = new NavBarItem(tank.Tank_Description); groupItem.Name = String.Format("{0}_{1}", tank.CountryID, tank.TankID); if (tankimage.Images[String.Format("{0}_{1}", tank.CountryID, tank.TankID)] != null) groupItem.SmallImage = tankimage.Images[String.Format("{0}_{1}", tank.CountryID, tank.TankID)]; group.ItemLinks.Add(groupItem); } groupItem.LinkClicked += CompareItemA_LinkClicked; } group = null; groupItem = null; foreach (Tank tankB in wsB.tanks.OrderBy(y => y.CountryID).ThenByDescending(x => x.Tier)) { try { if (!tankimage.Images.ContainsKey(String.Format("{0}_{1}", tankB.CountryID, tankB.TankID))) tankimage.Images.Add(String.Format("{0}_{1}", tankB.CountryID, tankB.TankID), Image.FromFile(String.Format(@"{0}\Images\Tanks\{1}_{2}_Large.png", WOTHelper.GetEXEPath(), tankB.CountryID, tankB.TankID))); if (!tankimage.Images.ContainsKey(String.Format("{0}", tankB.CountryID))) tankimage.Images.Add(String.Format("{0}", tankB.CountryID), Image.FromFile(String.Format(@"{0}\Images\Countries\{1}.png", WOTHelper.GetEXEPath(), tankB.CountryID))); } catch { } if (group == null) { group = new NavBarGroup(tankB.Country_Description); group.Name = "group_" + tankB.CountryID; if (tankimage.Images[String.Format("{0}", tankB.CountryID)] != null) group.SmallImage = tankimage.Images[String.Format("{0}", tankB.CountryID)]; navBarControl4.Groups.Add(group); } if (group.Name != "group_" + tankB.CountryID) { group = new NavBarGroup(tankB.Country_Description); group.Name = "group_" + tankB.CountryID; group.SmallImage = tankimage.Images[String.Format("{0}", tankB.CountryID)]; navBarControl4.Groups.Add(group); groupItem = new NavBarItem(tankB.Tank_Description); groupItem.Name = String.Format("{0}_{1}", tankB.CountryID, tankB.TankID); if (tankimage.Images[String.Format("{0}_{1}", tankB.CountryID, tankB.TankID)] != null) groupItem.SmallImage = tankimage.Images[String.Format("{0}_{1}", tankB.CountryID, tankB.TankID)]; group.ItemLinks.Add(groupItem); } else { groupItem = new NavBarItem(tankB.Tank_Description); groupItem.Name = String.Format("{0}_{1}", tankB.CountryID, tankB.TankID); if (tankimage.Images[String.Format("{0}_{1}", tankB.CountryID, tankB.TankID)] != null) groupItem.SmallImage = tankimage.Images[String.Format("{0}_{1}", tankB.CountryID, tankB.TankID)]; group.ItemLinks.Add(groupItem); } groupItem.LinkClicked += new NavBarLinkEventHandler(CompareItemB_LinkClicked); } }
private static void OverallChart(string playerName, string chartID, GraphFields gFields, ChartControl chartControl) { chartControl.Series.Clear(); chartControl.Titles.Clear(); Player player = new PlayerListing(new MessageQueue()).GetPlayer(playerName); DossierManager dossierManager = new DossierManager(player.PlayerID, player.WatchFile, player.Monitor, new MessageQueue(), null); DateTime endFile = dossierManager.FormatTextDate(dossierManager.GetCurrentPlayerFile().ToString()); DateTime startFile = dossierManager.FormatTextDate(dossierManager.GetCurrentPlayerFile().ToString()).AddDays((gFields.Period + 1) * -1); Dictionary <Int32, Int32> files = dossierManager.GetAllFilesForPlayer(); Dictionary <Int32, Int32> selectedFiles = (from d in files where dossierManager.FormatTextDate(d.Key.ToString()) >= startFile && dossierManager.FormatTextDate(d.Key.ToString()) <= endFile select d).ToDictionary(x => x.Key, x => x.Value); Series series1 = new Series(gFields.Caption, ViewType.Line); series1.Label.Font = new System.Drawing.Font("Tahoma", float.Parse(UserSettings.HTMLCellFont), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); foreach (KeyValuePair <Int32, Int32> file in selectedFiles.OrderBy(x => x.Key)) { Dossier dossierFile = new Dossier(file.Value, player.PlayerID, new MessageQueue()); WOTStats dossierStats = dossierFile.GetStats(); series1.Points.Add(new SeriesPoint(dossierManager.FormatTextDate(file.Key.ToString()), Math.Round(GetStatValue(gFields.DataField, dossierStats), 2))); } // Add the series to the chart. chartControl.Series.Add(series1); // Set the numerical argument scale types for the series, // as it is qualitative, by default. series1.ArgumentScaleType = ScaleType.DateTime; series1.Label.ResolveOverlappingMode = ResolveOverlappingMode.HideOverlapped; // Access the view-type-specific options of the series. ((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Circle; ((LineSeriesView)series1.View).LineStyle.DashStyle = DashStyle.Solid; // Access the type-specific options of the diagram. ((XYDiagram)chartControl.Diagram).EnableAxisXZooming = true; // Hide the legend (if necessary). chartControl.Legend.Visible = false; // Add a title to the chart (if necessary). chartControl.Titles.Add(new ChartTitle()); chartControl.Titles[0].Font = new System.Drawing.Font("Tahoma", float.Parse(UserSettings.HTMLHeaderFont), System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); chartControl.Titles[0].Text = gFields.Caption; chartControl.Titles.Add(new ChartTitle()); chartControl.Titles[1].Font = new System.Drawing.Font("Tahoma", float.Parse(UserSettings.HTMLHeaderFont) - 1.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); chartControl.Titles[1].Text = startFile.ToString(UserSettings.DateFormat) + " to " + endFile.ToString(UserSettings.DateFormat); chartControl.Titles.Add(new ChartTitle()); chartControl.Titles[2].Font = new System.Drawing.Font("Tahoma", float.Parse(UserSettings.HTMLHeaderFont) - 3, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); chartControl.Titles[2].Text = gFields.DataField; XYDiagram diagram = (XYDiagram)chartControl.Diagram; switch (gFields.Period) { case 7: diagram.AxisX.DateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Day; diagram.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Day; break; case 14: diagram.AxisX.DateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Day; diagram.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Day; break; case 92: case 184: case 365: diagram.AxisX.DateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Month; diagram.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Day; diagram.AxisX.Label.TextPattern = "MMM yy"; break; default: diagram.AxisX.DateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Week; diagram.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Day; break; } diagram.AxisX.Label.Font = new System.Drawing.Font("Tahoma", float.Parse(UserSettings.HTMLCellFont), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); diagram.AxisY.Label.Font = new System.Drawing.Font("Tahoma", float.Parse(UserSettings.HTMLCellFont), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(0))); diagram.AxisY.WholeRange.AlwaysShowZeroLevel = false; diagram.AxisY.NumericScaleOptions.AutoGrid = true; diagram.AxisY.DateTimeScaleOptions.AutoGrid = true; }
private string TierEfficiency(WOTStats stats, WOTStats prevStats) { TankTypeDescription tankTypes = new TankTypeDescription(_message); string html = @"<table class=o width=100%> <thead> </thead> <tbody> <tr> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_TIER", "DE", "Tier") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_TANKCOUNT", "DE", "Tank Count") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_BATTLES", "DE", "Battles") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("STR_WN7_Caption", "DE", "WN7") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_DELTA", "DE", "Delta") + @"</strong></th> </tr>"; for (int i = 1; i <= 10; i++) { double frags = (from x in stats.tanks where x.Tier == i select x.Data.Frags).Sum(); double victories = (from x in stats.tanks where x.Tier == i select x.Data.Victories).Sum(); double victoriesPercentage = (from x in stats.tanks where x.Tier == i select x.Data.VictoryPercentage).Sum(); double damage = (from x in stats.tanks where x.Tier == i select x.Data.DamageDealt).Sum(); double damageAssistedRadio = (from x in stats.tanks where x.Tier == i select x.Data.DamageAssistedRadio).Sum(); double damageAssistedTrack = (from x in stats.tanks where x.Tier == i select x.Data.DamageAssistedTracks).Sum(); double spotted = (from x in stats.tanks where x.Tier == i select x.Data.Spotted).Sum(); double defence = (from x in stats.tanks where x.Tier == i select x.Data.DefencePoints).Sum(); double capture = (from x in stats.tanks where x.Tier == i select x.Data.CapturePoints).Sum(); double battles = (from x in stats.tanks where x.Tier == i select x.Data.BattlesCount).Sum(); double tanksPerTier = stats.tanks.Where(x => x.Tier == i).Count(); RatingStructure ratingStructs = new RatingStructure(); ratingStructs.countryID = 0; ratingStructs.tankID = 0; ratingStructs.tier = stats.AverageTier; ratingStructs.globalTier = ratingStructs.tier; ratingStructs.singleTank = false; ratingStructs.battlesCount = Convert.ToInt32(battles); ratingStructs.battlesCount8_8 = 0; ratingStructs.capturePoints = capture; ratingStructs.defencePoints = defence; ratingStructs.damageAssistedRadio = damageAssistedRadio; ratingStructs.damageAssistedTracks = damageAssistedTrack; ratingStructs.damageDealt = damage; ratingStructs.frags = frags; ratingStructs.spotted = spotted; ratingStructs.wins=victories; ratingStructs.gWinRate = ratingStructs.winRate; double efficiency = WOTStatistics.Core.Ratings.GetRatingWN7(ratingStructs).Value; //double efficiency = -64323; //ScriptWrapper.GetEFFValue(battles, damage, i, frags, spotted, capture, defence, victoriesPercentage, true, stats.AverageTier, stats.AverageDefencePoints, stats.BattlesCount, damageAssistedRadio, damageAssistedTrack); double prevFrags = (from x in prevStats.tanks where x.Tier == i select x.Data.Frags).Sum(); double prevVictories = (from x in prevStats.tanks where x.Tier == i select x.Data.Victories).Sum(); double prevVictoriesPercentage = (from x in prevStats.tanks where x.Tier == i select x.Data.VictoryPercentage).Sum(); double prevDamage = (from x in prevStats.tanks where x.Tier == i select x.Data.DamageDealt).Sum(); double prevDamageAssistedRadio = (from x in prevStats.tanks where x.Tier == i select x.Data.DamageAssistedRadio).Sum(); double prevDamageAssistedTrack = (from x in prevStats.tanks where x.Tier == i select x.Data.DamageAssistedTracks).Sum(); double prevSpotted = (from x in prevStats.tanks where x.Tier == i select x.Data.Spotted).Sum(); double prevDefence = (from x in prevStats.tanks where x.Tier == i select x.Data.DefencePoints).Sum(); double prevCapture = (from x in prevStats.tanks where x.Tier == i select x.Data.CapturePoints).Sum(); double prevBattles = (from x in prevStats.tanks where x.Tier == i select x.Data.BattlesCount).Sum(); //double prevEfficiency = -6343; //ScriptWrapper.GetEFFValue(prevBattles, prevDamage, i, prevFrags, prevSpotted, prevCapture, prevDefence, prevVictoriesPercentage, true, stats.AverageTier, stats.AverageDefencePoints, stats.BattlesCount, prevDamageAssistedRadio, prevDamageAssistedTrack); //double prevEfficiency = ScriptWrapper.GetEFFValue(prevBattles, prevDamage, i, prevFrags, prevSpotted, prevCapture, prevDefence, (prevVictories / prevBattles) * 100, true, stats.AverageTier, stats.AverageDefencePoints, stats.BattlesCount); ratingStructs.countryID = 0; ratingStructs.tankID = 0; ratingStructs.tier = stats.AverageTier; ratingStructs.globalTier = ratingStructs.tier; ratingStructs.singleTank = false; ratingStructs.battlesCount = Convert.ToInt32(prevBattles); ratingStructs.battlesCount8_8 = 0; ratingStructs.capturePoints = prevCapture; ratingStructs.defencePoints = prevDefence; ratingStructs.damageAssistedRadio = prevDamageAssistedRadio; ratingStructs.damageAssistedTracks = prevDamageAssistedTrack; ratingStructs.damageDealt = prevDamage; ratingStructs.frags = prevFrags; ratingStructs.spotted = prevSpotted; ratingStructs.wins=prevVictories; ratingStructs.gWinRate = ratingStructs.winRate; double prevEfficiency = WOTStatistics.Core.Ratings.GetRatingWN7(ratingStructs).Value; //var answer = stats.tanks.Where(x => x.Tier == i).Select(x => new { tankid = x.CountryID + "_" + x.TankID, Tier = x.Tier, TotalEff = x.Data.BattlesCount * x.Efficiency }).Sum(y => y.TotalEff) / stats.tanks.Where(x => x.Tier == i).Sum(y => y.Data.BattlesCount); //var answer = stats.tanks.Where(x => x.Tier == i).Select(x => new { tankid = x.CountryID + "_" + x.TankID, Tier = x.Tier, TotalEff = x.Data.BattlesCount * x.Efficiency }).Sum(y => y.TotalEff); //var answer = stats.tanks.Where(x => x.Tier == i).Select(x => new { tankid = x.CountryID + "_" + x.TankID, Tier = x.Tier, TotalEff = x.Data.BattlesCount * x.Efficiency }); //var answer = stats.tanks.Where(x => x.Tier == i).Select(x => new { tankid = x.CountryID + "_" + x.TankID, Tier = x.Tier, Battles = x.Data.BattlesCount, Eff = x.Efficiency }); //<td class='td-1' align=right width=auto>" + WOTHelper.FormatNumberToString((stats.tanks.Where(x => x.Tier == i).Sum(y => y.Efficiency) / stats.tanks.Where(x => x.Tier == i).Count()), 2) + @"</td> //<td class='td-1' align=right width=auto>" + GetDelta((delta.tanks.Where(x => x.Tier == i).Sum(y => y.Efficiency) / delta.tanks.Where(x => x.Tier == i).Count()), "", 2) + @"</td> html += @"<tr> <td class='td-1' align=center width=auto>" + GetRoman(i) + @"</td> <td class='td-1' align=center width=auto>" + WOTHelper.FormatNumberToString(tanksPerTier, 0) + @"</td> <td class='td-1' align=center width=auto>" + WOTHelper.FormatNumberToString(battles, 0) + @"</td> <td class='td-1' align=center width=auto>" + GetDelta(battles - prevBattles, "", 0) + @"</td> <td class='td-1' align=right width=auto>" + WOTHelper.FormatNumberToString(efficiency, 2) + @"</td> <td class='td-1' align=right width=auto>" + GetDelta(efficiency - prevEfficiency, "", 2) + @"</td> </tr>"; } // html += @"</tbody> </table>"; return html; }
private string Top05Experience(WOTStats stats) { string html = @"<table class=o width=100%> <thead> </thead> <tbody> <tr> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_RANK", "DE", "Rank") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_TIER", "DE", "Tier") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_HEAD_TANK", "DE", "Tank") + @"</strong></th> <th align=center><strong>" + Translations.TranslationGet("HTML_EXPER", "DE", "Experience") + @"</strong></th> </tr>"; int place = 1; foreach (Tank tank in stats.tanks.OrderByDescending(x => x.Data.MaxXp).Take(UserSettings.TopXTake)) { html += @"<tr> <td align=center>" + place + @"</td> <td class='" + CountryFlag(tank.CountryID) + @" td-armory-icon'> <div class='wrapper'> <span class='level'> <a class='b-gray-text'>" + GetRoman(tank.Tier) + @"</a> </span> <a>" + TankImage(tank.CountryID, tank.TankID, tank.Tank_Description) + @"</a> </div> </td> <td><a href='h' onclick='window.external.Redirect(""" + tank.CountryID + "_" + tank.TankID + @""")'>" + tank.Tank_Description + @"</a></td> <td align=right>" + WOTHelper.FormatNumberToString(Math.Round((double)tank.Data.MaxXp, 2), 0) + @"</td> </tr>"; place++; } html += @"</tbody> </table>"; return html; }
private void CreateRecentBattle(MemoryTables mt) { //try //{ Dossier fileB = new Dossier(GetCurrentPlayerFile(), _playerName, _messages); WOTStats stats = fileB.GetStats(); double avgTier = stats.AverageTier; double vics = stats.Victory_Percentage; double defPoints = stats.AverageDefencePoints; List <string> cur = (from x in mt.GetTable("File_Total").AsEnumerable() select x["foLastBattleTime"].ToString()).ToList(); List <string> saved; DataTable currentRecord; DataTable Kills; using (IDBHelpers db = new DBHelpers(WOTHelper.GetDBPath(_playerName), false)) { saved = (from x in db.GetDataTable("select foLastBattleTime from File_Total").AsEnumerable() select x["foLastBattleTime"].ToString()).ToList(); currentRecord = db.GetDataTable(@"select case when T2.bpBattleMode = 7 then 7 else 15 end as bpBattleMode, T1.cmID, T1.cmCountryID, T1.cmTankID, T1.cmUpdated, (T2.bpBattleCount) bpBattleCount, (t2.bpSpotted) bpSpotted, (t2.bpHits) bpHits, (t2.bpMaxFrags) bpMaxFrags, (t2.bpMaxXP) bpMaxXP, (t2.bpWins) bpWins, (t2.bpCapturePoints) bpCapturePoints, (t2.bpLosses) bpLosses, (t2.bpSurvivedBattles) bpSurvivedBattles, min(T4.foBattleLifeTime) foBattleLifeTime, (t2.bpDefencePoints) bpDefencePoints, min(t4.foLastBattleTime) foLastBattleTime, (t2.bpDamageReceived) bpDamageReceived, (t2.bpShots) bpShots, (t2.bpWinAndSurvive) bpWinAndSurvive, (t2.bpFrags8P) bpFrags8P, (t2.bpXP) bpXP, (t2.bpDamageDealt) bpDamageDealt, (t2.bpDamageAssistedRadio) bpDamageAssistedRadio, (t2.bpDamageAssistedTracks) bpDamageAssistedTracks, (t2.bpMileage) bpMileage, (t2.bpRatingEffWeight)/(t2.bpBattleCount) bpRatingEff, (t2.bpRatingBRWeight)/(t2.bpBattleCount) bpRatingBR, (t2.bpRatingWN7Weight)/(t2.bpBattleCount) bpRatingWN7, (t2.bpRatingWN8Weight)/(t2.bpBattleCount) bpRatingWN8, (t2.bpFrags) bpFrags, t4.foTreesCut, t3.faMarkOfMastery from File_TankDetails T1 inner join File_Battles T2 on T1.cmID = T2.bpParentID inner join File_Achievements T3 on T1.cmID = T3.faParentID inner join File_Total T4 on T1.cmID = T4.foParentID where cmFileID = " + GetCurrentPlayerFileKey() + " group by T2.bpBattleMode, T1.cmID, T1.cmCountryID, T1.cmTankID, T1.cmUpdated, t4.foTreesCut, t3.faMarkOfMastery"); Kills = db.GetDataTable(String.Format(@"select fgParentID, fgCountryID, fgTankID, sum(fgValue) kills from File_TankDetails inner join File_FragList on cmID = fgParentID where cmFileID = {0} group by fgParentID, fgCountryID, fgTankID", GetCurrentPlayerFileKey())); } List <string> diff = cur.Except(saved).ToList(); RecentBattles lb = new RecentBattles(GetPlayerName, _messages); var battleCheck = from x in mt.GetTable("File_TankDetails").AsEnumerable() join y in mt.GetTable("File_Battles").AsEnumerable() on x.GetSafeInt("cmID") equals y.GetSafeInt("bpParentID") join z in mt.GetTable("File_Total").AsEnumerable() on x.GetSafeInt("cmID") equals z.GetSafeInt("foParentID") join d in diff on z["foLastBattleTime"].ToString() equals d group y by new { ID = x.GetSafeInt("cmID"), countryID = x.GetSafeInt("cmCountryID"), tankID = x.GetSafeInt("cmTankID"), battleTime = z["foLastBattleTime"].ToString(), BattleMode = y["bpBattleMode"] } into tank select new { ID = tank.Key.ID, CountryID = tank.Key.countryID, TankID = tank.Key.tankID, BattleTime = tank.Key.battleTime, BattleCount = tank.Sum(y => y.GetSafeInt("bpBattleCount")), Hits = tank.Sum(y => y.GetSafeInt("bpHits")), Shots = tank.Sum(y => y.GetSafeInt("bpShots")), Victory = tank.Sum(y => y.GetSafeInt("bpWins")), Losses = tank.Sum(y => y.GetSafeInt("bpLosses")), Survived = tank.Sum(y => y.GetSafeInt("bpSurvivedBattles")), DefencePoints = tank.Sum(y => y.GetSafeInt("bpDefencePoints")), CapturePoints = tank.Sum(y => y.GetSafeInt("bpCapturePoints")), Spotted = tank.Sum(y => y.GetSafeInt("bpSpotted")), DamageDealt = tank.Sum(y => y.GetSafeInt("bpDamageDealt")), DamageAssistedRadio = tank.Sum(y => y.GetSafeInt("bpDamageAssistedRadio")), DamageAssistedTracks = tank.Sum(y => y.GetSafeInt("bpDamageAssistedTracks")), DamageReceived = tank.Sum(y => y.GetSafeInt("bpDamageReceived")), Kills = tank.Sum(y => y.GetSafeInt("bpFrags")), Mileage = tank.Sum(y => y.GetSafeInt("bpMileage")), RatingEff = tank.Sum(y => y.GetSafeInt("bpRatingEff")), RatingBR = tank.Sum(y => y.GetSafeInt("bpRatingBR")), RatingWN7 = tank.Sum(y => y.GetSafeInt("bpRatingWN7")), RatingWN8 = tank.Sum(y => y.GetSafeInt("bpRatingWN8")), XPReceived = tank.Sum(y => y.GetSafeInt("bpXP")), BattleMode = int.Parse(tank.Key.BattleMode.ToString()) }; if (currentRecord.Rows.Count > 0) { foreach (var item in battleCheck) { //WOTHelper.AddToLog("BM 1: " + item.BattleMode); DataRow dr = currentRecord.Select(String.Format("cmCountryID = {0} and cmTankID = {1} and bpBattleMode = {2}", item.CountryID, item.TankID, item.BattleMode)).DefaultIfEmpty(null).FirstOrDefault(); if (dr != null) { if (item.BattleCount - dr.GetSafeInt("bpBattleCount") > 0) { int i = 0; List <string> newKills = new List <string>(); foreach (DataRow killRow in mt.GetTable("File_FragList").Select("fgParentID = " + item.ID)) { DataRow dr_oldKills = Kills.Select(String.Format(@"fgParentID = {0} and fgCountryID = {1} and fgTankID = {2}", dr.GetSafeInt("cmID"), killRow.GetSafeInt("fgCountryID"), killRow.GetSafeInt("fgTankID"))).FirstOrDefault(); if (dr_oldKills != null) { if (killRow.GetSafeInt("fgValue") > dr_oldKills.GetSafeInt("kills")) { newKills.Add(String.Format("{0}:{1}_{2}", i, killRow.GetSafeInt("fgCountryID"), killRow.GetSafeInt("fgTankID"))); i++; } } else { newKills.Add(String.Format("{0}:{1}_{2}", i, killRow.GetSafeInt("fgCountryID"), killRow.GetSafeInt("fgTankID"))); i++; } } int vic = 0; if (item.Victory - dr.GetSafeInt("bpWins") > 0) { vic = 0; } else if (item.Losses - dr.GetSafeInt("bpLosses") > 0) { vic = 1; } else { vic = 2; } //WOTHelper.AddToLog("ASD: " + dr.GetSafeInt("bpRatingWN8")); lb.Add(int.Parse(item.BattleTime), new RecentBattle() { CountryID = item.CountryID, TankID = item.TankID, Battles = item.BattleCount - dr.GetSafeInt("bpBattleCount"), BattleTime = int.Parse(item.BattleTime), Hits = item.Hits - dr.GetSafeInt("bpHits"), Shot = item.Shots - dr.GetSafeInt("bpShots"), Victory = vic, Survived = item.Survived - dr.GetSafeInt("bpSurvivedBattles"), DefencePoints = item.DefencePoints - dr.GetSafeInt("bpDefencePoints"), CapturePoints = item.CapturePoints - dr.GetSafeInt("bpCapturePoints"), Spotted = item.Spotted - dr.GetSafeInt("bpSpotted"), DamageDealt = item.DamageDealt - dr.GetSafeInt("bpDamageDealt"), DamageAssistedRadio = item.DamageAssistedRadio - dr.GetSafeInt("bpDamageAssistedRadio"), DamageAssistedTracks = item.DamageAssistedTracks - dr.GetSafeInt("bpDamageAssistedTracks"), DamageReceived = item.DamageReceived - dr.GetSafeInt("bpDamageReceived"), Kills = item.Kills - dr.GetSafeInt("bpFrags"), Mileage = item.Mileage - dr.GetSafeInt("bpMileage"), RatingEff = item.RatingEff - dr.GetSafeInt("bpRatingEff"), RatingBR = item.RatingBR - dr.GetSafeInt("bpRatingBR"), RatingWN7 = item.RatingWN7 - dr.GetSafeInt("bpRatingWN7"), RatingWN8 = item.RatingWN8 - dr.GetSafeInt("bpRatingWN8"), XPReceived = item.XPReceived - dr.GetSafeInt("bpXP"), OriginalBattleCount = item.BattleCount - dr.GetSafeInt("bpBattleCount"), FragList = string.Join(";", newKills.ToArray().Take(15)), GlobalAvgTier = avgTier, GlobalWinPercentage = vics, GlobalAvgDefencePoints = defPoints, BattleMode = item.BattleMode, DBEntry = false }); lb.Save(); } } else { int i = 0; List <string> newKills = new List <string>(); WOTHelper.AddToLog("BM 2: " + item.BattleMode); dr = currentRecord.Select(String.Format("cmCountryID = {0} and cmTankID = {1} and bpBattleMode <> '{2}'", item.CountryID, item.TankID, item.BattleMode)).DefaultIfEmpty(null).FirstOrDefault(); if (dr != null) { foreach (DataRow killRow in mt.GetTable("File_FragList").Select("fgParentID = " + item.ID)) { DataRow dr_oldKills = Kills.Select(String.Format(@"fgParentID = {0} and fgCountryID = {1} and fgTankID = {2}", dr.GetSafeInt("cmID"), killRow.GetSafeInt("fgCountryID"), killRow.GetSafeInt("fgTankID"))).FirstOrDefault(); if (dr_oldKills != null) { if (killRow.GetSafeInt("fgValue") > dr_oldKills.GetSafeInt("kills")) { newKills.Add(String.Format("{0}:{1}_{2}", i, killRow.GetSafeInt("fgCountryID"), killRow.GetSafeInt("fgTankID"))); i++; } } else { newKills.Add(String.Format("{0}:{1}_{2}", i, killRow.GetSafeInt("fgCountryID"), killRow.GetSafeInt("fgTankID"))); i++; } } } else { foreach (DataRow killRow in mt.GetTable("File_FragList").Select("fgParentID = " + item.ID)) { newKills.Add(String.Format("{0}:{1}_{2}", i, killRow.GetSafeInt("fgCountryID"), killRow.GetSafeInt("fgTankID"))); i++; } } int vic = 0; if (item.Victory - 0 > 0) { vic = 0; } else if (item.Losses - 0 > 0) { vic = 1; } else { vic = 2; } lb.Add(int.Parse(item.BattleTime), new RecentBattle() { CountryID = item.CountryID, TankID = item.TankID, Battles = item.BattleCount, BattleTime = int.Parse(item.BattleTime), Hits = item.Hits, Shot = item.Shots, Victory = vic, Survived = item.Survived, DefencePoints = item.DefencePoints, CapturePoints = item.CapturePoints, Spotted = item.Spotted, DamageDealt = item.DamageDealt, DamageAssistedRadio = item.DamageAssistedRadio, DamageAssistedTracks = item.DamageAssistedTracks, DamageReceived = item.DamageReceived, Kills = item.Kills, Mileage = item.Mileage, XPReceived = item.XPReceived, OriginalBattleCount = item.BattleCount, FragList = string.Join(";", newKills.ToArray().Take(15)), GlobalAvgTier = avgTier, GlobalWinPercentage = vics, GlobalAvgDefencePoints = defPoints, BattleMode = item.BattleMode, RatingEff = item.RatingEff, RatingBR = item.RatingBR, RatingWN7 = item.RatingWN7, RatingWN8 = item.RatingWN8, DBEntry = false }); lb.Save(); } } } //} //catch (Exception ex) //{ // _messages.Add(String.Format("Error : Cannot create last battle ({0}) - {1}", GetPlayerName, ex.Message)); //} }