private static RatingStorage GetRatingWN7Calc(RatingStructure ratingStruct) { ratingStruct.RatingType = "WN7"; RatingStorage Storage = new RatingStorage(ratingStruct); if (ratingStruct.battlesCount == 0) { return Storage; } Storage.rDAMAGE = WN7_Damage(ratingStruct); Storage.rFRAG = WN7_Frags(ratingStruct); Storage.rSPOT = WN7_Spotted(ratingStruct); Storage.rDEF = WN7_Defence(ratingStruct) ; Storage.rWIN = WN7_WinRate(ratingStruct); Storage.rTIERMALUS = WN7_TierMalus(ratingStruct); //if (ratingStruct.countryID == 0 & ratingStruct.tankID == 32) //{ // WOTHelper.AddToLog("WN7 : " + Storage.Value); // WOTHelper.AddToLog("TIER: " + ratingStruct.tier); // WOTHelper.AddToLog("WRAT: " + ratingStruct.winRate); // WOTHelper.AddToLog("TDMG: " + Storage.rDAMAGE); // WOTHelper.AddToLog("TFRG: " + Storage.rFRAG); // WOTHelper.AddToLog("TSPT: " + Storage.rSPOT); // WOTHelper.AddToLog("TDEF: " + Storage.rDEF); // WOTHelper.AddToLog("TWIN: " + Storage.rWIN); // WOTHelper.AddToLog("TMAL: " + Storage.rTIERMALUS); //} return Storage; }
private static double BR_DamageAssistedTrack(RatingStructure ratingStruct) { double result = (((ratingStruct.damageAssistedTracks / (ratingStruct.battlesCount - ratingStruct.battlesCount8_8)) / 2)) * (0.2 + 1.5 / ratingStruct.tier); //if (typeof(result)) //{ // result = 0; //} ////WOTHelper.AddToLog("BR AssTrack " + result); return result; }
private static double BR_Captured(RatingStructure ratingStruct) { double result = 15.0 * (ratingStruct.AvgCapturePoints); //WOTHelper.AddToLog("BR Capture " + result); return result; }
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 static string WN7_Tooltip(RatingStructure ratingStruct) { double damageFormula = WN7_Damage(ratingStruct); double killFormula = WN7_Frags(ratingStruct); double spottedFormula = WN7_Spotted(ratingStruct); double winRateFormula = WN7_WinRate(ratingStruct); double defenceFormula = WN7_Defence(ratingStruct); double tierMalusFormula = WN7_TierMalus(ratingStruct); string total = FormatNumberToString(damageFormula + killFormula + spottedFormula + winRateFormula + defenceFormula + tierMalusFormula, 2); double[] valueArray = new double[] { damageFormula, killFormula, spottedFormula, winRateFormula, defenceFormula, tierMalusFormula }; double maxValue = valueArray.Max(); double iTotal = maxValue; List<string> i = new List<string>(); string[] s = new string[7] { "", "Value", "WN7", "0", "0", "1", "H" }; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("STR_DAMAGE", "de", "Damage"); s[1] = FormatNumberToString(ratingStruct.damageDealt, 0); s[2] = FormatNumberToString(damageFormula, 2); s[3] = FormatNumberToString(Math.Abs(((damageFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((damageFormula / iTotal)) * 100), 2); s[5] = "0"; s[6] = "D"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("HTML_CONT_KILLS", "de", "Kills"); s[1] = FormatNumberToString(ratingStruct.frags, 0); s[2] = FormatNumberToString(killFormula, 2); s[3] = FormatNumberToString(Math.Abs(((killFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((killFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("HTML_CONT_DETECTED", "de", "Spotted"); s[1] = FormatNumberToString(ratingStruct.spotted, 0); s[2] = FormatNumberToString(spottedFormula, 2); s[3] = FormatNumberToString(Math.Abs(((spottedFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((spottedFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("STR_DEFENCE", "de", "Defence"); s[1] = FormatNumberToString(ratingStruct.defencePoints, 0); s[2] = FormatNumberToString(defenceFormula, 2); s[3] = FormatNumberToString(Math.Abs(((defenceFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((defenceFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("STR_WINRATE", "de", "Win Percentage"); // TODO: Added by BadButton 2014-06-25 - Added method for getting correct win rate used for calculation, to be chacked by Phalynx s[1] = FormatNumberToString(WN7_WinRateTooltipPrefix(ratingStruct), 0); s[2] = FormatNumberToString(winRateFormula, 2); s[3] = FormatNumberToString(Math.Abs(((winRateFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((winRateFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("STR_TIERMALUS", "de", "Tier Malus"); s[1] = FormatNumberToString(ratingStruct.tier, 0); s[2] = FormatNumberToString(tierMalusFormula, 2); s[3] = FormatNumberToString(Math.Abs(((tierMalusFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((tierMalusFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = "Total"; s[1] = ""; s[2] = total; s[3] = "0"; s[4] = "0"; s[5] = "1"; s[6] = "T"; i.Add(string.Join("|", s)); //RatingStorage rr = new RatingStorage(ratingStruct); return string.Join(";", i); }
private static double WN7_Spotted(RatingStructure ratingStruct) { return (ratingStruct.AvgSpotted) * 125 * (GetMinValue(ratingStruct.tier, 3)) / 3; }
private static double WN7_Defence(RatingStructure ratingStruct) { return GetMinValue(ratingStruct.AvgDefencePoints, 2.2) * 100; }
// TODO: Added by BadButton 2014-06-25, new method to return correct winrate factor used for wn7 caculation private static double WN7_WinRateTooltipPrefix(RatingStructure ratingStruct) { double winRate = ratingStruct.gWinRate; if (ratingStruct.battlesCount == 1) winRate = 50; return winRate; }
public void Fill(dynamic file, int fileName) { if (file == null) { WOTHelper.AddToLog("File cannot be read: " + fileName); return; } using (DataTable tabFile = ds.Tables["Files"]) { DataRow row = tabFile.NewRow(); row["fiID"] = fileName; row["fiResult"] = GetSafeValue(file.header.result); row["fiUserName"] = GetSafeValue(file.header.username); row["fiTankCount"] = GetSafeValue(file.header.tankcount); row["fiParser"] = GetSafeValue(file.header.parser); row["fiServer"] = GetSafeValue(file.header.server); row["fiMessage"] = GetSafeValue(file.header.message); row["fiDate"] = GetSafeValue(file.header.date); row["fiParserVersion"] = GetSafeValue(file.header.parserversion); tabFile.Rows.Add(row); } int tempTankID = 0; using (IDBHelpers db = new DBHelpers(_dbPath, false)) { string id = db.ExecuteScalar("select max(cmID) + 1 nextID from File_TankDetails"); if (!string.IsNullOrEmpty(id)) tempTankID = int.Parse(id); else tempTankID = 1; } foreach (var item in file.tanks) { foreach (var i in item) { if (ObjectExists(i, "common")) { using (DataTable tab = ds.Tables["File_TankDetails"]) { DataRow dr = tab.NewRow(); dr["cmID"] = tempTankID; dr["cmFileID"] = fileName; dr["cmCreationTimeR"] = i.common.creationTimeR; dr["cmFrags"] = i.common.frags; dr["cmTankTitle"] = i.common.tanktitle; dr["cmPremium"] = i.common.premium; dr["cmUpdated"] = i.common.updated; dr["cmTier"] = i.common.tier; dr["cmUpdatedR"] = i.common.updatedR; dr["cmLastBattleTime"] = i.common.lastBattleTime; dr["cmFragsCompare"] = i.common.frags_compare; dr["cmLastBattleTimeR"] = i.common.lastBattleTimeR; dr["cmBaseVersion"] = i.common.basedonversion; dr["cmCreationTime"] = i.common.creationTime; dr["cmCompactDescription"] = i.common.compactDescr; dr["cmCountryID"] = i.common.countryid; dr["cmTankID"] = i.common.tankid; dr["cmType"] = i.common.type; tab.Rows.Add(dr); } } if (ObjectExists(i, "clan")) { using (DataTable tab = ds.Tables["File_Clan"]) { DataRow dr = tab.NewRow(); dr["clParentID"] = tempTankID; dr["clBattlesCount"] = i.clan.battlesCount; dr["clDefencePoints"] = i.clan.droppedCapturePoints; dr["clFrags"] = i.clan.frags; dr["clSpotted"] = i.clan.spotted; dr["clDamageDealt"] = i.clan.damageDealt; dr["clShots"] = i.clan.shots; dr["clWins"] = i.clan.wins; dr["clDamageReceived"] = i.clan.damageReceived; dr["clLosses"] = i.clan.losses; dr["clXP"] = i.clan.xp; dr["clSurvivedBattles"] = i.clan.survivedBattles; dr["clHits"] = i.clan.hits; dr["clCapturePoints"] = i.clan.capturePoints; tab.Rows.Add(dr); } } if (ObjectExists(i, "company")) { using (DataTable tab = ds.Tables["File_Company"]) { DataRow dr = tab.NewRow(); dr["fcParentID"] = tempTankID; dr["fcBattlesCount"] = GetSafeValue(i.company.battlesCount); dr["fcDefencePoints"] = GetSafeValue(i.company.droppedCapturePoints); dr["fcFrags"] = GetSafeValue(i.company.frags); dr["fcSpotted"] = GetSafeValue(i.company.spotted); dr["fcDamageDealt"] = GetSafeValue(i.company.damageDealt); dr["fcShots"] = GetSafeValue(i.company.shots); dr["fcWins"] = GetSafeValue(i.company.wins); dr["fcDamageReceived"] = GetSafeValue(i.company.damageReceived); dr["fcLosses"] = GetSafeValue(i.company.losses); dr["fcXP"] = GetSafeValue(i.company.xp); dr["fcSurvivedBattles"] = GetSafeValue(i.company.survivedBattles); dr["fcHits"] = GetSafeValue(i.company.hits); dr["fcCapturePoints"] = GetSafeValue(i.company.capturePoints); tab.Rows.Add(dr); } } using (DataTable tab = ds.Tables["File_Achievements"]) { DataRow dr = tab.NewRow(); dr["faParentID"] = tempTankID; dr["faAlaric"] = GetSafeValue(GetSafeValue(i.special.alaric)); dr["faArmorPiercer"] = GetSafeValue(i.special.armorPiercer); dr["faBattleHeroes"] = GetSafeValue(i.battle.battleHeroes); dr["faBeastHunter"] = GetSafeValue(i.special.beasthunter); dr["faBombardier"] = GetSafeValue(i.special.bombardier); dr["faDefender"] = GetSafeValue(i.battle.defender); dr["faDieHard"] = GetSafeValue(i.special.diehard); dr["faDieHardSeries"] = GetSafeValue(i.series.diehardSeries); dr["faEveilEye"] = GetSafeValue(i.battle.evileye); dr["faFragsBeast"] = GetSafeValue(i.tankdata.fragsBeast); dr["faFragsPatton"] = GetSafeValue(i.special.fragsPatton); dr["faFragsSinai"] = GetSafeValue(i.battle.fragsSinai); dr["faHandOfDeath"] = GetSafeValue(i.special.handOfDeath); dr["faHeroesOfRasseney"] = GetSafeValue(i.special.heroesOfRassenay); dr["faHuntsman"] = GetSafeValue(i.special.huntsman); dr["faInvader"] = GetSafeValue(i.battle.invader); dr["faInvincible"] = GetSafeValue(i.special.invincible); dr["faInvincibleSeries"] = GetSafeValue(i.series.invincibleSeries); dr["faIronman"] = GetSafeValue(i.special.ironMan); dr["faKamikaze"] = GetSafeValue(i.special.kamikaze); dr["faKillingSeries"] = GetSafeValue(i.series.killingSeries); dr["faLuckyDevil"] = GetSafeValue(i.special.luckyDevil); dr["faLumberJack"] = GetSafeValue(i.special.lumberjack); dr["faMarkOfMastery"] = GetSafeValue(i.special.markOfMastery); dr["faMaxDieHardSeries"] = GetSafeValue(i.series.maxDiehardSeries); dr["faMaxInvincibleSeries"] = GetSafeValue(i.series.maxInvincibleSeries); dr["faMaxKillingSeries"] = GetSafeValue(i.series.maxKillingSeries); dr["faMaxPiercingSeries"] = GetSafeValue(i.series.maxPiercingSeries); dr["faMaxSniperSeries"] = GetSafeValue(i.series.maxSniperSeries); dr["faMedalAbrams"] = GetSafeValue(i.major.medalAbrams); dr["faMedalBillotte"] = GetSafeValue(i.epic.medalBillotte); dr["faMedalBrothersInArms"] = GetSafeValue(i.epic.medalBrothersInArms); dr["faMedalBrunoPietro"] = GetSafeValue(i.epic.medalBrunoPietro); dr["faMedalBurda"] = GetSafeValue(i.epic.medalBurda); dr["faMedalCarius"] = GetSafeValue(i.major.medalCarius); dr["faMedalCrucialContribution"] = GetSafeValue(i.epic.medalCrucialContribution); dr["faMedalDeLanglade"] = GetSafeValue(i.epic.medalDeLanglade); dr["faMedalDumitru"] = GetSafeValue(i.epic.medalDumitru); dr["faMedalEkins"] = GetSafeValue(i.major.medalEkins); dr["faMedalFadin"] = GetSafeValue(i.epic.medalFadin); dr["faMedalHalonen"] = GetSafeValue(i.epic.medalHalonen); dr["faMedalKay"] = GetSafeValue(i.major.medalKay); dr["faMedalKnispel"] = GetSafeValue(i.major.medalKnispel); dr["faMedalKolobanov"] = GetSafeValue(i.epic.medalKolobanov); dr["faMedalLafayettePool"] = GetSafeValue(i.epic.medalLafayettePool); dr["faMedalLavrinenko"] = GetSafeValue(i.major.medalLavrinenko); dr["faMedalLeClerc"] = GetSafeValue(i.major.medalLeClerc); dr["faMedalLehvaslaiho"] = GetSafeValue(i.epic.medalLehvaslaiho); dr["faMedalNikolas"] = GetSafeValue(i.epic.medalNikolas); dr["faMedalOrlik"] = GetSafeValue(i.epic.medalOrlik); dr["faMedalOskin"] = GetSafeValue(i.epic.medalOskin); dr["faMedalPascucci"] = GetSafeValue(i.epic.medalPascucci); dr["faMedalPoppel"] = GetSafeValue(i.major.medalPoppel); dr["faMedalRadleyWalters"] = GetSafeValue(i.epic.medalRadleyWalters); dr["faMedalTamadaYoshio"] = GetSafeValue(i.epic.medalTamadaYoshio); dr["faMedalTarczay"] = GetSafeValue(i.epic.medalTarczay); dr["faMedalWittmann"] = GetSafeValue(i.epic.medalWittmann); dr["faMousebane"] = GetSafeValue(i.special.mousebane); dr["faPattonValley"] = GetSafeValue(i.special.pattonValley); dr["faPiercingSeries"] = GetSafeValue(i.series.piercingSeries); dr["faRaider"] = GetSafeValue(i.special.raider); dr["faScout"] = GetSafeValue(i.battle.scout); dr["faSinai"] = GetSafeValue(i.special.sinai); dr["faSniper"] = GetSafeValue(i.battle.sniper); dr["faSniperSeries"] = GetSafeValue(i.series.sniperSeries); dr["faSteelwall"] = GetSafeValue(i.battle.steelwall); dr["faSturdy"] = GetSafeValue(i.special.sturdy); dr["faSupporter"] = GetSafeValue(i.battle.supporter); dr["faTankExpertStrg"] = GetSafeValue(i.special.tankExpertStrg); dr["faTitleSniper"] = GetSafeValue(i.special.titleSniper); dr["faWarrior"] = GetSafeValue(i.battle.warrior); tab.Rows.Add(dr); } if (ObjectExists(i, "tankdata")) { using (DataTable tab = ds.Tables["File_Battles"]) { DataRow dr = tab.NewRow(); dr["bpParentID"] = tempTankID; dr["bpBattleCount"] = GetSafeValue(i.tankdata.battlesCount); dr["bpFrags8P"] = GetSafeValue(i.tankdata.frags8p); dr["bpDefencePoints"] = GetSafeValue(i.tankdata.droppedCapturePoints); dr["bpFrags"] = GetSafeValue(i.tankdata.frags); dr["bpWinAndSurvive"] = GetSafeValue(i.tankdata.winAndSurvived); dr["bpSpotted"] = GetSafeValue(i.tankdata.spotted); dr["bpDamageDealt"] = GetSafeValue(i.tankdata.damageDealt); dr["bpXPBefore8_8"] = 0; dr["bpShots"] = GetSafeValue(i.tankdata.shots); dr["bpBattlesBefore8_8"] = 0; dr["bpWins"] = GetSafeValue(i.tankdata.wins); dr["bpDamageReceived"] = GetSafeValue(i.tankdata.damageReceived); dr["bpLosses"] = GetSafeValue(i.tankdata.losses); dr["bpXP"] = GetSafeValue(i.tankdata.xp); dr["bpSurvivedBattles"] = GetSafeValue(i.tankdata.survivedBattles); dr["bpHits"] = GetSafeValue(i.tankdata.hits); dr["bpCapturePoints"] = GetSafeValue(i.tankdata.capturePoints); dr["bpDamageAssistedTracks"] = 0; dr["bpHEHitsReceived"] = 0; dr["bpPierced"] = 0; dr["bpShotsReceived"] = 0; dr["bpNoDamageShotsReceived"] = 0; dr["bpOriginalXP"] = 0; dr["bpHEHits"] = 0; dr["bpMaxXP"] = GetSafeValue(i.tankdata.maxXP); dr["bpMaxFrags"] = GetSafeValue(i.tankdata.maxFrags); dr["bpMaxDamage"] = 0; dr["bpMileage"] = 0; dr["bpBattleMode"] = 15; RatingStructure ratingStruct = new RatingStructure(); ratingStruct.WN8ExpectedTankList = WN8ExpectedTankList; ratingStruct.countryID = GetSafeValue(i.common.countryid); ratingStruct.tankID = GetSafeValue(i.common.tankid); ratingStruct.tier = GetSafeValue(i.common.tier); ratingStruct.globalTier = ratingStruct.tier; ratingStruct.singleTank = true; ratingStruct.battlesCount = GetSafeValue(i.tankdata.battlesCount); ratingStruct.battlesCount8_8 = 0; ratingStruct.capturePoints = GetSafeValue(i.tankdata.capturePoints); ratingStruct.defencePoints = GetSafeValue(i.tankdata.droppedCapturePoints); ratingStruct.damageAssistedRadio = 0; ratingStruct.damageAssistedTracks = 0; ratingStruct.damageDealt = GetSafeValue(i.tankdata.damageDealt); ratingStruct.frags = GetSafeValue(i.tankdata.frags); ratingStruct.spotted = GetSafeValue(i.tankdata.spotted); ratingStruct.wins = GetSafeValue(i.tankdata.wins); //ratingStruct.globalWinRate = (GetSafeValue(i.tankdata.wins) / GetSafeValue(i.tankdata.battlesCount)) * 100; //WOTStatistics.Core.Ratings.printRatingStruct(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage Eff = Ratings.GetRatingEff(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage BR = Ratings.GetRatingBR(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage WN7 = Ratings.GetRatingWN7(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage WN8 = Ratings.GetRatingWN8(ratingStruct); dr["bpRatingEff"] = Eff.Value; dr["bpRatingEffWeight"] = Eff.Weight; dr["bpRatingBR"] = BR.Value; dr["bpRatingBRWeight"] = BR.Weight; dr["bpRatingWN7"] = WN7.Value; dr["bpRatingWN7Weight"] = WN7.Weight; dr["bpRatingWN8"] = WN8.Value; dr["bpRatingWN8Weight"] = WN8.Weight; dr["bpRatingVersion"] = WOTStatistics.Core.UserSettings.RatingVersion; tab.Rows.Add(dr); } } using (DataTable tab = ds.Tables["File_Total"]) { DataRow dr = tab.NewRow(); dr["foParentID"] = tempTankID; dr["foCreationTime"] = i.common.creationTime; dr["foMileage"] = Convert.ToInt32(i.common.mileage); dr["foTreesCut"] = i.tankdata.treesCut; dr["foLastBattleTime"] = i.tankdata.lastBattleTime; dr["foBattleLifeTime"] = i.tankdata.battleLifeTime; tab.Rows.Add(dr); } if (ObjectExists(i, "kills")) { foreach (var k in i.kills) { using (DataTable tab = ds.Tables["File_FragList"]) { DataRow dr = tab.NewRow(); dr["fgParentID"] = tempTankID; dr["fgCountryID"] = k[0]; dr["fgTankID"] = k[1]; dr["fgValue"] = k[2]; dr["fgTankDescription"] = k[3]; tab.Rows.Add(dr); } } } } tempTankID++; } foreach (var item in file.tanks_v2) { foreach (var i in item) { if (ObjectExists(i, "common")) { using (DataTable tab = ds.Tables["File_TankDetails"]) { DataRow dr = tab.NewRow(); dr["cmID"] = tempTankID; dr["cmFileID"] = fileName; if (ObjectExists(i, "common")) { dr["cmCreationTimeR"] = i.common.creationTimeR; dr["cmFrags"] = i.common.frags; dr["cmTankTitle"] = i.common.tanktitle; dr["cmPremium"] = i.common.premium; dr["cmUpdated"] = i.common.updated; dr["cmTier"] = i.common.tier; dr["cmUpdatedR"] = i.common.updatedR; dr["cmLastBattleTime"] = i.common.lastBattleTime; dr["cmFragsCompare"] = i.common.frags_compare; dr["cmLastBattleTimeR"] = i.common.lastBattleTimeR; dr["cmBaseVersion"] = i.common.basedonversion; dr["cmCreationTime"] = i.common.creationTime; dr["cmCompactDescription"] = i.common.compactDescr; dr["cmCountryID"] = i.common.countryid; dr["cmTankID"] = i.common.tankid; dr["cmType"] = i.common.type; dr["cmHasClan"] = i.common.has_clan; dr["cmHas7x7"] = i.common.has_7x7; dr["cmHas15x15"] = i.common.has_15x15; dr["cmHasCompany"] = i.common.has_company; } tab.Rows.Add(dr); } } if (ObjectExists(i, "historical")) { using (DataTable tab = ds.Tables["File_Historical"]) { DataRow dr = tab.NewRow(); dr["hsParentID"] = tempTankID; dr["hsBattlesCount"] = i.historical.battlesCount; dr["hsDefencePoints"] = i.historical.droppedCapturePoints; dr["hsFrags"] = i.historical.frags; dr["hsSpotted"] = i.historical.spotted; dr["hsDamageDealt"] = i.historical.damageDealt; dr["hsShots"] = i.historical.shots; dr["hsWins"] = i.historical.wins; dr["hsDamageReceived"] = i.historical.damageReceived; dr["hsLosses"] = i.historical.losses; dr["hsXP"] = i.historical.xp; dr["hsSurvivedBattles"] = i.historical.survivedBattles; dr["hsHits"] = i.historical.hits; dr["hsCapturePoints"] = i.historical.capturePoints; tab.Rows.Add(dr); } } if (ObjectExists(i, "clan")) { using (DataTable tab = ds.Tables["File_Clan"]) { DataRow dr = tab.NewRow(); dr["clParentID"] = tempTankID; dr["clBattlesCount"] = i.clan.battlesCount; dr["clDefencePoints"] = i.clan.droppedCapturePoints; dr["clFrags"] = i.clan.frags; dr["clSpotted"] = i.clan.spotted; dr["clDamageDealt"] = i.clan.damageDealt; dr["clXPBefore8_9"] = i.clan.xpBefore8_9; dr["clShots"] = i.clan.shots; dr["clBattlesCountBefore8_9"] = i.clan.battlesCountBefore8_9; dr["clWins"] = i.clan.wins; dr["clDamageReceived"] = i.clan.damageReceived; dr["clLosses"] = i.clan.losses; dr["clXP"] = i.clan.xp; dr["clSurvivedBattles"] = i.clan.survivedBattles; dr["clHits"] = i.clan.hits; dr["clCapturePoints"] = i.clan.capturePoints; tab.Rows.Add(dr); } } if (ObjectExists(i, "company")) { using (DataTable tab = ds.Tables["File_Company"]) { DataRow dr = tab.NewRow(); dr["fcParentID"] = tempTankID; dr["fcBattlesCount"] = GetSafeValue(i.company.battlesCount); dr["fcDefencePoints"] = GetSafeValue(i.company.droppedCapturePoints); dr["fcFrags"] = GetSafeValue(i.company.frags); dr["fcSpotted"] = GetSafeValue(i.company.spotted); dr["fcDamageDealt"] = GetSafeValue(i.company.damageDealt); dr["fcXPBefore8_9"] = GetSafeValue(i.company.xpBefore8_9); dr["fcShots"] = GetSafeValue(i.company.shots); dr["fcBattlesCountBefore8_9"] = GetSafeValue(i.company.battlesCountBefore8_9); dr["fcWins"] = GetSafeValue(i.company.wins); dr["fcDamageReceived"] = GetSafeValue(i.company.damageReceived); dr["fcLosses"] = GetSafeValue(i.company.losses); dr["fcXP"] = GetSafeValue(i.company.xp); dr["fcSurvivedBattles"] = GetSafeValue(i.company.survivedBattles); dr["fcHits"] = GetSafeValue(i.company.hits); dr["fcCapturePoints"] = GetSafeValue(i.company.capturePoints); tab.Rows.Add(dr); } } if (ObjectExists(i, "achievements")) { using (DataTable tab = ds.Tables["File_Achievements"]) { DataRow dr = tab.NewRow(); dr["faParentID"] = tempTankID; dr["faAlaric"] = GetSafeValue(i.achievements.alaric); dr["faArmorPiercer"] = GetSafeValue(i.achievements.armorPiercer); dr["faBattleHeroes"] = GetSafeValue(i.achievements.battleHeroes); dr["faBeastHunter"] = GetSafeValue(i.achievements.beasthunter); dr["faBombardier"] = GetSafeValue(i.achievements.bombardier); dr["faDefender"] = GetSafeValue(i.achievements.defender); dr["faDieHard"] = GetSafeValue(i.achievements.diehard); dr["faDieHardSeries"] = GetSafeValue(i.achievements.diehardSeries); dr["faEveilEye"] = GetSafeValue(i.achievements.evileye); dr["faFragsBeast"] = GetSafeValue(i.achievements.fragsBeast); dr["faFragsPatton"] = GetSafeValue(i.achievements.fragsPatton); dr["faFragsSinai"] = GetSafeValue(i.achievements.fragsSinai); dr["faHandOfDeath"] = GetSafeValue(i.achievements.handOfDeath); dr["faHeroesOfRasseney"] = GetSafeValue(i.achievements.heroesOfRassenay); dr["faHuntsman"] = GetSafeValue(i.achievements.huntsman); dr["faInvader"] = GetSafeValue(i.achievements.invader); dr["faInvincible"] = GetSafeValue(i.achievements.invincible); dr["faInvincibleSeries"] = GetSafeValue(i.achievements.invincibleSeries); dr["faIronman"] = GetSafeValue(i.achievements.ironMan); dr["faKamikaze"] = GetSafeValue(i.achievements.kamikaze); dr["faKillingSeries"] = GetSafeValue(i.achievements.killingSeries); dr["faLuckyDevil"] = GetSafeValue(i.achievements.luckyDevil); dr["faLumberJack"] = GetSafeValue(i.achievements.lumberjack); dr["faMarkOfMastery"] = GetSafeValue(i.achievements.markOfMastery); dr["faMaxDieHardSeries"] = GetSafeValue(i.achievements.maxDiehardSeries); dr["faMaxInvincibleSeries"] = GetSafeValue(i.achievements.maxInvincibleSeries); dr["faMaxKillingSeries"] = GetSafeValue(i.achievements.maxKillingSeries); dr["faMaxPiercingSeries"] = GetSafeValue(i.achievements.maxPiercingSeries); dr["faMaxSniperSeries"] = GetSafeValue(i.achievements.maxSniperSeries); dr["faMedalAbrams"] = GetSafeValue(i.achievements.medalAbrams); dr["faMedalBillotte"] = GetSafeValue(i.achievements.medalBillotte); dr["faMedalBrothersInArms"] = GetSafeValue(i.achievements.medalBrothersInArms); dr["faMedalBrunoPietro"] = GetSafeValue(i.achievements.medalBrunoPietro); dr["faMedalBurda"] = GetSafeValue(i.achievements.medalBurda); dr["faMedalCarius"] = GetSafeValue(i.achievements.medalCarius); dr["faMedalCrucialContribution"] = GetSafeValue(i.achievements.medalCrucialContribution); dr["faMedalDeLanglade"] = GetSafeValue(i.achievements.medalDeLanglade); dr["faMedalDumitru"] = GetSafeValue(i.achievements.medalDumitru); dr["faMedalEkins"] = GetSafeValue(i.achievements.medalEkins); dr["faMedalFadin"] = GetSafeValue(i.achievements.medalFadin); dr["faMedalHalonen"] = GetSafeValue(i.achievements.medalHalonen); dr["faMedalKay"] = GetSafeValue(i.achievements.medalKay); dr["faMedalKnispel"] = GetSafeValue(i.achievements.medalKnispel); dr["faMedalKolobanov"] = GetSafeValue(i.achievements.medalKolobanov); dr["faMedalLafayettePool"] = GetSafeValue(i.achievements.medalLafayettePool); dr["faMedalLavrinenko"] = GetSafeValue(i.achievements.medalLavrinenko); dr["faMedalLeClerc"] = GetSafeValue(i.achievements.medalLeClerc); dr["faMedalLehvaslaiho"] = GetSafeValue(i.achievements.medalLehvaslaiho); dr["faMedalNikolas"] = GetSafeValue(i.achievements.medalNikolas); dr["faMedalOrlik"] = GetSafeValue(i.achievements.medalOrlik); dr["faMedalOskin"] = GetSafeValue(i.achievements.medalOskin); dr["faMedalPascucci"] = GetSafeValue(i.achievements.medalPascucci); dr["faMedalPoppel"] = GetSafeValue(i.achievements.medalPoppel); dr["faMedalRadleyWalters"] = GetSafeValue(i.achievements.medalRadleyWalters); dr["faMedalTamadaYoshio"] = GetSafeValue(i.achievements.medalTamadaYoshio); dr["faMedalTarczay"] = GetSafeValue(i.achievements.medalTarczay); dr["faMedalWittmann"] = GetSafeValue(i.achievements.medalWittmann); dr["faMousebane"] = GetSafeValue(i.achievements.mousebane); dr["faPattonValley"] = GetSafeValue(i.achievements.pattonValley); dr["faPiercingSeries"] = GetSafeValue(i.achievements.piercingSeries); dr["faRaider"] = GetSafeValue(i.achievements.raider); dr["faScout"] = GetSafeValue(i.achievements.scout); dr["faSinai"] = GetSafeValue(i.achievements.sinai); dr["faSniper"] = GetSafeValue(i.achievements.sniper); dr["faSniperSeries"] = GetSafeValue(i.achievements.sniperSeries); dr["faSteelwall"] = GetSafeValue(i.achievements.steelwall); dr["faSturdy"] = GetSafeValue(i.achievements.sturdy); dr["faSupporter"] = GetSafeValue(i.achievements.supporter); dr["faTankExpertStrg"] = GetSafeValue(i.achievements.tankExpertStrg); dr["faTitleSniper"] = GetSafeValue(i.achievements.titleSniper); dr["faWarrior"] = GetSafeValue(i.achievements.warrior); tab.Rows.Add(dr); } } if (ObjectExists(i, "a15x15")) { using (DataTable tab = ds.Tables["File_Battles"]) { DataRow dr = tab.NewRow(); dr["bpParentID"] = tempTankID; dr["bpBattleCount"] = GetSafeValue(i.a15x15.battlesCount); dr["bpFrags8P"] = GetSafeValue(i.a15x15.frags8p); dr["bpDefencePoints"] = GetSafeValue(i.a15x15.droppedCapturePoints); dr["bpFrags"] = GetSafeValue(i.a15x15.frags); dr["bpWinAndSurvive"] = GetSafeValue(i.a15x15.winAndSurvived); dr["bpSpotted"] = GetSafeValue(i.a15x15.spotted); dr["bpDamageDealt"] = GetSafeValue(i.a15x15.damageDealt); dr["bpXPBefore8_8"] = GetSafeValue(i.a15x15.xpBefore8_8); dr["bpShots"] = GetSafeValue(i.a15x15.shots); dr["bpBattlesBefore8_8"] = GetSafeValue(i.a15x15.battlesCountBefore8_8); dr["bpWins"] = GetSafeValue(i.a15x15.wins); dr["bpDamageReceived"] = GetSafeValue(i.a15x15.damageReceived); dr["bpLosses"] = GetSafeValue(i.a15x15.losses); dr["bpXP"] = GetSafeValue(i.a15x15.xp); dr["bpSurvivedBattles"] = GetSafeValue(i.a15x15.survivedBattles); dr["bpHits"] = GetSafeValue(i.a15x15.hits); dr["bpCapturePoints"] = GetSafeValue(i.a15x15.capturePoints); if (ObjectExists(i, "a15x15_2")) { dr["bpDamageAssistedRadio"] = GetSafeValue(i.a15x15_2.damageAssistedRadio); dr["bpDamageAssistedTracks"] = GetSafeValue(i.a15x15_2.damageAssistedTrack); dr["bpHEHitsReceived"] = GetSafeValue(i.a15x15_2.heHitsReceived); dr["bpPierced"] = GetSafeValue(i.a15x15_2.pierced); dr["bpPiercedReceived"] = GetSafeValue(i.a15x15_2.piercedReceived); dr["bpShotsReceived"] = GetSafeValue(i.a15x15_2.shotsReceived); dr["bpNoDamageShotsReceived"] = GetSafeValue(i.a15x15_2.noDamageShotsReceived); dr["bpOriginalXP"] = GetSafeValue(i.a15x15_2.originalXP); dr["bpHEHits"] = GetSafeValue(i.a15x15_2.he_hits); } if (ObjectExists(i, "max15x15")) { dr["bpMaxXP"] = GetSafeValue(i.max15x15.maxXP); dr["bpMaxFrags"] = GetSafeValue(i.max15x15.maxFrags); dr["bpMaxDamage"] = GetSafeValue(i.max15x15.maxDamage); ; } dr["bpBattleMode"] = 15; RatingStructure ratingStruct = new RatingStructure(); ratingStruct.WN8ExpectedTankList = WN8ExpectedTankList; ratingStruct.countryID = GetSafeValue(i.common.countryid); ratingStruct.tankID = GetSafeValue(i.common.tankid); ratingStruct.tier = GetSafeValue(i.common.tier); ratingStruct.globalTier = ratingStruct.tier; ratingStruct.singleTank = true; ratingStruct.battlesCount = GetSafeValue(i.a15x15.battlesCount); ratingStruct.battlesCount8_8 = GetSafeValue(i.a15x15.battlesCountBefore8_8); ratingStruct.capturePoints = GetSafeValue(i.a15x15.capturePoints); ratingStruct.defencePoints = GetSafeValue(i.a15x15.droppedCapturePoints); ratingStruct.damageAssistedRadio = GetSafeValue(i.a15x15_2.damageAssistedRadio); ratingStruct.damageAssistedTracks = GetSafeValue(i.a15x15_2.damageAssistedTrack); ratingStruct.damageDealt = GetSafeValue(i.a15x15.damageDealt); ratingStruct.frags = GetSafeValue(i.a15x15.frags); ratingStruct.spotted = GetSafeValue(i.a15x15.spotted); ratingStruct.wins=GetSafeValue(i.a15x15.wins); ratingStruct.gWinRate = ratingStruct.winRate; WOTStatistics.Core.Ratings.RatingStorage Eff = Ratings.GetRatingEff(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage BR = Ratings.GetRatingBR(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage WN7 = Ratings.GetRatingWN7(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage WN8 = Ratings.GetRatingWN8(ratingStruct); dr["bpRatingEff"] = Eff.Value; dr["bpRatingEffWeight"] = Eff.Weight; dr["bpRatingBR"] = BR.Value; dr["bpRatingBRWeight"] = BR.Weight; dr["bpRatingWN7"] = WN7.Value; dr["bpRatingWN7Weight"] = WN7.Weight; dr["bpRatingWN8"] = WN8.Value; dr["bpRatingWN8Weight"] = WN8.Weight; dr["bpRatingVersion"] = WOTStatistics.Core.UserSettings.RatingVersion; //foreach (DataRow drt in dr) //{ //} //foreach (DataRow itemarr in dr.ItemArray) //{ // WOTHelper.AddToLog("IA " + itemarr["bpBattleMode"]); //} tab.Rows.Add(dr); } } if (ObjectExists(i, "a7x7")) { using (DataTable tab = ds.Tables["File_Battles"]) { DataRow dr = tab.NewRow(); dr["bpParentID"] = tempTankID; dr["bpBattleCount"] = GetSafeValue(i.a7x7.battlesCount); dr["bpFrags8P"] = GetSafeValue(i.a7x7.frags8p); dr["bpDefencePoints"] = GetSafeValue(i.a7x7.droppedCapturePoints); dr["bpFrags"] = GetSafeValue(i.a7x7.frags); dr["bpWinAndSurvive"] = GetSafeValue(i.a7x7.winAndSurvived); dr["bpSpotted"] = GetSafeValue(i.a7x7.spotted); dr["bpDamageDealt"] = GetSafeValue(i.a7x7.damageDealt); dr["bpXPBefore8_8"] = GetSafeValue(i.a7x7.xpBefore8_8); dr["bpShots"] = GetSafeValue(i.a7x7.shots); dr["bpBattlesBefore8_8"] = GetSafeValue(i.a7x7.battlesCountBefore8_8); dr["bpWins"] = GetSafeValue(i.a7x7.wins); dr["bpDamageReceived"] = GetSafeValue(i.a7x7.damageReceived); dr["bpLosses"] = GetSafeValue(i.a7x7.losses); dr["bpXP"] = GetSafeValue(i.a7x7.xp); dr["bpSurvivedBattles"] = GetSafeValue(i.a7x7.survivedBattles); dr["bpHits"] = GetSafeValue(i.a7x7.hits); dr["bpCapturePoints"] = GetSafeValue(i.a7x7.capturePoints); dr["bpDamageAssistedRadio"] = GetSafeValue(i.a7x7.damageAssistedRadio); dr["bpDamageAssistedTracks"] = GetSafeValue(i.a7x7.damageAssistedTrack); dr["bpHEHitsReceived"] = GetSafeValue(i.a7x7.heHitsReceived); dr["bpPierced"] = GetSafeValue(i.a7x7.pierced); dr["bpPiercedReceived"] = GetSafeValue(i.a7x7.piercedReceived); dr["bpShotsReceived"] = GetSafeValue(i.a7x7.shotsReceived); dr["bpNoDamageShotsReceived"] = GetSafeValue(i.a7x7.noDamageShotsReceived); dr["bpOriginalXP"] = GetSafeValue(i.a7x7.originalXP); dr["bpHEHits"] = GetSafeValue(i.a7x7.he_hits); if (ObjectExists(i, "max7x7")) { dr["bpMaxXP"] = GetSafeValue(i.max7x7.maxXP); dr["bpMaxFrags"] = GetSafeValue(i.max7x7.maxFrags); dr["bpMaxDamage"] = GetSafeValue(i.max7x7.maxDamage); } dr["bpBattleMode"] = 7; RatingStructure ratingStruct = new RatingStructure(); ratingStruct.WN8ExpectedTankList = WN8ExpectedTankList; ratingStruct.countryID = GetSafeValue(i.common.countryid); ratingStruct.tankID = GetSafeValue(i.common.tankid); ratingStruct.tier = GetSafeValue(i.common.tier); ratingStruct.globalTier = ratingStruct.tier; ratingStruct.singleTank = true; ratingStruct.battlesCount = GetSafeValue(i.a7x7.battlesCount); ratingStruct.battlesCount8_8 = 0; ratingStruct.capturePoints = GetSafeValue(i.a7x7.capturePoints); ratingStruct.defencePoints = GetSafeValue(i.a7x7.droppedCapturePoints); ratingStruct.damageAssistedRadio = GetSafeValue(i.a7x7.damageAssistedRadio); ratingStruct.damageAssistedTracks = GetSafeValue(i.a7x7.damageAssistedTrack); ratingStruct.damageDealt = GetSafeValue(i.a7x7.damageDealt); ratingStruct.frags = GetSafeValue(i.a7x7.frags); ratingStruct.spotted = GetSafeValue(i.a7x7.spotted); ratingStruct.wins = GetSafeValue(i.a7x7.wins); ratingStruct.gWinRate = ratingStruct.winRate; WOTStatistics.Core.Ratings.RatingStorage Eff = Ratings.GetRatingEff(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage BR = Ratings.GetRatingBR(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage WN7 = Ratings.GetRatingWN7(ratingStruct); WOTStatistics.Core.Ratings.RatingStorage WN8 = Ratings.GetRatingWN8(ratingStruct); dr["bpRatingEff"] = Eff.Value; dr["bpRatingEffWeight"] = Eff.Weight; dr["bpRatingBR"] = BR.Value; dr["bpRatingBRWeight"] = BR.Weight; dr["bpRatingWN7"] = WN7.Value; dr["bpRatingWN7Weight"] = WN7.Weight; dr["bpRatingWN8"] = WN8.Value; dr["bpRatingWN8Weight"] = WN8.Weight; dr["bpRatingVersion"] = WOTStatistics.Core.UserSettings.RatingVersion; tab.Rows.Add(dr); } } if (ObjectExists(i, "total")) { using (DataTable tab = ds.Tables["File_Total"]) { DataRow dr = tab.NewRow(); dr["foParentID"] = tempTankID; dr["foCreationTime"] = i.total.creationTime; dr["foMileage"] = Convert.ToInt32(i.total.mileage); dr["foTreesCut"] = i.total.treesCut; dr["foLastBattleTime"] = i.total.lastBattleTime; dr["foBattleLifeTime"] = i.total.battleLifeTime; tab.Rows.Add(dr); } } if (ObjectExists(i, "fragslist")) { foreach (var k in i.fragslist) { using (DataTable tab = ds.Tables["File_FragList"]) { DataRow dr = tab.NewRow(); dr["fgParentID"] = tempTankID; dr["fgCountryID"] = k[0]; dr["fgTankID"] = k[1]; dr["fgValue"] = k[2]; dr["fgTankDescription"] = k[3]; tab.Rows.Add(dr); } } } } tempTankID++; } }
private static string BR_Tooltip(RatingStructure ratingStruct) { double damageFormula = BR_Damage(ratingStruct); double killFormula = BR_Kills(ratingStruct); double spottedFormula = BR_Spotted(ratingStruct); double captureFormula = BR_Captured(ratingStruct); double defenceFormula = BR_Defence(ratingStruct); double damageAssistedRadioFormula = BR_DamageAssistedRadio(ratingStruct); double damageAssistedTracksFormula = BR_DamageAssistedTrack(ratingStruct); string total = FormatNumberToString(damageFormula + killFormula + spottedFormula + captureFormula + defenceFormula + damageAssistedRadioFormula + damageAssistedTracksFormula, 2); double[] valueArray = new double[] { damageFormula, killFormula, spottedFormula, captureFormula, defenceFormula, damageAssistedRadioFormula, damageAssistedTracksFormula }; double maxValue = valueArray.Max(); double iTotal = maxValue; List<string> i = new List<string>(); string[] s = new string[7] { "", "Value", "BR", "0", "0", "1", "H" }; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("STR_DAMAGE", "de", "Damage"); s[1] = FormatNumberToString(ratingStruct.damageDealt, 0); s[2] = FormatNumberToString(damageFormula, 2); s[3] = FormatNumberToString(Math.Abs(((damageFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((damageFormula / iTotal)) * 100), 2); s[5] = "0"; s[6] = "D"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("STR_DAMAGE_ASSISTED_RADIO", "de", "Damage Assisted Radio"); s[1] = FormatNumberToString(ratingStruct.damageAssistedRadio, 0); s[2] = FormatNumberToString(damageAssistedRadioFormula, 2); s[3] = FormatNumberToString(Math.Abs(((damageAssistedRadioFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((damageAssistedRadioFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("STR_DAMAGE_ASSISTED_TRACK", "de", "Damage Assisted Track"); s[1] = FormatNumberToString(ratingStruct.damageAssistedTracks, 0); s[2] = FormatNumberToString(damageAssistedTracksFormula, 2); s[3] = FormatNumberToString(Math.Abs(((damageAssistedTracksFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((damageAssistedTracksFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("HTML_CONT_KILLS", "de", "Kills"); s[1] = FormatNumberToString(ratingStruct.frags, 0); s[2] = FormatNumberToString(killFormula, 2); s[3] = FormatNumberToString(Math.Abs(((killFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((killFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("HTML_CONT_DETECTED", "de", "Spotted"); s[1] = FormatNumberToString(ratingStruct.spotted, 0); s[2] = FormatNumberToString(spottedFormula, 2); s[3] = FormatNumberToString(Math.Abs(((spottedFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((spottedFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("STR_CAPTURE", "de", "Capture"); s[1] = FormatNumberToString(ratingStruct.capturePoints, 0); s[2] = FormatNumberToString(captureFormula, 2); s[3] = FormatNumberToString(Math.Abs(((captureFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((captureFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = Translations.TranslationGet("STR_DEFENCE", "de", "Defence"); s[1] = FormatNumberToString(ratingStruct.defencePoints, 0); s[2] = FormatNumberToString(defenceFormula, 2); s[3] = FormatNumberToString(Math.Abs(((defenceFormula / iTotal) - 1) * 100), 2); s[4] = FormatNumberToString(Math.Abs(((defenceFormula / iTotal)) * 100), 2); s[5] = "0"; i.Add(string.Join("|", s)); s[0] = "Total"; s[1] = ""; s[2] = total; s[3] = "0"; s[4] = "0"; s[5] = "1"; s[6] = "T"; i.Add(string.Join("|", s)); return string.Join(";", i); }
private static double BR_Spotted(RatingStructure ratingStruct) { double result = 200.0 * (ratingStruct.AvgSpotted); //WOTHelper.AddToLog("BR Spotted " + result); return result; }
private static double BR_Kills(RatingStructure ratingStruct) { double result = (ratingStruct.AvgFrags) * (350.0 - ratingStruct.tier * 20.0); //WOTHelper.AddToLog("BR Kills " + result); return result; }
private static double BR_Defence(RatingStructure ratingStruct) { double result = 15.0 * (ratingStruct.AvgDefencePoints); //WOTHelper.AddToLog("BR Defence " + result); return result; }
private static double BR_Damage(RatingStructure ratingStruct) { double result = (ratingStruct.AvgDamageDealt) * (0.2 + 1.5 / ratingStruct.tier); //WOTHelper.AddToLog("BR Damage " + result); return result; }
public static RatingStorage GetRatingWN7(RatingStructure ratingStruct) { return GetRatingWN7Calc(ratingStruct); }
private static double WN8_Damage(WN8ExpValue WN8ExpectedTank, RatingStructure ratingStruct) { double rDAMAGE = 0; if (ratingStruct.isOverall) { rDAMAGE = ratingStruct.overallDamageDealt; } else { if (WN8ExpectedTank.expDamage > 0) { rDAMAGE = ratingStruct.AvgDamageDealt / WN8ExpectedTank.expDamage; } } return Math.Max(0, (rDAMAGE - 0.22) / (1 - 0.22)); }
private static double WN7_WinRate(RatingStructure ratingStruct) { double winRate = ratingStruct.gWinRate; // TODO: Added by BadButton 2014-06-25, bugfix winrate-part for wn7 formula, to be chacked by Phalynx if (ratingStruct.battlesCount == 1) winRate = 50; return (((185 / (0.17 + Math.Exp((winRate - 35) * -0.134))) - 500) * 0.45); // TODO: Removed by BadButton, if above work, just remove this //if (ratingStruct.gWinRate == 0 & ratingStruct.winRate > 0) //{ // ratingStruct.gWinRate = ratingStruct.winRate; //} //return (((185 / (0.17 + Math.Exp(((ratingStruct.gWinRate * 100) - 35) * -0.134))) - 500) * 0.45); ////return ((185 / (0.17 + Math.Pow(Math.Exp(1), ((ratingStruct.winRate - 35) * -0.134)))) - 500) * 0.45; }
private static double WN8_Defence(WN8ExpValue WN8ExpectedTank, double rDAMAGEc, RatingStructure ratingStruct) { double rDEF = 0; if (ratingStruct.isOverall) { rDEF = ratingStruct.overallDefencePoints; } else { if (WN8ExpectedTank.expDefense > 0) { rDEF = ratingStruct.AvgDefencePoints / WN8ExpectedTank.expDefense; } } return Math.Max(0, Math.Min(rDAMAGEc + 0.1, (rDEF - 0.10) / (1 - 0.10))); //Math.Min(rDAMAGEc + 0.1, Math.Max(0, (rDEF - 0.10) / (1 - 0.10))); }
public static string GetRatingWN7ToolTip(RatingStructure ratingStruct) { return WN7_Tooltip(ratingStruct);//Translations.TranslationGet("STR_DAMAGE", "de", "Damage"), ratingStruct.damageDealt, WN7_Damage(ratingStruct.battlesCount, ratingStruct.damageDealt, avgTier), Translations.TranslationGet("HTML_CONT_KILLS", "de", "Kills"), frags, WN7_Frags(battles, frags, avgTier), Translations.TranslationGet("HTML_CONT_DETECTED", "de", "Detected"), spotted, WN7_Spotted(ratingStruct.battlesCount, spotted, globalAvgTier), Translations.TranslationGet("STR_DEFENCE", "de", "Defence"), defence, WN7_Defence(ratingStruct.battlesCount, defence), Translations.TranslationGet("STR_WINRATE", "de", "Win Percentage"), winRate, WN7_WinRate(winRate), Translations.TranslationGet("STR_TIERMALUS", "de", "Tier Malus"), 0, WN7_TierMalus(ratingStruct.battlesCount, globalAvgTier)); }
public static RatingStorage GetRatingWN8(RatingStructure ratingStruct) { RatingStorage WN8 = GetRatingWN8Calc(ratingStruct); return WN8; }
private static double WN7_Damage(RatingStructure ratingStruct) { return ratingStruct.AvgDamageDealt * 530 / (184 * Math.Pow(Math.Exp(1), (0.24 * ratingStruct.tier)) + 130); }
private static double WN8_Frags(WN8ExpValue WN8ExpectedTank, double rDAMAGEc, RatingStructure ratingStruct) { double rFRAG = 0; if (ratingStruct.isOverall) { rFRAG = ratingStruct.overallFrags; } else { if (WN8ExpectedTank.expFrag > 0) { rFRAG = ratingStruct.AvgFrags / WN8ExpectedTank.expFrag; } } return Math.Min(rDAMAGEc + 0.2, Math.Max(0, (rFRAG - 0.12) / (1 - 0.12))); }
private static double WN7_Frags(RatingStructure ratingStruct) { return (1240 - 1040 / Math.Pow(GetMinValue(ratingStruct.tier, 6), 0.164)) * (ratingStruct.AvgFrags); }
private static double WN8_Spotted(WN8ExpValue WN8ExpectedTank, double rDAMAGEc, RatingStructure ratingStruct) { double rSPOT = 0; if (ratingStruct.isOverall) { rSPOT = ratingStruct.overallSpotted; } else { if (WN8ExpectedTank.expSpot > 0) { rSPOT = ratingStruct.AvgSpotted / WN8ExpectedTank.expSpot; } } double oResult = Math.Max(0, Math.Min(rDAMAGEc + 0.1, (rSPOT - 0.38) / (1 - 0.38))); return oResult; }
private static double WN7_TierMalus(RatingStructure ratingStruct) { return (((5 - Math.Min(ratingStruct.tier, 5)) * 125) / (1 + Math.Exp(ratingStruct.tier - Math.Pow(ratingStruct.battlesCount / 220, 3 / ratingStruct.tier)) * 1.5)); //return (((5 - Math.Min(ratingStruct.tier, 5)) * 125) / (1 + Math.Pow(Math.Exp(1), ((ratingStruct.tier - Math.Pow((ratingStruct.battlesCount / 220), (3 / ratingStruct.tier))) * 1.5)))) * -1; // (((5 - mi n(ratingStruct.tier,5))*125)/(1+exp(ratingStruct.tier-pow($missingdossier['battles']/220,3/$missingdossier['tier']))*1.5)); }
private static RatingStorage GetRatingWN8Calc(RatingStructure ratingStruct) { ratingStruct.RatingType = "WN8"; RatingStorage Storage = new RatingStorage(ratingStruct); if (ratingStruct.battlesCount == 0) { return Storage; } //WOTHelper.AddToLog(countryID); //WOTHelper.AddToLog(tankID); WN8ExpValue WN8ExpectedTank = null; try { WN8ExpectedTank = ratingStruct.WN8ExpectedTankList.GetByTankID(ratingStruct.countryID, ratingStruct.tankID); } catch (Exception ex) { WOTHelper.AddToLog(ex.Message); } if (WN8ExpectedTank == null) { WOTHelper.AddToLog("WNExpectedTank is NULL: " + ratingStruct.countryID + " - " + ratingStruct.tankID); return Storage; } //rDAMAGE=sum(TotalDamageOfSingleTank)/sum(ExpectedDamagePerTank*BattlesInThatTank) //rSPOT=sum(totalSpotOfSingleTank)/sum(ExpectedSpotPerTank*BattlesInThatTank) //rFRAG=sum(totalFragsOfSingleTank)/sum(ExpectedFragsPerTank*BattlesInThatTank) //rWin=sum(WinsOfSingleTanks)/Sum(ExpectedWinsPerTank*BattlesInThatTank) Storage.expDAMAGE = WN8ExpectedTank.expDamage; Storage.expFRAG = WN8ExpectedTank.expFrag; Storage.expSPOT = WN8ExpectedTank.expSpot; Storage.expDEF = WN8ExpectedTank.expDefense; Storage.expWIN = WN8ExpectedTank.expWin; //Storage.damage = ratingStruct.AvgDamageDealt; //Storage.frags = ratingStruct.AvgFrags; //Storage.spotted = ratingStruct.AvgSpotted; //Storage.defence = ratingStruct.AvgDefencePoints; //Storage.winRate = ratingStruct.winRate; Storage.rDAMAGEc = WN8_Damage(WN8ExpectedTank, ratingStruct); Storage.rFRAGc = WN8_Frags(WN8ExpectedTank, Storage.rDAMAGEc, ratingStruct); Storage.rSPOTc = WN8_Spotted(WN8ExpectedTank, Storage.rDAMAGEc, ratingStruct); Storage.rDEFc = WN8_Defence(WN8ExpectedTank, Storage.rDAMAGEc, ratingStruct); Storage.rWINc = WN8_WinRate(WN8ExpectedTank, ratingStruct); Storage.rDAMAGE = 980 * Storage.rDAMAGEc; Storage.rFRAG = 210 * Storage.rDAMAGEc * Storage.rFRAGc; Storage.rSPOT = 155 * Storage.rFRAGc * Storage.rSPOTc; Storage.rDEF = 75 * Storage.rDEFc * Storage.rFRAGc; Storage.rWIN = 145 * Math.Min(1.8, Storage.rWINc); //if (ratingStruct.countryID == 0 & ratingStruct.tankID == 32) //if (Storage.damage == 820) //if (ratingStruct.isOverall) //{ // WOTHelper.AddToLog("Setting exp: " + Storage.rWIN); // WOTHelper.AddToLog("#############"); // printExpectedTank(WN8ExpectedTank); // printRatingStruct(ratingStruct); // WOTHelper.AddToLog("rDAMAGEc " + Storage.rDAMAGEc); // WOTHelper.AddToLog("rFRAGc " + Storage.rFRAGc); // WOTHelper.AddToLog("rSPOTc " + Storage.rSPOTc); // WOTHelper.AddToLog("rDEFc " + Storage.rDEFc); // WOTHelper.AddToLog("rWINc " + Storage.rWINc); // WOTHelper.AddToLog("____"); // printRatingStruct(ratingStruct); // WOTHelper.AddToLog("rFRAGc " + Storage.rFRAGc); // WOTHelper.AddToLog("rSPOTc " + Storage.rSPOTc); // WOTHelper.AddToLog("rDEFc " + Storage.rDEFc); // WOTHelper.AddToLog("rWINc " + Storage.rWINc); // WOTHelper.AddToLog("____"); // WOTHelper.AddToLog("rDAMAGE " + Storage.rDAMAGE); // WOTHelper.AddToLog("rFRAG " + Storage.rFRAG); // WOTHelper.AddToLog("rSPOT " + Storage.rSPOT); // WOTHelper.AddToLog("rDEF " + Storage.rDEF); // WOTHelper.AddToLog("rWIN " + Storage.rWIN); // WOTHelper.AddToLog("rSUM " + Storage.Value); // WOTHelper.AddToLog("rWeight " + Storage.Weight); // WOTHelper.AddToLog("#############"); //} Storage.HTMLColorDescription = WOTStatistics.Core.WOTHtml.WN8ColorScaleDescription(Storage.Value); Storage.HTMLColor = WOTStatistics.Core.WOTHtml.WN8ColorScale(Storage.Value); return Storage; }
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 static double WN8_WinRate(WN8ExpValue WN8ExpectedTank, RatingStructure ratingStruct) { double rWIN = 0; if (ratingStruct.isOverall) { rWIN = ratingStruct.overallWinRate; } else { if (WN8ExpectedTank.expWin > 0) { rWIN = ratingStruct.winRate / WN8ExpectedTank.expWin; } } return Math.Max(0, (rWIN - 0.71) / (1 - 0.71)); }
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; }
public static string GetRatingBRToolTip(RatingStructure ratingStruct) { return BR_Tooltip(ratingStruct);//Translations.TranslationGet("STR_DAMAGE", "de", "Damage"), ratingStruct.damageDealt, BR_Damage(ratingStruct.damageDealt, ratingStruct.tier), , frags, BR_Kills(frags, avgTier), Translations.TranslationGet("HTML_CONT_DETECTED", "de", "Detected"), spotted, BR_Spotted(spotted), Translations.TranslationGet("STR_CAPTURE", "de", "Capture"), capture, BR_Captured(capture), Translations.TranslationGet("STR_DEFENCE", "de", "Defence"), defence, BR_Defence(defence), , defence, BR_DamageAssistedRadio(damageAssistedRadio, avgTier), Translations.TranslationGet("STR_DAMAGE_ASSISTED_TRACK", "de", "Damage Assisted Track"), defence, BR_DamageAssistedTrack(damageAssistedTrack, avgTier)); }