Example #1
0
        private static double BR_Captured(RatingStructure ratingStruct)
        {
            double result = 15.0 * (ratingStruct.AvgCapturePoints);

            //WOTHelper.AddToLog("BR Capture " + result);
            return(result);
        }
Example #2
0
        private static double BR_Spotted(RatingStructure ratingStruct)
        {
            double result = 200.0 * (ratingStruct.AvgSpotted);

            //WOTHelper.AddToLog("BR Spotted " + result);
            return(result);
        }
Example #3
0
        private static double BR_Defence(RatingStructure ratingStruct)
        {
            double result = 15.0 * (ratingStruct.AvgDefencePoints);

            //WOTHelper.AddToLog("BR Defence " + result);
            return(result);
        }
Example #4
0
        private static double BR_Kills(RatingStructure ratingStruct)
        {
            double result = (ratingStruct.AvgFrags) * (350.0 - ratingStruct.tier * 20.0);

            //WOTHelper.AddToLog("BR Kills " + result);
            return(result);
        }
Example #5
0
            public RatingStorage(RatingStructure ratingStruct)
            {
                battlesCount         = ratingStruct.battlesCount;
                battlesCount8_8      = ratingStruct.battlesCount8_8;
                damage               = ratingStruct.damageDealt;
                damageAssistedRadio  = ratingStruct.damageAssistedRadio;
                damageAssistedTracks = ratingStruct.damageAssistedTracks;
                frags   = ratingStruct.frags;
                spotted = ratingStruct.spotted;
                defence = ratingStruct.defencePoints;
                capture = ratingStruct.capturePoints;
                winRate = ratingStruct.winRate;

                if (battlesCount > 0)
                {
                    AvgDamage  = damage / battlesCount;
                    AvgFrags   = frags / battlesCount;
                    AvgSpotted = spotted / battlesCount;
                    AvgDefence = defence / battlesCount;
                    AvgCapture = capture / battlesCount;
                }
                if (battlesCount8_8 > 0)
                {
                    AvgDamageAssistedRadio  = damageAssistedRadio / battlesCount8_8;
                    AvgDamageAssistedTracks = damageAssistedTracks / battlesCount8_8;
                }

                //printRatingStruct(ratingStruct);
            }
Example #6
0
        private static double BR_Damage(RatingStructure ratingStruct)
        {
            double result = (ratingStruct.AvgDamageDealt) * (0.2 + 1.5 / ratingStruct.tier);

            //WOTHelper.AddToLog("BR Damage " + result);
            return(result);
        }
Example #7
0
        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);
        }
Example #8
0
        public static void printRatingStruct(RatingStructure ratingStruct)
        {
            WOTHelper.AddToLog("ratingStruct.countryID:" + ratingStruct.countryID);
            WOTHelper.AddToLog("ratingStruct.tankID:" + ratingStruct.tankID);
            WOTHelper.AddToLog("ratingStruct.tier:" + ratingStruct.tier);
            WOTHelper.AddToLog("ratingStruct.battlesCount:" + ratingStruct.battlesCount);
            WOTHelper.AddToLog("ratingStruct.battlesCount8_8:" + ratingStruct.battlesCount8_8);
            WOTHelper.AddToLog("ratingStruct.capturePoints:" + ratingStruct.capturePoints);
            WOTHelper.AddToLog("ratingStruct.defencePoints:" + ratingStruct.defencePoints);
            WOTHelper.AddToLog("ratingStruct.damageAssistedRadio:" + ratingStruct.damageAssistedRadio);
            WOTHelper.AddToLog("ratingStruct.damageAssistedTracks:" + ratingStruct.damageAssistedTracks);
            WOTHelper.AddToLog("ratingStruct.damageDealt:" + ratingStruct.damageDealt);
            WOTHelper.AddToLog("ratingStruct.frags:" + ratingStruct.frags);
            WOTHelper.AddToLog("ratingStruct.spotted:" + ratingStruct.spotted);
            WOTHelper.AddToLog("ratingStruct.wins:" + ratingStruct.wins);
            WOTHelper.AddToLog("ratingStruct.winRate:" + ratingStruct.winRate);
            WOTHelper.AddToLog("--------------");
            WOTHelper.AddToLog("ratingStruct.AvgcapturePoints:" + ratingStruct.AvgCapturePoints);
            WOTHelper.AddToLog("ratingStruct.AvgdefencePoints:" + ratingStruct.AvgDefencePoints);
            WOTHelper.AddToLog("ratingStruct.AvgdamageAssistedRadio:" + ratingStruct.AvgDamageAssistedRadio);
            WOTHelper.AddToLog("ratingStruct.AvgdamageAssistedTracks:" + ratingStruct.AvgDamageAssistedTracks);
            WOTHelper.AddToLog("ratingStruct.AvgdamageDealt:" + ratingStruct.AvgDamageDealt);
            WOTHelper.AddToLog("ratingStruct.Avgfrags:" + ratingStruct.AvgFrags);
            WOTHelper.AddToLog("ratingStruct.Avgspotted:" + ratingStruct.AvgSpotted);
            WOTHelper.AddToLog("--------------");
            WOTHelper.AddToLog("ratingStruct.overallDamageDealt:" + ratingStruct.overallDamageDealt);
            WOTHelper.AddToLog("ratingStruct.overallFrag:" + ratingStruct.overallFrags);
            WOTHelper.AddToLog("ratingStruct.overallSpot:" + ratingStruct.overallSpotted);
            WOTHelper.AddToLog("ratingStruct.overallDefensePoints:" + ratingStruct.overallDefencePoints);
            WOTHelper.AddToLog("ratingStruct.overallWinrate:" + ratingStruct.overallWinRate);

            WOTHelper.AddToLog("--------------");
        }
Example #9
0
        // 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);
        }
Example #10
0
        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);
        }
Example #11
0
        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));            
        }
Example #12
0
        private static RatingStorage GetRatingEffCalc(RatingStructure ratingStruct)
        {
            ratingStruct.RatingType = "Eff";
            RatingStorage oStorage = new RatingStorage(ratingStruct);

            if (ratingStruct.battlesCount == 0)
            {
                return(oStorage);
            }

            oStorage.rDAMAGE = EFF_Damage(ratingStruct);
            oStorage.rFRAG   = EFF_Kills(ratingStruct);
            oStorage.rSPOT   = EFF_Spotted(ratingStruct);
            oStorage.rCAP    = EFF_Captured(ratingStruct);
            oStorage.rDEF    = EFF_Defence(ratingStruct);
            return(oStorage);
        }
Example #13
0
        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));
        }
Example #14
0
        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;
        }
Example #15
0
        private static RatingStorage GetRatingBRCalc(RatingStructure ratingStruct)
        {
            ratingStruct.RatingType = "BR";
            RatingStorage oStorage = new RatingStorage(ratingStruct);

            if (ratingStruct.battlesCount == 0)
            {
                return(oStorage);
            }

            oStorage.rDAMAGE        = BR_Damage(ratingStruct);
            oStorage.rFRAG          = BR_Kills(ratingStruct);
            oStorage.rSPOT          = BR_Spotted(ratingStruct);
            oStorage.rCAP           = BR_Captured(ratingStruct);
            oStorage.rDEF           = BR_Defence(ratingStruct);
            oStorage.rDAMAGE_RADIO  = BR_DamageAssistedRadio(ratingStruct);
            oStorage.rDAMAGE_TRACKS = BR_DamageAssistedTrack(ratingStruct);

            return(oStorage);
        }
Example #16
0
        private static string Eff_Tooltip(RatingStructure ratingStruct)
        {
            double damageFormula  = EFF_Damage(ratingStruct);
            double killFormula    = EFF_Kills(ratingStruct);
            double spottedFormula = EFF_Spotted(ratingStruct);
            double captureFormula = EFF_Captured(ratingStruct);
            double defenceFormula = EFF_Defence(ratingStruct);
            string total          = FormatNumberToString(damageFormula + killFormula + spottedFormula + captureFormula + defenceFormula, 2);

            double[] valueArray = new double[] { damageFormula, killFormula, spottedFormula, captureFormula, defenceFormula };
            double   maxValue   = valueArray.Max();
            double   iTotal     = maxValue;

            List <string> i = new List <string>();

            string[] s = new string[7] {
                "", "Value", "Eff", "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", "Detected");
            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));
        }
Example #17
0
 public static RatingStorage GetRatingWN7(RatingStructure ratingStruct)
 {
     return(GetRatingWN7Calc(ratingStruct));
 }
Example #18
0
        public static RatingStorage GetRatingWN8(RatingStructure ratingStruct)
        {
            RatingStorage WN8 = GetRatingWN8Calc(ratingStruct);

            return WN8;
        }
Example #19
0
        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)));
        }
Example #20
0
 private static double WN7_Spotted(RatingStructure ratingStruct)
 {
     return((ratingStruct.AvgSpotted) * 125 * (GetMinValue(ratingStruct.tier, 3)) / 3);
 }
Example #21
0
 private static double WN7_Defence(RatingStructure ratingStruct)
 {
     return(GetMinValue(ratingStruct.AvgDefencePoints, 2.2) * 100);
 }
Example #22
0
 private static double WN7_Frags(RatingStructure ratingStruct)
 {
     return((1240 - 1040 / Math.Pow(GetMinValue(ratingStruct.tier, 6), 0.164)) * (ratingStruct.AvgFrags));
 }
Example #23
0
 private static double WN7_Damage(RatingStructure ratingStruct)
 {
     return(ratingStruct.AvgDamageDealt * 530 / (184 * Math.Pow(Math.Exp(1), (0.24 * ratingStruct.tier)) + 130));
 }
Example #24
0
 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));
 }
Example #25
0
        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;

        }
Example #26
0
        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));
        }
Example #27
0
 public static string GetRatingEffToolTip(RatingStructure ratingStruct)
 {
     return(Eff_Tooltip(ratingStruct));
 }
Example #28
0
 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));
 }
Example #29
0
        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;

        }
Example #30
0
        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)));
        }