Esempio n. 1
0
        //-------------------------------------------------------------
        // DATA SOURCES GIVEN VALUES HERE
        //-------------------------------------------------------------
        public double RequestData(int dataSource)
        {
            if (sourceTouches[dataSource] != random)
            {
                switch (dataSource)
                {
                //sources: value1-5 dont need cases, works anyway

                //LOCAL COORDINATES AND ANGLES
                case (int)DATA_SOURCES.PLAYER_X:
                    Structures.FLOAT3 pos = gameState.LocalPosition;
                    dataSources[(int)DATA_SOURCES.PLAYER_X]   = pos.X;
                    dataSources[(int)DATA_SOURCES.PLAYER_Y]   = pos.Y;
                    dataSources[(int)DATA_SOURCES.PLAYER_Z]   = pos.Z;
                    sourceTouches[(int)DATA_SOURCES.PLAYER_Y] = random;
                    sourceTouches[(int)DATA_SOURCES.PLAYER_Z] = random;
                    break;

                case (int)DATA_SOURCES.PLAYER_Y:
                    pos = gameState.LocalPosition;
                    dataSources[(int)DATA_SOURCES.PLAYER_X]   = pos.X;
                    dataSources[(int)DATA_SOURCES.PLAYER_Y]   = pos.Y;
                    dataSources[(int)DATA_SOURCES.PLAYER_Z]   = pos.Z;
                    sourceTouches[(int)DATA_SOURCES.PLAYER_X] = random;
                    sourceTouches[(int)DATA_SOURCES.PLAYER_Z] = random;
                    break;

                case (int)DATA_SOURCES.PLAYER_Z:
                    pos = gameState.LocalPosition;
                    dataSources[(int)DATA_SOURCES.PLAYER_X]   = pos.X;
                    dataSources[(int)DATA_SOURCES.PLAYER_Y]   = pos.Y;
                    dataSources[(int)DATA_SOURCES.PLAYER_Z]   = pos.Z;
                    sourceTouches[(int)DATA_SOURCES.PLAYER_X] = random;
                    sourceTouches[(int)DATA_SOURCES.PLAYER_Y] = random;
                    break;

                case (int)DATA_SOURCES.VIEW_ANGLE_H:
                    dataSources[(int)DATA_SOURCES.VIEW_ANGLE_H] = (double)gameState.PlayerHorizontalViewAngle;
                    break;

                case (int)DATA_SOURCES.VIEW_ANGLE_V:
                    dataSources[(int)DATA_SOURCES.VIEW_ANGLE_V] = (double)gameState.PlayerVerticalViewAngle;
                    break;

                case (int)DATA_SOURCES.CAMERA_X:
                    pos = gameState.CameraPosition;
                    dataSources[(int)DATA_SOURCES.CAMERA_X]   = pos.X;
                    dataSources[(int)DATA_SOURCES.CAMERA_Y]   = pos.Y;
                    dataSources[(int)DATA_SOURCES.CAMERA_Z]   = pos.Z;
                    sourceTouches[(int)DATA_SOURCES.CAMERA_Y] = random;
                    sourceTouches[(int)DATA_SOURCES.CAMERA_Z] = random;
                    break;

                case (int)DATA_SOURCES.CAMERA_Y:
                    pos = gameState.CameraPosition;
                    dataSources[(int)DATA_SOURCES.CAMERA_X]   = pos.X;
                    dataSources[(int)DATA_SOURCES.CAMERA_Y]   = pos.Y;
                    dataSources[(int)DATA_SOURCES.CAMERA_Z]   = pos.Z;
                    sourceTouches[(int)DATA_SOURCES.CAMERA_X] = random;
                    sourceTouches[(int)DATA_SOURCES.CAMERA_Z] = random;
                    break;

                case (int)DATA_SOURCES.CAMERA_Z:
                    pos = gameState.CameraPosition;
                    dataSources[(int)DATA_SOURCES.CAMERA_X]   = pos.X;
                    dataSources[(int)DATA_SOURCES.CAMERA_Y]   = pos.Y;
                    dataSources[(int)DATA_SOURCES.CAMERA_Z]   = pos.Z;
                    sourceTouches[(int)DATA_SOURCES.CAMERA_X] = random;
                    sourceTouches[(int)DATA_SOURCES.CAMERA_Y] = random;
                    break;


                //MISC
                case (int)DATA_SOURCES.CAN_WALK:
                    bool cw = gameState.CanWalk;
                    dataSources[(int)DATA_SOURCES.CAN_WALK] = cw ? 1 : 0;
                    break;

                case (int)DATA_SOURCES.CLEAR_SHOT:
                    dataSources[dataSource] = gameState.HasClearShot ? 1.0 : 0.0;
                    break;

                case (int)DATA_SOURCES.CLEAR_SHOT_ADVANCED:
                    dataSources[dataSource] = gameState.BSPIntersectionCheck(
                        gameState.LocalPosition, gameState.PlayerPosition(form1.nav.aimbot.GetTargetIndex()))
                            ? 0.0 : 1.0;
                    break;

                case (int)DATA_SOURCES.SHIFT_KEY:
                    dataSources[dataSource] = Form1.GetKeyState(Form1.VirtualKeyStates.VK_SHIFT) < 0 ?
                                              1.0 : 0.0;
                    break;

                case (int)DATA_SOURCES.PLAYER_COUNT:
                    dataSources[dataSource] = (double)gameState.PlayerCount;
                    break;

                case (int)DATA_SOURCES.RANDOM:
                    dataSources[dataSource] = r.NextDouble();
                    break;

                //LOCAL INFO
                case (int)DATA_SOURCES.LOCAL_HEALTH:
                    dataSources[dataSource] = (double)gameState.LocalHealth;
                    break;

                case (int)DATA_SOURCES.TARGET_HEALTH:
                    dataSources[dataSource] =
                        (double)gameState.PlayerHealth(form1.nav.aimbot.GetTargetIndex());
                    break;

                case (int)DATA_SOURCES.TARGET_DIST:
                    dataSources[dataSource] =
                        (double)Navigation.Distance3D(form1.nav.aimbot.GetTargetPos(), gameState.LocalPosition);
                    break;

                case (int)DATA_SOURCES.TARGET_SHIELD:
                    dataSources[dataSource] =
                        (double)gameState.PlayerShield(form1.nav.aimbot.GetTargetIndex());
                    break;

                case (int)DATA_SOURCES.LOCAL_SHIELD:
                    dataSources[dataSource] = (double)gameState.LocalShield;
                    break;

                case (int)DATA_SOURCES.LOCAL_TEAM:
                    dataSources[dataSource] = (double)gameState.LocalTeam;
                    break;

                case (int)DATA_SOURCES.LOCAL_PING:
                    dataSources[dataSource] = (double)gameState.LocalPing;
                    break;

                case (int)DATA_SOURCES.ZOOM_LEVEL:
                    dataSources[dataSource] = (double)gameState.ZoomLevel;
                    break;

                case (int)DATA_SOURCES.FLASHLIGHT:
                    dataSources[dataSource] = gameState.FlashlightOn ? 1.0 : 0.0;
                    break;

                //WEAPONS
                case (int)DATA_SOURCES.PRIMARY_WEAPON:
                    dataSources[dataSource] = gameState.PrimaryWeapon ? 1.0 : 0.0;
                    break;

                case (int)DATA_SOURCES.WEAPON0_TYPE:
                    dataSources[dataSource] = gameState.GetWeaponType(
                        gameState.GetObjectOffset(
                            gameState.GetWeaponIndex(gameState.LocalIndex, true)));
                    break;

                case (int)DATA_SOURCES.WEAPON1_TYPE:
                    dataSources[dataSource] = gameState.GetWeaponType(
                        gameState.GetObjectOffset(
                            gameState.GetWeaponIndex(gameState.LocalIndex, false)));
                    break;

                case (int)DATA_SOURCES.WEAPON0_CLIP:
                    dataSources[dataSource] = gameState.GetWeaponClip(
                        gameState.GetObjectOffset(
                            gameState.GetWeaponIndex(gameState.LocalIndex, true)));
                    break;

                case (int)DATA_SOURCES.WEAPON1_CLIP:
                    dataSources[dataSource] = gameState.GetWeaponClip(
                        gameState.GetObjectOffset(
                            gameState.GetWeaponIndex(gameState.LocalIndex, false)));
                    break;

                case (int)DATA_SOURCES.WEAPON0_RESERVE:
                    dataSources[dataSource] = gameState.GetWeaponReserve(
                        gameState.GetObjectOffset(
                            gameState.GetWeaponIndex(gameState.LocalIndex, true)));
                    break;

                case (int)DATA_SOURCES.WEAPON1_RESERVE:
                    dataSources[dataSource] = gameState.GetWeaponReserve(
                        gameState.GetObjectOffset(
                            gameState.GetWeaponIndex(gameState.LocalIndex, false)));
                    break;

                case (int)DATA_SOURCES.GRENADE_TYPE:
                    dataSources[dataSource] = (double)gameState.LocalGrenadeType;
                    break;

                case (int)DATA_SOURCES.PLASMA_GRENADE_COUNT:
                    dataSources[dataSource] = (double)gameState.LocalPlasmaGrenadeCount;
                    break;

                case (int)DATA_SOURCES.FRAG_GRENADE_COUNT:
                    dataSources[dataSource] = (double)gameState.LocalFragGrenadeCount;
                    break;

                //TARGET INFO
                case (int)DATA_SOURCES.TARGET_CAMO:
                    dataSources[dataSource] = gameState.PlayerHasCamo(form1.nav.aimbot.GetTargetIndex()) ? 1.0 : 0.0;
                    break;

                case (int)DATA_SOURCES.LOCAL_CAMO:
                    dataSources[dataSource] = gameState.LocalCamo ? 1.0 : 0.0;
                    break;

                case (int)DATA_SOURCES.TARGET_STANCE:
                    dataSources[dataSource] = (double)gameState.PlayerStance(form1.nav.aimbot.GetTargetIndex());
                    break;

                case (int)DATA_SOURCES.LOCAL_STANCE:
                    dataSources[dataSource] = (double)gameState.LocalStance;
                    break;

                //GETTING TARGETS
                case (int)DATA_SOURCES.CLOSEST_ENEMY:
                case (int)DATA_SOURCES.CLOSEST_ALLY:
                case (int)DATA_SOURCES.CLOSEST_ANYONE:
                //call FID CLOSEST_ENEMY/ALLY/ANYONE before CLOSEST_DIST to set DIST's mode
                case (int)DATA_SOURCES.CLOSEST_DIST:
                    #region CLOSEST_PLAYER
                    pos = gameState.LocalPosition;
                    int localTeam = gameState.LocalTeam;

                    int   maxSlots     = gameState.MaxSlots;
                    int   closestIndex = -1;
                    float closestDist  = float.MaxValue;

                    //for every player
                    for (int i = 0; i < maxSlots; i++)
                    {
                        int    staticPlayerPointer = gameState.GetStaticPlayerPointer(i);
                        ushort objectID            = gameState.GetPlayerObjectID(staticPlayerPointer);
                        ushort objectIndex         = gameState.GetPlayerObjectIndex(staticPlayerPointer);
                        short  playerId2           = gameState.GetPlayerId2(staticPlayerPointer);

                        if (objectID == 65535 || objectID == 0 || objectIndex == gameState.LocalObjectIndex ||
                            objectID != gameState.GetObjectID(objectIndex))    // || playerId2 == -1)
                        {
                            continue;
                        }

                        if (dataSource == (int)DATA_SOURCES.CLOSEST_ENEMY ||
                            dataSource == (int)DATA_SOURCES.CLOSEST_DIST)
                        {
                            if (gameState.GetPlayerTeam(staticPlayerPointer) == localTeam)
                            {
                                continue;
                            }
                        }
                        else if (dataSource == (int)DATA_SOURCES.CLOSEST_ALLY)
                        {
                            if (gameState.GetPlayerTeam(staticPlayerPointer) != localTeam)
                            {
                                continue;
                            }
                        }

                        float dist = Navigation.Distance3D(gameState.PlayerPosition(i), pos);
                        if (dist < closestDist)
                        {
                            closestDist  = dist;
                            closestIndex = i;
                        }
                    }

                    dataSources[dataSource] = (double)closestIndex;
                    dataSources[(int)DATA_SOURCES.CLOSEST_DIST] = (double)closestDist;

                    if (dataSource == (int)DATA_SOURCES.CLOSEST_DIST)
                    {
                        sourceTouches[(int)DATA_SOURCES.CLOSEST_ENEMY] = random;
                    }
                    else
                    {
                        sourceTouches[(int)DATA_SOURCES.CLOSEST_DIST] = random;
                    }

                    break;
                    #endregion

                case (int)DATA_SOURCES.ENEMY_NEAREST_VIEW:
                case (int)DATA_SOURCES.ALLY_NEAREST_VIEW:
                case (int)DATA_SOURCES.ANYONE_NEAREST_VIEW:
                    #region PLAYER_NEAREST_VIEW
                    pos       = gameState.LocalPosition;
                    localTeam = gameState.LocalTeam;

                    maxSlots     = gameState.MaxSlots;
                    closestIndex = -1;
                    float closestAngle = float.MaxValue;

                    //for every player
                    for (int i = 0; i < maxSlots; i++)
                    {
                        int    staticPlayerPointer = gameState.GetStaticPlayerPointer(i);
                        ushort objectID            = gameState.GetPlayerObjectID(staticPlayerPointer);
                        ushort objectIndex         = gameState.GetPlayerObjectIndex(staticPlayerPointer);

                        if (objectID == 65535 || objectID == 0 || objectIndex == gameState.LocalObjectIndex ||
                            objectID != gameState.GetObjectID(objectIndex))
                        {
                            continue;
                        }

                        if (dataSource == (int)DATA_SOURCES.ENEMY_NEAREST_VIEW)
                        {
                            if (gameState.GetPlayerTeam(staticPlayerPointer) == localTeam)
                            {
                                continue;
                            }
                        }
                        else if (dataSource == (int)DATA_SOURCES.ALLY_NEAREST_VIEW)
                        {
                            if (gameState.GetPlayerTeam(staticPlayerPointer) != localTeam)
                            {
                                continue;
                            }
                        }

                        //calculate angle from view center to player i
                        float closeness = form1.nav.aimbot.TargetClosenessToView(gameState.PlayerPosition(i));

                        //compare angle to previously closest
                        if (closeness < closestAngle)
                        {
                            closestAngle = closeness;
                            closestIndex = i;
                        }
                    }     //for every player

                    dataSources[dataSource] = (double)closestIndex;
                    break;

                    #endregion
                case (int)DATA_SOURCES.RANDOM_NODE:
                    //if no nodes, do nothing
                    if (form1.graph.pool[0] == null)
                    {
                        break;
                    }

                    //otherwise, find a node that exists (may have holes in the array)
                    int node;
                    do
                    {
                        node = r.Next(1, form1.graph.LastIndex + 1);
                    }while (form1.graph.pool[node] == null);
                    dataSources[dataSource] = node;
                    break;
                } //end switch

                sourceTouches[dataSource] = random;
            } //if requested data source hasn't been calculated this tick

            return(dataSources[dataSource]);
        }