private string ParseForArtifactXP(string input, int spellID)
        {
            string str;
            string str1;
            int    num = 0;

            while (!this.CharacterIsNumeric(input[num]) && num < input.Length)
            {
                num++;
            }
            if (num >= input.Length)
            {
                return(input);
            }
            string empty  = string.Empty;
            string empty1 = string.Empty;

            while (num < input.Length && (this.CharacterIsNumeric(input[num]) || input[num] == ','))
            {
                if (input[num] != ',')
                {
                    empty = string.Concat(empty, input[num]);
                }
                empty1 = string.Concat(empty1, input[num]);
                num++;
            }
            if (empty == string.Empty)
            {
                return(input);
            }
            long num1 = (long)0;

            try
            {
                num1 = long.Parse(empty);
                goto Label0;
            }
            catch (Exception exception)
            {
                str = input;
            }
            return(str);

Label0:
            long num2 = GeneralHelpers.ApplyArtifactXPMultiplier(num1, (double)GarrisonStatus.ArtifactXpMultiplier);

            if (num2 < (long)1000000)
            {
                if (num2 <= (long)999)
                {
                    return(input.Replace(empty1, num2.ToString()));
                }
                string str2 = string.Format("{0},{1:D3}", num2 / (long)1000, num2 % (long)1000);
                return(input.Replace(empty1, str2));
            }
            long   num3 = num2 / (long)1000000;
            long   num4 = num2 % (long)1000000 / (long)100000;
            string str3 = StaticDB.GetString("MILLION", "million");

            if (num2 > (long)1000000000)
            {
                num3 = num2 / (long)1000000000;
                num4 = num2 % (long)1000000000 / (long)100000000;
                str3 = StaticDB.GetString("BILLION", "billion");
            }
            string str4   = ".";
            string empty2 = string.Empty;
            string locale = Main.instance.GetLocale();

            if (locale != null)
            {
                if (locale == "esES" || locale == "frFR")
                {
                    str4   = ",";
                    empty2 = " de";
                }
                else if (locale == "itIT")
                {
                    str4   = ",";
                    empty2 = " di";
                }
                else if (locale == "deDE" || locale == "ruRU")
                {
                    str4 = ",";
                }
            }
            str1 = (num4 <= (long)0 ? string.Format("{0:D} {3}{4}", new object[] { num3, str4, num4, str3, empty2 }) : string.Format("{0:D}{1}{2:D} {3}{4}", new object[] { num3, str4, num4, str3, empty2 }));
            return(input.Replace(empty1, str1));
        }
Ejemplo n.º 2
0
        private string ParseForArtifactXP(string input, int spellID)
        {
            int num = 0;

            while (!this.CharacterIsNumeric(input[num]) && num < input.Length)
            {
                num++;
            }
            if (num >= input.Length)
            {
                return(input);
            }
            string text  = string.Empty;
            string text2 = string.Empty;

            while (num < input.Length && (this.CharacterIsNumeric(input[num]) || input[num] == ','))
            {
                if (input[num] != ',')
                {
                    text += input[num];
                }
                text2 += input[num];
                num++;
            }
            if (text == string.Empty)
            {
                return(input);
            }
            long inputAmount = 0L;

            try
            {
                inputAmount = long.Parse(text);
            }
            catch (Exception)
            {
                return(input);
            }
            long num2 = GeneralHelpers.ApplyArtifactXPMultiplier(inputAmount, (double)GarrisonStatus.ArtifactXpMultiplier);

            if (num2 >= 1000000L)
            {
                long   num3    = num2 / 1000000L;
                long   num4    = num2 % 1000000L / 100000L;
                string @string = StaticDB.GetString("MILLION", "million");
                if (num2 > 1000000000L)
                {
                    num3    = num2 / 1000000000L;
                    num4    = num2 % 1000000000L / 100000000L;
                    @string = StaticDB.GetString("BILLION", "billion");
                }
                string text3  = ".";
                string text4  = string.Empty;
                string locale = Main.instance.GetLocale();
                if (locale != null)
                {
                    if (!(locale == "esES") && !(locale == "frFR"))
                    {
                        if (!(locale == "itIT"))
                        {
                            if (locale == "deDE" || locale == "ruRU")
                            {
                                text3 = ",";
                            }
                        }
                        else
                        {
                            text3 = ",";
                            text4 = " di";
                        }
                    }
                    else
                    {
                        text3 = ",";
                        text4 = " de";
                    }
                }
                string newValue;
                if (num4 > 0L)
                {
                    newValue = string.Format("{0:D}{1}{2:D} {3}{4}", new object[]
                    {
                        num3,
                        text3,
                        num4,
                        @string,
                        text4
                    });
                }
                else
                {
                    newValue = string.Format("{0:D} {3}{4}", new object[]
                    {
                        num3,
                        text3,
                        num4,
                        @string,
                        text4
                    });
                }
                return(input.Replace(text2, newValue));
            }
            if (num2 > 999L)
            {
                string newValue2 = string.Format("{0},{1:D3}", num2 / 1000L, num2 % 1000L);
                return(input.Replace(text2, newValue2));
            }
            return(input.Replace(text2, num2.ToString()));
        }