/// <summary> /// Player's World To Screen Function /// </summary> /// <param name="vAddr"></param> /// <param name="pos"></param> /// <param name="screen"></param> /// <param name="windowWidth"></param> /// <param name="windowHeight"></param> /// <returns></returns> public static bool WorldToScreenPlayer(D3DMatrix viewMatrix, ShpVector3 pos, out ShpVector3 screen, out int distance, int windowWidth, int windowHeight) { screen = new ShpVector3(); //ScreenW = (GameViewMatrix._14 * _Enemy_Point.x) + (GameViewMatrix._24* _Enemy_Point.y) + (GameViewMatrix._34 * _Enemy_Point.z + GameViewMatrix._44); float screenW = (viewMatrix._14 * pos.X) + (viewMatrix._24 * pos.Y) + (viewMatrix._34 * pos.Z + viewMatrix._44); distance = (int)(screenW / 100); if (screenW < 0.0001f) { return(false); } // float ScreenY = (GameViewMatrix._12 * _Enemy_Point.x) + (GameViewMatrix._22 * _Enemy_Point.y) + (GameViewMatrix._32 * (_Enemy_Point.z + 85) + GameViewMatrix._42); float screenY = (viewMatrix._12 * pos.X) + (viewMatrix._22 * pos.Y) + (viewMatrix._32 * (pos.Z + 85) + viewMatrix._42); // float ScreenX = (GameViewMatrix._11 * _Enemy_Point.x) + (GameViewMatrix._21 * _Enemy_Point.y) + (GameViewMatrix._31 * _Enemy_Point.z + GameViewMatrix._41); float screenX = (viewMatrix._11 * pos.X) + (viewMatrix._21 * pos.Y) + (viewMatrix._31 * pos.Z + viewMatrix._41); screen.Y = (windowHeight / 2) - (windowHeight / 2) * screenY / screenW; screen.X = (windowWidth / 2) + (windowWidth / 2) * screenX / screenW; // float y1 = (pDxm->s_height / 2) - (GameViewMatrix._12*_Enemy_Point.x + GameViewMatrix._22 * _Enemy_Point.y + GameViewMatrix._32 *(_Enemy_Point.z - 95) + GameViewMatrix._42) *(pDxm->s_height / 2) / ScreenW; float y1 = (windowHeight / 2) - (viewMatrix._12 * pos.X + viewMatrix._22 * pos.Y + viewMatrix._32 * (pos.Z - 95) + viewMatrix._42) * (windowHeight / 2) / screenW; screen.Z = y1 - screen.Y; return(true); }
/// <summary> /// To Matrix With Scale /// </summary> /// <param name="translation"></param> /// <param name="scale"></param> /// <param name="rot"></param> /// <returns></returns> private static D3DMatrix ToMatrixWithScale(Vector3 translation, Vector3 scale, Vector4 rot) { D3DMatrix m = new D3DMatrix { _41 = translation.X, _42 = translation.Y, _43 = translation.Z }; float x2 = rot.X + rot.X; float y2 = rot.Y + rot.Y; float z2 = rot.Z + rot.Z; float xx2 = rot.X * x2; float yy2 = rot.Y * y2; float zz2 = rot.Z * z2; m._11 = (1.0f - (yy2 + zz2)) * scale.X; m._22 = (1.0f - (xx2 + zz2)) * scale.Y; m._33 = (1.0f - (xx2 + yy2)) * scale.Z; float yz2 = rot.Y * z2; float wx2 = rot.W * x2; m._32 = (yz2 - wx2) * scale.Z; m._23 = (yz2 + wx2) * scale.Y; float xy2 = rot.X * y2; float wz2 = rot.W * z2; m._21 = (xy2 - wz2) * scale.Y; m._12 = (xy2 + wz2) * scale.X; float xz2 = rot.X * z2; float wy2 = rot.W * y2; m._31 = (xz2 + wy2) * scale.Z; m._13 = (xz2 - wy2) * scale.X; m._14 = 0.0f; m._24 = 0.0f; m._34 = 0.0f; m._44 = 1.0f; return(m); }
/// Item's World To Screen Function /// </summary> /// <param name="viewMatrix"></param> /// <param name="pos"></param> /// <param name="screen"></param> /// <param name="distance"></param> /// <param name="windowWidth"></param> /// <param name="windowHeight"></param> /// <returns></returns> public static bool WorldToScreenItem(D3DMatrix viewMatrix, ShpVector3 pos, out ShpVector2 screen, out int distance, int windowWidth, int windowHeight) { screen = new ShpVector2(); float screenW = (viewMatrix._14 * pos.X) + (viewMatrix._24 * pos.Y) + (viewMatrix._34 * pos.Z + viewMatrix._44); distance = (int)(screenW / 100); if (screenW < 0.0001f) { return(false); } screenW = 1 / screenW; float sightX = (windowWidth / 2); float sightY = (windowHeight / 2); screen.X = sightX + (viewMatrix._11 * pos.X + viewMatrix._21 * pos.Y + viewMatrix._31 * pos.Z + viewMatrix._41) * screenW * sightX; screen.Y = sightY - (viewMatrix._12 * pos.X + viewMatrix._22 * pos.Y + viewMatrix._32 * pos.Z + viewMatrix._42) * screenW * sightY; return(!float.IsNaN(screen.X) && !float.IsNaN(screen.Y)); }
public static bool WorldToScreen3DBox(D3DMatrix viewMatrix, ShpVector3 position, out ShpVector2 res, int sw, int sh) { res.X = 0f; res.Y = 0f; D3DMatrix matrix = viewMatrix; double num = (double)(position.X * matrix._14 + position.Y * matrix._24 + position.Z * matrix._34 + matrix._44); if (num < 0.100000001490116) { return(false); } double num2 = (double)(position.X * matrix._11 + position.Y * matrix._21 + position.Z * matrix._31 + matrix._41); double num3 = (double)(position.X * matrix._12 + position.Y * matrix._22 + position.Z * matrix._32 + matrix._42); num2 /= num; num3 /= num; float num4 = (float)(sw / 2); float num5 = (float)(sh / 2); res.X = (float)((double)num4 * num2 + (num2 + (double)num4)); res.Y = (float)(-(float)((double)num5 * num3) + (num3 + (double)num5)); return(!float.IsNaN(res.X) && !float.IsNaN(res.Y)); }
/// <summary> /// D3DMatrix Mutiplication /// </summary> /// <param name="pM1"></param> /// <param name="pM2"></param> /// <returns></returns> public static D3DMatrix MatrixMultiplication(D3DMatrix pM1, D3DMatrix pM2) { D3DMatrix pOut = new D3DMatrix { _11 = pM1._11 * pM2._11 + pM1._12 * pM2._21 + pM1._13 * pM2._31 + pM1._14 * pM2._41, _12 = pM1._11 * pM2._12 + pM1._12 * pM2._22 + pM1._13 * pM2._32 + pM1._14 * pM2._42, _13 = pM1._11 * pM2._13 + pM1._12 * pM2._23 + pM1._13 * pM2._33 + pM1._14 * pM2._43, _14 = pM1._11 * pM2._14 + pM1._12 * pM2._24 + pM1._13 * pM2._34 + pM1._14 * pM2._44, _21 = pM1._21 * pM2._11 + pM1._22 * pM2._21 + pM1._23 * pM2._31 + pM1._24 * pM2._41, _22 = pM1._21 * pM2._12 + pM1._22 * pM2._22 + pM1._23 * pM2._32 + pM1._24 * pM2._42, _23 = pM1._21 * pM2._13 + pM1._22 * pM2._23 + pM1._23 * pM2._33 + pM1._24 * pM2._43, _24 = pM1._21 * pM2._14 + pM1._22 * pM2._24 + pM1._23 * pM2._34 + pM1._24 * pM2._44, _31 = pM1._31 * pM2._11 + pM1._32 * pM2._21 + pM1._33 * pM2._31 + pM1._34 * pM2._41, _32 = pM1._31 * pM2._12 + pM1._32 * pM2._22 + pM1._33 * pM2._32 + pM1._34 * pM2._42, _33 = pM1._31 * pM2._13 + pM1._32 * pM2._23 + pM1._33 * pM2._33 + pM1._34 * pM2._43, _34 = pM1._31 * pM2._14 + pM1._32 * pM2._24 + pM1._33 * pM2._34 + pM1._34 * pM2._44, _41 = pM1._41 * pM2._11 + pM1._42 * pM2._21 + pM1._43 * pM2._31 + pM1._44 * pM2._41, _42 = pM1._41 * pM2._12 + pM1._42 * pM2._22 + pM1._43 * pM2._32 + pM1._44 * pM2._42, _43 = pM1._41 * pM2._13 + pM1._42 * pM2._23 + pM1._43 * pM2._33 + pM1._44 * pM2._43, _44 = pM1._41 * pM2._14 + pM1._42 * pM2._24 + pM1._43 * pM2._34 + pM1._44 * pM2._44 }; return(pOut); }
public void Update() { var gfx = _graphics; gfx.BeginScene(); gfx.ClearScene(_transparent); if (Settings.ShowMenu) { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 115), "Aimbot Menu"); if (Settings.aimEnabled) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 + 130), "Aimbot ON (F5) : " + Settings.aimEnabled.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 130), "Aimbot OF (F5) : " + Settings.aimEnabled.ToString()); } if (Settings.bDrawFow) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 + 145), "FOV SHOW (F6) : " + Settings.bDrawFow.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 145), "FOV HIDE (F6) : " + Settings.bDrawFow.ToString()); } DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 160), "┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈"); } // Read View Matrix long viewMatrixAddr = Mem.ReadMemory <int>(Mem.ReadMemory <int>(_data.ViewMatrixBase) + 32) + 512; D3DMatrix viewMatrix = Algorithms.ReadViewMatrix(viewMatrixAddr); var AimTargets = new AimTarget[_data.Players.Length]; float fClosestDist = -1; // Draw Player ESP if (Settings.PlayerESP) { for (int i = 0; i < _data.Players.Length; i++) { var player = _data.Players[i]; //if (player.Health <= 0) continue; if (Algorithms.WorldToScreenPlayer(viewMatrix, player.Position, out ShpVector3 playerScreen, out int distance, _window.Width, _window.Height)) { // Too Far not render if (distance > 500) { continue; } float x = playerScreen.X; float y = playerScreen.Y; float h = playerScreen.Z; float w = playerScreen.Z / 2; try { _boxBrush = _randomBrush[player.TeamID % 7]; } catch (IndexOutOfRangeException) { _boxBrush = _green; } //DrawShadowText(gfx,_font, _green, new Point((x - playerScreen.Z / 4) - 3, y - 15), player.Pose.ToString()); // Adjust Box if (player.Pose == 1114636288) { y = playerScreen.Y + playerScreen.Z / 5; h -= playerScreen.Z / 5; } if (player.Pose == 1112014848 || player.Status == 7) { y = playerScreen.Y + playerScreen.Z / 4; h -= playerScreen.Z / 4; } int ScreenCenterX = _window.Width / 2, ScreenCenterY = _window.Height / 2; if (Settings.aimEnabled) { long tmpAddv = Mem.ReadMemory <int>(player.Address + tmpOffset); long bodyAddv = tmpAddv + actorOffset; long boneAddv = Mem.ReadMemory <int>(tmpAddv + boneOffset) + 48; ShpVector3 headPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 5 * 48); headPos.Z += 7; var clampPos = headPos - player.Position; bool w2sHead = Algorithms.WorldToScreen3DBox(viewMatrix, new ShpVector3(headPos.X, headPos.Y - (Settings.bPredict * 2), headPos.Z - (Settings.bYAxis * 8)), out ShpVector2 HeadPosition, _window.Width, _window.Height); AimTargets[i] = new AimTarget(); AimTargets[i].Screen2D = HeadPosition; AimTargets[i].uniqueID = player.TeamID; AimTargets[i].CrosshairDistance = ShpVector2.Distance(HeadPosition, new ShpVector2(ScreenCenterX, ScreenCenterY)); if (BestTargetUniqID == -1) { if (Algorithms.isInside(ScreenCenterX, ScreenCenterY, Settings.bFovArray[Settings.bFovInt], AimTargets[i].Screen2D.X, AimTargets[i].Screen2D.Y)) { fClosestDist = AimTargets[i].CrosshairDistance; BestTargetUniqID = AimTargets[i].uniqueID; } } if (MainForm.GetAsyncKeyState(Settings.bAimKeys[Settings.bAimKeyINT])) { if (BestTargetUniqID != -1) { var best = FindAimTargetByUniqueID(AimTargets, BestTargetUniqID); if (best != null) { { var roundPos = new ShpVector2((float)Math.Round(best.Screen2D.X), (float)Math.Round(best.Screen2D.Y)); AimAtPosV2(roundPos.X, roundPos.Y, _window.Width, _window.Height, false); } } } } else { BestTargetUniqID = -1; } } if (Settings.bDrawFow) { gfx.DrawCircle(_red, ScreenCenterX, ScreenCenterY, Settings.bFovArray[Settings.bFovInt], 2); } } } gfx.EndScene(); } }
private void DrawPlayerBone(long bodyAddv, long boneAddv, float w, D3DMatrix viewMatrix, int winWidth, int winHeight) { float sightX = winWidth / 2, sightY = winHeight / 2; ShpVector3 headPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 5 * 48); headPos.Z += 7; ShpVector2 head; Algorithms.WorldToScreenBone(viewMatrix, headPos, out head, out int distance, winWidth, winHeight); ShpVector2 neck = head; ShpVector2 chest; ShpVector3 chestPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 4 * 48); Algorithms.WorldToScreenBone(viewMatrix, chestPos, out chest, out distance, winWidth, winHeight); ShpVector2 pelvis; ShpVector3 pelvisPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 1 * 48); Algorithms.WorldToScreenBone(viewMatrix, pelvisPos, out pelvis, out distance, winWidth, winHeight); ShpVector2 lSholder; ShpVector3 lSholderPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 11 * 48); Algorithms.WorldToScreenBone(viewMatrix, lSholderPos, out lSholder, out distance, winWidth, winHeight); ShpVector2 rSholder; ShpVector3 rSholderPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 32 * 48); Algorithms.WorldToScreenBone(viewMatrix, rSholderPos, out rSholder, out distance, winWidth, winHeight); ShpVector2 lElbow; ShpVector3 lElbowPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 12 * 48); Algorithms.WorldToScreenBone(viewMatrix, lElbowPos, out lElbow, out distance, winWidth, winHeight); ShpVector2 rElbow; ShpVector3 rElbowPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 33 * 48); Algorithms.WorldToScreenBone(viewMatrix, rElbowPos, out rElbow, out distance, winWidth, winHeight); ShpVector2 lWrist; ShpVector3 lWristPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 63 * 48); Algorithms.WorldToScreenBone(viewMatrix, lWristPos, out lWrist, out distance, winWidth, winHeight); ShpVector2 rWrist; ShpVector3 rWristPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 62 * 48); Algorithms.WorldToScreenBone(viewMatrix, rWristPos, out rWrist, out distance, winWidth, winHeight); ShpVector2 lThigh; ShpVector3 lThighPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 52 * 48); Algorithms.WorldToScreenBone(viewMatrix, lThighPos, out lThigh, out distance, winWidth, winHeight); ShpVector2 rThigh; ShpVector3 rThighPos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 56 * 48); Algorithms.WorldToScreenBone(viewMatrix, rThighPos, out rThigh, out distance, winWidth, winHeight); ShpVector2 lKnee; ShpVector3 lKneePos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 53 * 48); Algorithms.WorldToScreenBone(viewMatrix, lKneePos, out lKnee, out distance, winWidth, winHeight); ShpVector2 rKnee; ShpVector3 rKneePos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 57 * 48); Algorithms.WorldToScreenBone(viewMatrix, rKneePos, out rKnee, out distance, winWidth, winHeight); ShpVector2 lAnkle; ShpVector3 lAnklePos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 54 * 48); Algorithms.WorldToScreenBone(viewMatrix, lAnklePos, out lAnkle, out distance, winWidth, winHeight); ShpVector2 rAnkle; ShpVector3 rAnklePos = Algorithms.GetBoneWorldPosition(bodyAddv, boneAddv + 58 * 48); Algorithms.WorldToScreenBone(viewMatrix, rAnklePos, out rAnkle, out distance, winWidth, winHeight); if (head != null && chest != null && pelvis != null && lSholder != null && rSholder != null && lElbow != null && rElbow != null && lWrist != null && rWrist != null && lThigh != null && rThigh != null && lKnee != null && rKnee != null && lAnkle != null && rAnkle != null) { _graphics.DrawCircle(_white, new Circle(head.X, head.Y, w / 6), 1); _graphics.DrawLine(_white, new Line(neck.X, neck.Y, chest.X, chest.Y), 1); _graphics.DrawLine(_white, new Line(chest.X, chest.Y, pelvis.X, pelvis.Y), 1); _graphics.DrawLine(_white, new Line(chest.X, chest.Y, lSholder.X, lSholder.Y), 1); _graphics.DrawLine(_white, new Line(chest.X, chest.Y, rSholder.X, rSholder.Y), 1); _graphics.DrawLine(_white, new Line(lSholder.X, lSholder.Y, lElbow.X, lElbow.Y), 1); _graphics.DrawLine(_white, new Line(rSholder.X, rSholder.Y, rElbow.X, rElbow.Y), 1); _graphics.DrawLine(_white, new Line(lElbow.X, lElbow.Y, lWrist.X, lWrist.Y), 1); _graphics.DrawLine(_white, new Line(rElbow.X, rElbow.Y, rWrist.X, rWrist.Y), 1); _graphics.DrawLine(_white, new Line(pelvis.X, pelvis.Y, lThigh.X, lThigh.Y), 1); _graphics.DrawLine(_white, new Line(pelvis.X, pelvis.Y, rThigh.X, rThigh.Y), 1); _graphics.DrawLine(_white, new Line(lThigh.X, lThigh.Y, lKnee.X, lKnee.Y), 1); _graphics.DrawLine(_white, new Line(rThigh.X, rThigh.Y, rKnee.X, rKnee.Y), 1); _graphics.DrawLine(_white, new Line(lKnee.X, lKnee.Y, lAnkle.X, lAnkle.Y), 1); _graphics.DrawLine(_white, new Line(rKnee.X, rKnee.Y, rAnkle.X, rAnkle.Y), 1); } }
private void Draw3DBox(D3DMatrix viewMatrix, PlayerData player, ShpVector3 playersc, int winWidth, int winHeight, float hei = 180f) { float num = 70f; float num2 = 60f; float num3 = 50f; float num4 = 85f; hei = 180f; ShpVector3 vector = new ShpVector3(num3, -num2 / 2f, 0f); ShpVector3 vector2 = new ShpVector3(num3, num2 / 2f, 0f); ShpVector3 vector3 = new ShpVector3(num3 - num, num2 / 2f, 0f); ShpVector3 vector4 = new ShpVector3(num3 - num, -num2 / 2f, 0f); Matrix matrix = Matrix.RotationZ((6.28318548f * (player.Position.Y) / 180f / 2f)); ShpVector3 vector5 = new ShpVector3(player.Position.X, player.Position.Y, player.Position.Z - num4); vector = ShpVector3.TransformCoordinate(vector, matrix) + vector5; vector2 = ShpVector3.TransformCoordinate(vector2, matrix) + vector5; vector3 = ShpVector3.TransformCoordinate(vector3, matrix) + vector5; vector4 = ShpVector3.TransformCoordinate(vector4, matrix) + vector5; ShpVector2 vector6; if (!Algorithms.WorldToScreen3DBox(viewMatrix, vector, out vector6, winWidth, winHeight)) { return; } ShpVector2 vector7; if (!Algorithms.WorldToScreen3DBox(viewMatrix, vector2, out vector7, winWidth, winHeight)) { return; } ShpVector2 vector8; if (!Algorithms.WorldToScreen3DBox(viewMatrix, vector3, out vector8, winWidth, winHeight)) { return; } ShpVector2 vector9; if (!Algorithms.WorldToScreen3DBox(viewMatrix, vector4, out vector9, winWidth, winHeight)) { return; } RawVector2[] array = new RawVector2[] { vector6, vector7, vector8, vector9, vector6 }; DrawLines(array, _boxBrush); vector.Z += hei; bool arg_240_0 = Algorithms.WorldToScreen3DBox(viewMatrix, vector, out vector6, winWidth, winHeight); vector2.Z += hei; bool flag = Algorithms.WorldToScreen3DBox(viewMatrix, vector2, out vector7, winWidth, winHeight); vector3.Z += hei; bool flag2 = Algorithms.WorldToScreen3DBox(viewMatrix, vector3, out vector8, winWidth, winHeight); vector4.Z += hei; bool flag3 = Algorithms.WorldToScreen3DBox(viewMatrix, vector4, out vector9, winWidth, winHeight); if (!arg_240_0 || !flag || !flag2 || !flag3) { return; } RawVector2[] array2 = new RawVector2[] { vector6, vector7, vector8, vector9, vector6 }; DrawLines(array2, _boxBrush); DrawLine(new RawVector2(array[0].X, array[0].Y), new RawVector2(array2[0].X, array2[0].Y), _boxBrush); DrawLine(new RawVector2(array[1].X, array[1].Y), new RawVector2(array2[1].X, array2[1].Y), _boxBrush); DrawLine(new RawVector2(array[2].X, array[2].Y), new RawVector2(array2[2].X, array2[2].Y), _boxBrush); DrawLine(new RawVector2(array[3].X, array[3].Y), new RawVector2(array2[3].X, array2[3].Y), _boxBrush); }
public void Update() { var gfx = _graphics; gfx.BeginScene(); gfx.ClearScene(_transparent); // Draw FPS //gfx.DrawTextWithBackground(_font, _red, _black, 10, 10, "FPS: " + gfx.FPS); // Draw Menu if (Settings.ShowMenu) { //gfx.FillRectangle(_menuBrush, 10f, _window.Height / 2 - 75, 180, _window.Height / 2 + 165); DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 - 65), " [ AM7 PUBG ] "); DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 - 50), "┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈"); DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 - 35), "ESP Menu"); if (Settings.PlayerESP) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 - 20), "Player ESP (Num1) : " + Settings.PlayerESP.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 - 20), "Player ESP (Num1) : " + Settings.PlayerESP.ToString()); } if (Settings.PlayerBox) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 - 5), "Player Box (Num2) : " + Settings.PlayerBox.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 - 5), "Player Box (Num2) : " + Settings.PlayerBox.ToString()); } if (Settings.PlayerBone) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 + 10), "Player Bone (Num3) : " + Settings.PlayerBone.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 10), "Player Bone (Num3) : " + Settings.PlayerBone.ToString()); } if (Settings.PlayerLines) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 + 25), "Player Line (Num4) : " + Settings.PlayerLines.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 25), "Player Line (Num4) : " + Settings.PlayerLines.ToString()); } if (Settings.PlayerHealth) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 + 40), "Player Health (Num5) : " + Settings.PlayerHealth.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 40), "Player Health (Num5) : " + Settings.PlayerHealth.ToString()); } if (Settings.ItemESP) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 + 55), "Item ESP (Num6) : " + Settings.ItemESP.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 55), "Item ESP (Num6) : " + Settings.ItemESP.ToString()); } if (Settings.VehicleESP) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 + 70), "Vehicle ESP (Num7) : " + Settings.VehicleESP.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 70), "Vehicle ESP (Num7) : " + Settings.VehicleESP.ToString()); } if (Settings.Player3dBox) { DrawShadowText(gfx, _font, _red, new Point(20f, _window.Height / 2 + 85), "Player 3D Box (Num8) : " + Settings.Player3dBox.ToString()); } else { DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 85), "Player 3D Box (Num8) : " + Settings.Player3dBox.ToString()); } DrawShadowText(gfx, _font, _green, new Point(20f, _window.Height / 2 + 100), "┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈"); } if (_data.Players.Length > 0) { playerCount = _data.Players.Length; DrawShadowText(gfx, _bigfont, _red, new Point(_window.Width / 2 - 40f, 40f), "Enemy near : " + playerCount); } // Read View Matrix long viewMatrixAddr = Mem.ReadMemory <int>(Mem.ReadMemory <int>(_data.ViewMatrixBase) + 32) + 512; D3DMatrix viewMatrix = Algorithms.ReadViewMatrix(viewMatrixAddr); // Draw Player ESP if (Settings.PlayerESP) { foreach (var player in _data.Players) { //if (player.Health <= 0) continue; if (Algorithms.WorldToScreenPlayer(viewMatrix, player.Position, out ShpVector3 playerScreen, out int distance, _window.Width, _window.Height)) { // Too Far not render if (distance > 500) { continue; } float x = playerScreen.X; float y = playerScreen.Y; float h = playerScreen.Z; float w = playerScreen.Z / 2; try { _boxBrush = _randomBrush[player.TeamID % 7]; } catch (IndexOutOfRangeException) { _boxBrush = _green; } //DrawShadowText(gfx,_font, _green, new Point((x - playerScreen.Z / 4) - 3, y - 15), player.Pose.ToString()); // Adjust Box if (player.Pose == 1114636288) { y = playerScreen.Y + playerScreen.Z / 5; h -= playerScreen.Z / 5; } if (player.Pose == 1112014848 || player.Status == 7) { y = playerScreen.Y + playerScreen.Z / 4; h -= playerScreen.Z / 4; } // Draw Info StringBuilder sb = new StringBuilder("["); if (player.IsRobot) { sb.Append("[Bot] "); } sb.Append(player.Name); DrawShadowText(gfx, _infoFont, _boxBrush, new Point(x + w / 2, y - 5), sb.ToString()); // Draw Distance sb = new StringBuilder("["); sb.Append(distance).Append("M]"); DrawShadowText(gfx, _font, _boxBrush, new Point(x + w / 2, y + 7), sb.ToString()); if (Settings.PlayerBox) { // Draw Box gfx.DrawRectangle(_boxBrush, Rectangle.Create(x - playerScreen.Z / 4 - 3, y - 5, w + 3, h + 5), 1); } if (Settings.Player3dBox) { Draw3DBox(viewMatrix, player, playerScreen, _window.Width, _window.Height, 180f); // Draw Box //gfx.DrawRectangle(_boxBrush, Rectangle.Create(x - playerScreen.Z / 4 - 3, y - 5, w + 3, h + 5), 1); } if (Settings.PlayerBone) { // Draw Bone long tmpAddv = Mem.ReadMemory <int>(player.Address + tmpOffset); long bodyAddv = tmpAddv + actorOffset; long boneAddv = Mem.ReadMemory <int>(tmpAddv + boneOffset) + 48; DrawPlayerBone(bodyAddv, boneAddv, w, viewMatrix, _window.Width, _window.Height); } if (Settings.PlayerHealth) { // Draw Health DrawPlayerBlood((x - playerScreen.Z / 4) - 8, y - 5, h + 5, 3, player.Health); } if (Settings.PlayerLines) { // Draw Line gfx.DrawLine(_white, new Line(_window.Width / 2, 0, x, y), 2); } } } } // Draw Item ESP if (Settings.ItemESP) { foreach (var item in _data.Items) { if (Algorithms.WorldToScreenItem(viewMatrix, item.Position, out ShpVector2 itemScreen, out int distance, _window.Width, _window.Height)) { // Too Far not render if (distance > 100) { continue; } // Draw Item string disStr = string.Format("[{0}m]", distance); DrawShadowText(gfx, _font, _yellow, new Point(itemScreen.X, itemScreen.Y), item.Name); DrawShadowText(gfx, _font, _yellow, new Point(itemScreen.X, itemScreen.Y + 10), disStr); } } foreach (var box in _data.Boxes) { if (Algorithms.WorldToScreenItem(viewMatrix, box.Position, out ShpVector2 itemScreen, out int distance, _window.Width, _window.Height)) { // Too Far not render if (distance > 100) { continue; } DrawShadowText(gfx, _font, _yellow, new Point(itemScreen.X, itemScreen.Y), "Lootbox [" + distance.ToString() + "M]"); } } } // Draw Vehicle ESP if (Settings.VehicleESP) { foreach (var car in _data.Vehicles) { if (Algorithms.WorldToScreenItem(viewMatrix, car.Position, out ShpVector2 carScreen, out int distance, _window.Width, _window.Height)) { // Too Far not render if (distance > 300) { continue; } string disStr = string.Format("[{0}m]", distance); // Draw Car DrawShadowText(gfx, _font, _blue, new Point(carScreen.X, carScreen.Y), car.Name); DrawShadowText(gfx, _font, _blue, new Point(carScreen.X, carScreen.Y + 10), disStr); } } } // Grenade alert foreach (var gre in _data.Grenades) { if (Algorithms.WorldToScreenItem(viewMatrix, gre.Position, out ShpVector2 greScreen, out int distance, _window.Width, _window.Height)) { DrawShadowText(gfx, _font, 15, _red, new Point(greScreen.X, greScreen.Y), string.Format("!!! {0} !!! [{1}M]", gre.Type.GetDescription(), distance)); } } gfx.EndScene(); }
/// <summary> /// Bone's World to Screen Function /// </summary> /// <param name="viewMatrix"></param> /// <param name="pos"></param> /// <param name="screen"></param> /// <param name="windowWidth"></param> /// <param name="windowHeight"></param> /// <returns></returns> public static bool WorldToScreenBone(D3DMatrix viewMatrix, ShpVector3 pos, out ShpVector2 screen, out int distance, int windowWidth, int windowHeight) => WorldToScreenItem(viewMatrix, pos, out screen, out distance, windowWidth, windowHeight);