Beispiel #1
0
        public async Task Init()
        {
            // Find NGM location
            ngmPath = Tools.GetNgmPath();
            if (ngmPath == null)
            {
                throw new VerdantException.GameNotFoundException();
            }

            // Get front page, if no load, then channel and try again. If not then gg
            // NOTE: make sure if >1 maple id, there is one selected as default on the website!!
            // Or will not channel properly!!
            Debug.WriteLine("getting maple");

            // preload - ensure everything is smooth with 2x get (loginproc on second if no good) + cheeky channel
            if (Account.Preloaded)
            {
                Debug.WriteLine("preload get");
                await webClient.GetAsync(MAPLE_HOME);

                Debug.WriteLine("pre 1");
                await webClient.GetAsync("http://api.game.naver.com/js/jslib.nhn?gameId=P_PN000046");

                Debug.WriteLine("pre 2");
                await webClient.GetAsync(MAPLE_HOME);

                Debug.WriteLine("pre ok");
                Account.SaveCookies();
            }

            if (!(await getCurrentMaple()))
            {
                throw new VerdantException.ChannelingRequiredException();
            }
        }
Beispiel #2
0
        public async Task Channel()
        {
            Debug.WriteLine("have to channel");
            await channeling();

            Debug.WriteLine("channeled, saving and getting again");
            Account.SaveCookies();

            if (!(await getCurrentMaple()))
            {
                throw new Exception("no");
            }
        }
Beispiel #3
0
        private void getSystemCookiesAndTest()
        {
            string cookies = Tools.GetCookieStringData("https://naver.com");

            if (cookies != null && cookies.Contains("NID_AUT"))
            {
                // success - now we add properly, then double check and go!
                foreach (string s in cookies.Split(new string[] { "; " }, StringSplitOptions.None))
                {
                    string[] ss = s.Split('=');
                    addNaverCookieData(ss[0], ss[1]);
                }

                Task.Run(() => account.EnsureLoggedIn()).Wait();
                account.SaveCookies();
                account.LoggedIn = true;
            }
        }
Beispiel #4
0
        private async Task switchMapleId()
        {
            if (String.IsNullOrEmpty(mapleIdBox.Text) || !Maple.MapleIds.Contains(mapleIdBox.Text))
            {
                return;
            }

            charImage.Source = null;
            toggleUi(false);
            mapleIdLabel.Content = "Switching...";

            try
            {
                await Maple.SwitchMapleId(mapleIdBox.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error swiching IDs...\n\n" + ex.ToString());
            }

            mapleIdLabel.Content = "Web Main Character (대표 캐릭터): " + Maple.MainCharName;
            if (Maple.CharacterImageUrl != null)
            {
                charImage.Source = Tools.UrlToXamlImage(Maple.CharacterImageUrl);
            }
            tespiaCheckBox.IsChecked = false;

            if (noAuth)
            {
                Account.SaveCookies();
                await startGame();

                return;
            }

            toggleUi(true);
        }