예제 #1
0
        private async void Logout()
        {
            if (_logoutIsRunning)
            {
                _logoutIsRunning      = false;
                _logoutKeysender.Stop = true;
                return;
            }
            _logoutKeysender = new KeySender();
            _logoutIsRunning = true;
            while (_logoutIsRunning)
            {
                if (IsLogoutTimeChecked)
                {
                    await Task.Delay(LogoutTime * 1000 + new Random().Next(10, 200));

                    await _logoutKeysender.SendKey(TibiaProcess.Process, LogoutKey, 1);

                    if (_isLogoutHibernateChecked)
                    {
                        var psi = new ProcessStartInfo("shutdown", "/s /t 0");
                        psi.CreateNoWindow  = true;
                        psi.UseShellExecute = false;
                        Process.Start(psi);
                    }
                    if (IsLogoutHibernateChecked)
                    {
                        var psi = new ProcessStartInfo("shutdown", "/h /t 0");
                        psi.CreateNoWindow  = true;
                        psi.UseShellExecute = false;
                        Process.Start(psi);
                    }
                }
                if (IsLogoutSoulsChecked)
                {
                    if (MemoryReader.souls >= LogoutTime)
                    {
                        await Task.Delay(new Random().Next(10, 200));

                        await _logoutKeysender.SendKey(TibiaProcess.Process, LogoutKey, 1);

                        if (_isLogoutHibernateChecked)
                        {
                            var psi = new ProcessStartInfo("shutdown", "/s /t 0");
                            psi.CreateNoWindow  = true;
                            psi.UseShellExecute = false;
                            Process.Start(psi);
                        }
                        if (IsLogoutHibernateChecked)
                        {
                            var psi = new ProcessStartInfo("shutdown", "/h /t 0");
                            psi.CreateNoWindow  = true;
                            psi.UseShellExecute = false;
                            Process.Start(psi);
                        }
                    }
                }
            }
        }
예제 #2
0
        private async void F5_OnClick(object sender, RoutedEventArgs e)
        {
            if (mana1.Text.Length == 0)
            {
                f5button.IsChecked = false;
                return;
            }

            keys1.IsEnabled = false;
            mana1.IsEnabled = false;

            logBox.AppendText("\nF5 started.");
            logBox.ScrollToEnd();
            _ksF5 = new KeySender();
            var proc = (TibiaProc)processCombo.SelectedValue;

            _ksF5isrunning = true;
            while (_ksF5isrunning)
            {
                if (MemoryReader.mana >= int.Parse(mana1.Text))
                {
                    await _ksF5.SendKey(proc.Process, int.Parse(keys1.SelectedValue.ToString()));
                }
                await Task.Delay(250);
            }
            //await _ksF5.SendKey(proc.Process, int.Parse(mana1.Text), double.Parse(classCombo.SelectedValue.ToString()), double.Parse(itemCombo.SelectedValue.ToString()), int.Parse(keys1.SelectedValue.ToString()), logBox, 1);
        }
예제 #3
0
        //todo: logout after X time, shutdown pc
        private async void LogoutButton_OnClick(object sender, RoutedEventArgs e)
        {
            if (logout.Text.Length == 0 || LogoutSoulsRadioButton.IsChecked == false && LogoutSoulsRadioButton.IsChecked == false)
            {
                logoutButton.IsChecked = false;
                return;
            }

            logout.IsEnabled = false;

            logBox.AppendText("\nLogout started.");
            logBox.ScrollToEnd();
            var proc = (TibiaProc)processCombo.SelectedValue;

            if (LogoutTimeRadioButton.IsChecked == true)
            {
                _ksLogoutTime = new KeySender();
                await _ksLogoutTime.SendKeyMultiple(proc.Process, int.Parse(logout.Text), 1, 0, int.Parse(keys4.SelectedValue.ToString()), logBox);

                if (LogoutShutdownRadioButton.IsChecked == true)
                {
                    var psi = new ProcessStartInfo("shutdown", "/s /t 0");
                    psi.CreateNoWindow  = true;
                    psi.UseShellExecute = false;
                    Process.Start(psi);
                }

                if (LogoutHibernateRadioButton.IsChecked == true)
                {
                    var psi = new ProcessStartInfo("shutdown", "/h /t 0");
                    psi.CreateNoWindow  = true;
                    psi.UseShellExecute = false;
                    Process.Start(psi);
                }
            }
            if (LogoutSoulsRadioButton.IsChecked == true && MemoryReader.souls <= int.Parse(logout.Text))
            {
                _ksLogoutSouls = new KeySender();
                await _ksLogoutSouls.SendKey(proc.Process, int.Parse(keys4.SelectedValue.ToString()));

                if (LogoutShutdownRadioButton.IsChecked == true)
                {
                    var psi = new ProcessStartInfo("shutdown", "/s /t 0");
                    psi.CreateNoWindow  = true;
                    psi.UseShellExecute = false;
                    Process.Start(psi);
                }

                if (LogoutHibernateRadioButton.IsChecked == true)
                {
                    var psi = new ProcessStartInfo("shutdown", "/h /t 0");
                    psi.CreateNoWindow  = true;
                    psi.UseShellExecute = false;
                    Process.Start(psi);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Handles "key:" requests
        /// </summary>
        /// <param name="data">Message received from client</param>
        public void OnKeyRequest(string data)
        {
            string key = data.Substring("key:".Length);

            Program.Log("Key request: " + key, debug: true);

            try
            {
                KeySender.SendKey(ScancodeConvert.GetScancode(key));
            }
            catch
            {
                Program.Log("Failed to send key: " + key, ConsoleColor.Red);
            }
        }
예제 #5
0
        private async void Skilling()
        {
            if (_skillingIsRunning)
            {
                _skillingIsRunning      = false;
                _skillingKeysender.Stop = true;
                return;
            }
            _skillingKeysender = new KeySender();
            _skillingIsRunning = true;
            while (_skillingIsRunning)
            {
                await _skillingKeysender.SendKey(TibiaProcess.Process, SkillingKey, 2);

                await Task.Delay(SkillingTime * 1000 + new Random().Next(10, 200));
            }
        }
예제 #6
0
 private async void Manaburn()
 {
     if (_manaburnIsRunning)
     {
         _manaburnIsRunning = false;
         return;
     }
     _manaburnKeysender = new KeySender();
     _manaburnIsRunning = true;
     while (_manaburnIsRunning)
     {
         if (MemoryReader.mana >= RequiredMana)
         {
             await _manaburnKeysender.SendKey(TibiaProcess.Process, ManaburnKey, 1);
         }
         await Task.Delay(250);
     }
 }
예제 #7
0
        private async void SpaceButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            if (spacebox.Text.Length == 0)
            {
                spacebutton.IsChecked = false;
                return;
            }


            keys3.IsEnabled    = false;
            spacebox.IsEnabled = false;

            logBox.AppendText("\nSpace started.");
            logBox.ScrollToEnd();
            _ksSpace = new KeySender();
            var proc = (TibiaProc)processCombo.SelectedValue;
            await _ksSpace.SendKey(proc.Process, int.Parse(spacebox.Text), 1, 0, int.Parse(keys3.SelectedValue.ToString()), logBox, 2);
        }
예제 #8
0
        private async void F6_OnClick(object sender, RoutedEventArgs e)
        {
            if (mana2.Text.Length == 0)
            {
                f6button.IsChecked = false;
                return;
            }


            keys2.IsEnabled = false;
            mana2.IsEnabled = false;

            logBox.AppendText("\nF6 started.");
            logBox.ScrollToEnd();
            _ksF6 = new KeySender();
            var proc = (TibiaProc)processCombo.SelectedValue;
            await _ksF6.SendKey(proc.Process, int.Parse(mana2.Text), 1, 0, int.Parse(keys2.SelectedValue.ToString()), logBox, 1);
        }
예제 #9
0
        /// <summary>
        /// Handles "action:" requests.
        /// Similar to key requests except the actual keycode is loaded from a file based on the action name passed.
        /// </summary>
        /// <param name="data"></param>
        public void OnActionRequest(string data)
        {
            string action = data.Substring("action:".Length);

            Program.Log("Action request: " + action, debug: true);

            string keycode = Program.keybindingHelper.GetKeybind(action);

            if (keycode != null)
            {
                try
                {
                    KeySender.SendKey(ScancodeConvert.GetScancode(keycode));
                }
                catch
                {
                    Program.Log("Failed to send key: " + keycode, ConsoleColor.Red);
                }
            }
            else
            {
                Program.Log("Attempt to trigger action that doesn't have an associated keybind! (" + action + ")", ConsoleColor.Red);
            }
        }