예제 #1
0
        public static void SendKey(Keyboard.DirectXKeyStrokes key, bool Release = false)
        {
            if (!_foundWindow)
            {
                _eliteGameWindow = FindWindow(null, "Elite - Dangerous (CLIENT)"); // FrontierDevelopmentsAppWinClass
                _foundWindow     = true;
            }

            try
            {
                IntPtr foregroundWindow = GetForegroundWindow();
                if (foregroundWindow != _eliteGameWindow)
                {
                    SetForegroundWindow(_eliteGameWindow);
                }
                Keyboard.SendKey(key, Release, Keyboard.InputType.Keyboard);
                if (Release)
                {
                    _activeKey = null;
                }
                else
                {
                    _activeKey = key;
                }
                //if (foregroundWindow != _eliteGameWindow)
                //    SetForegroundWindow(foregroundWindow);
            }
            catch //(Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        public void StartBlockReversalLoop(SlotInput slotInput)
        {
            lock (RunBlockReversalThreadLock)
            {
                _runBlockReversalThread = true;
            }

            Thread blockReversalThread = new Thread(() =>
            {
                LogManager.Instance.WriteLine("Block Reversal Thread start");

                bool localRunBlockReversalThread = true;

                this._stroke     = this.GetReplayKeyStroke();
                int oldBlockstun = 0;

                while (localRunBlockReversalThread && !this._process.HasExited)
                {
                    try
                    {
                        int blockStun = this.GetBlockstun(2);

                        if (slotInput.WakeupFrameIndex + 2 == blockStun && oldBlockstun != blockStun)
                        {
                            this.PlayReversal();

                            Thread.Sleep(32);
                        }

                        oldBlockstun = blockStun;

                        Thread.Sleep(10);     //check about twice by frame
                    }
                    catch (Exception ex)
                    {
                        LogManager.Instance.WriteException(ex);
                        StopBlockReversalLoop();
                        BlockReversalLoopErrorOccured?.Invoke(ex);
                        return;
                    }

                    lock (RunBlockReversalThreadLock)
                    {
                        localRunBlockReversalThread = _runBlockReversalThread;
                    }

                    Thread.Sleep(1);
                }


                LogManager.Instance.WriteLine("Block Reversal Thread ended");
            })
            {
                Name = "blockReversalThread"
            };

            blockReversalThread.Start();

            this.BringWindowToFront();
        }
예제 #3
0
        public void SendKey(
            Keyboard.DirectXKeyStrokes key,
            bool KeyUp,
            Keyboard.InputType inputType)
        {
            uint num1 = !KeyUp ? 8U : 10U;

            Keyboard.Input[] pInputs = new Keyboard.Input[1]
            {
                new Keyboard.Input()
                {
                    type = (int)inputType,
                    u    = new Keyboard.InputUnion()
                    {
                        ki = new Keyboard.KeyboardInput()
                        {
                            wVk         = (ushort)0,
                            wScan       = (ushort)key,
                            dwFlags     = num1,
                            dwExtraInfo = Keyboard.GetMessageExtraInfo()
                        }
                    }
                }
            };
            int num2 = (int)Keyboard.SendInput((uint)pInputs.Length, pInputs, Marshal.SizeOf(typeof(Keyboard.Input)));
        }
예제 #4
0
        private void HandleKeyDown(string message, int keyCode)
        {
            // if (stopKeyInput == true)
            //   return;

            if (GameInput.Windows2DirectXInputs.ContainsKey(keyCode))
            {
                Keyboard.DirectXKeyStrokes key = GameInput.Windows2DirectXInputs[keyCode];

                if (!KeyDownLog.ContainsKey(key) || KeyDownLog[key] <= 0)
                {
                    KeyDownLog[key] = 1;

                    if (GVCommand.gvSetup.gameName == "FORNITE")
                    {
                        Keyboard.DirectXKeyStrokes okey = GVCommand.KeySwitchPairing(key);
                        if (okey != Keyboard.DirectXKeyStrokes.DIK_NULL)
                        {
                            SimulateKeyUp(okey);
                        }
                    }

                    //  System.Console.Beep();
#if DEBUG
                    Console.WriteLine("----- External key down Pressed--------" + key.ToString());
#endif
                    //  Keyboard.SendKey(key, Keyboard.KEY_DOWN, Keyboard.InputType.Keyboard);
                }
            }
        }
예제 #5
0
        private void HandleKeyUp(string message, int keyCode)
        {
            // if (stopKeyInput == true)
            //     return;
            if (keyCode == 20)
            {
                this.Invoke(new Action(() =>
                {
                    StopAllAction();
                }));
            }
            else if (GameInput.Windows2DirectXInputs.ContainsKey(keyCode))
            {
                Keyboard.DirectXKeyStrokes key = GameInput.Windows2DirectXInputs[keyCode];
                // CAP LOCK PRESS

                if (KeyDownLog.ContainsKey(key) && KeyDownLog[key] > 0)
                {
                    // KeyDownLog.Remove(key) ;
                    KeyDownLog[key] = 0;

                    // System.Console.Beep();
#if DEBUG
                    Console.WriteLine("----- External key up Pressed--------" + key.ToString());
#endif
                    //Keyboard.SendKey(key, Keyboard.KEY_UP, Keyboard.InputType.Keyboard);
                }
            }
        }
예제 #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _reversalTool = new ReversalTool();

            _reversalTool.AttachToProcess();

            this._stroke = _reversalTool.GetReplayKeyStroke();
        }
예제 #7
0
        public void StartReversalLoop(SlotInput slotInput)
        {
            lock (RunReversalThreadLock)
            {
                _runReversalThread = true;
            }

            Thread reversalThread = new Thread(() =>
            {
                LogManager.Instance.WriteLine("Reversal Thread start");
                var currentDummy            = GetDummy();
                bool localRunReversalThread = true;

                this._stroke = this.GetReplayKeyStroke();

                while (localRunReversalThread && !this._process.HasExited)
                {
                    try
                    {
                        int wakeupTiming = GetWakeupTiming(currentDummy);


                        if (wakeupTiming != 0)
                        {
                            WaitAndReversal(slotInput, wakeupTiming);
                        }
                    }
                    catch (Exception ex)
                    {
                        LogManager.Instance.WriteException(ex);
                        StopReversalLoop();
                        ReversalLoopErrorOccured?.Invoke(ex);
                        return;
                    }

                    lock (RunReversalThreadLock)
                    {
                        localRunReversalThread = _runReversalThread;
                    }

                    Thread.Sleep(1);
                }


                LogManager.Instance.WriteLine("Reversal Thread ended");
            })
            {
                Name = "reversalThread"
            };

            reversalThread.Start();

            this.BringWindowToFront();
        }
예제 #8
0
        private void WaitAndReversal(SlotInput slotInput, int wakeupTiming, Keyboard.DirectXKeyStrokes stroke)
        {
            int fc     = FrameCount();
            var frames = wakeupTiming - slotInput.WakeupFrameIndex - 1;

            while (FrameCount() < fc + frames)
            {
            }
            PlayReversal(stroke);

            Thread.Sleep(320); //20 frames, approximately, it's actually 333.333333333 ms.  Nobody should be able to be knocked down and get up in this time, causing the code to execute again.
        }
예제 #9
0
        private void SaveKeybinds()
        {
            //set keybind data
            enginePowerKey     = (Keyboard.DirectXKeyStrokes)enginePowerKeybind.SelectedItem;
            weaponPowerKey     = (Keyboard.DirectXKeyStrokes)weaponPowerKeybind.SelectedItem;
            shieldPowerKey     = (Keyboard.DirectXKeyStrokes)shieldPowerKeybind.SelectedItem;
            balancePowerKey    = (Keyboard.DirectXKeyStrokes)balancePowerKeybind.SelectedItem;
            counterKey         = (Keyboard.DirectXKeyStrokes)countermeasureKeybind.SelectedItem;
            forwardShieldKey   = (Keyboard.DirectXKeyStrokes)forwardShieldKeybind.SelectedItem;
            rearShieldKey      = (Keyboard.DirectXKeyStrokes)rearShieldKeybind.SelectedItem;
            balanceShieldKey   = (Keyboard.DirectXKeyStrokes)balanceShieldKeybind.SelectedItem;
            cycleTargetsKey    = (Keyboard.DirectXKeyStrokes)cycleKeybind.SelectedItem;
            targetAttackerKey  = (Keyboard.DirectXKeyStrokes)targetAttackerKeybind.SelectedItem;
            targetAlliesKey    = (Keyboard.DirectXKeyStrokes)targetAlliesKeybind.SelectedItem;
            targetHostilesKey  = (Keyboard.DirectXKeyStrokes)targetHostilesKeybind.SelectedItem;
            targetSystemsKey   = (Keyboard.DirectXKeyStrokes)targetSystemsKeybind.SelectedItem;
            targetAIKey        = (Keyboard.DirectXKeyStrokes)targetAIKeybind.SelectedItem;
            targetsFollowerKey = (Keyboard.DirectXKeyStrokes)targetsFollowerKeybind.SelectedItem;
            targetMissilesKey  = (Keyboard.DirectXKeyStrokes)targetMissilesKeybind.SelectedItem;
            pingKey            = (Keyboard.DirectXKeyStrokes)pingKeybind.SelectedItem;
            acknowledgeKey     = (Keyboard.DirectXKeyStrokes)acknowledgeKeybind.SelectedItem;
            modKey             = (Keyboard.DirectXKeyStrokes)modKeyKeybind.SelectedItem;

            //save to application settings file
            Properties.Settings.Default.enginePowerKey  = enginePowerKey.ToString();
            Properties.Settings.Default.weaponPowerKey  = weaponPowerKey.ToString();
            Properties.Settings.Default.shieldPowerKey  = shieldPowerKey.ToString();
            Properties.Settings.Default.balancePowerKey = balancePowerKey.ToString();
            Properties.Settings.Default.counterKey      = counterKey.ToString();
            Properties.Settings.Default.fShieldKey      = forwardShieldKey.ToString();
            Properties.Settings.Default.rShieldKey      = rearShieldKey.ToString();
            Properties.Settings.Default.bShieldKey      = balanceShieldKey.ToString();

            Properties.Settings.Default.cycleKey    = cycleTargetsKey.ToString();
            Properties.Settings.Default.attackerKey = targetAttackerKey.ToString();
            Properties.Settings.Default.alliesKey   = targetAlliesKey.ToString();
            Properties.Settings.Default.hostilesKey = targetHostilesKey.ToString();
            Properties.Settings.Default.systemsKey  = targetSystemsKey.ToString();
            Properties.Settings.Default.AIKey       = targetAIKey.ToString();
            Properties.Settings.Default.followerKey = targetsFollowerKey.ToString();
            Properties.Settings.Default.missileKey  = targetMissilesKey.ToString();
            Properties.Settings.Default.pingKey     = pingKey.ToString();
            Properties.Settings.Default.ackKey      = acknowledgeKey.ToString();
            Properties.Settings.Default.modKey      = modKey.ToString();
            Properties.Settings.Default.Save();

            changesMade = false;
            MessageBox.Show("Keybinds saved.");
        }
예제 #10
0
 public static Key ToInputKey(this Keyboard.DirectXKeyStrokes key)
 {
     return(key switch
     {
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD0 => Key.NumPad0,
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD1 => Key.NumPad1,
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD2 => Key.NumPad2,
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD3 => Key.NumPad3,
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD4 => Key.NumPad4,
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD5 => Key.NumPad5,
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD6 => Key.NumPad6,
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD7 => Key.NumPad7,
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD8 => Key.NumPad8,
         Keyboard.DirectXKeyStrokes.DIK_NUMPAD9 => Key.NumPad9,
         _ => Key.None
     });
예제 #11
0
        public void PlayReversal(Keyboard.DirectXKeyStrokes stroke)
        {
            LogManager.Instance.WriteLine("Reversal!");

            BringWindowToFront();
            Keyboard keyboard = new Keyboard();


            keyboard.SendKey(stroke, false, Keyboard.InputType.Keyboard);
            Thread.Sleep(150);
            keyboard.SendKey(stroke, true, Keyboard.InputType.Keyboard);



            LogManager.Instance.WriteLine("Reversal Done!");
        }
예제 #12
0
        private void SimulateKeyUp(Keyboard.DirectXKeyStrokes key)
        {
            if (stopKeyInput == true)
            {
                return;
            }

            if (KeyDownLog.ContainsKey(key) && KeyDownLog[key] > 0)
            {
#if DEBUG
                Console.WriteLine("----- SimulateKeyUp--------" + key.ToString());
#endif
                Keyboard.SendKey(key, Keyboard.KEY_UP);
                //KeyDownLog.Remove(key);
            }
        }
예제 #13
0
        private void SimulateKeyDown(Keyboard.DirectXKeyStrokes key)
        {
            if (stopKeyInput == true)
            {
                return;
            }

            if (!KeyDownLog.ContainsKey(key) || KeyDownLog[key] <= 0)
            {
#if DEBUG
                Console.WriteLine("----- SimulateKeyDown--------" + key.ToString());
#endif
                Keyboard.SendKey(key, Keyboard.KEY_DOWN);
                //KeyDownLog[key] = 1;
            }
        }
예제 #14
0
        private void SimulateKeyPress(Keyboard.DirectXKeyStrokes key)
        {
            if (stopKeyInput == true)
            {
                return;
            }

            if (!KeyDownLog.ContainsKey(key) || KeyDownLog[key] == 0)
            {
#if DEBUG
                Console.WriteLine("----- SimulateKeyPress--------" + key.ToString());
#endif
                Keyboard.SendKey(key, Keyboard.KEY_DOWN);
                System.Threading.Thread.Sleep(Properties.Settings.Default.KeyPressSpeed);
                Keyboard.SendKey(key, Keyboard.KEY_UP);
            }
        }
예제 #15
0
 //can be called externally, so that we don't have to open a keybind window to get these.
 public void SetKeybindDataFromFile()
 {
     enginePowerKey     = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.enginePowerKey, false);
     weaponPowerKey     = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.weaponPowerKey, false);
     shieldPowerKey     = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.shieldPowerKey, false);
     balancePowerKey    = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.balancePowerKey, false);
     counterKey         = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.counterKey, false);
     forwardShieldKey   = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.fShieldKey, false);
     rearShieldKey      = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.rShieldKey, false);
     balanceShieldKey   = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.bShieldKey, false);
     cycleTargetsKey    = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.cycleKey, false);
     targetAttackerKey  = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.attackerKey, false);
     targetAlliesKey    = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.alliesKey, false);
     targetHostilesKey  = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.hostilesKey, false);
     targetSystemsKey   = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.systemsKey, false);
     targetAIKey        = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.AIKey, false);
     targetsFollowerKey = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.followerKey, false);
     targetMissilesKey  = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.missileKey, false);
     pingKey            = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.pingKey, false);
     acknowledgeKey     = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.ackKey, false);
     modKey             = (Keyboard.DirectXKeyStrokes)Enum.Parse(typeof(Keyboard.DirectXKeyStrokes), Properties.Settings.Default.modKey, false);
 }
예제 #16
0
        private void SimulateKeyAllup()
        {
            if (stopKeyInput == true)
            {
                return;
            }

            List <Keyboard.DirectXKeyStrokes> keys = new List <Keyboard.DirectXKeyStrokes>(KeyDownLog.Keys);

            stopKeyInput = true;

            try
            {
                if (KeyDownLog.Count > 0 && KeyDownLog != null)
                {
                    for (int i = 0; i < keys.Count; i++)
                    {
                        Keyboard.DirectXKeyStrokes key = keys[i];

                        if (KeyDownLog[key] > 0)
                        {
                            KeyDownLog[key] = 0;
#if DEBUG
                            Console.WriteLine("SimulateKeyAllup, {0} count = {1}", key, KeyDownLog[key]);
#endif
                            Keyboard.SendKey(key, Keyboard.KEY_UP);
                        }
                    }
                    //KeyDownLog.Clear();
                }
            } catch (Exception ex)
            {
                System.Console.WriteLine(ex);
            }
            stopKeyInput = false;
        }
예제 #17
0
        // The opposing keys that must be release e.g LEFT - RIGHT key are mutually exclusive.
        // TODO: This should be defined in the XML, as this is hardcoded to handle specific keys
        //       which is wrong.
        //       Should use the action name not the key input e.g. "MOVE RIGHT", "MOVE LEFT"
        public static Keyboard.DirectXKeyStrokes KeySwitchPairing(Keyboard.DirectXKeyStrokes key)
        {
            Keyboard.DirectXKeyStrokes okey = Keyboard.DirectXKeyStrokes.DIK_NULL;
            string c = key.ToString();
            string o = "";

            c = c.Replace("DIK_", "");

            switch (c)
            {
            case "A": o = "D"; break;

            case "D": o = "A"; break;

            case "S": o = "W"; break;
            }

            if (GameInput.Inputs.ContainsKey(o))
            {
                okey = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[o];
            }

            return(okey);
        }
예제 #18
0
 private void balanceShieldKeybind_SelectedIndexChanged(object sender, EventArgs e)
 {
     balancePowerKey = (Keyboard.DirectXKeyStrokes)balanceShieldKeybind.SelectedItem;
 }
예제 #19
0
 private void cycleKeybind_SelectedIndexChanged(object sender, EventArgs e)
 {
     cycleTargetsKey = (Keyboard.DirectXKeyStrokes)cycleKeybind.SelectedItem;
 }
예제 #20
0
 private void acknowledgeKeybind_SelectedIndexChanged(object sender, EventArgs e)
 {
     acknowledgeKey = (Keyboard.DirectXKeyStrokes)acknowledgeKeybind.SelectedItem;
 }
예제 #21
0
 private void enginePowerKeybind_SelectedIndexChanged(object sender, EventArgs e)
 {
     enginePowerKey = (Keyboard.DirectXKeyStrokes)enginePowerKeybind.SelectedItem;
 }
예제 #22
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // GVCommand.InitData(true, GVCommand.TESTDATA_CONFIG_GEN_FORNITE);
            GVCommand.InitData(false);

            //GVCommand.LoadGVSetup();

            Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs["ESCAPE"];
#if DEBUG
            //   isDebug = true;
            Console.WriteLine("Debug version");
#endif

            Hookkeys.handlerKeyDown += HandleKeyDown;
            Hookkeys.handlerKeyUp   += HandleKeyUp;

            this.TopMost = true; // checkBoxTopmost.Checked = Properties.Settings.Default.TopMost;

            if (GVCommand.gvSetup == null || GVCommand.gvSetup.gameName == null)
            {
                MessageBox.Show("GVC configuration was not loaded....", "Error");
                Application.Exit();
                Application.ExitThread();
                return;
                //Environment.Exit();
            }

            if (GVCommand.gvSetup.gameName == "FORNITE")
            {
                wordLastBuild  = GVCommand.ActionToWord["WALL"];
                wordLastWeapon = GVCommand.ActionToWord["HARVESTING TOOL"];
            }

            BuildSpeechRecognized();

            timerJump.Interval = new TimeSpan(TIMER_MI * Properties.Settings.Default.AutoJumpSpeed);
            timerJump.Tick     = new EventHandler(TimerJump_Elapsed);
            timerJump.Stop();

            timerBuild.Interval = new TimeSpan(TIMER_MI * Properties.Settings.Default.AutoBuildSpeed);
            timerBuild.Tick     = new EventHandler(TimerBuild_Elapsed);
            timerBuild.Stop();

            timerDodge.Interval = new TimeSpan(TIMER_MI * Properties.Settings.Default.AutoDodgeSpeed);
            timerDodge.Tick     = new EventHandler(TimerDodge_Elapsed);
            timerDodge.Stop();

            timerFire.Interval = new TimeSpan(TIMER_MI * Properties.Settings.Default.AutoFireSpeed);
            timerFire.Tick     = new EventHandler(TimerFire_Elapsed);
            timerFire.Stop();

            timerWindowsChecker.Interval = new TimeSpan(TIMER_MI * 300);
            timerWindowsChecker.Tick     = new EventHandler(CheckActiveWindowd);
            timerWindowsChecker.Start();

            timerWordOkay.Interval = new TimeSpan(TIMER_MI * 100);
            timerWordOkay.Tick     = new EventHandler(TimerWordOkay_Elapsed);
            timerWordOkay.Stop();

            labelAction.BackColor = Color.FromArgb(0, 200, 0);
            labelAction.Text      = "";
        }
        public void StartRandomBurstLoop(int min, int max, int replaySlot, int burstPercentage)
        {
            lock (RunRandomBurstThreadLock)
            {
                _runRandomBurstThread = true;
            }

            Thread randomBurstThread = new Thread(() =>
            {
                LogManager.Instance.WriteLine("RandomBurst Thread start");
                bool localRunRandomBurstThread = true;

                var slotInput = new SlotInput("!5HD");
                SetInputInSlot(replaySlot, slotInput);

                Random rnd = new Random();

                int valueToBurst = rnd.Next(min, max + 1);
                bool willBurst   = rnd.Next(0, 101) <= burstPercentage;

                this._stroke = this.GetReplayKeyStroke();


                while (localRunRandomBurstThread && !this._process.HasExited)
                {
                    try
                    {
                        int currentCombo = GetCurrentComboCount(1);



                        while (currentCombo > 0)
                        {
                            if (currentCombo == valueToBurst && willBurst)
                            {
                                PlayReversal();
                                Thread.Sleep(850); //50 frames, approximately, Burst recovery is around 50f.
                            }

                            currentCombo = GetCurrentComboCount(1);

                            if (currentCombo == 0)
                            {
                                valueToBurst = rnd.Next(min, max + 1);
                                willBurst    = rnd.Next(0, 101) <= burstPercentage;
                            }
                            Thread.Sleep(1);
                        }


                        lock (RunRandomBurstThreadLock)
                        {
                            localRunRandomBurstThread = _runRandomBurstThread;
                        }
                        Thread.Sleep(1);
                    }
                    catch (Exception ex)
                    {
                        LogManager.Instance.WriteException(ex);
                        StopRandomBurstLoop();
                        RandomBurstlLoopErrorOccured?.Invoke(ex);
                        return;
                    }
                }

                LogManager.Instance.WriteLine("RandomBurst Thread ended");
            })
            {
                Name = "randomBurstThread"
            };

            randomBurstThread.Start();

            this.BringWindowToFront();
        }
예제 #24
0
 private void rearShieldKeybind_SelectedIndexChanged(object sender, EventArgs e)
 {
     rearShieldKey = (Keyboard.DirectXKeyStrokes)rearShieldKeybind.SelectedItem;
 }
예제 #25
0
 private void targetMissilesKeybind_SelectedIndexChanged(object sender, EventArgs e)
 {
     targetMissilesKey = (Keyboard.DirectXKeyStrokes)targetMissilesKeybind.SelectedItem;
 }
예제 #26
0
        private void Action(string action)
        {
            if (action == "")
            {
                return;
            }

            //if(/  if (isFornite == false && action != "STOP")
            //  {
            //      System.Console.WriteLine("TEST MODE: Action requested = " + action);
            //      return;
            //k  }

            switch (action)
            {
            case "STOP":
                StopAllAction();
                return;

            case "MOVE LEFT":
            {
                List <string> keys             = GVCommand.ActionToKeys["MOVE RIGHT"];
                Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[0]];
                SimulateKeyUp(key);
            }
            break;

            case "MOVE RIGHT":
            {
                List <string> keys             = GVCommand.ActionToKeys["MOVE LEFT"];
                Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[0]];
                SimulateKeyUp(key);
            }
            break;

            case "MOVE FORWARD":
            {
                List <string> keys             = GVCommand.ActionToKeys["MOVE BACKWARD"];
                Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[0]];
                SimulateKeyUp(key);
            }
            break;

            case "MOVE BACKWARD":
            {
                List <string> keysOdd             = GVCommand.ActionToKeys["MOVE BACKWARD"];
                Keyboard.DirectXKeyStrokes keyOdd = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keysOdd[0]];

                if (!KeyDownLog.ContainsKey(keyOdd) || KeyDownLog[keyOdd] <= 0)
                {
                    List <string> keys             = GVCommand.ActionToKeys["MOVE FORWARD"];
                    Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[0]];
                    SimulateKeyUp(key);
                }
                else
                {
                    return;
                }
            }
            break;

            case "AUTO FIRE ON":
                //timerFire.Enabled = true;
                timerFire.Start();
                buidFireFlipflop = true;
                break;

            case "AUTO FIRE OFF":
                //timerFire.Enabled = false;
                timerFire.Stop();
                break;

            case "AUTO JUMP ON":
            {
                // timerJump.Enabled = true;
                timerJump.Start();
                // List<string> keys = GVCommand.ActionToKeys["MOVE FORWARD"];
                //Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[0]];
                //SimulateKeyUp(key);
            }
            break;

            case "JUMP":
            {
                if (timerJump.IsEnabled == true)
                {
                    //timerJump.Enabled = false;
                    timerJump.Stop();
                    List <string> keys             = GVCommand.ActionToKeys["MOVE FORWARD"];
                    Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[0]];
                    SimulateKeyUp(key);
                    SimulateKeyPress(key);
                }
            }
            break;

            case "AUTO JUMP OFF":
            {
                //timerJump.Enabled = false;
                timerJump.Stop();
            }
            break;


            case "AUTO BUILD ON":
            {
                buidFireFlipflop = true;
                // timerBuild.Enabled = true;
                timerBuild.Start();
            }
            break;

            case "AUTO BUILD OFF":
            {
                //timerBuild.Enabled = false;
                timerBuild.Stop();
                //if(timerBuild.IsEnabled == false)
                if (wordLastWeapon != "")
                {
                    WordToAction(wordLastWeapon);
                }
            }
            break;


            case "GHOST ON":
            {
                timerDodge.Interval = new TimeSpan(TIMER_MI / 2);

                if (timerDodge.IsEnabled == false)
                {
                    autoDodgeAction = "LEFT";
                    // timerDodge.Enabled = true;
                    timerDodge.Start();
                }
            }
            break;

            case "AUTO DODGE ON":
            {
                timerDodge.Interval = new TimeSpan(TIMER_MI * Properties.Settings.Default.AutoDodgeSpeed);

                if (timerDodge.IsEnabled == false)
                {
                    autoDodgeAction = "LEFT";
                    // timerDodge.Enabled = true;
                    timerDodge.Start();
                }
            }
            break;

            case "GHOST OFF":
            case "AUTO DODGE OFF":
            {
                if (timerDodge.IsEnabled == true)
                {
                    //timerDodge.Enabled = false;
                    timerDodge.Stop();

                    List <string> keys             = GVCommand.ActionToKeys["MOVE LEFT"];
                    Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[0]];
                    SimulateKeyUp(key);

                    keys = GVCommand.ActionToKeys["MOVE RIGHT"];
                    key  = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[0]];
                    SimulateKeyUp(key);
                }
            }
            break;

            case "LASTWEAPON":
                if (timerBuild.IsEnabled == false)
                {
                    if (wordLastWeapon != "")
                    {
                        WordToAction(wordLastWeapon);
                    }
                }
                break;

            case "BUILD FORT":
            {        /*
                      * Mouse.Move(0, 600);
                      * Action("WALL");
                      * List<string> keys = GVCommand.ActionToKeys["MOVE FORWARD"];
                      * Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[0]];
                      * SimulateKeyDown(key);
                      * System.Threading.Thread.Sleep(Properties.Settings.Default.KeyPressSpeed + 1000);
                      * SimulateKeyUp(key);
                      * Mouse.Move(200, 0);
                      * Action("WALL");
                      * // Mouse.Move(100, 500);
                      * // Action("WALL");
                      * //Mouse.Move(1, 0);
                      * // Action("WALL");*/
                break;
            }
            }

            labelAction.BackColor = Color.Red;
            labelAction.Text      = action;
            //timerWordOkay.Enabled = true;
            timerWordOkay.Start();

            ActionExec(action);

            /*
             *  switch (action)
             *  {
             *  case "WALL":
             *  case "FLOOR":
             *  case "STAIRS":
             *  case "ROOF":
             *      break;
             *  }
             */
        }
예제 #27
0
        private void ActionExec(string action)
        {
            if (!GVCommand.ActionToKeys.ContainsKey(action))
            {
                return;
            }

            List <string> keys          = GVCommand.ActionToKeys[action];
            List <string> keyBehaviours = GVCommand.ActionkeyBehaviours[action];

            for (var k = 0; k < keys.Count; k++)
            {
                String stype = GameInput.Inputs[keys[k]].GetType().ToString();

                if (stype == "GameVoiceControl.Mouse+Button")
                {
                    Mouse.Button button = (Mouse.Button)GameInput.Inputs[keys[k]];

#if DEBUG
                    System.Console.WriteLine("MOUSE=================");
#endif

                    if (keyBehaviours[k].ToUpper() == "DOWN")
                    {
                    }
                    if (keyBehaviours[k].ToUpper() == "PRESS" || keyBehaviours[k].ToUpper() == "CLICK")
                    {
                        Mouse.Click(button);
                    }

                    if (keyBehaviours[k].ToUpper() == "UP")
                    {
                    }
                }
                else if (stype == "GameVoiceControl.Keyboard+DirectXKeyStrokes")
                {
                    Keyboard.DirectXKeyStrokes key = (Keyboard.DirectXKeyStrokes)GameInput.Inputs[keys[k]];

                    if (keyBehaviours[k].ToUpper() == "DOWN")
                    {
                        SimulateKeyDown(key);
                    }
                    if (keyBehaviours[k].ToUpper() == "PRESS")
                    {
                        SimulateKeyPress(key);
                    }

                    if (keyBehaviours[k].ToUpper() == "UP")
                    {
                        SimulateKeyUp(key);
                    }
                }
                else if (stype == "GameVoiceControl.GameInput+ActionsInput")
                {
                    string nextAction = keys[k];

#if DEBUG
                    System.Console.WriteLine("Action next = {0}.", nextAction);
#endif
                    Action(nextAction);
                }
            }
        }
예제 #28
0
 private void modKeyKeybind_SelectedIndexChanged(object sender, EventArgs e)
 {
     modKey = (Keyboard.DirectXKeyStrokes)modKeyKeybind.SelectedItem;
 }
        public void StartWakeupReversalLoop(SlotInput slotInput, int wakeupReversalPercentage)
        {
            lock (RunReversalThreadLock)
            {
                _runReversalThread = true;
            }

            Thread reversalThread = new Thread(() =>
            {
                LogManager.Instance.WriteLine("Reversal Thread start");
                var currentDummy            = GetDummy();
                bool localRunReversalThread = true;

                Random rnd = new Random();

                bool willReversal = rnd.Next(0, 101) <= wakeupReversalPercentage;

                this._stroke = this.GetReplayKeyStroke();

                while (localRunReversalThread && !this._process.HasExited)
                {
                    try
                    {
                        int wakeupTiming = GetWakeupTiming(currentDummy);


                        if (wakeupTiming != 0)
                        {
                            int fc     = FrameCount();
                            var frames = wakeupTiming - slotInput.ReversalFrameIndex - 1;
                            while (FrameCount() < fc + frames)
                            {
                            }

                            if (willReversal)
                            {
                                PlayReversal();
                            }
                            willReversal = rnd.Next(0, 101) <= wakeupReversalPercentage;


                            Thread.Sleep(16); // ~1 frame
                            //Thread.Sleep(320); //20 frames, approximately, it's actually 333.333333333 ms.  Nobody should be able to be knocked down and get up in this time, causing the code to execute again.
                        }
                    }
                    catch (Exception ex)
                    {
                        LogManager.Instance.WriteException(ex);
                        StopReversalLoop();
                        ReversalLoopErrorOccured?.Invoke(ex);
                        return;
                    }

                    lock (RunReversalThreadLock)
                    {
                        localRunReversalThread = _runReversalThread;
                    }

                    Thread.Sleep(1);
                }


                LogManager.Instance.WriteLine("Reversal Thread ended");
            })
            {
                Name = "reversalThread"
            };

            reversalThread.Start();

            this.BringWindowToFront();
        }
예제 #30
0
 private void countermeasureKeybind_SelectedIndexChanged(object sender, EventArgs e)
 {
     counterKey = (Keyboard.DirectXKeyStrokes)countermeasureKeybind.SelectedItem;
 }