Пример #1
0
        public bool Register(string EMail, CaptchaSolver captchaSolver, string friendId = "", string friendHash = "")
        {
            EMail = EMail.Replace("+", "%2B");
            string response = network.DownloadString(url + string.Format("?action=newPlayer&function=createAvatar&fh={0}&friendId={3}&list=0&kid=&gclid=&password={1}&email={2}&agb=on", friendHash, password, EMail, friendId));

            while (response.Replace(" ", "").Contains("captchaForm"))
            {
                byte[] captchaData = network.DownloadData(url + "?action=NoUser&function=createCaptcha&rand=" + random.Next(0, 99999).ToString());
                captchaSolver.image = captchaData;

                string captchaID;
                bool   success;
                string captchaValue = captchaSolver.SendCaptcha(out captchaID, out success);
                if (success && captchaValue != null)
                {
                    response = network.DownloadString(url + string.Format("?registrationCaptcha={0}&action=newPlayer&function=createAvatar&friend=0&checksum&password={1}&name={2}&email={3}&agb=on&kid&friendId={4}&list=0&ssoMode=0&oiUrl&fh={5}&state&altNames&errors[0]=39", captchaValue, password, userName, EMail, friendId, friendHash));
                    captchaSolver.CaptchaWorked(captchaID, !response.Replace(" ", "").Contains("captchaForm"));
                }
            }

            network = new Network(connection, url);
            bool result = Login(EMail);

            if (result)
            {
                response = network.AjaxHandlerRequest(string.Format("action=TutorialOperations&function=updateTutorialData&disableTutorial=false&avatarName={0}&email={1}&agb=on&cityId={2}&signUp=1&backgroundView=city&currentCityId={2}&ajax=1", userName, EMail, currentCity.ID), Relogin);
            }
            return(result);
        }
Пример #2
0
        public void PirateMission(string missionLevel, CaptchaSolver captchaSolver)
        {
            string response = network.AjaxHandlerRequest(string.Format("action=PiracyScreen&function=capture&buildingLevel={1}&view=pirateFortress&cityId={0}&position=17&activeTab=tabBootyQuest&backgroundView=city&currentCityId={0}&templateView=pirateFortress", currentCity.ID, missionLevel), Relogin);

            if (response.Contains("captchaNeeded=1"))
            {
                byte[] captchaData = null;
                try
                {
                    captchaData = network.DownloadData(url + "?action=Options&function=createCaptcha&rand=" + random.Next(0, 99999).ToString());
                }
                catch (Exception exc) { }

                //Captcha solve
                captchaSolver.image = captchaData;

                string captchaID;
                bool   success;
                string captchaValue = captchaSolver.SendCaptcha(out captchaID, out success);
                if (!success)
                {
                    captchaValue = "None";
                }

                network.AjaxHandlerRequest(string.Format("action=PiracyScreen&function=capture&cityId={0}&position=17&captchaNeeded=1&activeTab=tabBootyQuest&backgroundView=city&templateView=pirateFortress&currentCityId={0}&buildingLevel={1}&ajax=1&captcha={2}", currentCity.ID, missionLevel, captchaValue), Relogin);

                if (success)
                {
                    captchaSolver.CaptchaWorked(captchaID, !response.Contains("captchaNeeded=1"));
                }
            }
        }