internal static LuckyDraw Deserialize(string base64String)
        {
            if (string.IsNullOrEmpty(base64String))
            {
                Log.Error("LuckyDraw.FromString with empty value!");
                return(new LuckyDraw());
            }
            string[]  parts     = Conv.StringPartsFromBase64(base64String, "LuckyDraw");
            LuckyDraw luckyDraw = new LuckyDraw();

            luckyDraw.LastLuckyDraw = (LuckyType)Conv.getIntFromParts(parts, "a");
            string stringFromParts = Conv.getStringFromParts(parts, "b");

            string[] array = stringFromParts.Split(new char[]
            {
                '&'
            });
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text = array2[i];
                if (!string.IsNullOrEmpty(text))
                {
                    luckyDraw.DrawCounts.Add(LuckyDrawCount.Deserialize(text));
                }
            }
            return(luckyDraw);
        }
        public LuckyType Draw()
        {
            if (App.State == null || App.State.PremiumBoni.LuckyDraws < 1)
            {
                return(LuckyType.None);
            }
            List <LuckyType> list = new List <LuckyType>();

            this.AddDraw(ref list, LuckyType.GP2, 40);
            this.AddDraw(ref list, LuckyType.GP5, 10);
            this.AddDraw(ref list, LuckyType.GP10, 5);
            this.AddDraw(ref list, LuckyType.GP25, 2);
            this.AddDraw(ref list, LuckyType.GP50, 1);
            this.AddDraw(ref list, LuckyType.GP100, 1);
            this.AddDraw(ref list, LuckyType.Liquid1, 8);
            this.AddDraw(ref list, LuckyType.Liquid2, 4);
            this.AddDraw(ref list, LuckyType.Chakra1, 8);
            this.AddDraw(ref list, LuckyType.Chakra2, 4);
            this.AddDraw(ref list, LuckyType.PetToken, 2);
            this.AddDraw(ref list, LuckyType.LuckyDraw, 10);
            this.AddDraw(ref list, LuckyType.USS, 6);
            this.AddDraw(ref list, LuckyType.CrystalSlot, 1);
            this.AddDraw(ref list, LuckyType.Dall, 4);
            this.AddDraw(ref list, LuckyType.DPhysical, 15);
            this.AddDraw(ref list, LuckyType.DMystic, 15);
            this.AddDraw(ref list, LuckyType.DCreating, 15);
            this.AddDraw(ref list, LuckyType.DBattle, 15);
            this.AddDraw(ref list, LuckyType.DDiv, 15);
            this.AddDraw(ref list, LuckyType.Div1, 50);
            this.AddDraw(ref list, LuckyType.Div5, 15);
            this.AddDraw(ref list, LuckyType.Growth1, 55);
            this.AddDraw(ref list, LuckyType.Growth2, 25);
            this.AddDraw(ref list, LuckyType.Growth5, 5);
            this.AddDraw(ref list, LuckyType.MightyFood1, 25);
            this.AddDraw(ref list, LuckyType.MightyFood2, 10);
            this.AddDraw(ref list, LuckyType.MightyFood5, 5);
            this.AddDraw(ref list, LuckyType.GP1, 130);
            LuckyType drawing = LuckyType.GP5;

            if (this.LastLuckyDraw != LuckyType.None)
            {
                drawing = list[State2.RandomInt(0, list.Count, App.State.Ext)];
            }
            if ((drawing == LuckyType.CrystalSlot && App.State.PremiumBoni.MaxCrystals == 6) || (drawing == LuckyType.CrystalSlot && !App.State.IsCrystalFactoryAvailable))
            {
                drawing = LuckyType.GP10;
            }
            Premium expr_20D = App.State.PremiumBoni;

            expr_20D.LuckyDraws = --expr_20D.LuckyDraws;
            this.LastLuckyDraw  = drawing;
            LuckyDrawCount luckyDrawCount = this.DrawCounts.FirstOrDefault((LuckyDrawCount x) => x.Type == drawing);

            if (luckyDrawCount == null)
            {
                luckyDrawCount      = new LuckyDrawCount();
                luckyDrawCount.Type = drawing;
                this.DrawCounts.Add(luckyDrawCount);
            }
            luckyDrawCount.Count++;
            return(drawing);
        }