1. using System;
  2. using System.Text;
  3. using System.Data;
  4. using System.Drawing;
  5. using System.Threading;
  6. using System.Reflection;
  7. using System.Windows.Forms;
  8. using System.Collections.Generic;
  9. using System.Runtime.InteropServices;
  10. using System.ComponentModel;
  11. using System.Diagnostics;
  12. using SlimDX.Direct3D9;
  13. using SlimDX;
  14. using System.Linq;
  15. namespace H1Z1ESP
  16. {
  17. public partial class Main : Form
  18. {
  19. private delegate void AsyncWrite(String Text);
  20. private delegate void AsyncClear();
  21. public static Boolean IsRunning = false;
  22. private Int64 CGameOffset = 0x1429DC0E0;
  23. private Int64 GraphicsOffset = 0x1429DBE18;
  24. private Hotkey HotKey;
  25. private Settings Settings;
  26. private IntPtr GameWindowHandle;
  27. private MARGIN GameWindowMargin;
  28. private FastMemory GameMemory = new FastMemory();
  29. private RECT GameWindowRect;
  30. private POINT GameWindowSize;
  31. private POINT GameWindowCenter;
  32. public static IniHandler Ini;
  33. public static Boolean Aiming = false;
  34. private static Boolean Aimed = false;
  35. private static ENTITY AimedEntity;
  36. private static DateTime AimedUpdate;
  37. public static Boolean ShowESP = false;
  38. public static Boolean ShowPlayers = true;
  39. public static Boolean ShowAggressive = true;
  40. public static Boolean ShowAnimals = false;
  41. public static Boolean ShowContainers = false;
  42. public static Boolean ShowWeapons = true;
  43. public static Boolean ShowAmmo = true;
  44. public static Boolean ShowItems = true;
  45. public static Boolean ShowVehicles = true;
  46. public static Boolean HideESPWhenAiming = true;
  47. public static Boolean HideDead = true;
  48. public static Boolean BoxedPlayers = true;
  49. public static Boolean BoxedAggressive = true;
  50. public static Boolean BoxedAnimals = false;
  51. public static Boolean BoxedItems = false;
  52. public static Boolean BoxedVehicles = false;
  53. public static Boolean Boxed3D = false;
  54. public static Boolean ShowMap = false;
  55. public static Boolean ShowRadar = true;
  56. public static int RadarTransparency = 210;
  57. public static Boolean RadarPlayers = true;
  58. public static Boolean RadarAggressive = true;
  59. public static Boolean RadarAnimals = true;
  60. public static Boolean RadarVehicles = true;
  61. public static int shootwhere;
  62. public static Boolean ShowEntityLists = true;
  63. private static Vector2 RadarCenter;
  64. public static Boolean ShowMapLarge = true;
  65. public static int MapTransparency = 210;
  66. private static float map_pos_x;
  67. private static float map_pos_z;
  68. public static Boolean ShowPosition = false;
  69. public static Boolean ShowCities = true;
  70. public static Boolean BRMode = false;
  71. public static Boolean ShowAR = true;
  72. public static Boolean ShowShotgun = true;
  73. public static Boolean ShowFirstAid = true;
  74. public static Boolean ShowBackpack = true;
  75. public static Boolean ShowHelmet = true;
  76. public static Boolean TextShadow = true;
  77. public static POINT TextRegion;
  78. public static List<ENTITY> Entity = new List<ENTITY>();
  79. public static Vector3 PlayerPosition = Vector3.Zero;
  80. public static float player_X;
  81. public static float player_Y;
  82. public static float player_Z;
  83. public static float player_D;
  84. public double player_rad;
  85. public string player_C;
  86. private static SlimDX.Direct3D9.Device DXDevice;
  87. private static SlimDX.Direct3D9.Sprite DXSprite;
  88. private static SlimDX.Direct3D9.Texture DXTextrureMap;
  89. private static SlimDX.Direct3D9.Texture DXTextrureMapLarge;
  90. private static SlimDX.Direct3D9.Line DXLine;
  91. private static SlimDX.Direct3D9.Font DXFont;
  92. // 0511 update add //
  93. public Boolean IsCorpse;
  94. public Boolean IsDriving;
  95. public Boolean InVehicle;
  96. [DllImport("shlwapi.dll")]
  97. public static extern int ColorHLSToRGB(int H, int L, int S);
  98. public Main()
  99. {
  100. String iniPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Replace(@"file:\", "");
  101. Ini = new IniHandler(iniPath + @"\Settings.ini");
  102. /*
  103. if (Ini.IniReadValue("Offsets", "CGame") != String.Empty)
  104. CGameOffset = Convert.ToInt64("0x14294A240");
  105. if (Ini.IniReadValue("Offsets", "Graphics") != String.Empty)
  106. GraphicsOffset = Convert.ToInt64("0x142949F88");
  107. */
  108. if (Ini.IniReadValue("Offsets", "CGame") != String.Empty)
  109. CGameOffset = Convert.ToInt64(Ini.IniReadValue("Offsets", "CGame"), 16);
  110. if (Ini.IniReadValue("Offsets", "Graphics") != String.Empty)
  111. GraphicsOffset = Convert.ToInt64(Ini.IniReadValue("Offsets", "Graphics"), 16);
  112. //
  113. if (Ini.IniReadValue("ESP", "ShowPlayers") != String.Empty)
  114. ShowPlayers = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowPlayers"));
  115. if (Ini.IniReadValue("ESP", "ShowAggressive") != String.Empty)
  116. ShowAggressive = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowAggressive"));
  117. if (Ini.IniReadValue("ESP", "ShowAnimals") != String.Empty)
  118. ShowAnimals = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowAnimals"));
  119. if (Ini.IniReadValue("ESP", "ShowContainers") != String.Empty)
  120. ShowContainers = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowContainers"));
  121. if (Ini.IniReadValue("ESP", "ShowWeapons") != String.Empty)
  122. ShowWeapons = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowWeapons"));
  123. if (Ini.IniReadValue("ESP", "ShowAmmo") != String.Empty)
  124. ShowAmmo = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowAmmo"));
  125. if (Ini.IniReadValue("ESP", "ShowItems") != String.Empty)
  126. ShowItems = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowItems"));
  127. if (Ini.IniReadValue("ESP", "ShowVehicles") != String.Empty)
  128. ShowVehicles = Convert.ToBoolean(Ini.IniReadValue("ESP", "ShowVehicles"));
  129. //
  130. if (Ini.IniReadValue("Boxed", "Players") != String.Empty)
  131. BoxedPlayers = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Players"));
  132. if (Ini.IniReadValue("Boxed", "Aggressive") != String.Empty)
  133. BoxedAggressive = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Aggressive"));
  134. if (Ini.IniReadValue("Boxed", "Animals") != String.Empty)
  135. BoxedAnimals = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Animals"));
  136. if (Ini.IniReadValue("Boxed", "Items") != String.Empty)
  137. BoxedItems = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Items"));
  138. if (Ini.IniReadValue("Boxed", "Vehicles") != String.Empty)
  139. BoxedVehicles = Convert.ToBoolean(Ini.IniReadValue("Boxed", "Vehicles"));
  140. if (Ini.IniReadValue("Boxed", "3D") != String.Empty)
  141. Boxed3D = Convert.ToBoolean(Ini.IniReadValue("Boxed", "3D"));
  142. //
  143. if (Ini.IniReadValue("Misc", "ShowPosition") != String.Empty)
  144. ShowPosition = Convert.ToBoolean(Ini.IniReadValue("Misc", "ShowPosition"));
  145. if (Ini.IniReadValue("Misc", "ShowCities") != String.Empty)
  146. ShowCities = Convert.ToBoolean(Ini.IniReadValue("Misc", "ShowCities"));
  147. //
  148. if (Ini.IniReadValue("Misc", "HideDead") != String.Empty)
  149. HideDead = Convert.ToBoolean(Ini.IniReadValue("Misc", "HideDead"));
  150. if (Ini.IniReadValue("Misc", "HideESPWhenAiming") != String.Empty)
  151. HideESPWhenAiming = Convert.ToBoolean(Ini.IniReadValue("Misc", "HideESPWhenAiming"));
  152. //
  153. if (Ini.IniReadValue("Map", "LargeMap") != String.Empty)
  154. ShowMapLarge = Convert.ToBoolean(Ini.IniReadValue("Map", "LargeMap"));
  155. if (Ini.IniReadValue("Map", "Transparency") != String.Empty)
  156. MapTransparency = Int32.Parse(Ini.IniReadValue("Map", "Transparency"));
  157. //
  158. if (Ini.IniReadValue("Radar", "Show") != String.Empty)
  159. ShowRadar = Convert.ToBoolean(Ini.IniReadValue("Radar", "Show"));
  160. if (Ini.IniReadValue("Radar", "Transparency") != String.Empty)
  161. RadarTransparency = Int32.Parse(Ini.IniReadValue("Radar", "Transparency"));
  162. if (Ini.IniReadValue("Radar", "Players") != String.Empty)
  163. RadarPlayers = Convert.ToBoolean(Ini.IniReadValue("Radar", "Players"));
  164. if (Ini.IniReadValue("Radar", "Aggressive") != String.Empty)
  165. RadarAggressive = Convert.ToBoolean(Ini.IniReadValue("Radar", "Aggressive"));
  166. if (Ini.IniReadValue("Radar", "Animals") != String.Empty)
  167. RadarAnimals = Convert.ToBoolean(Ini.IniReadValue("Radar", "Animals"));
  168. if (Ini.IniReadValue("Radar", "Vehicles") != String.Empty)
  169. RadarVehicles = Convert.ToBoolean(Ini.IniReadValue("Radar", "Vehicles"));
  170. if (Ini.IniReadValue("Misc", "ShowEntityLists") != String.Empty)
  171. ShowEntityLists = Convert.ToBoolean(Ini.IniReadValue("Misc", "ShowEntityLists"));
  172. InitializeComponent();
  173. }
  174. public static RECT GetWindowRect(IntPtr hWnd)
  175. {
  176. RECT lpRect = new RECT();
  177. Native.GetWindowRect(hWnd, out lpRect);
  178. return lpRect;
  179. }
  180. private void Main_Load(object sender, EventArgs e)
  181. {
  182. HotKey = new Hotkey();
  183. HotKey.enable(this.Handle, Hotkey.Modifiers.None, Keys.Insert); // Delete //Insert
  184. HotKey.enable(this.Handle, Hotkey.Modifiers.Alt, Keys.F1);
  185. HotKey.enable(this.Handle, Hotkey.Modifiers.Alt, Keys.F2);
  186. HotKey.enable(this.Handle, Hotkey.Modifiers.Alt, Keys.F3);
  187. HotKey.enable(this.Handle, Hotkey.Modifiers.Alt, Keys.F5);
  188. //HotKey.enable(base.Handle, Hotkey.Modifiers.None, Keys.CapsLock);
  189. //HotKey.enable(base.Handle, Hotkey.Modifiers.None, Keys.Q);
  190. Native.SetWindowLong(this.Handle, -20, (IntPtr)((Native.GetWindowLong(this.Handle, -20) ^ 0x80000) ^ 0x20));
  191. Native.SetLayeredWindowAttributes(this.Handle, 0, 0xff, 2);
  192. PresentParameters parameters = new SlimDX.Direct3D9.PresentParameters();
  193. parameters.Windowed = true;
  194. parameters.SwapEffect = SwapEffect.Discard;
  195. parameters.BackBufferFormat = Format.A8R8G8B8;
  196. parameters.BackBufferHeight = this.Height;
  197. parameters.BackBufferWidth = this.Width;
  198. parameters.PresentationInterval = PresentInterval.One;
  199. DXDevice = new SlimDX.Direct3D9.Device(new Direct3D(), 0, DeviceType.Hardware, this.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters[] { parameters });
  200. if (System.IO.File.Exists("map_large.png")) DXTextrureMapLarge = SlimDX.Direct3D9.Texture.FromFile(DXDevice, "map_large.png");
  201. if (System.IO.File.Exists("map.png")) DXTextrureMap = SlimDX.Direct3D9.Texture.FromFile(DXDevice, "map.png");
  202. DXSprite = new SlimDX.Direct3D9.Sprite(DXDevice);
  203. DXLine = new SlimDX.Direct3D9.Line(DXDevice);
  204. DXFont = new SlimDX.Direct3D9.Font(DXDevice, new System.Drawing.Font("NewRoman", 9f));
  205. if (this.GameMemory.Attach("H1Z1 PlayClient (Live)") == false) { Application.Exit(); return; }
  206. Thread dxThread = new Thread(new ThreadStart(DoProcess));
  207. dxThread.IsBackground = true;
  208. dxThread.Start();
  209. //Thread aimThread = new Thread(new ThreadStart(DoAiming));
  210. //aimThread.IsBackground = true;
  211. //aimThread.Start();
  212. }
  213. private void Main_Paint(object sender, PaintEventArgs e)
  214. {
  215. this.GameWindowMargin.Top = 0;
  216. this.GameWindowMargin.Left = 0;
  217. this.GameWindowMargin.Right = this.Width;
  218. this.GameWindowMargin.Bottom = this.Height;
  219. Native.DwmExtendFrameIntoClientArea(this.Handle, ref this.GameWindowMargin);
  220. }
  221. #region RemapValue
  222. public static float RemapValue(float value, float from1, float to1, float from2, float to2)
  223. {
  224. return ((((value - from1) / (to1 - from1)) * (to2 - from2)) + from2);
  225. }
  226. #endregion
  227. #region DrawFilledBox
  228. public static void DrawFilledBox(float x, float y, float w, float h, Color Color, int alpha = 255)
  229. {
  230. if (w > 0f)
  231. {
  232. Vector2[] vertexList = new Vector2[2];
  233. DXLine.GLLines = true;
  234. DXLine.Antialias = false;
  235. DXLine.Width = w;
  236. vertexList[0].X = x + (w / 2f);
  237. vertexList[0].Y = y;
  238. vertexList[1].X = x + (w / 2f);
  239. vertexList[1].Y = y + h;
  240. DXLine.Begin();
  241. DXLine.Draw(vertexList, Color.FromArgb(alpha, Color.R, Color.G, Color.B));
  242. DXLine.End();
  243. }
  244. }
  245. #endregion
  246. #region RotatePoint
  247. private static Vector2 RotatePoint(Vector2 pointToRotate, Vector2 centerPoint, float angle, bool angleInRadians = false)
  248. {
  249. if (!angleInRadians) angle = (float)(angle * 0.017453292519943295);
  250. float num = (float)Math.Cos((double)angle);
  251. float num2 = (float)Math.Sin((double)angle);
  252. Vector2 vector = new Vector2((num * (pointToRotate.X - centerPoint.X)) - (num2 * (pointToRotate.Y - centerPoint.Y)), (num2 * (pointToRotate.X - centerPoint.X)) + (num * (pointToRotate.Y - centerPoint.Y)));
  253. return (vector + centerPoint);
  254. }
  255. #endregion
  256. #region GetMatrixAxis
  257. private static Vector3 GetMatrixAxis(Matrix matrix, int i)
  258. {
  259. switch (i)
  260. {
  261. case 0: return new Vector3(matrix.M11, matrix.M12, matrix.M13);
  262. case 1: return new Vector3(matrix.M21, matrix.M22, matrix.M23);
  263. case 2: return new Vector3(matrix.M31, matrix.M32, matrix.M33);
  264. case 3: return new Vector3(matrix.M41, matrix.M42, matrix.M43);
  265. }
  266. return Vector3.Zero;
  267. }
  268. #endregion
  269. #region WorldToScreen
  270. private bool WorldToScreen(Vector3 vector, out Vector3 screen)
  271. {
  272. screen = Vector3.Zero;
  273. long num = this.GameMemory.ReadInt64(GraphicsOffset);
  274. long num2 = this.GameMemory.ReadInt64(num + 0x48L);
  275. long num3 = this.GameMemory.ReadInt64(num2 + 0x20L) + 0x10L;
  276. Matrix4 matrix = this.GameMemory.ReadMatrix(num3 + 0x1a0L);
  277. Matrix matrix2 = new Matrix();
  278. matrix2.M11 = matrix.M11;
  279. matrix2.M12 = matrix.M12;
  280. matrix2.M13 = matrix.M13;
  281. matrix2.M14 = matrix.M14;
  282. matrix2.M21 = matrix.M21;
  283. matrix2.M22 = matrix.M22;
  284. matrix2.M23 = matrix.M23;
  285. matrix2.M24 = matrix.M24;
  286. matrix2.M31 = matrix.M31;
  287. matrix2.M32 = matrix.M32;
  288. matrix2.M33 = matrix.M33;
  289. matrix2.M34 = matrix.M34;
  290. matrix2.M41 = matrix.M41;
  291. matrix2.M42 = matrix.M42;
  292. matrix2.M43 = matrix.M43;
  293. matrix2.M44 = matrix.M44;
  294. Matrix.Transpose(ref matrix2, out matrix2);
  295. matrix2.M21 *= -1f;
  296. matrix2.M22 *= -1f;
  297. matrix2.M23 *= -1f;
  298. matrix2.M24 *= -1f;
  299. float introduced8 = Vector3.Dot(GetMatrixAxis(matrix2, 3), vector);
  300. float num4 = introduced8 + matrix2.M44;
  301. if (num4 < 0.098f) return false;
  302. float introduced9 = Vector3.Dot(GetMatrixAxis(matrix2, 0), vector);
  303. float num5 = introduced9 + matrix2.M14;
  304. float introduced10 = Vector3.Dot(GetMatrixAxis(matrix2, 1), vector);
  305. float num6 = introduced10 + matrix2.M24;
  306. screen.X = ((((this.GameWindowSize.X - 0x10) / 2) * (1f + (num5 / num4))) + this.GameWindowRect.Left) + 8f;
  307. screen.Y = ((((this.GameWindowSize.Y - 0x26) / 2) * (1f - (num6 / num4))) + this.GameWindowRect.Top) + 30f;
  308. return true;
  309. }
  310. #endregion
  311. #region DrawLine
  312. public static void DrawLine(float x1, float y1, float x2, float y2, float w, Color Color)
  313. {
  314. if (w > 0f)
  315. {
  316. Vector2[] vertexList = new Vector2[] { new Vector2(x1, y1), new Vector2(x2, y2) };
  317. DXLine.GLLines = true;
  318. DXLine.Width = w;
  319. DXLine.Antialias = true;
  320. DXLine.Begin();
  321. DXLine.Draw(vertexList, Color);
  322. DXLine.End();
  323. }
  324. }
  325. #endregion
  326. #region DrawText
  327. public static void DrawText(string text, int x, int y, Color color, bool center = false)
  328. {
  329. int offset = center ? (text.Length * 5) / 2 : 0;
  330. if (TextShadow) DXFont.DrawString(null, text, x - offset + 1, y + 1, (Color4)Color.Black);
  331. DXFont.DrawString(null, text, x - offset, y, (Color4)color);
  332. }
  333. public static void DrawText(string text, ref POINT point, Color color)
  334. {
  335. if (TextShadow) DXFont.DrawString(null, text, point.X + 1, point.Y + 1, (Color4)Color.Black);
  336. DXFont.DrawString(null, text, point.X, point.Y, (Color4)color); point.Y += 15;
  337. }
  338. #endregion
  339. #region DrawBox
  340. public static void DrawBox(float x, float y, float w, float h, float px, Color Color)
  341. {
  342. DrawFilledBox(x - (w / 2f), (y + h) - (h / 2f), w, px, Color);
  343. DrawFilledBox((x - (w / 2f)) - px, y - (h / 2f), px, h, Color);
  344. DrawFilledBox(x - (w / 2f), (y - px) - (h / 2f), w, px, Color);
  345. DrawFilledBox((x - (w / 2f)) + w, y - (h / 2f), px, h, Color);
  346. }
  347. #endregion
  348. #region DrawBoxAbs
  349. public static void DrawBoxAbs(float x, float y, float w, float h, float px, Color Color)
  350. {
  351. DrawFilledBox(x, y + h, w, px, Color);
  352. DrawFilledBox(x - px, y, px, h, Color);
  353. DrawFilledBox(x, y - px, w, px, Color);
  354. DrawFilledBox(x + w, y, px, h, Color);
  355. }
  356. #endregion
  357. #region EntityToScreen
  358. public void EntityToScreen(Vector3 pos, string name, Color color, bool dist, bool line, bool bounds, float boxHeight, float yaw, float pitch)
  359. {
  360. string text = name;
  361. Vector3 dest = Vector3.Zero;
  362. this.WorldToScreen(pos, out dest);
  363. double distX = pos.X - player_X;
  364. double distY = pos.Z - player_Z;
  365. double distZ = pos.Y - player_Y;
  366. double a = Math.Sqrt(((distX * distX) + (distY * distY)) + (distZ * distZ));
  367. if (dest.Y > 0f && dest.X > 0f && dest.Y >= this.GameWindowRect.Top + 20 && dest.X >= this.GameWindowRect.Left && dest.X <= this.GameWindowRect.Right && dest.Y <= this.GameWindowRect.Bottom)
  368. {
  369. if (dist)
  370. {
  371. text = text + " [" + Math.Round(a).ToString() + "m]";
  372. }
  373. if (line)
  374. {
  375. DrawLine(dest.X, dest.Y, this.GameWindowCenter.X, this.GameWindowCenter.Y, 1f, color);
  376. }
  377. if (bounds)
  378. {
  379. if (!Boxed3D || a >= 100.0)
  380. {
  381. DrawBox(dest.X, dest.Y, 65f / Math.Max((float)(((float)a) / 10f), (float)0.2f), 150f / Math.Max((float)(((float)a) / 10f), (float)0.2f), 1f, color);
  382. }
  383. else if (a < 100.0)
  384. {
  385. float wOffset = (boxHeight < 1f) ? boxHeight : 1f;
  386. float zOffset = (boxHeight > 1f) ? boxHeight / 2 : 0f;
  387. double num5 = pos.Z + ((1.0 * Math.Cos((double)pitch)) * Math.Cos((double)yaw));
  388. double num6 = pos.X + ((1.0 * Math.Cos((double)pitch)) * Math.Sin((double)yaw));
  389. double num7 = pos.Y + (1.0 * Math.Sin((double)pitch));
  390. Vector3 vector = new Vector3((float)num6, (float)num7, (float)num5);
  391. Vector3 zero = Vector3.Zero;
  392. this.WorldToScreen(vector, out zero);
  393. DrawLine(dest.X, dest.Y, zero.X, zero.Y, 1f, color);
  394. num5 = pos.Z + (0.5 * Math.Cos(yaw + 0.78539816339744828));
  395. num6 = pos.X + (0.5 * Math.Sin(yaw + 0.78539816339744828));
  396. Vector3 vector4 = new Vector3((float)num6, pos.Y - zOffset, (float)num5);
  397. Vector3 screen = Vector3.Zero;
  398. this.WorldToScreen(vector4, out screen);
  399. num5 = pos.Z + (0.5 * Math.Cos(yaw + 5.497787143782138));
  400. num6 = pos.X + (0.5 * Math.Sin(yaw + 5.497787143782138));
  401. Vector3 vector6 = new Vector3((float)num6, pos.Y - zOffset, (float)num5);
  402. Vector3 vector7 = Vector3.Zero;
  403. this.WorldToScreen(vector6, out vector7);
  404. DrawLine(screen.X, screen.Y, vector7.X, vector7.Y, 1f, color);
  405. num5 = pos.Z + (0.5 * Math.Cos(yaw + 3.9269908169872414));
  406. num6 = pos.X + (0.5 * Math.Sin(yaw + 3.9269908169872414));
  407. Vector3 vector8 = new Vector3((float)num6, pos.Y - zOffset, (float)num5);
  408. Vector3 vector9 = Vector3.Zero;
  409. this.WorldToScreen(vector8, out vector9);
  410. DrawLine(vector7.X, vector7.Y, vector9.X, vector9.Y, 1f, color);
  411. num5 = pos.Z + (0.5 * Math.Cos(yaw + 2.3561944901923448));
  412. num6 = pos.X + (0.5 * Math.Sin(yaw + 2.3561944901923448));
  413. Vector3 vector10 = new Vector3((float)num6, pos.Y - zOffset, (float)num5);
  414. Vector3 vector11 = Vector3.Zero;
  415. this.WorldToScreen(vector10, out vector11);
  416. DrawLine(vector9.X, vector9.Y, vector11.X, vector11.Y, 1f, color);
  417. DrawLine(vector11.X, vector11.Y, screen.X, screen.Y, 1f, color);
  418. Vector3 vector12 = new Vector3(vector4.X, vector4.Y + boxHeight, vector4.Z);
  419. Vector3 vector13 = Vector3.Zero;
  420. this.WorldToScreen(vector12, out vector13);
  421. DrawLine(screen.X, screen.Y, vector13.X, vector13.Y, 1f, color);
  422. Vector3 vector14 = new Vector3(vector6.X, vector6.Y + boxHeight, vector6.Z);
  423. Vector3 vector15 = Vector3.Zero;
  424. this.WorldToScreen(vector14, out vector15);
  425. DrawLine(vector13.X, vector13.Y, vector15.X, vector15.Y, 1f, color);
  426. DrawLine(vector7.X, vector7.Y, vector15.X, vector15.Y, 1f, color);
  427. Vector3 vector16 = new Vector3(vector8.X, vector8.Y + boxHeight, vector8.Z);
  428. Vector3 vector17 = Vector3.Zero;
  429. this.WorldToScreen(vector16, out vector17);
  430. DrawLine(vector15.X, vector15.Y, vector17.X, vector17.Y, 1f, color);
  431. DrawLine(vector9.X, vector9.Y, vector17.X, vector17.Y, 1f, color);
  432. Vector3 vector18 = new Vector3(vector10.X, vector10.Y + boxHeight, vector10.Z);
  433. Vector3 vector19 = Vector3.Zero;
  434. this.WorldToScreen(vector18, out vector19);
  435. DrawLine(vector17.X, vector17.Y, vector19.X, vector19.Y, 1f, color);
  436. DrawLine(vector11.X, vector11.Y, vector19.X, vector19.Y, 1f, color);
  437. DrawLine(vector19.X, vector19.Y, vector13.X, vector13.Y, 1f, color);
  438. }
  439. }
  440. DrawText(text, (int)dest.X, (int)dest.Y - 20, color, true);
  441. }
  442. }
  443. #endregion
  444. public void DoProcess()
  445. {
  446. Main.IsRunning = true;
  447. this.GameWindowHandle = this.GameMemory.Process.MainWindowHandle;
  448. Native.SetForegroundWindow(this.GameWindowHandle);
  449. while (this.GameWindowHandle != IntPtr.Zero && Main.IsRunning && this.GameMemory.IsOpen)
  450. {
  451. this.GameWindowRect = GetWindowRect(this.GameWindowHandle);
  452. this.GameWindowSize.X = this.GameWindowRect.Right - this.GameWindowRect.Left;
  453. this.GameWindowSize.Y = this.GameWindowRect.Bottom - this.GameWindowRect.Top;
  454. this.GameWindowCenter.X = this.GameWindowRect.Left + (this.GameWindowSize.X / 2);
  455. this.GameWindowCenter.Y = this.GameWindowRect.Top + (this.GameWindowSize.Y / 2) + 11;
  456. DXDevice.Clear(ClearFlags.Target, Color.FromArgb(0, 0, 0, 0), 1f, 0);
  457. DXDevice.SetRenderState(RenderState.ZEnable, false);
  458. DXDevice.SetRenderState(RenderState.Lighting, false);
  459. DXDevice.SetRenderState<Cull>(RenderState.CullMode, Cull.None);
  460. DXDevice.BeginScene();
  461. long entityOffset = this.GameMemory.ReadInt64(CGameOffset);
  462. long playerOffset = this.GameMemory.ReadInt64(entityOffset + 0x118);
  463. byte[] playerPos;
  464. long pOffset = GameMemory.ReadInt64(playerOffset + 0x118);
  465. playerPos = GameMemory.ReadBytes(pOffset + 0x6e4, 4 * 3);
  466. player_X = BitConverter.ToSingle(playerPos, 0);
  467. player_Y = BitConverter.ToSingle(playerPos, 4);
  468. player_Z = BitConverter.ToSingle(playerPos, 8);
  469. player_D = this.GameMemory.ReadFloat(playerOffset + 0x2D0);
  470. player_rad = player_D * (180.0 / Math.PI);
  471. if ((player_rad >= -11.25) && (player_rad <= 11.25)) { player_C = "E"; }
  472. else if ((player_rad >= 11.25) && (player_rad <= 33.75)) { player_C = "ENE"; }
  473. else if ((player_rad >= 33.75) && (player_rad <= 56.25)) { player_C = "NE"; }
  474. else if ((player_rad >= 56.25) && (player_rad <= 78.75)) { player_C = "NNE"; }
  475. else if ((player_rad >= 78.75) && (player_rad <= 101.25)) { player_C = "N"; }
  476. else if ((player_rad >= 101.25) && (player_rad <= 123.75)) { player_C = "NNW"; }
  477. else if ((player_rad >= 123.75) && (player_rad <= 146.25)) { player_C = "NW"; }
  478. else if ((player_rad >= 146.25) && (player_rad <= 168.75)) { player_C = "WNW"; }
  479. else if ((player_rad >= 168.75) && (player_rad <= 180)) { player_C = "W"; }
  480. else if ((player_rad >= -180) && (player_rad <= -168.75)) { player_C = "W"; }
  481. else if ((player_rad >= -168.75) && (player_rad <= -146.25)) { player_C = "WSW"; }
  482. else if ((player_rad >= -146.25) && (player_rad <= -123.75)) { player_C = "SW"; }
  483. else if ((player_rad >= -123.75) && (player_rad <= -101.25)) { player_C = "SSW"; }
  484. else if ((player_rad >= -101.25) && (player_rad <= -78.75)) { player_C = "S"; }
  485. else if ((player_rad >= -78.75) && (player_rad <= -56.25)) { player_C = "SSE"; }
  486. else if ((player_rad >= -56.75) && (player_rad <= -33.75)) { player_C = "SE"; }
  487. else if ((player_rad >= -33.75) && (player_rad <= -11.25)) { player_C = "ESE"; }
  488. /*
  489. long posOffset = this.GameMemory.ReadInt64(playerOffset + 0x198);
  490. player_X = this.GameMemory.ReadFloat(posOffset + 0x100); // 0x110 old
  491. player_Y = this.GameMemory.ReadFloat(posOffset + 0x104); // 0x114 old
  492. player_Z = this.GameMemory.ReadFloat(posOffset + 0x108); // 0x118 old*/
  493. PlayerPosition.X = player_X;
  494. PlayerPosition.Y = player_Y;
  495. PlayerPosition.Z = player_Z;
  496. TextRegion = new POINT(this.GameWindowRect.Left + 15, this.GameWindowRect.Top + 35);
  497. if (ShowPosition)
  498. {
  499. DrawText("Position X: " + player_X.ToString("F1") + " Y: " + player_Y.ToString("F1") + " Z: " + player_Z.ToString("F1"), ref TextRegion, Color.White);
  500. DrawText("Direction: " + player_D.ToString("F2"), ref TextRegion, Color.White);
  501. DrawText("Compass:" + player_C, ref TextRegion, Color.White);
  502. }
  503. ShowESP = (!HideESPWhenAiming || Convert.ToBoolean(Native.GetAsyncKeyState(2) & 0x8000) == false);
  504. Entity.Clear(); Aimed = false;
  505. int entityCount = this.GameMemory.ReadInt32(entityOffset + 0x688);
  506. long entityEntry = this.GameMemory.ReadInt64(playerOffset + 0x420);
  507. for (int i = 1; i < entityCount; i++)
  508. {
  509. float EntityX = 0;
  510. float EntityY = 0;
  511. float EntityZ = 0;
  512. float EntityYaw = 0;
  513. float EntityPitch = 0;
  514. float EntitySpeed = 0;
  515. IsCorpse = false;
  516. int EntityType = this.GameMemory.ReadInt32(entityEntry + 0x5E0);
  517. if (EntityType == 0) continue;
  518. int EntityId = this.GameMemory.ReadInt32(entityEntry + 0x638);
  519. long _nameEntry = this.GameMemory.ReadInt64(entityEntry + 0x4F8);
  520. String EntityName = this.GameMemory.ReadString(_nameEntry, this.GameMemory.ReadInt32(entityEntry + 0x500));
  521. // Get Player Pos //
  522. if (EntityType == 0x04 || EntityType == 0x05)
  523. {
  524. EntityX = this.GameMemory.ReadFloat(entityEntry + 0x3E0);
  525. EntityY = this.GameMemory.ReadFloat(entityEntry + 0x3E4);
  526. EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x3E8);
  527. }
  528. else
  529. {
  530. EntityX = this.GameMemory.ReadFloat(entityEntry + 0x3C90);
  531. EntityY = this.GameMemory.ReadFloat(entityEntry + 0x3C94);
  532. EntityZ = this.GameMemory.ReadFloat(entityEntry + 0x3C98);
  533. }
  534. // Create New Entity //
  535. ENTITY currentEntity = new ENTITY()
  536. {
  537. Id = EntityId,
  538. Type = EntityType,
  539. Name = EntityName,
  540. Pos = new Vector3(EntityX, EntityY, EntityZ),
  541. Distance = Vector3.Distance(new Vector3(EntityX, EntityY, EntityZ), PlayerPosition),
  542. Yaw = EntityYaw,
  543. Pitch = EntityPitch,
  544. Speed = EntitySpeed,
  545. };
  546. // Append New Entity //
  547. Entity.Add(currentEntity);
  548. Int32 EntityState = this.GameMemory.ReadInt32(entityEntry + 0x5D8);
  549. // Detect type of Loot (Corpse or Loot) //
  550. if (currentEntity.Type == 0x2E && this.GameMemory.ReadByte(entityEntry + 0x1D88) == 0xE4)
  551. {
  552. IsCorpse = true;
  553. currentEntity.Name = "Corpse";
  554. }
  555. switch (EntityType)
  556. {
  557. case 0x04/*Player*/:
  558. case 0x05/*BR Player*/:
  559. // case 0x11: // OffRoad
  560. // case 0x72: // Pickup
  561. // case 0x76: // PoliceCar
  562. // Aiming //
  563. Vector3 aimingTo = Vector3.Zero;
  564. if (Aimed == true || currentEntity.Distance > 250f || this.GameMemory.ReadByte(entityEntry + 0x13AC) != 1)
  565. {
  566. /* Already aimed, not in range, entity is dead */
  567. }
  568. else if (ModifierKeys.HasFlag(Keys.Control) == true)
  569. {
  570. if (AimedEntity != null && AimedEntity.Id == currentEntity.Id)
  571. {
  572. if (Convert.ToBoolean(this.GameMemory.ReadByte(entityEntry + 0x13AC)) == false)
  573. {
  574. // Target is dead //
  575. AimedEntity = null;
  576. }
  577. else
  578. {
  579. Aimed = true; Vector3 AimXY;
  580. AimedEntity = currentEntity;
  581. float offsetY = 1.2f;
  582. if (AimedEntity.Type == 0x55) offsetY = 0.20f;
  583. if (AimedEntity.Type == 0x13) offsetY = 0.75f;
  584. if (AimedEntity.Type == 0x14) offsetY = 0.50f;
  585. if (AimedEntity.Type == 0x50) offsetY = 0.65f;
  586. if (WorldToScreen(new Vector3(AimedEntity.Pos.X, AimedEntity.Pos.Y + offsetY, AimedEntity.Pos.Z), out AimXY) == true)
  587. {
  588. int moveOffsetX = (int)(Math.Round(AimXY.X) - this.GameWindowCenter.X) / 2;
  589. int moveOffsetY = (int)(Math.Round(AimXY.Y) - this.GameWindowCenter.Y) / 2;
  590. DrawText("Aimed at " + AimedEntity.Name + ": " + moveOffsetX + ", " + moveOffsetY, ref TextRegion, Color.Red);
  591. if (moveOffsetX != 0 || moveOffsetY != 0) Native.mouse_event(0x0001, (short)moveOffsetX, (short)moveOffsetY, 0, 0);
  592. }
  593. }
  594. }
  595. else if (AimedEntity == null && WorldToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), out aimingTo)) // EntityY + 1f old
  596. {
  597. float distance = Vector2.Distance(new Vector2(aimingTo.X, aimingTo.Y), new Vector2(this.GameWindowCenter.X, this.GameWindowCenter.Y));
  598. if (distance < 100f)
  599. {
  600. AimedEntity = currentEntity; Aimed = true;
  601. float moveOffsetX = aimingTo.X - this.GameWindowCenter.X;
  602. float moveOffsetY = aimingTo.Y - this.GameWindowCenter.Y;
  603. Native.mouse_event(0x0001, (short)moveOffsetX, (short)moveOffsetY, 0, 0);
  604. }
  605. }
  606. }
  607. // AIM 2 //
  608. else if (Convert.ToBoolean(Native.GetAsyncKeyState(Keys.CapsLock) & 0x8000) || Convert.ToBoolean(Native.GetAsyncKeyState(Keys.XButton1) & 0x8000) == true)
  609. {
  610. if (AimedEntity != null && AimedEntity.Id == currentEntity.Id)
  611. {
  612. if (Convert.ToBoolean(this.GameMemory.ReadByte(entityEntry + 0x137C)) == false)
  613. {
  614. // Target is dead //
  615. AimedEntity = null;
  616. }
  617. else
  618. {
  619. Aimed = true;
  620. AimedEntity = currentEntity;
  621. Vector3 AIM; float offsetY = 1.5f;
  622. {
  623. switch (EntityState)
  624. {
  625. case 0: offsetY = 1.8f; ; break; // Standing [站立]
  626. case 1: offsetY = 1.05f; ; break; // Crouched [坐著]
  627. case 2: offsetY = 1.5f; break; // Walking [走路]
  628. case 3: offsetY = 1.5f; break; // Running [跑步]
  629. case 4: offsetY = 1.55f; break; // Jumping [跳躍]
  630. case 5: offsetY = 1.05f; break; // Crouching [蹲著]
  631. case 6: offsetY = 0.3f; break; // Prone [趴著]
  632. case 7: offsetY = 0.3f; break; // Crawling [爬行]
  633. }
  634. }
  635. if (WorldToScreen(new Vector3(AimedEntity.Pos.X, AimedEntity.Pos.Y + offsetY, AimedEntity.Pos.Z), out AIM))
  636. {
  637. int moveOffsetX = (int)(Math.Round(AIM.X) - this.GameWindowCenter.X) * 1; // /1
  638. int moveOffsetY = (int)(Math.Round(AIM.Y) - this.GameWindowCenter.Y) * 1; // /1
  639. DrawText("Aimed at " + AimedEntity.Name + ": " + moveOffsetX + ", " + moveOffsetY, ref TextRegion, Color.Red);
  640. if (moveOffsetX != 0 || moveOffsetY != 0) Native.mouse_event(0x0001, (short)moveOffsetX, (short)moveOffsetY, 0, 0);
  641. }
  642. }
  643. }
  644. else if (AimedEntity == null && WorldToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), out aimingTo)) // EntityY + 1f old
  645. {
  646. float distance = Vector2.Distance(new Vector2(aimingTo.X, aimingTo.Y), new Vector2(this.GameWindowCenter.X, this.GameWindowCenter.Y));
  647. if (distance < 75f)
  648. {
  649. AimedEntity = currentEntity; Aimed = true;
  650. float moveOffsetX = aimingTo.X - this.GameWindowCenter.X;
  651. float moveOffsetY = aimingTo.Y - this.GameWindowCenter.Y;
  652. Native.mouse_event(0x0001, (short)moveOffsetX, (short)moveOffsetY, 0, 0);
  653. }
  654. }
  655. }
  656. else
  657. {
  658. AimedEntity = null;
  659. }
  660. // Player Behavior //
  661. if (EntityType == 0x04 || EntityType == 0x05)
  662. {
  663. switch (EntityState)
  664. {
  665. case 0: EntityName += " [Standing]"; break; // Standing
  666. case 1: EntityName += " [Crouched]"; break; // Crouched
  667. case 2: EntityName += " [Walking]"; break; // Walking
  668. case 3: EntityName += " [Running]"; break; // Running
  669. case 4: EntityName += " [Jumping]"; break; // Jumping
  670. case 5: EntityName += " [Crouching]"; break; // Crouching
  671. case 6: EntityName += " [Prone]"; break; // Prone
  672. case 7: EntityName += " [Crawling]"; break; // Crawling
  673. }
  674. }
  675. // Creat SpeedHack // Object+
  676. // float SpeedState = this.GameMemory.ReadInt64(entityOffset + 0x43d8);
  677. long SpeedState = this.GameMemory.ReadInt64(playerOffset + 0x1D70);
  678. // Show Entity when ESP enabled //
  679. if (ShowESP) // && this.GameMemory.ReadFloat(entityEntry + 0x1CC) == 1f)
  680. {
  681. Byte EntityAlive = this.GameMemory.ReadByte(entityEntry + 0x13AC);
  682. if (HideDead == false || Convert.ToBoolean(EntityAlive) == true)
  683. {
  684. // Player //
  685. if (EntityType == 0x04 || EntityType == 0x05)
  686. {
  687. // Show HP
  688. /*long num22 = this.GameMemory.ReadInt64(entityEntry + 0x4098L);
  689. uint num23 = this.GameMemory.ReadUInt32(num22);
  690. for (uint j = 1; (num23 != 0x30) && (j < 50); j++)
  691. {
  692. num22 = this.GameMemory.ReadInt64(num22 + 0xf8L);
  693. num23 = this.GameMemory.ReadUInt32(num22);
  694. }
  695. uint playerHP = this.GameMemory.ReadUInt32(num22 + 0xb0L) / 100;
  696. */
  697. long HPoffset = this.GameMemory.ReadInt64(entityEntry + 0x4088L); // old 0x4058L oldold 0x3fa8L
  698. uint playerHP = this.GameMemory.ReadUInt32(HPoffset + 0xb0L) / 100;
  699. int Hue = (int)(120f * (float)playerHP / 100f); // Hue red at 0° green at 120°
  700. Color color = ColorTranslator.FromWin32(ColorHLSToRGB(Hue, 120, 240)); // H,L,S;
  701. string playerNameHP = EntityName + " " + playerHP.ToString() + "%";
  702. if (ShowPlayers) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), playerNameHP, color, true, false, BoxedPlayers, 2f, EntityYaw, EntityPitch);
  703. // if (ShowPlayers) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.SkyBlue, true, false, BoxedPlayers, 2f, EntityYaw, EntityPitch);
  704. }
  705. // Aggressive NPC (Wolf, Bear, Zombies) //
  706. else
  707. {
  708. if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.Thistle, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch);
  709. }
  710. }
  711. }
  712. break;
  713. // Deer or Rabbit //
  714. case 0x13: // Deer
  715. if (ShowAnimals) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.DarkGreen, true, false, BoxedAnimals, 2f, EntityYaw, EntityPitch);
  716. break;
  717. case 0x55: // Rabbit
  718. if (ShowAnimals) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.DarkGreen, true, false, BoxedAnimals, 2f, EntityYaw, EntityPitch);
  719. break;
  720. // Aggressive NPC (Wolf, Bear, Zombies) //
  721. case 0x0C: // Zombies
  722. if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Thistle, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch);
  723. break;
  724. case 0x5b: // Zombies
  725. if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Red, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch);
  726. break;
  727. case 0x14: // Wolf
  728. if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Red, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch);
  729. break;
  730. case 0x50: // Bear
  731. if (ShowAggressive) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Red, true, false, BoxedAggressive, 2f, EntityYaw, EntityPitch);
  732. break;
  733. case 0x2E: // Loot
  734. if (ShowESP && ShowAmmo)
  735. {
  736. if (IsCorpse == false)
  737. {
  738. if (ShowESP && ShowItems) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.GreenYellow, true, false, BoxedItems, 1f, EntityYaw, EntityPitch);
  739. }
  740. /* else if(ShowESP && ShowItems)
  741. {
  742. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), currentEntity.Name, Color.Olive, true, false, BoxedItems, 1f, EntityYaw, EntityPitch);
  743. }*/
  744. }
  745. break;
  746. case 0x1B: // Campfire
  747. case 0x6D: // Stash
  748. case 0x9C: // Land Mine
  749. if (ShowESP && ShowItems && !BRMode) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.SaddleBrown, true, false, BoxedItems, 0.15f, 0.15f, 0.15f);
  750. break;
  751. case 0x2F: // Furnace //
  752. case 0x33: // Storage Container
  753. case 0x35: // Animal Trap
  754. case 0x36: // Dew Collector
  755. case 0x53: // Barbeque
  756. if (ShowESP && ShowContainers) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Gray, true, false, BoxedItems, 0.15f, 0.15f, 0.15f);
  757. break;
  758. case 0x34: // Weapons
  759. if (ShowESP && ShowWeapons)
  760. {
  761. if (EntityName.Contains("R380") || (EntityName.Contains("M1911") || EntityName.Contains("AR15") || EntityName.Contains(".308 Hunting Rifle") || EntityName.Contains("12GA Pump Shotgun") || EntityName.Contains("M9") || EntityName.Contains("Recurve Bow") || EntityName.Contains("Crowbar")))
  762. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.GreenYellow, true, false, BoxedItems, 1f, 0f, 0f);
  763. }
  764. break;
  765. case 0x15: // Ammo
  766. if (ShowESP && ShowAmmo)
  767. {
  768. if (EntityName.Contains(".45 Round") || EntityName.Contains(".308 Round") || EntityName.Contains(".223 Round") || EntityName.Contains("Shotgun Shell") || EntityName.Contains(".380 round") || EntityName.Contains("9mm Round"))
  769. {
  770. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Orange, true, false, BoxedItems, 1f, 0f, 0f);
  771. }
  772. else
  773. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Orange, true, false, BoxedItems, 1f, 0f, 0f);
  774. }
  775. break;
  776. case 0x11: // OffRoad
  777. case 0x72: // Pickup
  778. case 0x76: // PoliceCar
  779. if (ShowESP && ShowVehicles)
  780. {
  781. if (EntityType == 0x11 || EntityType == 0x72 || EntityType == 0x76)
  782. {
  783. if (ShowVehicles) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.HotPink, true, false, BoxedVehicles, 2f, EntityYaw, EntityPitch);
  784. }
  785. }
  786. if (ShowESP && ShowVehicles) this.EntityToScreen(new Vector3(EntityX, EntityY + 1f, EntityZ), EntityName, Color.HotPink, true, false, BoxedVehicles, 2f, 0f, 0f);
  787. break;
  788. case 0x2C: // Resources, Battary, Turbo, Sparkplugs
  789. if (ShowESP && ShowItems)
  790. {
  791. if (ShowFirstAid || ShowBackpack || ShowHelmet)
  792. {
  793. if (ShowFirstAid && EntityName.Contains("First"))
  794. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.LimeGreen, true, false, BoxedItems, 0.15f, 0.15f, 0.15f);
  795. if (ShowBackpack && EntityName.Contains("Backpack") || EntityName.Contains("Waist Pack"))
  796. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.CornflowerBlue, true, false, BoxedItems, 0.15f, 0.15f, 0.15f);
  797. if (ShowHelmet && EntityName.Contains("Helmet"))
  798. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.DarkSalmon, true, false, BoxedItems, 0.15f, 0.15f, 0.15f);
  799. if (ShowHelmet && EntityName.Contains("Body Armor")) //|| EntityName.Contains("Plated Body Armor") || EntityName.Contains("Wooden Body Armor"))
  800. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Khaki, true, false, BoxedItems, 0.15f, 0.15f, 0.15f);
  801. }
  802. else
  803. {
  804. if (EntityName.Contains("Battery") || EntityName.Contains("Turbo") || EntityName.Contains("Headlights") || EntityName.Contains("Sparkplugs"))
  805. {
  806. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.Plum, true, false, BoxedItems, 0.15f, 0.15f, 0.15f);
  807. }
  808. else
  809. this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName, Color.White, true, false, BoxedItems, 0.15f, 0.15f, 0.15f);
  810. }
  811. }
  812. break;
  813. case 0x16: // Dresser
  814. case 0x17: // Armoire
  815. case 0x19: // World Doors
  816. case 0x1D: // Cabinets
  817. case 0x1E: // Cabinets
  818. case 0x21: // Cabinets
  819. case 0x22: // Cabinets
  820. case 0x23: // Cabinets
  821. case 0x25: // Refrigerator
  822. case 0x26: // Garbage Can
  823. case 0x28: // Cabinets
  824. case 0x29: // Desk
  825. case 0x27: // Dumpster
  826. case 0x30: // File Cabinet
  827. case 0x31: // Tool Cabinet
  828. case 0x37: // Recycle Bin (with fire)
  829. case 0x38: // Punji Sticks
  830. case 0x3D: // Wooded Barricade
  831. case 0x3E: // Water Well
  832. case 0x3F: // Armoire
  833. case 0x40: // Dresser
  834. case 0x42: // Chest
  835. case 0x44: // Wrecked Sedan
  836. case 0x45: // Wrecked Van
  837. case 0x46: // Wrecked Truck
  838. case 0x49: // Ottoman
  839. case 0x4A: // Ottoman
  840. case 0x4F: // Designer-placed(?) Door
  841. case 0x5D: // File Cabinet
  842. case 0x61: // Cabinets
  843. case 0x63: // Cabinets
  844. case 0x6F: // Locker
  845. case 0x70: // Weapon Locker
  846. case 0x71: // Glass Cabinet
  847. case 0x79: // Designer-placed(?) Door
  848. case 0x7A: // Resting (Bed)
  849. case 0x7B: // Designer-placed(?) Door
  850. case 0x7C: // Designer-placed(?) Door
  851. case 0x80: // Cabinets
  852. case 0x81: // Cabinets
  853. case 0x82: // Cabinets
  854. case 0x83: // Cabinets
  855. case 0x84: // Cabinets
  856. case 0x85: // Cabinets
  857. case 0x86: // Cabinets
  858. case 0x87: // Cabinets
  859. case 0x88: // Cabinets
  860. case 0xA1: // Washing Machine
  861. case 0xA2: // Dryer
  862. case 0x7D: // IO.FireHydrant
  863. case 0x7E: // IO.FireHydrant
  864. //this.WorldToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "[" + EntityId.ToString("X2") + "]", Color.Gray, true, false, false, 0f, 0f);
  865. break;
  866. case 0x4C: // Shed
  867. case 0x5F: // Metal Wall/Gate
  868. case 0x62: // Basic Shack Door
  869. case 0x6E: // Desk Foundation
  870. case 0x9E: // Metal Door
  871. case 0xA6: // Large Shelter
  872. case 0xA7: // Shed
  873. //this.WorldToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "[" + EntityId.ToString("X2") + "]", Color.Gray, true, false, false, 0f, 0f);
  874. break;
  875. default: // Other Items
  876. if (ShowESP && ShowItems && !BRMode) this.EntityToScreen(new Vector3(EntityX, EntityY, EntityZ), EntityName + "[" + EntityType.ToString("X2") + "]", Color.White, true, false, false, 0.15f, 0.30f, 0.30f);
  877. break;
  878. }
  879. entityEntry = this.GameMemory.ReadInt64(entityEntry + 0x420);
  880. }
  881. if (Aimed == false) AimedEntity = null;
  882. if (ShowEntityLists)
  883. {
  884. ENTITY[] playerList = Entity.Where(E => E.Type == 0x04 || E.Type == 0x05).OrderBy(E => E.Distance).ToArray();
  885. ENTITY[] aggressiveList = Entity.Where(E => E.Type == 0x0C || E.Type == 0x14 || E.Type == 0x50 || E.Type == 0x5b).OrderBy(E => E.Distance).ToArray();
  886. ENTITY[] animalsList = Entity.Where(E => E.Type == 0x13 || E.Type == 0x55).OrderBy(E => E.Distance).ToArray();
  887. ENTITY[] vehiclesList = Entity.Where(E => E.Type == 0x11 || E.Type == 0x72 || E.Type == 0x76).OrderBy(E => E.Distance).ToArray();
  888. ENTITY[] ammoList = Entity.Where(E => E.Type == 0x15).OrderBy(E => E.Distance).ToArray();
  889. int itemY = (aggressiveList.Length > 10 ? 150 : aggressiveList.Length * 15);
  890. foreach (ENTITY entity in aggressiveList)
  891. {
  892. DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 20, this.GameWindowRect.Bottom - itemY - 15, Color.Red);
  893. itemY -= 15; if (itemY <= 0) break;
  894. }
  895. itemY = (animalsList.Length > 10 ? 150 : animalsList.Length * 15);
  896. foreach (ENTITY entity in animalsList)
  897. {
  898. DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 120, this.GameWindowRect.Bottom - itemY - 15, Color.Green);
  899. itemY -= 15; if (itemY <= 0) break;
  900. }
  901. itemY = (vehiclesList.Length > 10 ? 150 : vehiclesList.Length * 15);
  902. foreach (ENTITY entity in vehiclesList)
  903. {
  904. DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 220, this.GameWindowRect.Bottom - itemY - 15, Color.HotPink);
  905. itemY -= 15; if (itemY <= 0) break;
  906. }
  907. itemY = (playerList.Length > 10 ? 150 : playerList.Length * 15);
  908. foreach (ENTITY entity in playerList)
  909. {
  910. DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 340, this.GameWindowRect.Bottom - itemY - 15, Color.SkyBlue);
  911. itemY -= 15; if (itemY <= 0) break;
  912. }
  913. itemY = (ammoList.Length > 10 ? 150 : ammoList.Length * 15);
  914. foreach (ENTITY entity in ammoList)
  915. {
  916. DrawText(entity.Name + " [" + Math.Round(entity.Distance).ToString() + " m]", this.GameWindowRect.Left + 540, this.GameWindowRect.Bottom - itemY - 15, Color.Orange);
  917. itemY -= 15; if (itemY <= 0) break;
  918. }
  919. }
  920. if (ShowRadar)
  921. {
  922. DrawFilledBox(this.GameWindowRect.Right - 225, this.GameWindowRect.Top + 50, 201f, 201f, Color.LightSlateGray, RadarTransparency);
  923. DrawBoxAbs(this.GameWindowRect.Right - 225, this.GameWindowRect.Top + 50, 201f, 201f, 1f, Color.Black);
  924. DrawLine(this.GameWindowRect.Right - 125, this.GameWindowRect.Top + 50, this.GameWindowRect.Right - 125, this.GameWindowRect.Top + 251, 1f, Color.Black);
  925. DrawLine(this.GameWindowRect.Right - 225, this.GameWindowRect.Top + 150, this.GameWindowRect.Right - 24, this.GameWindowRect.Top + 150, 1f, Color.Black);
  926. RadarCenter = new Vector2(this.GameWindowRect.Right - 125, this.GameWindowRect.Top + 125 + 25);
  927. DrawFilledBox(RadarCenter.X - 1f, RadarCenter.Y - 1f, 3f, 3f, Color.White);
  928. if (RadarCenter.Length() > 0f)
  929. {
  930. foreach (ENTITY entity in Entity)
  931. {
  932. Vector2 pointToRotate = new Vector2(entity.Pos.X, entity.Pos.Z);
  933. Vector2 vector3 = new Vector2(player_X, player_Z);
  934. pointToRotate = vector3 - pointToRotate;
  935. float num30 = pointToRotate.Length() * 0.5f;
  936. num30 = Math.Min(num30, 90f);
  937. pointToRotate.Normalize();
  938. pointToRotate = (Vector2)(pointToRotate * num30);
  939. pointToRotate += RadarCenter;
  940. pointToRotate = RotatePoint(pointToRotate, RadarCenter, player_D, true);
  941. if ((entity.Type == 0x04 || entity.Type == 0x05) && RadarPlayers)
  942. {
  943. DrawFilledBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, Color.SkyBlue);
  944. }
  945. if ((entity.Type == 0x0C || entity.Type == 0x14 || entity.Type == 0x50 || entity.Type == 0x5b) && RadarAggressive)
  946. {
  947. DrawFilledBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, Color.Red);
  948. }
  949. if ((entity.Type == 0x13 || entity.Type == 0x55) && RadarAnimals)
  950. {
  951. DrawFilledBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, Color.LightGreen);
  952. }
  953. if ((entity.Type == 0x11 || entity.Type == 0x72 || entity.Type == 0x76) && RadarVehicles)
  954. {
  955. //DrawFilledBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, Color.HotPink);
  956. DrawBox(pointToRotate.X, pointToRotate.Y, 3f, 3f, 1f, Color.HotPink);
  957. }
  958. }
  959. }
  960. }
  961. if (ShowCities)
  962. {
  963. this.EntityToScreen(new Vector3(-129f, 40f, -1146f), "Pleasant Valley", Color.HotPink, true, false, false, 1f, 0f, 0f);
  964. this.EntityToScreen(new Vector3(-1233f, 90f, 1855f), "Cranberry", Color.HotPink, true, false, false, 1f, 0f, 0f);
  965. this.EntityToScreen(new Vector3(2003f, 50f, 2221f), "Ranchito", Color.HotPink, true, false, false, 1f, 0f, 0f);
  966. }
  967. if (Main.ShowMap && (DXTextrureMap != null || DXTextrureMapLarge != null))
  968. {
  969. DXSprite.Begin(SpriteFlags.AlphaBlend);
  970. if (Main.ShowMapLarge && DXTextrureMapLarge != null)
  971. {
  972. map_pos_x = RemapValue(player_X, 4000f, -4000f, -512f, 512f);
  973. map_pos_z = RemapValue(player_Z, -4000f, 4000f, -512f, 512f);
  974. DXSprite.Draw(DXTextrureMapLarge, new Vector3(512f, 512f, 0f), new Vector3(this.GameWindowCenter.X, this.GameWindowCenter.Y, 0f), Color.FromArgb(MapTransparency, 0xff, 0xff, 0xff));
  975. }
  976. else if (DXTextrureMap != null)
  977. {
  978. map_pos_x = RemapValue(player_X, 4000f, -4000f, -265f, 265f);
  979. map_pos_z = RemapValue(player_Z, -4000f, 4000f, -265f, 265f);
  980. DXSprite.Draw(DXTextrureMap, new Vector3(256f, 256f, 0f), new Vector3(this.GameWindowCenter.X, this.GameWindowCenter.Y, 0f), Color.FromArgb(MapTransparency, 0xff, 0xff, 0xff));
  981. }
  982. DXSprite.End();
  983. float direction = Main.player_D * -1f;
  984. float fromX = (float)((this.GameWindowCenter.X + map_pos_z) + (20.0 * Math.Cos(direction)));
  985. float fromY = (float)((this.GameWindowCenter.Y + map_pos_x) + (20.0 * Math.Sin(direction)));
  986. DrawFilledBox((this.GameWindowCenter.X + map_pos_z) - 2f, (this.GameWindowCenter.Y + map_pos_x) - 2f, 6f, 6f, Color.Magenta);
  987. DrawLine(fromX, fromY, (this.GameWindowCenter.X + map_pos_z) + 1f, (this.GameWindowCenter.Y + map_pos_x) + 1f, 1f, Color.PaleVioletRed);
  988. }
  989. DXDevice.EndScene();
  990. DXDevice.Present();
  991. Thread.Sleep(1);
  992. }
  993. DXDevice.Dispose();
  994. Application.Exit();
  995. }
  996. public void DoAiming()
  997. {
  998. while (true)
  999. {
  1000. if (Aimed == true && AimedEntity != null)
  1001. {
  1002. }
  1003. Thread.Sleep(1);
  1004. }
  1005. }
  1006. protected override void WndProc(ref Message m)
  1007. {
  1008. if (m.Msg == 0x312)
  1009. {
  1010. switch ((int)m.WParam)
  1011. {
  1012. case 0:
  1013. if (this.Settings != null && this.Settings.Visible)
  1014. {
  1015. this.Settings.Close();
  1016. break;
  1017. }
  1018. this.Settings = new Settings(); this.Settings.Show();
  1019. this.Settings.Location = new Point(this.GameWindowRect.Right - this.Settings.Width - 20, this.GameWindowRect.Top + 200);
  1020. Native.SetForegroundWindow(this.GameMemory.Process.MainWindowHandle);
  1021. break;
  1022. case 1:
  1023. ShowRadar = !ShowRadar;
  1024. Main.Ini.IniWriteValue("Radar", "Show", ShowRadar.ToString());
  1025. break;
  1026. case 2:
  1027. ShowMap = !ShowMap;
  1028. break;
  1029. case 3:
  1030. ShowMapLarge = !ShowMapLarge;
  1031. Main.Ini.IniWriteValue("Map", "LargeMap", Main.ShowMapLarge.ToString());
  1032. break;
  1033. case 4:
  1034. Main.IsRunning = false;
  1035. break;
  1036. }
  1037. }
  1038. base.WndProc(ref m);
  1039. }
  1040. public static void MoveMouse(int xDelta, int yDelta)
  1041. {
  1042. Native.mouse_event(1, xDelta, yDelta, 0u, 0u);
  1043. }
  1044. public static void MoveMouseTo(int x, int y)
  1045. {
  1046. Native.mouse_event(0x8000, x, y, 0, 0);
  1047. Native.mouse_event(1, x, y, 0, 0);
  1048. }
  1049. }
  1050. }