示例#1
0
        // private
        #region keyboardHookProc, mouseHookProc 콜백 구현
        IntPtr keyboardHookProc(int code, IntPtr wParam, ref keyboardHookStruct lParam)
        {
            if (code >= 0)
            {
                if (0 == (lParam.flags & LLKHF_INJECTED))
                {
                    llKeyEventArgs kea = new llKeyEventArgs(KeyInterop.KeyFromVirtualKey(lParam.vkCode));
                    if (wParam == (IntPtr)WM_KEYDOWN || wParam == WM_SYSKEYDOWN)
                    {
                        KeyDown(this, kea);
                    }
                    else if (wParam == WM_KEYUP || wParam == WM_SYSKEYUP)
                    {
                        KeyUp(this, kea);
                    }
                    if (kea.Handled)
                    {
                        return((IntPtr)1);
                    }
                }
                else
                {
                    lParam.flags ^= LLKHF_INJECTED;
                }
            }

            return(NativeMethods.CallNextHook(keyboardHook, code, wParam, ref lParam));
        }
示例#2
0
 // mapper 이벤트 핸들링
 void onPowerKeyDown(object sender, llKeyEventArgs e)
 {
     /// 부팅버튼
     /// 부작용 인정 안함
     if (Keys.Power == e.Key)
     {
         Active    = !Active;
         e.Handled = true;
     }
 }
示例#3
0
        void onKeyUp(object sender, llKeyEventArgs e)
        {
            #region 탈출조건
            // Alt+Tab 일때
            if (0 != (Keyboard.Modifiers & ModifierKeys.Alt) && (Key.F4 == e.Key || Key.Tab == e.Key))
            {
                return;
            }
            // 일시정지상태 일때
            if (Pause)
            {
                return;
            }
            #endregion

            switch (e.Key)
            {
                #region 상점, 성배, 창고, 특성
            case Keys.Purchase:
            case Keys.HolyGrail:
            case Keys.Storage:
            case Keys.Attribute:
                if ((FocusPosition)e.Key == Focus)
                {
                    Focus     = FocusPosition.Servant;
                    e.Handled = true;
                }
                return;

                #endregion

                #region 오토마우스
            case Keys.AutoMouse:
                AutoMouse = false;
                e.Handled = true;
                return;

                #endregion
            }
        }
示例#4
0
        void onKeyDown(object sender, llKeyEventArgs e)
        {
            #region 사전처리
            if (Keys.Pause == e.Key)
            {
                Pause = !Pause;
                return;
            }
            #endregion
            #region 탈출조건
            // Alt+Tab, Alt+F4 일때 : 시스템 비활성화
            if (0 != (Keyboard.Modifiers & ModifierKeys.Alt) && (Key.F4 == e.Key || Key.Tab == e.Key))
            {
                Active = false;
                return;
            }

            // 일시정지상태 일때
            if (Pause)
            {
                return;
            }
            #endregion

            Key reservedKey;
            switch (e.Key)
            {
                #region 상점, 성배, 창고, 특성
            case Keys.Purchase:
            case Keys.HolyGrail:
            case Keys.Storage:
            case Keys.Attribute:
                if (e.Key == (Key)Focus)
                {
                    e.Handled = true;
                }
                else if (FocusPosition.Servant != Focus)
                {
                    return;
                }

                Focus     = (FocusPosition)e.Key;
                e.Handled = true;
                return;

                #endregion

                #region 령주
            case Keys.Command1: reservedKey = Key.Q; goto Command;

            case Keys.Command2: reservedKey = Key.W; goto Command;

            case Keys.Command3: reservedKey = Key.E; goto Command;

            case Keys.Command4: reservedKey = Key.R; goto Command;

            case Keys.Command5: reservedKey = Key.A; goto Command;

            case Keys.Command6: reservedKey = Key.S; goto Command;
Command:
                if (CommandEnabled)
                {
                    lock (mapper)
                    {
                        llInputManager.ProcessKey(Key.F3);
                        Thread.Sleep(KeyDelay);
                        llInputManager.ProcessInput(
                            new Input(Key.F, InputState.Down),
                            new Input(Key.F, InputState.Up),
                            new Input(reservedKey, InputState.Down),
                            new Input(reservedKey, InputState.Up));
                        if (Keys.Command6 != e.Key)
                        {
                            llInputManager.ProcessKey(Key.F1);
                        }
                    }
                    e.Handled = true;
                }
                return;

                #endregion



                #region 서번트
            case Keys.Servant:
                llInputManager.ProcessInput(
                    new Input(Key.F1, InputState.Down),
                    new Input(Key.F1, InputState.Up),
                    new Input(Key.F1, InputState.Down),
                    new Input(Key.F1, InputState.Up));
                e.Handled = true;
                return;

                #endregion

                #region 스마트 캐스팅 토글
            case Keys.SmartCastingToggle:
                SmartCastingToggle = !SmartCastingToggle;
                e.Handled          = true;
                return;

                #endregion
                #region 스킬·아이템, 어빌리티 투자, 스마트 캐스팅, 셀프 캐스팅
            case Keys.Item1: reservedKey = Key.NumPad1; goto SmartCasting_SelfCasting;

            case Keys.Item2: reservedKey = Key.NumPad2; goto SmartCasting_SelfCasting;

            case Keys.Item4: reservedKey = Key.NumPad4; goto SmartCasting_SelfCasting;

            case Keys.Item5: reservedKey = Key.NumPad5; goto SmartCasting_SelfCasting;

            case Keys.Item7: reservedKey = Key.NumPad7; goto SmartCasting_SelfCasting;

            case Keys.Item8: reservedKey = Key.NumPad8; goto SmartCasting_SelfCasting;

            case Keys.SkillD: reservedKey = Key.D; goto SmartCasting_SelfCasting;

            case Keys.SkillF: reservedKey = Key.F; goto SmartCasting_SelfCasting;

            case Keys.SkillG: reservedKey = Key.G; goto SmartCasting_SelfCasting;

            case Keys.SkillQ: reservedKey = Key.Q; goto SmartCasting_SelfCasting;

            case Keys.SkillW: reservedKey = Key.W; goto SmartCasting_SelfCasting;

            case Keys.SkillE: reservedKey = Key.E; goto SmartCasting_SelfCasting;

            case Keys.SkillR: reservedKey = Key.R; goto SmartCasting_SelfCasting;

            case Keys.Stats: reservedKey = Key.B; goto AbilityPoint;

SmartCasting_SelfCasting:
                if (FocusPosition.Servant != Focus)
                {
                    return;
                }
                #region 처리
                if (SmartCastingToggle)
                {
                    lock (mapper)
                    {
                        llInputManager.ProcessInput(
                            new Input(reservedKey, InputState.Down),
                            new Input(reservedKey, InputState.Up));
                        Thread.Sleep(KeyDelay);
                        llInputManager.ProcessInput(
                            new Input(MouseButton.Left, InputState.Down),
                            new Input(MouseButton.Left, InputState.Up),
                            new Input(Key.Escape, InputState.Down),
                            new Input(Key.Escape, InputState.Up));
                    }
                    e.Handled = true;
                    return;
                }
                if (SmartCastingEnabled)
                {
                    if (Keyboard.IsKeyDown(Keys.SmartCasting))
                    {
                        lock (mapper)
                        {
                            llInputManager.ProcessInput(
                                new Input(Keys.SmartCasting, InputState.Up),
                                new Input(reservedKey, InputState.Down),
                                new Input(reservedKey, InputState.Up));
                            Thread.Sleep(KeyDelay);
                            llInputManager.ProcessInput(
                                new Input(MouseButton.Left, InputState.Down),
                                new Input(MouseButton.Left, InputState.Up),
                                new Input(Key.Escape, InputState.Down),
                                new Input(Key.Escape, InputState.Up),
                                new Input(Keys.SmartCasting, InputState.Down));
                        }
                        e.Handled = true;
                        return;
                    }
                }
                if (Keyboard.IsKeyDown(Keys.SelfCasting))
                {
                    // TODO 셀프캐스팅 완성
                    e.Handled = true;
                    return;
                }
                #endregion
                #region 검사지점
                switch (e.Key)
                {
                case Keys.Item1:
                case Keys.Item2:
                case Keys.Item4:
                case Keys.Item5:
                case Keys.Item7:
                case Keys.Item8:
                case Keys.SkillD:
                case Keys.SkillF:
                case Keys.SkillG:
                    goto NormalCasting;
                }
                #endregion
AbilityPoint:
                #region 처리
                if (Keyboard.IsKeyDown(Keys.AbilityPoint))
                {
                    llInputManager.ProcessInput(
                        new Input(Keys.AbilityPoint, InputState.Up),
                        new Input(Key.O, InputState.Down),
                        new Input(Key.O, InputState.Up),
                        new Input(reservedKey, InputState.Down),
                        new Input(reservedKey, InputState.Up),
                        new Input(Key.Escape, InputState.Down),
                        new Input(Key.Escape, InputState.Up),
                        new Input(Keys.AbilityPoint, InputState.Down));
                    e.Handled = true;
                    return;
                }
                #endregion
                #region 검사지점
                if (Keys.Stats == e.Key)
                {
                    return;
                }
                #endregion
NormalCasting:
                #region 처리
                llInputManager.ProcessKey(reservedKey);
                e.Handled = true;
                #endregion
                return;

                #endregion

                #region 오토마우스
            case Keys.AutoMouse:
                AutoMouse = true;
                e.Handled = true;
                return;

                #endregion
            }
        }