Beispiel #1
0
        private void fUpdateEntityList()
        {
            for (int i = 0; i < 32; i++)
            {
                int[] iEntityOffset      = { i * 0x04 };
                int   iEntityListAddress = pmcrw.ReadInt(moduleBaseAddress + OS.m_os_EntityList);
                iEntityList[i] = pmcrw.ReadInt(iEntityListAddress + (i * 0x04));

                VecInt2 tmpLocalPlayer = new VecInt2();
                tmpLocalPlayer.x = pmcrw.ReadInt(localPlayerBaseAddress + OS.m_os_LocalPlayerBodyXCoord);
                tmpLocalPlayer.y = pmcrw.ReadInt(localPlayerBaseAddress + OS.m_os_LocalPlayerBodyYCoord);

                VecInt2 tmpEnemyPlayer = new VecInt2();
                tmpEnemyPlayer.x = pmcrw.ReadInt(iEntityList[i] + OS.m_os_EnemyPlayerXCoord);
                tmpEnemyPlayer.y = pmcrw.ReadInt(iEntityList[i] + OS.m_os_EnemyPlayerYCoord);

                /* We are calculating the distance to the current enemy player. We will store this distance in an array
                 * along with the enemy index. We can validate if needed by storing unique parameters and checking later.
                 * But for now, this is good.
                 */
                int iDistanceToEnemy = ACFunctions.fGetDistance(tmpLocalPlayer, tmpEnemyPlayer);

                // We will store the distance, and the pointer to the enemy. So later on when we figure out which distance is the closest,
                // we can grab the pointer to that enemy and do what we want. As an example, set the mouse cursor to aim at them, etc..
                enemyDistances.SetValue(iDistanceToEnemy, i);
            }

            //fGet2dCoords();
        }
Beispiel #2
0
        public static int fGetDistance(VecInt2 player, VecInt2 enemy)
        {
            double dDistance = Math.Sqrt(Math.Pow(enemy.x - player.x, 2) + Math.Pow(enemy.y - player.y, 2));

            return((int)dDistance);
        }
Beispiel #3
0
        private void fGet2dCoords()
        {
            //int entityList = pmcrw.ReadInt(moduleBaseAddress + OS.m_os_EntityList);

            //our entity list loop
            for (int i = 1; i < iAmountOfPlayers; i++)
            {
                //Create the entity
                // int entity = pmcrw.ReadInt(iEntityList[i] + 0x4 * i);



                //The entitys Pos
                float enemyX = pmcrw.ReadFloat(iEntityList[i] + 0x34);
                float enemyY = pmcrw.ReadFloat(iEntityList[i] + 0x38);
                float enemyZ = pmcrw.ReadFloat(iEntityList[i] + 0x3C);

                Vec3 enemyPos = new Vec3();
                enemyPos.x = enemyX;
                enemyPos.y = enemyY;
                enemyPos.z = enemyZ;

                /*
                 * I guess I will do the processing here to get the current distance from the local player to the enemy, as we are already
                 * looking at each enemies parameters here.
                 * */

                //Enemys Head Pos
                float enemyXHead = pmcrw.ReadFloat(iEntityList[i] + 0x4);
                float enemyYHead = pmcrw.ReadFloat(iEntityList[i] + 0x8);
                float enemyZHead = pmcrw.ReadFloat(iEntityList[i] + 0xC);

                Vec3 enemyHeadPos = new Vec3();
                enemyHeadPos.x = enemyXHead;
                enemyHeadPos.y = enemyYHead;
                enemyHeadPos.z = enemyZHead;


                //Sets each entitys health
                int health = pmcrw.ReadInt(iEntityList[i] + OS.m_os_EnemyPlayerHealth);

                if (ACFunctions.WorldToScreenFPos(enemyPos, viewMatrix, iWidthOfGameWindow, iHeightOfGameWindow))
                {
                    if (ACFunctions.WorldToScreenHPos(enemyHeadPos, viewMatrix, iWidthOfGameWindow, iHeightOfGameWindow))
                    {
                        VecInt2 tmpLocalPlayer = new VecInt2();
                        tmpLocalPlayer.x = pmcrw.ReadInt(localPlayerBaseAddress + OS.m_os_LocalPlayerBodyXCoord);
                        tmpLocalPlayer.y = pmcrw.ReadInt(localPlayerBaseAddress + OS.m_os_LocalPlayerBodyYCoord);

                        VecInt2 tmpEnemyPlayer = new VecInt2();
                        tmpEnemyPlayer.x = pmcrw.ReadInt(iEntityList[i] + OS.m_os_EnemyPlayerXCoord);
                        tmpEnemyPlayer.y = pmcrw.ReadInt(iEntityList[i] + OS.m_os_EnemyPlayerYCoord);

                        /* We are calculating the distance to the current enemy player. We will store this distance in an array
                         * along with the enemy index. We can validate if needed by storing unique parameters and checking later.
                         * But for now, this is good.
                         */
                        int iDistanceToEnemy = ACFunctions.fGetDistance(tmpLocalPlayer, tmpEnemyPlayer);
                        iDistanceToEnemy = iDistanceToEnemy / 20000;
                        //Creates the head height
                        float head = ACFunctions.vHead.y - ACFunctions.vFoot.y;
                        //Creates Width
                        float width = head / 2;
                        //Creates Center
                        float center = width / -2;
                        //Creates Extra area above head
                        float extra = head / -6;

                        Graphics g = Graphics.FromHwnd(hwnd);

                        SolidBrush b = new SolidBrush(Color.Aqua);

                        int iTeam = pmcrw.ReadInt(iEntityList[i] + OS.m_os_LocalPlayerTeam_ID);
                        // It is sorted, so the first address should be the closest enemy.
                        if (!(iTeam == localPlayer.iLPCurrentTeam))
                        {
                            b = new SolidBrush(Color.Red);
                        }
                        else
                        {
                            b = new SolidBrush(Color.Green);
                        }
                        Pen myPen = new Pen(b);

                        System.Drawing.Rectangle myrect = new Rectangle();
                        myrect.X = (int)ACFunctions.vFoot.x - (int)center;
                        myrect.Y = (int)ACFunctions.vHead.y - 20;
                        // myrect.Width = (int)ACFunctions.vFoot.x + (int)center + (int)width;
                        myrect.Width = iDistanceToEnemy / 5; //- (int)center + (int)width;
                        // myrect.Height = (int)ACFunctions.vFoot.y + ((int)head - (int)extra);
                        myrect.Height = iDistanceToEnemy * 2 / 5;

                        g.DrawRectangle(myPen, myrect);

                        // g.FillRectangle(Brushes.Red, new Rectangle((SystemInformation.WorkingArea.Width / 2) - 4, (SystemInformation.WorkingArea.Height / 2) - 20, 8, 40));
                        // g.FillRectangle(Brushes.Red, new Rectangle((SystemInformation.WorkingArea.Width / 2) - 20, (SystemInformation.WorkingArea.Height / 2) - 4, 40, 8));
                        // g.Dispose();
                        // ReleaseDC(IntPtr.Zero, hwnd);
                    }
                }
            }
        }