//处理键盘输入
    public void ProcessInput_Keybord()
    {
        CInputSystem input = CInputSystem.Instance;

        if (CInputSystem.Instance.IsKeyDown(KeyCode.Space))//空格键复位摄像机
        {
            GFX.SceneCamera.Instance.ResetCamera();
        }
        if (input.IsKeyDown(KeyCode.K))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_ACCELERATE_KEYSEND, (int)KeyCode.K);
        }

        if (input.IsKeyDown(KeyCode.O))
        {
            // 这个只是为了检查是否已经下载窗口
            //UIWindowMng.Instance.GetWindow("FaBaoWindow");
            //CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_OPEN_TALISMANITEM);

            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_ACCELERATE_KEYSEND, (int)KeyCode.O);
        }

        // 选定最近的目标 [4/11/2012 Ivan]
        if (input.IsKeyDown(KeyCode.Tab))
        {
            //CObjectManager.Instance.LockNearestEnemy();
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_ACCELERATE_KEYSEND, (int)KeyCode.Tab);
        }

        // m键显示大地图 [3/31/2012 Ivan]
        if (input.IsKeyDown(KeyCode.M))
        {
            // 这个只是为了检查是否已经下载窗口
            //UIWindowMng.Instance.GetWindow("SceneMapWindow");
            //CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_TOGLE_SCENEMAP);
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_ACCELERATE_KEYSEND, (int)KeyCode.M);
        }

        if (input.IsKeyDown(KeyCode.R))
        {
            s_pObjectManager.getPlayerMySelf().Ride = !s_pObjectManager.getPlayerMySelf().Ride;
        }

        // 广播回车键按下 [4/23/2012 Ivan]
        if (input.IsKeyUp(KeyCode.Return))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_UI_INFOS, "KeyDown_Enter");
        }

        UpdateClickShortKey();
    }
    private void UpdateClickShortKey()
    {
        CInputSystem input = CInputSystem.Instance;

        if (input.IsKeyDown(KeyCode.Alpha0))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha0);
        }
        else if (input.IsKeyDown(KeyCode.Alpha1))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha1);
        }
        else if (input.IsKeyDown(KeyCode.Alpha2))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha2);
        }
        else if (input.IsKeyDown(KeyCode.Alpha3))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha3);
        }
        else if (input.IsKeyDown(KeyCode.Alpha4))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha4);
        }
        else if (input.IsKeyDown(KeyCode.Alpha5))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha5);
        }
        else if (input.IsKeyDown(KeyCode.Alpha6))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha6);
        }
        else if (input.IsKeyDown(KeyCode.Alpha7))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha7);
        }
        else if (input.IsKeyDown(KeyCode.Alpha8))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha8);
        }
        else if (input.IsKeyDown(KeyCode.Alpha9))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.Alpha9);
        }
        else if (input.IsKeyDown(KeyCode.F1))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F1);
        }
        else if (input.IsKeyDown(KeyCode.F2))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F2);
        }
        else if (input.IsKeyDown(KeyCode.F3))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F3);
        }
        else if (input.IsKeyDown(KeyCode.F4))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F4);
        }
        else if (input.IsKeyDown(KeyCode.F5))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F5);
        }
        else if (input.IsKeyDown(KeyCode.F6))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F6);
        }
        else if (input.IsKeyDown(KeyCode.F7))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F7);
        }
        else if (input.IsKeyDown(KeyCode.F8))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F8);
        }
        else if (input.IsKeyDown(KeyCode.F9))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F9);
        }
        else if (input.IsKeyDown(KeyCode.F10))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F10);
        }
        else if (input.IsKeyDown(KeyCode.F11))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F11);
        }
        else if (input.IsKeyDown(KeyCode.F12))
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SHORTKEY, (int)KeyCode.F12);
        }
    }
Example #3
0
        public static void Start()
        {
            GC.Collect();

            g_EntityList  = new IClientEntityList();
            g_Input       = new CInput();
            g_ConVar      = new CConVarManager();
            g_InputSystem = new CInputSystem();

            var dwMouseEnabled = new ConVar("cl_mouseenable");

            var name = new ConVar("name");

            TriggerThread = new Thread(new ThreadStart(StartTrigger));
            TriggerThread.IsBackground = true;
            TriggerThread.Start();

            while (true)
            {
                try
                {
                    g_pEngineClient.Update();

                    if (g_pEngineClient.IsInGame())
                    {
                        bool bMouseEnabled = dwMouseEnabled.GetBool();

                        #region UpdateRegion

                        Update();

                        bool bLocalPlayerAlive = pLocal.GetHealth() > 0;
                        Team iLocalTeamNum     = pLocal.GetTeamNum();

                        Vector localPlayerEyePosition = pLocal.GetEyePosition();

                        Vector viewangles = g_pEngineClient.GetViewAngles();

                        bool FindNewAimBotTarget = false;

                        var LocalWeapon = pLocal.GetActiveWeapon();

                        var LocalWeaponID = LocalWeapon.GetWeaponID();

                        var LocalWeaponConfig = Config.GetWeaponConfig(LocalWeaponID);

                        bool bAimBotKey = IsKeyState(Config.iAimbotKey) || IsKeyState(Config.iTriggerBotWorkWithAimKey);

                        if (LocalWeapon.IsKnife() || LocalWeapon.IsBomb() || LocalWeapon.IsGrenade())
                        {
                            bAimBotKey = false;
                        }

                        if (!bLocalPlayerAlive)
                        {
                            bAimBotKey = false;
                        }

                        if (LocalWeapon.GetAvailableAmmo() <= 0)
                        {
                            bAimBotKey = false;
                        }

                        if (!Config.AimbotEnabled)
                        {
                            bAimBotKey = false;
                        }

                        if (!bAimBotKey)
                        {
                            WaitBreak   = false;
                            pLastTarget = null;
                        }

                        if (LocalWeaponConfig.bAimbotEnabled && bAimBotKey && pLastTarget == null)
                        {
                            FindNewAimBotTarget = true;
                        }

                        if (pLastTarget != null && LocalWeaponConfig.bVisibleCheck && !pLastTarget.IsSpottedByMask(pLocal))
                        {
                            FindNewAimBotTarget = true;
                        }

                        #endregion

                        #region KeyStateCheck
                        for (int i = 0; i < 255; ++i)
                        {
                            currentKeyState[i] = WinAPI.GetAsyncKeyState(i) != 0;
                        }

                        if (Config.iGlowToogleKey != -1 && IsKeyPress(Config.iGlowToogleKey))
                        {
                            Config.bGlowEnabled = !Config.bGlowEnabled;
                        }
                        if (Config.iPanicKey != -1 && IsKeyPress(Config.iPanicKey))
                        {
                            Globals._csgo.ProcessHandle = IntPtr.Zero;
                            Globals._csgo.CheckHandle();
                        }
                        #endregion

                        #region GlowESP

                        GlowESP(iLocalTeamNum, bLocalPlayerAlive);

                        #endregion

                        #region ForeachPlayerList
                        CBasePlayer   pTarget        = null;
                        float         fDistance      = -1;
                        List <string> names_to_steal = new List <string>();

                        foreach (var pPointer in g_EntityList.pPlayerList)
                        {
                            CBasePlayer pEntity = new CBasePlayer(pPointer);

                            int EntityHealth = pEntity.GetHealth();

                            Team EntityTeamnum = pEntity.GetTeamNum();

                            #region Namestealer
                            if (Config.MiscEnabled && Config.bNameStealerEnabled && !Config.bNameStealerCustom)
                            {
                                if (Config.iNameStealerType == 0 && EntityTeamnum == iLocalTeamNum)
                                {
                                    names_to_steal.Add(new string(g_pEngineClient.GetPlayerInfo(pEntity.GetIndex()).m_szPlayerName));
                                }
                                else if (Config.iNameStealerType == 1 && EntityTeamnum != iLocalTeamNum)
                                {
                                    names_to_steal.Add(new string(g_pEngineClient.GetPlayerInfo(pEntity.GetIndex()).m_szPlayerName));
                                }
                                else if (Config.iNameStealerType == 2)
                                {
                                    names_to_steal.Add(new string(g_pEngineClient.GetPlayerInfo(pEntity.GetIndex()).m_szPlayerName));
                                }
                            }
                            #endregion

                            #region Radar
                            if (Config.ESPEnabled && Config.bRadarEnabled)
                            {
                                pEntity.SetSpotted(true);
                            }
                            #endregion

                            #region RenderColor
                            if (Config.ESPEnabled && Config.bCHAMSGOWNOPlayer)
                            {
                                if (EntityTeamnum == iLocalTeamNum)
                                {
                                    pEntity.SetRenderColor(Config.bChamsAllyColor);
                                }
                                else
                                {
                                    pEntity.SetRenderColor(Config.bChamsEnemyColor);
                                }
                            }
                            #endregion

                            #region GlowESPOnlyPlayers
                            if (Config.ESPEnabled && !Config.bGlowWeapons && !Config.bGlowBomb && Config.bGlowEnabled && (!Config.bGlowAfterDeath || !bLocalPlayerAlive))
                            {
                                if (!pEntity.IsDormant() && EntityHealth > 0)
                                {
                                    bool bFillerGood = true;
                                    if (iLocalTeamNum == EntityTeamnum && !Config.bGlowAlly)
                                    {
                                        bFillerGood = false;
                                    }
                                    else if (iLocalTeamNum != EntityTeamnum && !Config.bGlowEnemy)
                                    {
                                        bFillerGood = false;
                                    }
                                    if (bFillerGood)
                                    {
                                        Color color = new Color();
                                        switch (Config.iGlowType)
                                        {
                                        case GlowType.Color:
                                            color = iLocalTeamNum == EntityTeamnum ? Config.bGlowAllyVisibleColor : Config.bGlowEnemyVisibleColor;
                                            break;

                                        case GlowType.Vis_Color:
                                            bool bVisible = pEntity.IsSpottedByMask(pLocal);
                                            if (bVisible)
                                            {
                                                color = iLocalTeamNum == EntityTeamnum ? Config.bGlowAllyVisibleColor : Config.bGlowEnemyVisibleColor;
                                            }
                                            else
                                            {
                                                color = iLocalTeamNum == EntityTeamnum ? Config.bGlowAllyColor : Config.bGlowEnemyColor;
                                            }
                                            break;

                                        case GlowType.Health:
                                            color = new Color(255 - (EntityHealth * 2.55f), EntityHealth * 2.55f, 0, 255);
                                            break;
                                        }
                                        g_GlowObjectManager.RegisterGlowObject(pEntity, color, Config.bInnerGlow, Config.bFullRender);
                                    }
                                }
                            }
                            #endregion

                            #region FindAimBotTarget
                            if (FindNewAimBotTarget)
                            {
                                if (!pEntity.IsDormant() && EntityHealth > 0 && !pEntity.HasGunGameImmunity())
                                {
                                    if (LocalWeaponConfig.bFriendlyFire || EntityTeamnum != iLocalTeamNum)
                                    {
                                        if (!LocalWeaponConfig.bVisibleCheck || pEntity.IsSpottedByMask(pLocal))
                                        {
                                            if (!LocalWeaponConfig.bTargetOnGroundCheck || pEntity.IsOnGround())
                                            {
                                                float cur_distance = MathUtil.FovToPlayer(localPlayerEyePosition, viewangles, pEntity, 0);

                                                if (cur_distance <= LocalWeaponConfig.flAimbotFov)
                                                {
                                                    if (fDistance == -1 || cur_distance < fDistance)
                                                    {
                                                        fDistance = cur_distance;
                                                        pTarget   = pEntity;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                        }
                        #endregion

                        #region LocalPlayerFunctions

                        #region BunnyHop

                        bool bLocalIsOnGround = pLocal.IsOnGround();

                        if (bMouseEnabled && Config.MiscEnabled && Config.bBunnyHopEnabled && IsKeyState(Config.iBunnyHopKey) && pLocal.GetVelocity() > 45f)
                        {
                            if (bLocalIsOnGround)
                            {
                                g_pEngineClient.PlusJump();
                            }
                            else if (g_pEngineClient.GetJumpState() == 5)
                            {
                                g_pEngineClient.MinusJump();
                            }
                        }
                        #endregion

                        #region FovChanger

                        if (Config.MiscEnabled && Config.bFovChangerEnabled && !pLocal.IsScoped())
                        {
                            pLocal.SetFov(Config.FovValue);
                        }
                        else if (!pLocal.IsScoped())
                        {
                            pLocal.ResetFov();
                        }
                        #endregion

                        #endregion

                        #region Aimbot
                        bool b_do_RCS    = false;
                        bool b_do_Aimbot = false;
                        if (FindNewAimBotTarget && fDistance != -1)
                        {
                            pLastTarget = pTarget;
                        }

                        if (LocalWeaponConfig.bAimbotEnabled && bAimBotKey && pLastTarget != null)
                        {
                            if (pLastTarget.GetHealth() <= 0)
                            {
                                if (!WaitBreak)
                                {
                                    BreakTickCount = Environment.TickCount + LocalWeaponConfig.iAimbotDeathBreak;
                                    WaitBreak      = true;
                                }
                                else if (BreakTickCount <= Environment.TickCount)
                                {
                                    WaitBreak   = false;
                                    pLastTarget = null;
                                }
                            }
                            else
                            {
                                List <Vector> hitboxes = new List <Vector>();

                                if ((LocalWeaponConfig.iBones & (int)BoneSelector.Head) != 0)
                                {
                                    hitboxes.Add(pLastTarget.GetHitboxPosition((int)HitboxList.HITBOX_HEAD));
                                }
                                if ((LocalWeaponConfig.iBones & (int)BoneSelector.Neck) != 0)
                                {
                                    hitboxes.Add(pLastTarget.GetHitboxPosition((int)HitboxList.HITBOX_NECK));
                                }
                                if ((LocalWeaponConfig.iBones & (int)BoneSelector.Chest) != 0)
                                {
                                    hitboxes.Add(pLastTarget.GetHitboxPosition((int)HitboxList.HITBOX_CHEST));
                                }
                                if ((LocalWeaponConfig.iBones & (int)BoneSelector.Stomach) != 0)
                                {
                                    hitboxes.Add(pLastTarget.GetHitboxPosition((int)HitboxList.HITBOX_BODY));
                                }

                                float  best    = -1;
                                Vector calcang = new Vector(0, 0, 0);

                                for (int i = 0; i < hitboxes.Count(); i++)
                                {
                                    Vector temp_calcang = MathUtil.CalcAngle(localPlayerEyePosition, hitboxes[i]);
                                    Vector delta_bone   = viewangles - temp_calcang;
                                    delta_bone.NormalizeAngles();
                                    float len = (float)delta_bone.Lenght2D();
                                    if (best == -1 || len < best)
                                    {
                                        best    = len;
                                        calcang = temp_calcang;
                                    }
                                }

                                Vector current_punch = new Vector(last_vecPunch._x * 2f, last_vecPunch._y * (LocalWeaponConfig.Horizontal / 5f), 0);
                                calcang -= current_punch;
                                calcang.NormalizeAngles();
                                Vector delta = calcang - viewangles;
                                delta.NormalizeAngles();
                                if (LocalWeaponConfig.flAimbotSmooth != 0f)
                                {
                                    calcang = viewangles + (delta / LocalWeaponConfig.flAimbotSmooth);
                                }
                                calcang.NormalizeAngles();
                                viewangles  = calcang;
                                b_do_Aimbot = true;
                            }
                        }
                        #endregion

                        #region RecoilControlSystem
                        if (Config.AimbotEnabled && LocalWeaponConfig.Vertical != 0f && LocalWeaponConfig.Horizontal != 0f && LocalWeaponConfig.bRCS)
                        {
                            if (pLocal.GetShootsFired() > 1 && IsKeyState(1) && LocalWeapon.GetAvailableAmmo() > 0)
                            {
                                Vector Punch = pLocal.GetPunch();

                                float[] multiple = { LocalWeaponConfig.Vertical / 5f, LocalWeaponConfig.Horizontal / 5f };

                                Vector current_RCS_Punch = new Vector((Punch._x * multiple[0]) - (last_vecPunch._x * multiple[0]), (Punch._y * multiple[1]) - (last_vecPunch._y * multiple[1]), 0);
                                Vector ViewAngle_RCS     = viewangles - current_RCS_Punch;
                                ViewAngle_RCS.NormalizeAngles();
                                Vector delta = (viewangles - ViewAngle_RCS);
                                delta.NormalizeAngles();

                                if ((float)delta.Lenght2D() <= 3.1f)
                                {
                                    viewangles = ViewAngle_RCS;
                                }

                                last_vecPunch = Punch;

                                b_do_RCS = true;
                            }
                            else
                            {
                                last_vecPunch = new Vector(0, 0, 0);
                            }
                        }
                        #endregion

                        #region ShowRanks
                        if (Config.ESPEnabled && Config.bShowRanks)
                        {
                            var Command = g_pEngineClient.GetLastOutGoingCommand();

                            if (Command != lastOutgoingcommand)
                            {
                                var VerifiedCommandSystem = g_Input.GetVerifiedUserCmd();

                                var VerifiedCommand = VerifiedCommandSystem.GetVerifiedUserCmdBySequence(Command);

                                if ((VerifiedCommand.m_cmd.buttons & (1 << 16)) != 0)
                                {
                                    RevealRank.Do();
                                }
                            }

                            lastOutgoingcommand = Command;
                        }
                        #endregion

                        #region FakeLag
                        if (Config.MiscEnabled && Config.bFakeLag)
                        {
                            if (chockedPackets < Config.iFakeLagPower)
                            {
                                g_pEngineClient.SetSendPacket(false);
                                chockedPackets++;
                            }
                            else
                            {
                                g_pEngineClient.SetSendPacket(true);
                                chockedPackets = 0;
                            }
                        }
                        else if (Config.bFakeLag != bLastFakeLag)
                        {
                            g_pEngineClient.SetSendPacket(true);
                        }

                        bLastFakeLag = Config.bFakeLag;
                        #endregion

                        #region SetAngles
                        if (b_do_Aimbot || b_do_RCS)
                        {
                            g_pEngineClient.SetViewAngles(viewangles);
                        }
                        #endregion

                        #region ClanTagChanger
                        if (Config.MiscEnabled && Config.bClanTagChangerEnabled)
                        {
                            if (Environment.TickCount > ClantagTickCount)
                            {
                                if (Config.iClanTagChanger == 0)
                                {
                                    if (bSwapClantag)
                                    {
                                        SendClantag.Do(Config.szClanTag1, "ozon");
                                    }
                                    else
                                    {
                                        SendClantag.Do(Config.szClanTag2, "ozon");
                                    }
                                    bSwapClantag = !bSwapClantag;
                                }
                                else if (Config.iClanTagChanger == 1)
                                {
                                    if (LastTag != Config.szClanTag1)
                                    {
                                        LastTag = Config.szClanTag1;
                                        int start = 7 - LastTag.Length / 2;
                                        for (int i = 0; i < 15; i++)
                                        {
                                            if (i < start || i >= start + LastTag.Length)
                                            {
                                                Tag[i] = ' ';
                                            }
                                            else
                                            {
                                                Tag[i] = LastTag[i - start];
                                            }
                                        }
                                        SendClantag.Do(new string(Tag), "ozon");
                                    }
                                    else
                                    {
                                        char temp_var;

                                        for (int i = 0; i < (15 - 1); i++)
                                        {
                                            temp_var    = Tag[15 - 1];
                                            Tag[15 - 1] = Tag[i];
                                            Tag[i]      = temp_var;
                                        }
                                        SendClantag.Do(new string(Tag), "ozon");
                                    }
                                }
                                else if (Config.iClanTagChanger == 2)
                                {
                                    SendClantag.Do(DateTime.Now.ToString("hh:mm:ss"), "ozon");
                                }
                                ClantagTickCount = Environment.TickCount + Config.iClantTagDelay;
                            }
                        }
                        #endregion

                        #region Namestealer
                        if (Config.MiscEnabled && Config.bNameStealerEnabled)
                        {
                            if (Environment.TickCount > NamestealerTickCount)
                            {
                                if (Config.iNameStealerMode == 0)
                                {
                                    name.ClearCallbacks();
                                    if (Config.bNameStealerCustom)
                                    {
                                        if (bSwapNamestealer)
                                        {
                                            ClientCmd.Do("name \"" + Config.szName1 + "\"");
                                        }
                                        else
                                        {
                                            ClientCmd.Do("name \"" + Config.szName2 + "\"");
                                        }
                                        bSwapNamestealer = !bSwapNamestealer;
                                    }
                                    else
                                    {
                                        ClientCmd.Do("name \"" + names_to_steal[RandomHelper.RandomInt(0, names_to_steal.Count - 1)] + "   \"");
                                    }
                                }
                                NamestealerTickCount = Environment.TickCount + Config.iNameStealerDelay;
                            }
                        }
                        #endregion

                        #region AutoPistol
                        if (Config.MiscEnabled && bMouseEnabled && Config.AutoPistol && IsKeyState(0x01) && LocalWeaponID != 64 && LocalWeapon.IsPistol())
                        {
                            if (g_pEngineClient.GetAttackState() == 5)
                            {
                                g_pEngineClient.MinusAttack();
                            }
                            else
                            {
                                g_pEngineClient.PlusAttack();
                            }
                        }
                        #endregion

                        #region ForceUpdate
                        if (bDoForceUpdate)
                        {
                            g_pEngineClient.ForceUpdate();
                            bDoForceUpdate = false;
                        }
                        #endregion

                        Buffer.BlockCopy(currentKeyState, 0, lastKeyState, 0, 255);
                    }
                    else
                    {
                        if (!Globals._csgo.CheckHandle())
                        {
                            break;
                        }

                        Thread.Sleep(1000);

                        #region AutoAccept
                        if (Config.MiscEnabled && Config.bAutoAccept)
                        {
                            if (UTILS_GAME.MatchFound())
                            {
                                Thread.Sleep(1500);
                                UTILS_GAME.AcceptMatch();
                            }
                        }
                        #endregion
                    }
                }
                catch
                {
                    if (!Globals._csgo.CheckHandle())
                    {
                        break;
                    }
                }
                Thread.Sleep(5);
            }
            Program.StartCheat();
        }
    //处理鼠标输入
    public void ProcessInput_Mouse()
    {
        CInputSystem input      = CInputSystem.Instance;
        bool         bLBtnClick = input.IsLeftMouseClick();
        bool         bRBtnClick = input.IsRightMouseClick();

        //-----------------------------------------------------------
        //鼠标碰撞上的物体
        Vector3 fvMouseHitPlan = Vector3.zero;
        CObject pSelectObj     = CObjectManager.Instance.GetMouseOverObject(input.GetMousePos(), out fvMouseHitPlan);
        //鼠标是否在ui上空
        bool bInUIHover = s_pUISystem != null && s_pUISystem.IsMouseHover() && input.InputCapture != InputCapture.ICS_GAME;

        //-----------------------------------------------------------
        //如果左右键都没有按下,计算鼠标命令
        ENUM_CURSOR_TYPE LastCursor = ENUM_CURSOR_TYPE.CURSOR_WINBASE;
        MOUSE_CMD_TYPE   mouseType  = MOUSE_CMD_TYPE.MCT_NULL;

        if (!bLBtnClick && !bRBtnClick)
        {
            CursorMng.Instance.MouseCommand_Set(bInUIHover, pSelectObj, fvMouseHitPlan, CActionSystem.Instance.GetDefaultAction());
            //设置光标类型
            SCommand_Mouse cmd = CursorMng.Instance.MouseCommand_GetLeft();

            if (bInUIHover)
            {
                // 如果在UI上,且没有处于拖拽状态时,默认显示普通鼠标 [2/15/2012 Ivan]
                if (CursorMng.Instance.m_hUICursor == null)
                {
                    if (s_pUISystem.CurrHyperlink != null)
                    {
                        CursorMng.Instance.SetCursor(ENUM_CURSOR_TYPE.CURSOR_HYPERLINK_HOVER);
                    }
                    else
                    {
                        CursorMng.Instance.SetCursor(ENUM_CURSOR_TYPE.CURSOR_NORMAL);
                    }
                }
            }
            else
            {
                LastCursor = CursorMng.Instance.GetCursor();
                mouseType  = cmd.m_typeMouse;
                switch (cmd.m_typeMouse)
                {
                case MOUSE_CMD_TYPE.MCT_PLAYER_MOVETO:          //移动
                    CursorMng.Instance.SetCursor(ENUM_CURSOR_TYPE.CURSOR_NORMAL);
                    break;

                case MOUSE_CMD_TYPE.MCT_PLAYER_SELECT:          //选择目标
                    CursorMng.Instance.SetCursor(ENUM_CURSOR_TYPE.CURSOR_NORMAL);
                    break;

                case MOUSE_CMD_TYPE.MCT_SKILL_OBJ:              //目标攻击
                    CursorMng.Instance.SetCursor(ENUM_CURSOR_TYPE.CURSOR_ATTACK);
                    break;

                case MOUSE_CMD_TYPE.MCT_SKILL_AREA:                     //区域攻击
                    CursorMng.Instance.SetCursor(ENUM_CURSOR_TYPE.CURSOR_ATTACK);
                    break;

                case MOUSE_CMD_TYPE.MCT_SKILL_DIR:                              //方向型技能
                    CursorMng.Instance.SetCursor(ENUM_CURSOR_TYPE.CURSOR_ATTACK);
                    break;

                case MOUSE_CMD_TYPE.MCT_HIT_TRIPPEROBJ:                 //TripperObj

                    CTripperObject pTripperObj = (CTripperObject)CObjectManager.Instance.FindServerObject(cmd.GetValue <int>(0));
                    if (pTripperObj != null)
                    {
                        CursorMng.Instance.SetCursor(pTripperObj.Tripper_GetCursor());
                    }
                    else
                    {
                        CursorMng.Instance.SetCursor(ENUM_CURSOR_TYPE.CURSOR_NORMAL);
                    }
                    break;

                case MOUSE_CMD_TYPE.MCT_SPEAK:                  //对话
                    CursorMng.Instance.SetCursor(ENUM_CURSOR_TYPE.CURSOR_SPEAK);
                    break;
                }

                //显示/隐藏技能范围指示器
                if (MOUSE_CMD_TYPE.MCT_SKILL_AREA == cmd.m_typeMouse ||
                    (MOUSE_CMD_TYPE.MCT_USE_ITEM == cmd.m_typeMouse &&
                     cmd.GetValue <bool>(4)))
                {
                    if (m_pSkillArea == null)
                    {
                        m_pSkillArea = (CObject_ProjTex_AuraDure)CObjectManager.Instance.NewProjTexAuraDure(-1);
                        m_pSkillArea.Initial(null);
                    }
                    m_pSkillArea.SetShowEnable(true);
                    m_pSkillArea.SetPosition(fvMouseHitPlan);
                    if (MOUSE_CMD_TYPE.MCT_SKILL_AREA == cmd.m_typeMouse)
                    {
                        m_pSkillArea.SetRingRange(cmd.GetValue <float>(5));
                    }
                }
                else if (m_pSkillArea != null && m_pSkillArea.GetShowEnable())
                {
                    m_pSkillArea.SetShowEnable(false);
                }
            }
        }

        //-----------------------------------------------------------
        //分析事件队列
        if (input.IsLeftMouseClick())
        {
            //激活鼠标命令
            //          if(s_pUISystem && s_pUISystem->IsDragFlag())
            //          {
            //              s_pUISystem->ChangeDragFlag(false);
            //          }
            //          else if (m_bCameraDraging)
            //          {
            //              //显示鼠标
            //              CCursorMng::GetMe()->ShowCursor(true);
            //              s_pInputSystem->SetCapture(ICS_NONE);
            //          }
            //          else
            {
                if (CursorMng.Instance.MouseCommand_GetLeft().m_typeMouse == MOUSE_CMD_TYPE.MCT_PLAYER_MOVETO)
                {
                    AutoReleaseSkill.Instance.SetTargetObject(-1);
                    s_pGameInterface.StopAutoHit();
                }
                CursorMng.Instance.MouseCommand_Active(CursorMng.Instance.MouseCommand_GetLeft());
            }
        }
        else if (input.IsRightMouseClick())
        {
            CursorMng.Instance.MouseCommand_Active(CursorMng.Instance.MouseCommand_GetRight());
        }

        //鼠标滚轮操作
        float scrollWheel = input.GetAxis("Mouse ScrollWheel");

        GFX.SceneCamera.Instance.setScrollWheel(scrollWheel);

        if (input.isMouseRightHold() && !bInUIHover)//摄像机旋转操作
        {
            float mouseHorMove = input.GetAxis("Mouse X");
            if (Mathf.Abs(mouseHorMove) > 0.0001)
            {
                GFX.SceneCamera.Instance.AddDirection(mouseHorMove);
            }
        }


        //-----------------------------------------------------------

        // 显示鼠标
        if (CursorMng.Instance.GetCursor() != LastCursor)
        {
            CursorMng.Instance.OnSetCursor();
        }
    }
Example #5
0
        public static void Start()
        {
            GC.Collect();

            g_EntityList  = new IClientEntityList();
            g_Input       = new CInput();
            g_ConVar      = new CConVarManager();
            g_InputSystem = new CInputSystem();

            var dwMouseEnabled = new ConVar("cl_mouseenable");

            var name = new ConVar("name");


            while (true)
            {
                try
                {
                    g_pEngineClient.Update();

                    if (g_pEngineClient.IsInGame())
                    {
                        if (Config.MiscEnabled && Config.bBhopEnabled)
                        {
                            if (WinAPI.GetAsyncKeyState(32) != 0 && pLocal.IsOnGround())
                            {
                                g_pEngineClient.ForceJUMP();
                            }
                        }

                        bool bMouseEnabled = dwMouseEnabled.GetBool();

                        #region UpdateRegion

                        Update();

                        bool bLocalPlayerAlive = pLocal.GetHealth() > 0;
                        Team iLocalTeamNum     = pLocal.GetTeamNum();

                        Vector localPlayerEyePosition = pLocal.GetEyePosition();

                        Vector viewangles = g_pEngineClient.GetViewAngles();

                        bool FindNewAimBotTarget = false;

                        var LocalWeapon = pLocal.GetActiveWeapon();

                        var LocalWeaponID = LocalWeapon.GetWeaponID();

                        bool bAimBotKey = IsKeyState(Config.iAimbotKey);

                        if (LocalWeapon.IsKnife() || LocalWeapon.IsBomb() || LocalWeapon.IsGrenade())
                        {
                            bAimBotKey = false;
                        }

                        if (!bLocalPlayerAlive)
                        {
                            bAimBotKey = false;
                        }

                        if (LocalWeapon.GetAvailableAmmo() <= 0)
                        {
                            bAimBotKey = false;
                        }

                        if (!WeaponConfig.bAimbotEnabled)
                        {
                            bAimBotKey = false;
                        }

                        if (!bAimBotKey)
                        {
                            WaitBreak   = false;
                            pLastTarget = null;
                        }

                        if (WeaponConfig.bAimbotEnabled && bAimBotKey && pLastTarget == null)
                        {
                            FindNewAimBotTarget = true;
                        }

                        if (pLastTarget != null && WeaponConfig.bVisibleCheck && !pLastTarget.IsSpottedByMask(pLocal))
                        {
                            FindNewAimBotTarget = true;
                        }

                        #endregion

                        #region KeyStateCheck
                        for (int i = 0; i < 255; ++i)
                        {
                            currentKeyState[i] = WinAPI.GetAsyncKeyState(i) != 0;
                        }

                        if (Config.iGlowToogleKey != -1 && IsKeyPress(Config.iGlowToogleKey))
                        {
                            Config.bGlowEnabled = !Config.bGlowEnabled;
                        }
                        if (Config.iPanicKey != -1 && IsKeyPress(Config.iPanicKey))
                        {
                            Globals._csgo.ProcessHandle = IntPtr.Zero;
                            Globals._csgo.CheckHandle();
                            Environment.Exit(0);
                        }
                        #endregion

                        #region GlowESP

                        GlowESP(iLocalTeamNum, bLocalPlayerAlive);

                        #endregion

                        #region ForeachPlayerList
                        CBasePlayer   pTarget        = null;
                        float         fDistance      = -1;
                        List <string> names_to_steal = new List <string>();

                        foreach (var pPointer in g_EntityList.pPlayerList)
                        {
                            CBasePlayer pEntity = new CBasePlayer(pPointer);

                            int EntityHealth = pEntity.GetHealth();

                            Team EntityTeamnum = pEntity.GetTeamNum();


                            #region GlowESPOnlyPlayers
                            if (Config.ESPEnabled && !Config.bGlowWeapons && !Config.bGlowBomb && Config.bGlowEnabled && (!Config.bGlowAfterDeath || !bLocalPlayerAlive))
                            {
                                if (!pEntity.IsDormant() && EntityHealth > 0)
                                {
                                    bool bFillerGood = true;
                                    if (iLocalTeamNum == EntityTeamnum && !Config.bGlowAlly)
                                    {
                                        bFillerGood = false;
                                    }
                                    else if (iLocalTeamNum != EntityTeamnum && !Config.bGlowEnemy)
                                    {
                                        bFillerGood = false;
                                    }
                                    if (bFillerGood)
                                    {
                                        Color color = new Color();
                                        switch (Config.iGlowType)
                                        {
                                        case GlowType.Color:
                                            color = iLocalTeamNum == EntityTeamnum ? Config.bGlowAllyVisibleColor : Config.bGlowEnemyVisibleColor;
                                            break;

                                        case GlowType.Vis_Color:
                                            bool bVisible = pEntity.IsSpottedByMask(pLocal);
                                            if (bVisible)
                                            {
                                                color = iLocalTeamNum == EntityTeamnum ? Config.bGlowAllyVisibleColor : Config.bGlowEnemyVisibleColor;
                                            }
                                            else
                                            {
                                                color = iLocalTeamNum == EntityTeamnum ? Config.bGlowAllyColor : Config.bGlowEnemyColor;
                                            }
                                            break;

                                        case GlowType.Health:
                                            color = new Color(255 - (EntityHealth * 2.55f), EntityHealth * 2.55f, 0, 255);
                                            break;
                                        }
                                        g_GlowObjectManager.RegisterGlowObject(pEntity, color, Config.bInnerGlow, Config.bFullRender);
                                    }
                                }
                            }
                            #endregion

                            #region FindAimBotTarget
                            if (FindNewAimBotTarget)
                            {
                                if (!pEntity.IsDormant() && EntityHealth > 0 && !pEntity.HasGunGameImmunity())
                                {
                                    {
                                        if (!WeaponConfig.bVisibleCheck || pEntity.IsSpottedByMask(pLocal))
                                        {
                                            if (!WeaponConfig.bTargetOnGroundCheck || pEntity.IsOnGround())
                                            {
                                                float cur_distance = MathUtil.FovToPlayer(localPlayerEyePosition, viewangles, pEntity, 0);

                                                if (cur_distance <= WeaponConfig.flAimbotFov)
                                                {
                                                    if (fDistance == -1 || cur_distance < fDistance)
                                                    {
                                                        fDistance = cur_distance;
                                                        pTarget   = pEntity;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                        }
                        #endregion

                        #region LocalPlayerFunctions


                        #endregion

                        #region Aimbot
                        bool b_do_RCS    = false;
                        bool b_do_Aimbot = false;
                        if (FindNewAimBotTarget && fDistance != -1)
                        {
                            pLastTarget = pTarget;
                        }

                        if (WeaponConfig.bAimbotEnabled && bAimBotKey && pLastTarget != null)
                        {
                            if (pLastTarget.GetHealth() <= 0)
                            {
                                if (!WaitBreak)
                                {
                                    BreakTickCount = Environment.TickCount + WeaponConfig.iAimbotDeathBreak;
                                    WaitBreak      = true;
                                }
                                else if (BreakTickCount <= Environment.TickCount)
                                {
                                    WaitBreak   = false;
                                    pLastTarget = null;
                                }
                            }
                            else
                            {
                                float  best    = -1;
                                Vector calcang = new Vector(0, 0, 0);

                                Vector temp_calcang = MathUtil.CalcAngle(localPlayerEyePosition, pLastTarget.GetHitboxPosition((int)HitboxList.HITBOX_HEAD));
                                Vector delta_bone   = viewangles - temp_calcang;
                                delta_bone.NormalizeAngles();
                                float len = (float)delta_bone.Lenght2D();
                                if (best == -1 || len < best)
                                {
                                    best    = len;
                                    calcang = temp_calcang;
                                }


                                Vector current_punch = new Vector(last_vecPunch._x * 2f, last_vecPunch._y * (WeaponConfig.Horizontal / 5f), 0);
                                calcang -= current_punch;
                                calcang.NormalizeAngles();
                                Vector delta = calcang - viewangles;
                                delta.NormalizeAngles();
                                if (WeaponConfig.flAimbotSmooth != 0f)
                                {
                                    calcang = viewangles + (delta / WeaponConfig.flAimbotSmooth);
                                }
                                calcang.NormalizeAngles();
                                viewangles  = calcang;
                                b_do_Aimbot = true;
                            }
                        }
                        #endregion

                        #region Triggerbot

                        foreach (var pPointer in g_EntityList.pPlayerList)
                        {
                            CBasePlayer pEntity = new CBasePlayer(pPointer);
                            if (pEntity.GetTeamNum() != pLocal.GetTeamNum())
                            {
                                if (Config.bTriggerbotEnabled)
                                {
                                    if (MathUtil.FovToPlayer(localPlayerEyePosition, viewangles, pEntity, 0) < 1)
                                    {
                                        if (pEntity.IsSpottedByMask(pLocal))
                                        {
                                            g_pEngineClient.OneTickAttack();
                                        }
                                    }
                                }
                            }
                        }

                        #endregion

                        #region RecoilControlSystem
                        if (Config.AimbotEnabled && WeaponConfig.Vertical != 0f && WeaponConfig.Horizontal != 0f && WeaponConfig.bRCS)
                        {
                            if (pLocal.GetShootsFired() > 1 && IsKeyState(1) && LocalWeapon.GetAvailableAmmo() > 0)
                            {
                                Vector Punch = pLocal.GetPunch();

                                float[] multiple = { WeaponConfig.Vertical / 5f, WeaponConfig.Horizontal / 5f };

                                Vector current_RCS_Punch = new Vector((Punch._x * multiple[0]) - (last_vecPunch._x * multiple[0]), (Punch._y * multiple[1]) - (last_vecPunch._y * multiple[1]), 0);
                                Vector ViewAngle_RCS     = viewangles - current_RCS_Punch;
                                ViewAngle_RCS.NormalizeAngles();
                                Vector delta = (viewangles - ViewAngle_RCS);
                                delta.NormalizeAngles();

                                if ((float)delta.Lenght2D() <= 3.1f)
                                {
                                    viewangles = ViewAngle_RCS;
                                }

                                last_vecPunch = Punch;

                                b_do_RCS = true;
                            }
                            else
                            {
                                last_vecPunch = new Vector(0, 0, 0);
                            }
                        }
                        #endregion

                        #region ShowRanks
                        if (Config.ESPEnabled && Config.bShowRanks)
                        {
                            var Command = g_pEngineClient.GetLastOutGoingCommand();

                            if (Command != lastOutgoingcommand)
                            {
                                var VerifiedCommandSystem = g_Input.GetVerifiedUserCmd();

                                var VerifiedCommand = VerifiedCommandSystem.GetVerifiedUserCmdBySequence(Command);

                                if ((VerifiedCommand.m_cmd.buttons & (1 << 16)) != 0)
                                {
                                    RevealRank.Do();
                                }
                            }

                            lastOutgoingcommand = Command;
                        }
                        #endregion

                        #region SetAngles
                        if (b_do_Aimbot || b_do_RCS)
                        {
                            g_pEngineClient.SetViewAngles(viewangles);
                        }
                        #endregion

                        #region ClanTagChanger
                        if (Config.MiscEnabled && Config.bClanTagChangerEnabled)
                        {
                            if (Environment.TickCount > ClantagTickCount)
                            {
                                if (Config.iClanTagChanger == 0)
                                {
                                    SendClantag.Do(Config.szClanTag, "ozon");
                                }
                                else if (Config.iClanTagChanger == 1)
                                {
                                    if (LastTag != Config.szClanTag)
                                    {
                                        LastTag = Config.szClanTag;
                                        int start = 7 - LastTag.Length / 2;
                                        for (int i = 0; i < 15; i++)
                                        {
                                            if (i < start || i >= start + LastTag.Length)
                                            {
                                                Tag[i] = ' ';
                                            }
                                            else
                                            {
                                                Tag[i] = LastTag[i - start];
                                            }
                                        }
                                        SendClantag.Do(new string(Tag), "ozon");
                                    }
                                    else
                                    {
                                        char temp_var;

                                        for (int i = 0; i < (15 - 1); i++)
                                        {
                                            temp_var    = Tag[15 - 1];
                                            Tag[15 - 1] = Tag[i];
                                            Tag[i]      = temp_var;
                                        }
                                        SendClantag.Do(new string(Tag), "ozon");
                                    }
                                }
                                else if (Config.iClanTagChanger == 3)
                                {
                                    SendClantag.Do(RandomString(5), "ozon");
                                }
                                else if (Config.iClanTagChanger == 2)
                                {
                                    sainttag = SaintwareNext(sainttag);
                                    SendClantag.Do(SaintwareNext(sainttag), "ozon");
                                }
                                ClantagTickCount = Environment.TickCount + Config.iClantTagDelay;
                            }
                        }
                        #endregion

                        #region ForceUpdate
                        if (bDoForceUpdate)
                        {
                            g_pEngineClient.ForceUpdate();
                            bDoForceUpdate = false;
                        }
                        #endregion

                        Buffer.BlockCopy(currentKeyState, 0, lastKeyState, 0, 255);
                    }
                    else
                    {
                        if (!Globals._csgo.CheckHandle())
                        {
                            break;
                        }

                        Thread.Sleep(1000);

                        #region AutoAccept
                        if (Config.MiscEnabled && Config.bAutoAccept)
                        {
                            if (UTILS_GAME.MatchFound())
                            {
                                Thread.Sleep(1500);
                                UTILS_GAME.AcceptMatch();
                            }
                        }
                        #endregion
                    }
                }
                catch
                {
                    if (!Globals._csgo.CheckHandle())
                    {
                        break;
                    }
                }
                Thread.Sleep(5);
            }
            Program.StartCheat();
        }