Ejemplo n.º 1
0
		protected override void DoWork(CancellationToken ct)
		{
			CharacterRenderData[] loginData;
			WelcomeRequestData welcomeReqData;
			WelcomeMessageData welcomeMsgData;

			var h = new BotHelper(_api, Console.WriteLine, _errorMessage);

			if (!h.CreateAccountIfNeeded(_name, _name) || ct.IsCancellationRequested) return;
			Thread.Sleep(500);

			if (!h.LoginToAccount(_name, _name, out loginData) || ct.IsCancellationRequested) return;
			Thread.Sleep(500);

			if (!h.CreateCharacterIfNeeded(_name, ref loginData) || ct.IsCancellationRequested) return;

			if (!h.DoWelcomePacketsForFirstCharacter(loginData, out welcomeReqData, out welcomeMsgData) || ct.IsCancellationRequested) return;

			Console.WriteLine("{0} logged in and executing.", _name);

			var charlist = welcomeMsgData.CharacterData.ToList();
			int testuserNdx = charlist.FindIndex(_data => _data.Name.ToLower() == "testuser");
			if (testuserNdx >= 0)
			{
				PartyRequest(_api, charlist[testuserNdx].ID);
			}
		}
Ejemplo n.º 2
0
        protected override void DoWork(CancellationToken ct)
        {
            CharacterLoginData[] loginData;
            //WelcomeRequestData welcomeReqData;
            //WelcomeMessageData welcomeMsgData;

            var h = new BotHelper(_api, Console.WriteLine, _errorMessage);

            if (!h.CreateAccountIfNeeded(_name, _name) || ct.IsCancellationRequested)
            {
                return;
            }
            Thread.Sleep(500);

            if (!h.LoginToAccount(_name, _name, out loginData) || ct.IsCancellationRequested)
            {
                return;
            }
            Thread.Sleep(500);

            if (!h.CreateCharacterIfNeeded(_name, ref loginData) || ct.IsCancellationRequested)
            {
                return;
            }

            //if (!h.DoWelcomePacketsForFirstCharacter(loginData, out welcomeReqData, out welcomeMsgData) || ct.IsCancellationRequested) return;

            Console.WriteLine("{0} logged in and executing.", _name);

            //var charlist = welcomeMsgData.CharacterData.ToList();
            //int testuserNdx = charlist.FindIndex(_data => _data.Name.ToLower() == "testuser");
            //if (testuserNdx >= 0)
            //{
            //    PartyRequest(_api, charlist[testuserNdx].ID);
            //}
        }