Guest User

Untitled

a guest
Sep 6th, 2016
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.65 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5. using System;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading;
  10. using System.Diagnostics;
  11. using System.Windows.Forms;
  12. using System.ComponentModel;
  13. using System.Collections.Generic;
  14.  
  15. using Factory = SharpDX.Direct2D1.Factory;
  16. using FontFactory = SharpDX.DirectWrite.Factory;
  17. using Format = SharpDX.DXGI.Format;
  18.  
  19. using SharpDX;
  20. using SharpDX.Windows;
  21. using SharpDX.Direct2D1;
  22. using SharpDX.DirectWrite;
  23. using System.Runtime.InteropServices;
  24.  
  25. namespace Mumble
  26. {
  27. public partial class Overlay : Form
  28. {
  29. // Process
  30. private Process process = null;
  31. private Thread updateStream = null, windowStream = null;
  32.  
  33. // Game Data
  34. private List<Player> players = null;
  35. private Player localPlayer = null;
  36. private Matrix viewProj, m_ViewMatrixInverse;
  37. private int spectatorCount = 0;
  38.  
  39. // Keys Control
  40. private KeysManager manager;
  41. // Handle
  42. private IntPtr handle;
  43.  
  44. // Color
  45. private Color enemyColor = new Color(0, 0, 0, 255),
  46. enemyColorVisible = new Color(255, 255, 0, 220),
  47. enemyColorVehicle = new Color(255, 129, 72, 200),
  48. enemySkeletonColor = new Color(245, 114, 0, 255),
  49. friendlyColor = new Color(0, 255, 0, 200),
  50. friendlyColorVehicle = new Color(64, 154, 200, 255),
  51. friendSkeletonColor = new Color(46, 228, 213, 255);
  52.  
  53. // Settings
  54. private bool ESP_Box = true,
  55. ESP_Bone = true,
  56. ESP_Health = true,
  57. ESP_Distance = true,
  58. ESP_Vehicle = true;
  59.  
  60. // SharpDX
  61. private WindowRenderTarget device;
  62. private HwndRenderTargetProperties renderProperties;
  63. private SolidColorBrush solidColorBrush;
  64. private Factory factory;
  65. private bool IsResize = false;
  66. private bool IsMinimized = false;
  67.  
  68. // SharpDX Font
  69. private TextFormat font, fontSmall;
  70. private FontFactory fontFactory;
  71. private const string fontFamily = "Tahoma";
  72. private const float fontSize = 12.0f;
  73. private const float fontSizeSmall = 10.0f;
  74.  
  75. // Screen Size
  76. private Rectangle rect;
  77.  
  78. // Init
  79. public Overlay(Process process)
  80. {
  81. this.process = process;
  82. this.handle = Handle;
  83.  
  84. int initialStyle = Managed.GetWindowLong(this.Handle, -20);
  85. Managed.SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20);
  86.  
  87. IntPtr HWND_TOPMOST = new IntPtr(-1);
  88. const UInt32 SWP_NOSIZE = 0x0001;
  89. const UInt32 SWP_NOMOVE = 0x0002;
  90. const UInt32 TOPMOST_FLAGS = SWP_NOMOVE | SWP_NOSIZE;
  91.  
  92. Managed.SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS);
  93. OnResize(null);
  94.  
  95. InitializeComponent();
  96. }
  97.  
  98. // Set window style
  99. protected override void OnResize(EventArgs e)
  100. {
  101. int[] margins = new int[] { 0, 0, rect.Width, rect.Height };
  102. Managed.DwmExtendFrameIntoClientArea(this.Handle, ref margins);
  103. }
  104.  
  105. // INIT
  106. private void postherevip321smthincredibleimportant1337() { } // //new junk void reference
  107.  
  108. private void DrawWindow_Load(object sender, EventArgs e)
  109. {
  110. postherevip321smthincredibleimportant1337(); //junk code reference here
  111. this.TopMost = true; //
  112. this.Visible = true;
  113. this.FormBorderStyle = FormBorderStyle.None;
  114. //this.WindowState = FormWindowState.Maximized;
  115. this.Width = rect.Width;
  116. this.Height = rect.Height;
  117.  
  118. // Window name
  119. this.Name = Process.GetCurrentProcess().ProcessName + "";
  120. this.Text = Process.GetCurrentProcess().ProcessName + "";
  121.  
  122. // Init factory
  123. factory = new Factory();
  124. fontFactory = new FontFactory();
  125.  
  126. // Render settings
  127. renderProperties = new HwndRenderTargetProperties()
  128. {
  129. Hwnd = this.Handle,
  130. PixelSize = new Size2(rect.Width, rect.Height),
  131. PresentOptions = PresentOptions.None
  132. };
  133.  
  134. // Init device
  135. device = new WindowRenderTarget(factory, new RenderTargetProperties(new PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied)), renderProperties);
  136.  
  137. // Init brush
  138. solidColorBrush = new SolidColorBrush(device, Color.White);
  139.  
  140. // Init font's
  141. font = new TextFormat(fontFactory, fontFamily, fontSize);
  142. fontSmall = new TextFormat(fontFactory, fontFamily, fontSizeSmall);
  143.  
  144. // Open process
  145. RPM.OpenProcess(process.Id);
  146.  
  147. // Init player array
  148. players = new List<Player>();
  149. localPlayer = new Player();
  150.  
  151. // Init update thread
  152. updateStream = new Thread(new ParameterizedThreadStart(Update));
  153. updateStream.Start();
  154.  
  155. // Init window thread (resize / position)
  156. windowStream = new Thread(new ParameterizedThreadStart(SetWindow));
  157. windowStream.Start();
  158.  
  159. // Init Key Listener
  160. manager = new KeysManager();
  161. manager.AddKey(Keys.F5);
  162. manager.AddKey(Keys.F6);
  163. manager.AddKey(Keys.F7);
  164. manager.AddKey(Keys.F8);
  165. manager.AddKey(Keys.F9);
  166. //manager.KeyUpEvent += new KeysManager.KeyHandler(KeyUpEvent);
  167. manager.KeyDownEvent += new KeysManager.KeyHandler(KeyDownEvent);
  168. }
  169.  
  170. // Key Down Event
  171.  
  172. private void KeyDownEvent(int keyId, string keyName)
  173. {
  174. switch ((Keys)keyId)
  175. {
  176. case Keys.F5:
  177. this.ESP_Box = !this.ESP_Box;
  178. break;
  179. case Keys.F6:
  180. this.ESP_Bone = !this.ESP_Bone;
  181. break;
  182. case Keys.F7:
  183. this.ESP_Health = !this.ESP_Health;
  184. break;
  185. case Keys.F8:
  186. this.ESP_Distance = !this.ESP_Distance;
  187. break;
  188. case Keys.F9:
  189. this.ESP_Vehicle = !this.ESP_Vehicle;
  190. break;
  191. }
  192. }
  193.  
  194. // FPS Stats
  195. private static int lastTick;
  196. private static int lastFrameRate;
  197. private static int frameRate;
  198.  
  199. // Check is Game Run
  200. private bool IsGameRun()
  201. {
  202. foreach (Process p in Process.GetProcesses())
  203. {
  204. if (p.ProcessName == process.ProcessName)
  205. return true;
  206. }
  207. return false;
  208. }
  209.  
  210. // Update Thread
  211. private void Update(object sender)
  212. {
  213. while (IsGameRun())
  214. {
  215. // Resize
  216. if (IsResize)
  217. {
  218. device.Resize(new Size2(rect.Width, rect.Height));
  219. //Console.WriteLine("Resize {0}/{1}", rect.Width, rect.Height);
  220. IsResize = false;
  221. }
  222.  
  223. // Begin Draw
  224. device.BeginDraw();
  225. device.Clear(new Color4(0.0f, 0.0f, 0.0f, 0.0f));
  226.  
  227. // Check Window State
  228. if (!IsMinimized)
  229. {
  230. // Read & Draw Players
  231. Read();
  232.  
  233.  
  234.  
  235.  
  236.  
  237. }
  238.  
  239. // End Draw
  240. device.EndDraw();
  241. CalculateFrameRate();
  242. //Thread.Sleep(Interval);
  243. }
  244.  
  245. // Close Process
  246. RPM.CloseProcess();
  247. // Exit
  248. Environment.Exit(0);
  249. }
  250.  
  251. // Read Game Memorry
  252. private void Read()
  253. {
  254. // Reset Old Data
  255. players.Clear();
  256. localPlayer = new Player();
  257.  
  258. // Read Local
  259. #region Get Local Player
  260. Int64 pGContext = RPM.ReadInt64(Offsets.ClientGameContext.GetInstance());
  261. if (!RPM.IsValid(pGContext))
  262. return;
  263.  
  264. Int64 pPlayerManager = RPM.ReadInt64(pGContext + Offsets.ClientGameContext.m_pPlayerManager);
  265. if (!RPM.IsValid(pPlayerManager))
  266. return;
  267.  
  268. Int64 pLocalPlayer = RPM.ReadInt64(pPlayerManager + Offsets.ClientPlayerManager.m_pLocalPlayer);
  269. if (!RPM.IsValid(pLocalPlayer))
  270. return;
  271.  
  272. //RPM.ReadInt64(pLocalPlayer + Offsets.ClientPlayer.m_pControlledControllable);
  273. Int64 pLocalSoldier = GetClientSoldierEntity(pLocalPlayer, localPlayer);
  274. if (!RPM.IsValid(pLocalSoldier))
  275. return;
  276.  
  277. Int64 pHealthComponent = RPM.ReadInt64(pLocalSoldier + Offsets.ClientSoldierEntity.m_pHealthComponent);
  278. if (!RPM.IsValid(pHealthComponent))
  279. return;
  280.  
  281. Int64 m_pPredictedController = RPM.ReadInt64(pLocalSoldier + Offsets.ClientSoldierEntity.m_pPredictedController);
  282. if (!RPM.IsValid(m_pPredictedController))
  283. return;
  284.  
  285. // Health
  286. localPlayer.Health = RPM.ReadFloat(pHealthComponent + Offsets.HealthComponent.m_Health);
  287. localPlayer.MaxHealth = RPM.ReadFloat(pHealthComponent + Offsets.HealthComponent.m_MaxHealth);
  288.  
  289. if (localPlayer.Health <= 0.1f) // YOU DEAD :D
  290. return;
  291.  
  292. // Origin
  293. localPlayer.Origin = RPM.ReadVector3(m_pPredictedController + Offsets.ClientSoldierPrediction.m_Position);
  294.  
  295. // Other
  296. localPlayer.Team = RPM.ReadInt32(pLocalPlayer + Offsets.ClientPlayer.m_teamId);
  297. //localPlayer.Name = RPM.ReadString(pLocalPlayer + Offsets.ClientPlayer.szName, 10);
  298. localPlayer.Pose = RPM.ReadInt32(pLocalSoldier + Offsets.ClientSoldierEntity.m_poseType);
  299. localPlayer.Yaw = RPM.ReadFloat(pLocalSoldier + Offsets.ClientSoldierEntity.m_authorativeYaw);
  300. localPlayer.IsOccluded = RPM.ReadByte(pLocalSoldier + Offsets.ClientSoldierEntity.m_occluded);
  301.  
  302. // Weapon Ammo
  303. if (localPlayer.InVehicle)
  304. {
  305. Int64 pCurrentWeaponFiring = RPM.ReadInt64(Offsets.OFFSET_CURRENT_WEAPONFIRING);
  306. if (RPM.IsValid(pCurrentWeaponFiring))
  307. {
  308. // Change in Last Path
  309. //localPlayer.Ammo = RPM.ReadInt32(pCurrentWeaponFiring + Offsets.WeaponFiring.m_projectilesLoaded);
  310. //localPlayer.AmmoClip = RPM.ReadInt32(pCurrentWeaponFiring + Offsets.WeaponFiring.m_projectilesInMagazines);
  311. }
  312. }
  313. else
  314. {
  315. Int64 pClientWeaponComponent = RPM.ReadInt64(pLocalSoldier + Offsets.ClientSoldierEntity.m_soldierWeaponsComponent);
  316. if (RPM.IsValid(pClientWeaponComponent))
  317. {
  318. Int64 pWeaponHandle = RPM.ReadInt64(pClientWeaponComponent + Offsets.ClientSoldierWeaponsComponent.m_handler);
  319. Int32 ActiveSlot = RPM.ReadInt32(pClientWeaponComponent + Offsets.ClientSoldierWeaponsComponent.m_activeSlot);
  320.  
  321. if (RPM.IsValid(pWeaponHandle))
  322. {
  323. Int64 pSoldierWeapon = RPM.ReadInt64(pWeaponHandle + ActiveSlot * 0x8);
  324. if (RPM.IsValid(pSoldierWeapon))
  325. {
  326. Int64 pCorrectedFiring = RPM.ReadInt64(pSoldierWeapon + Offsets.ClientSoldierWeapon.m_pPrimary);
  327. if (RPM.IsValid(pCorrectedFiring))
  328. {
  329. // Ammo
  330. localPlayer.Ammo = RPM.ReadInt32(pCorrectedFiring + Offsets.WeaponFiring.m_projectilesLoaded);
  331. localPlayer.AmmoClip = RPM.ReadInt32(pCorrectedFiring + Offsets.WeaponFiring.m_projectilesInMagazines);
  332. }
  333. }
  334. }
  335. }
  336. }
  337. #endregion
  338.  
  339. // Render View
  340. Int64 pGameRenderer = RPM.ReadInt64(Offsets.GameRenderer.GetInstance());
  341. Int64 pRenderView = RPM.ReadInt64(pGameRenderer + Offsets.GameRenderer.m_pRenderView);
  342.  
  343. // Read Screen Matrix
  344. viewProj = RPM.ReadMatrix(pRenderView + Offsets.RenderView.m_ViewProj);
  345. m_ViewMatrixInverse = RPM.ReadMatrix(pRenderView + Offsets.RenderView.m_ViewMatrixInverse);
  346.  
  347. // Pointer to Players Array
  348. Int64 m_ppPlayer = RPM.ReadInt64(pPlayerManager + Offsets.ClientPlayerManager.m_ppPlayer);
  349. if (!RPM.IsValid(m_ppPlayer))
  350. return;
  351.  
  352. // Reset
  353. spectatorCount = 0;
  354.  
  355. // Get Player by Id
  356. #region Get Player by Id
  357. for (uint i = 0; i < 70; i++)
  358. {
  359. // Create new Player
  360. Player player = new Player();
  361.  
  362. // Pointer to ClientPlayer class (Player Array + (Id * Size of Pointer))
  363. Int64 pEnemyPlayer = RPM.ReadInt64(m_ppPlayer + (i * sizeof(Int64)));
  364. if (!RPM.IsValid(pEnemyPlayer))
  365. continue;
  366.  
  367. if (pEnemyPlayer == pLocalPlayer)
  368. continue;
  369.  
  370. player.IsSpectator = Convert.ToBoolean(RPM.ReadByte(pEnemyPlayer + Offsets.ClientPlayer.m_isSpectator));
  371.  
  372. if (player.IsSpectator)
  373. spectatorCount++;
  374.  
  375. // Name
  376. player.Name = RPM.ReadString2(pEnemyPlayer + Offsets.ClientPlayer.szName, 10);
  377.  
  378. // RPM.ReadInt64(pEnemyPlayer + Offsets.ClientPlayer.m_pControlledControllable);
  379. Int64 pEnemySoldier = GetClientSoldierEntity(pEnemyPlayer, player);
  380. if (!RPM.IsValid(pEnemySoldier))
  381. continue;
  382.  
  383. Int64 pEnemyHealthComponent = RPM.ReadInt64(pEnemySoldier + Offsets.ClientSoldierEntity.m_pHealthComponent);
  384. if (!RPM.IsValid(pEnemyHealthComponent))
  385. continue;
  386.  
  387. Int64 pEnemyPredictedController = RPM.ReadInt64(pEnemySoldier + Offsets.ClientSoldierEntity.m_pPredictedController);
  388. if (!RPM.IsValid(pEnemyPredictedController))
  389. continue;
  390.  
  391. // Health
  392. player.Health = RPM.ReadFloat(pEnemyHealthComponent + Offsets.HealthComponent.m_Health);
  393. player.MaxHealth = RPM.ReadFloat(pEnemyHealthComponent + Offsets.HealthComponent.m_MaxHealth);
  394.  
  395. if (player.Health <= 0.1f) // DEAD
  396. continue;
  397.  
  398. // Origin (Position in Game X, Y, Z)
  399. player.Origin = RPM.ReadVector3(pEnemyPredictedController + Offsets.ClientSoldierPrediction.m_Position);
  400.  
  401. // Other
  402. player.Team = RPM.ReadInt32(pEnemyPlayer + Offsets.ClientPlayer.m_teamId);
  403. if (player.Team == localPlayer.Team)
  404. continue;
  405. player.Pose = RPM.ReadInt32(pEnemySoldier + Offsets.ClientSoldierEntity.m_poseType);
  406. player.Yaw = RPM.ReadFloat(pEnemySoldier + Offsets.ClientSoldierEntity.m_authorativeYaw);
  407. player.IsOccluded = RPM.ReadByte(pEnemySoldier + Offsets.ClientSoldierEntity.m_occluded);
  408.  
  409. // Distance to You
  410. player.Distance = Vector3.Distance(localPlayer.Origin, player.Origin);
  411.  
  412. if (player.IsValid())
  413. {
  414. #region Bone ESP
  415. if (ESP_Bone)
  416. {
  417. // Player Bone
  418. if (GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD)
  419. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL)
  420. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT)
  421. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND)
  422. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL)
  423. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER)
  424. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK)
  425. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTELBOWROLL, out player.Bone.BONE_RIGHTELBOWROLL)
  426. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTFOOT, out player.Bone.BONE_RIGHTFOOT)
  427. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTHAND, out player.Bone.BONE_RIGHTHAND)
  428. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTKNEEROLL, out player.Bone.BONE_RIGHTKNEEROLL)
  429. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_RIGHTSHOULDER, out player.Bone.BONE_RIGHTSHOULDER)
  430. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_SPINE, out player.Bone.BONE_SPINE)
  431. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_SPINE1, out player.Bone.BONE_SPINE1)
  432. && GetBonyById(pEnemySoldier, (int)Offsets.UpdatePoseResultData.BONES.BONE_SPINE2, out player.Bone.BONE_SPINE2))
  433. {
  434. DrawBone(player);
  435. }
  436. }
  437. #endregion
  438.  
  439. Vector3 Foot, Head;
  440. if (WorldToScreen(player.Origin, out Foot) &&
  441. WorldToScreen(player.Origin, player.Pose, out Head))
  442. {
  443. float HeadToFoot = Foot.Y - Head.Y;
  444. float BoxWidth = HeadToFoot / 2;
  445. float X = Head.X - (BoxWidth) / 2;
  446.  
  447. #region ESP Color
  448. Color color;
  449. if (player.Team == localPlayer.Team) {
  450. color = friendlyColor;
  451. }
  452. else {
  453. color = player.IsVisible() ? enemyColorVisible : enemyColor;
  454. }
  455. #endregion
  456.  
  457. #region Draw ESP
  458. // ESP Box
  459. if (ESP_Box)
  460. {
  461. DrawAABB(player.GetAABB(), player.Origin, player.Yaw, color);
  462. //DrawRect((int)X, (int)Head.Y, (int)BoxWidth, (int)HeadToFoot, color);
  463. }
  464.  
  465. // ESP Vehicle
  466. if (ESP_Vehicle)
  467. {
  468. DrawAABB(player.VehicleAABB, player.VehicleTranfsorm, player.Team == localPlayer.Team ? friendlyColorVehicle : enemyColorVehicle);
  469. }
  470.  
  471. // ESP Distance
  472. if (ESP_Distance)
  473. {
  474. DrawText((int)X, (int)Foot.Y, (int)player.Distance + "m", Color.White, true);
  475. }
  476.  
  477. // ESP Health
  478. if (ESP_Health)
  479. {
  480. DrawHealth((int)X, (int)Head.Y - 6, (int)BoxWidth, 3, (int)player.Health, (int)player.MaxHealth);
  481.  
  482. // Vehicle Health
  483. if (player.InVehicle && player.IsDriver)
  484. {
  485. DrawHealth((int)X, (int)Head.Y - 10, (int)BoxWidth, 3, (int)player.VehicleHealth, (int)player.VehicleMaxHealth);
  486. }
  487. }
  488. #endregion
  489. }
  490. }
  491.  
  492. // ADD IN ARRAY
  493. players.Add(player);
  494. }
  495. #endregion
  496.  
  497. // Check Spectator Count
  498. if (spectatorCount > 0)
  499. {
  500. DrawWarn(rect.Center.X - 125, 25, 250, 55);
  501. }
  502. }
  503.  
  504. // Get SoldierEntity
  505. private Int64 GetClientSoldierEntity(Int64 pClientPlayer, Player player)
  506. {
  507. Int64 pAttached = RPM.ReadInt64(pClientPlayer + Offsets.ClientPlayer.m_pAttachedControllable);
  508. if (RPM.IsValid(pAttached))
  509. {
  510. Int64 m_ClientSoldier = RPM.ReadInt64(RPM.ReadInt64(pClientPlayer + Offsets.ClientPlayer.m_character)) - sizeof(Int64);
  511. if (RPM.IsValid(m_ClientSoldier))
  512. {
  513. player.InVehicle = true;
  514.  
  515. Int64 pVehicleEntity = RPM.ReadInt64(pClientPlayer + Offsets.ClientPlayer.m_pAttachedControllable);
  516. if (RPM.IsValid(pVehicleEntity))
  517. {
  518. // Driver
  519. if (RPM.ReadInt32(pClientPlayer + Offsets.ClientPlayer.m_attachedEntryId) == 0)
  520. {
  521. // Vehicle AABB
  522. if (ESP_Vehicle)
  523. {
  524. Int64 pDynamicPhysicsEntity = RPM.ReadInt64(pVehicleEntity + Offsets.ClientVehicleEntity.m_pPhysicsEntity);
  525. if (RPM.IsValid(pDynamicPhysicsEntity))
  526. {
  527. Int64 pPhysicsEntity = RPM.ReadInt64(pDynamicPhysicsEntity + Offsets.DynamicPhysicsEntity.m_EntityTransform);
  528. player.VehicleTranfsorm = RPM.ReadMatrix(pPhysicsEntity + Offsets.PhysicsEntityTransform.m_Transform);
  529. player.VehicleAABB = RPM.ReadAABB(pVehicleEntity + Offsets.ClientVehicleEntity.m_childrenAABB);
  530. }
  531. }
  532. Int64 _EntityData = RPM.ReadInt64(pVehicleEntity + Offsets.ClientSoldierEntity.m_data);
  533. if (RPM.IsValid(_EntityData))
  534. {
  535. Int64 _NameSid = RPM.ReadInt64(_EntityData + Offsets.VehicleEntityData.m_NameSid);
  536.  
  537. string strName = RPM.ReadString(_NameSid, 20);
  538. if (strName.Length > 11)
  539. {
  540. Int64 pAttachedClient = RPM.ReadInt64(m_ClientSoldier + Offsets.ClientSoldierEntity.m_pPlayer);
  541. // AttachedControllable Max Health
  542. Int64 p = RPM.ReadInt64(pAttachedClient + Offsets.ClientPlayer.m_pAttachedControllable);
  543. Int64 p2 = RPM.ReadInt64(p + Offsets.ClientSoldierEntity.m_pHealthComponent);
  544. player.VehicleHealth = RPM.ReadFloat(p2 + Offsets.HealthComponent.m_vehicleHealth);
  545.  
  546. // AttachedControllable Health
  547. player.VehicleMaxHealth = RPM.ReadFloat(_EntityData + Offsets.VehicleEntityData.m_FrontMaxHealth);
  548.  
  549. // AttachedControllable Name
  550. player.VehicleName = strName.Remove(0, 11);
  551. player.IsDriver = true;
  552. }
  553. }
  554. }
  555. }
  556. }
  557. return m_ClientSoldier;
  558. }
  559. return RPM.ReadInt64(pClientPlayer + Offsets.ClientPlayer.m_pControlledControllable);
  560. }
  561.  
  562. // Get Window Rect
  563. private void SetWindow(object sender)
  564. {
  565. while (true)
  566. {
  567. IntPtr targetWnd = IntPtr.Zero;
  568. targetWnd = Managed.FindWindow(null, "Battlefield™ 1 Open Beta");
  569.  
  570. if (targetWnd != IntPtr.Zero)
  571. {
  572. RECT targetSize = new RECT();
  573. Managed.GetWindowRect(targetWnd, out targetSize);
  574.  
  575. // Game is Minimized
  576. if (targetSize.Left < 0 && targetSize.Top < 0 && targetSize.Right < 0 && targetSize.Bottom < 0)
  577. {
  578. IsMinimized = true;
  579. continue;
  580. }
  581.  
  582. // Reset
  583. IsMinimized = false;
  584.  
  585. RECT borderSize = new RECT();
  586. Managed.GetClientRect(targetWnd, out borderSize);
  587.  
  588. int dwStyle = Managed.GetWindowLong(targetWnd, Managed.GWL_STYLE);
  589.  
  590. int windowheight;
  591. int windowwidth;
  592. int borderheight;
  593. int borderwidth;
  594.  
  595. if (rect.Width != (targetSize.Bottom - targetSize.Top)
  596. && rect.Width != (borderSize.Right - borderSize.Left))
  597. IsResize = true;
  598.  
  599. rect.Width = targetSize.Right - targetSize.Left;
  600. rect.Height = targetSize.Bottom - targetSize.Top;
  601.  
  602. if ((dwStyle & Managed.WS_BORDER) != 0)
  603. {
  604. windowheight = targetSize.Bottom - targetSize.Top;
  605. windowwidth = targetSize.Right - targetSize.Left;
  606.  
  607. rect.Height = borderSize.Bottom - borderSize.Top;
  608. rect.Width = borderSize.Right - borderSize.Left;
  609.  
  610. borderheight = (windowheight - borderSize.Bottom);
  611. borderwidth = (windowwidth - borderSize.Right) / 2; //only want one side
  612. borderheight -= borderwidth; //remove bottom
  613.  
  614. targetSize.Left += borderwidth;
  615. targetSize.Top += borderheight;
  616.  
  617. rect.Left = targetSize.Left;
  618. rect.Top = targetSize.Top;
  619. }
  620. Managed.MoveWindow(handle, targetSize.Left, targetSize.Top, rect.Width, rect.Height, true);
  621. }
  622. Thread.Sleep(300);
  623. }
  624. }
  625.  
  626. // 3D In 2D
  627. private bool WorldToScreen(Vector3 _Enemy, int _Pose, out Vector3 _Screen)
  628. {
  629. _Screen = new Vector3(0, 0, 0);
  630. float HeadHeight = _Enemy.Y;
  631.  
  632. #region HeadHeight
  633. if (_Pose == 0)
  634. {
  635. HeadHeight += 1.7f;
  636. }
  637. if (_Pose == 1)
  638. {
  639. HeadHeight += 1.15f;
  640. }
  641. if (_Pose == 2)
  642. {
  643. HeadHeight += 0.4f;
  644. }
  645. #endregion
  646.  
  647. float ScreenW = (viewProj.M14 * _Enemy.X) + (viewProj.M24 * HeadHeight) + (viewProj.M34 * _Enemy.Z + viewProj.M44);
  648.  
  649. if (ScreenW < 0.0001f)
  650. return false;
  651.  
  652. float ScreenX = (viewProj.M11 * _Enemy.X) + (viewProj.M21 * HeadHeight) + (viewProj.M31 * _Enemy.Z + viewProj.M41);
  653. float ScreenY = (viewProj.M12 * _Enemy.X) + (viewProj.M22 * HeadHeight) + (viewProj.M32 * _Enemy.Z + viewProj.M42);
  654.  
  655. _Screen.X = (rect.Width / 2) + (rect.Width / 2) * ScreenX / ScreenW;
  656. _Screen.Y = (rect.Height / 2) - (rect.Height / 2) * ScreenY / ScreenW;
  657. _Screen.Z = ScreenW;
  658. return true;
  659. }
  660.  
  661. // 3D In 2D
  662. private bool WorldToScreen(Vector3 _Enemy, out Vector3 _Screen)
  663. {
  664. _Screen = new Vector3(0, 0, 0);
  665. float ScreenW = (viewProj.M14 * _Enemy.X) + (viewProj.M24 * _Enemy.Y) + (viewProj.M34 * _Enemy.Z + viewProj.M44);
  666.  
  667. if (ScreenW < 0.0001f)
  668. return false;
  669.  
  670. float ScreenX = (viewProj.M11 * _Enemy.X) + (viewProj.M21 * _Enemy.Y) + (viewProj.M31 * _Enemy.Z + viewProj.M41);
  671. float ScreenY = (viewProj.M12 * _Enemy.X) + (viewProj.M22 * _Enemy.Y) + (viewProj.M32 * _Enemy.Z + viewProj.M42);
  672.  
  673. _Screen.X = (rect.Width / 2) + (rect.Width / 2) * ScreenX / ScreenW;
  674. _Screen.Y = (rect.Height / 2) - (rect.Height / 2) * ScreenY / ScreenW;
  675. _Screen.Z = ScreenW;
  676. return true;
  677. }
  678.  
  679. // Get Roll
  680. private bool GetBonyById(Int64 pEnemySoldier, int Id, out Vector3 _World)
  681. {
  682. _World = new Vector3();
  683.  
  684. Int64 pRagdollComp = RPM.ReadInt64(pEnemySoldier + 0x0460);
  685. if (!RPM.IsValid(pRagdollComp))
  686. return false;
  687. Int64 pQuatTransform = RPM.ReadInt64(pRagdollComp + 0x0020);
  688. if (!RPM.IsValid(pQuatTransform))
  689. return false;
  690.  
  691. _World = RPM.ReadVector3(pQuatTransform + (Id * 0x20));
  692. return true;
  693. }
  694.  
  695. // Get FPS
  696. public int CalculateFrameRate()
  697. {
  698. int tickCount = Environment.TickCount;
  699. if (tickCount - lastTick >= 1000)
  700. {
  701. lastFrameRate = frameRate;
  702. frameRate = 0;
  703. lastTick = tickCount;
  704. }
  705. frameRate++;
  706. return lastFrameRate;
  707. }
  708.  
  709. // Close window event
  710. private void DrawWindow_FormClosing(object sender, FormClosingEventArgs e)
  711. {
  712. updateStream.Abort();
  713. windowStream.Abort();
  714. RPM.CloseProcess();
  715.  
  716. // Close main process
  717. Environment.Exit(0);
  718. }
  719.  
  720. // Multiply Vector's
  721. public Vector3 Multiply(Vector3 vector, Matrix mat)
  722. {
  723. return new Vector3(mat.M11 * vector.X + mat.M21 * vector.Y + mat.M31 * vector.Z,
  724. mat.M12 * vector.X + mat.M22 * vector.Y + mat.M32 * vector.Z,
  725. mat.M13 * vector.X + mat.M23 * vector.Y + mat.M33 * vector.Z);
  726. }
  727.  
  728. // Draw Functions
  729. #region Draw Functions
  730. private void DrawRect(int X, int Y, int W, int H, Color color)
  731. {
  732. solidColorBrush.Color = color;
  733. device.DrawRectangle(new Rectangle(X, Y, W, H), solidColorBrush);
  734. }
  735.  
  736. private void DrawRect(int X, int Y, int W, int H, Color color, float stroke)
  737. {
  738. solidColorBrush.Color = color;
  739. device.DrawRectangle(new Rectangle(X, Y, W, H), solidColorBrush, stroke);
  740. }
  741.  
  742. private void DrawFillRect(int X, int Y, int W, int H, Color color)
  743. {
  744. solidColorBrush.Color = color;
  745. device.FillRectangle(new RectangleF(X, Y, W, H), solidColorBrush);
  746. }
  747.  
  748. private void DrawText(int X, int Y, string text, Color color)
  749. {
  750. solidColorBrush.Color = color;
  751. device.DrawText(text, font, new RectangleF(X, Y, font.FontSize * text.Length, font.FontSize), solidColorBrush);
  752. }
  753.  
  754. private void DrawText(int X, int Y, string text, Color color, bool outline)
  755. {
  756. if (outline)
  757. {
  758. solidColorBrush.Color = Color.Black;
  759. device.DrawText(text, font, new RectangleF(X + 1, Y + 1, font.FontSize * text.Length, font.FontSize), solidColorBrush);
  760. }
  761.  
  762. solidColorBrush.Color = color;
  763. device.DrawText(text, font, new RectangleF(X, Y, font.FontSize * text.Length, font.FontSize), solidColorBrush);
  764. }
  765.  
  766. private void DrawText(int X, int Y, string text, Color color, bool outline, TextFormat format)
  767. {
  768. if (outline)
  769. {
  770. solidColorBrush.Color = Color.Black;
  771. device.DrawText(text, format, new RectangleF(X + 1, Y + 1, format.FontSize * text.Length, format.FontSize), solidColorBrush);
  772. }
  773.  
  774. solidColorBrush.Color = color;
  775. device.DrawText(text, format, new RectangleF(X, Y, format.FontSize * text.Length, format.FontSize), solidColorBrush);
  776. }
  777.  
  778. private void DrawTextCenter(int X, int Y, int W, int H, string text, Color color)
  779. {
  780. solidColorBrush.Color = color;
  781. TextLayout layout = new TextLayout(fontFactory, text, fontSmall, W, H);
  782. layout.TextAlignment = TextAlignment.Center;
  783. device.DrawTextLayout(new Vector2(X, Y), layout, solidColorBrush);
  784. layout.Dispose();
  785. }
  786.  
  787. private void DrawTextCenter(int X, int Y, int W, int H, string text, Color color, bool outline)
  788. {
  789. TextLayout layout = new TextLayout(fontFactory, text, fontSmall, W, H);
  790. layout.TextAlignment = TextAlignment.Center;
  791.  
  792. if (outline)
  793. {
  794. solidColorBrush.Color = Color.Black;
  795. device.DrawTextLayout(new Vector2(X + 1, Y + 1), layout, solidColorBrush);
  796. }
  797.  
  798. solidColorBrush.Color = color;
  799. device.DrawTextLayout(new Vector2(X, Y), layout, solidColorBrush);
  800. layout.Dispose();
  801. }
  802.  
  803. private void DrawLine(int X, int Y, int XX, int YY, Color color)
  804. {
  805. solidColorBrush.Color = color;
  806. device.DrawLine(new Vector2(X, Y), new Vector2(XX, YY), solidColorBrush);
  807. }
  808.  
  809. private void DrawLine(Vector3 w2s, Vector3 _w2s, Color color)
  810. {
  811. solidColorBrush.Color = color;
  812. device.DrawLine(new Vector2(w2s.X, w2s.Y), new Vector2(_w2s.X, _w2s.Y), solidColorBrush);
  813. }
  814.  
  815. private void DrawCircle(int X, int Y, int W, Color color)
  816. {
  817. solidColorBrush.Color = color;
  818. device.DrawEllipse(new Ellipse(new Vector2(X, Y), W, W), solidColorBrush);
  819. }
  820.  
  821. private void DrawFillCircle(int X, int Y, int W, Color color)
  822. {
  823. solidColorBrush.Color = color;
  824. device.FillEllipse(new Ellipse(new Vector2(X, Y), W, W), solidColorBrush);
  825. }
  826.  
  827. private void DrawImage(int X, int Y, int W, int H, Bitmap bitmap)
  828. {
  829. device.DrawBitmap(bitmap, new RectangleF(X, Y, W, H), 1.0f, BitmapInterpolationMode.Linear);
  830. }
  831.  
  832. private void DrawImage(int X, int Y, int W, int H, Bitmap bitmap, float angle)
  833. {
  834. device.Transform = Matrix3x2.Rotation(angle, new Vector2(X + (H / 2), Y + (H / 2)));
  835. device.DrawBitmap(bitmap, new RectangleF(X, Y, W, H), 1.0f, BitmapInterpolationMode.Linear);
  836. device.Transform = Matrix3x2.Rotation(0);
  837. }
  838.  
  839. private void DrawSprite(RectangleF destinationRectangle, Bitmap bitmap, RectangleF sourceRectangle)
  840. {
  841. device.DrawBitmap(bitmap, destinationRectangle, 1.0f, BitmapInterpolationMode.Linear, sourceRectangle);
  842. }
  843.  
  844. private void DrawSprite(RectangleF destinationRectangle, Bitmap bitmap, RectangleF sourceRectangle, float angle)
  845. {
  846. Vector2 center = new Vector2();
  847. center.X = destinationRectangle.X + destinationRectangle.Width / 2;
  848. center.Y = destinationRectangle.Y + destinationRectangle.Height / 2;
  849.  
  850. device.Transform = Matrix3x2.Rotation(angle, center);
  851. device.DrawBitmap(bitmap, destinationRectangle, 1.0f, BitmapInterpolationMode.Linear, sourceRectangle);
  852. device.Transform = Matrix3x2.Rotation(0);
  853. }
  854.  
  855. private void DrawBone(Player player)
  856. {
  857. Vector3 BONE_HEAD,
  858. BONE_NECK,
  859. BONE_SPINE2,
  860. BONE_SPINE1,
  861. BONE_SPINE,
  862. BONE_LEFTSHOULDER,
  863. BONE_RIGHTSHOULDER,
  864. BONE_LEFTELBOWROLL,
  865. BONE_RIGHTELBOWROLL,
  866. BONE_LEFTHAND,
  867. BONE_RIGHTHAND,
  868. BONE_LEFTKNEEROLL,
  869. BONE_RIGHTKNEEROLL,
  870. BONE_LEFTFOOT,
  871. BONE_RIGHTFOOT;
  872.  
  873. if(WorldToScreen(player.Bone.BONE_HEAD, out BONE_HEAD) &&
  874. WorldToScreen(player.Bone.BONE_NECK, out BONE_NECK) &&
  875. WorldToScreen(player.Bone.BONE_SPINE2, out BONE_SPINE2) &&
  876. WorldToScreen(player.Bone.BONE_SPINE1, out BONE_SPINE1) &&
  877. WorldToScreen(player.Bone.BONE_SPINE, out BONE_SPINE) &&
  878. WorldToScreen(player.Bone.BONE_LEFTSHOULDER, out BONE_LEFTSHOULDER) &&
  879. WorldToScreen(player.Bone.BONE_RIGHTSHOULDER, out BONE_RIGHTSHOULDER) &&
  880. WorldToScreen(player.Bone.BONE_LEFTELBOWROLL, out BONE_LEFTELBOWROLL) &&
  881. WorldToScreen(player.Bone.BONE_RIGHTELBOWROLL, out BONE_RIGHTELBOWROLL) &&
  882. WorldToScreen(player.Bone.BONE_LEFTHAND, out BONE_LEFTHAND) &&
  883. WorldToScreen(player.Bone.BONE_RIGHTHAND, out BONE_RIGHTHAND) &&
  884. WorldToScreen(player.Bone.BONE_LEFTKNEEROLL, out BONE_LEFTKNEEROLL) &&
  885. WorldToScreen(player.Bone.BONE_RIGHTKNEEROLL, out BONE_RIGHTKNEEROLL) &&
  886. WorldToScreen(player.Bone.BONE_LEFTFOOT, out BONE_LEFTFOOT) &&
  887. WorldToScreen(player.Bone.BONE_RIGHTFOOT, out BONE_RIGHTFOOT))
  888. {
  889. int stroke = 3;
  890. int strokeW = stroke % 2 == 0 ? stroke / 2 : (stroke - 1) / 2;
  891.  
  892. // Color
  893. Color skeletonColor = player.Team == localPlayer.Team ? friendSkeletonColor : enemySkeletonColor;
  894.  
  895. // RECT's
  896. DrawFillRect((int)BONE_HEAD.X - strokeW, (int)BONE_HEAD.Y - strokeW, stroke, stroke, skeletonColor);
  897. DrawFillRect((int)BONE_NECK.X - strokeW, (int)BONE_NECK.Y - strokeW, stroke, stroke, skeletonColor);
  898. DrawFillRect((int)BONE_LEFTSHOULDER.X - strokeW, (int)BONE_LEFTSHOULDER.Y - strokeW, stroke, stroke, skeletonColor);
  899. DrawFillRect((int)BONE_LEFTELBOWROLL.X - strokeW, (int)BONE_LEFTELBOWROLL.Y - strokeW, stroke, stroke, skeletonColor);
  900. DrawFillRect((int)BONE_LEFTHAND.X - strokeW, (int)BONE_LEFTHAND.Y - strokeW, stroke, stroke, skeletonColor);
  901. DrawFillRect((int)BONE_RIGHTSHOULDER.X - strokeW, (int)BONE_RIGHTSHOULDER.Y - strokeW, stroke, stroke, skeletonColor);
  902. DrawFillRect((int)BONE_RIGHTELBOWROLL.X - strokeW, (int)BONE_RIGHTELBOWROLL.Y - strokeW, stroke, stroke, skeletonColor);
  903. DrawFillRect((int)BONE_RIGHTHAND.X - strokeW, (int)BONE_RIGHTHAND.Y - strokeW, stroke, stroke, skeletonColor);
  904. DrawFillRect((int)BONE_SPINE2.X - strokeW, (int)BONE_SPINE2.Y - strokeW, stroke, stroke, skeletonColor);
  905. DrawFillRect((int)BONE_SPINE1.X - strokeW, (int)BONE_SPINE1.Y - strokeW, stroke, stroke, skeletonColor);
  906. DrawFillRect((int)BONE_SPINE.X - strokeW, (int)BONE_SPINE.Y - strokeW, stroke, stroke, skeletonColor);
  907. DrawFillRect((int)BONE_LEFTKNEEROLL.X - strokeW, (int)BONE_LEFTKNEEROLL.Y - strokeW, stroke, stroke, skeletonColor);
  908. DrawFillRect((int)BONE_RIGHTKNEEROLL.X - strokeW, (int)BONE_RIGHTKNEEROLL.Y - strokeW, 2, 2, skeletonColor);
  909. DrawFillRect((int)BONE_LEFTFOOT.X - strokeW, (int)BONE_LEFTFOOT.Y - strokeW, 2, 2, skeletonColor);
  910. DrawFillRect((int)BONE_RIGHTFOOT.X - strokeW, (int)BONE_RIGHTFOOT.Y - strokeW, 2, 2, skeletonColor);
  911.  
  912. // Head -> Neck
  913. DrawLine((int)BONE_HEAD.X, (int)BONE_HEAD.Y, (int)BONE_NECK.X, (int)BONE_NECK.Y, skeletonColor);
  914.  
  915. // Neck -> Left
  916. DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_LEFTSHOULDER.X, (int)BONE_LEFTSHOULDER.Y, skeletonColor);
  917. DrawLine((int)BONE_LEFTSHOULDER.X, (int)BONE_LEFTSHOULDER.Y,(int) BONE_LEFTELBOWROLL.X, (int)BONE_LEFTELBOWROLL.Y, skeletonColor);
  918. DrawLine((int)BONE_LEFTELBOWROLL.X, (int)BONE_LEFTELBOWROLL.Y, (int)BONE_LEFTHAND.X, (int)BONE_LEFTHAND.Y, skeletonColor);
  919.  
  920. // Neck -> Right
  921. DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_RIGHTSHOULDER.X, (int)BONE_RIGHTSHOULDER.Y, skeletonColor);
  922. DrawLine((int)BONE_RIGHTSHOULDER.X, (int)BONE_RIGHTSHOULDER.Y, (int)BONE_RIGHTELBOWROLL.X, (int)BONE_RIGHTELBOWROLL.Y, skeletonColor);
  923. DrawLine((int)BONE_RIGHTELBOWROLL.X, (int)BONE_RIGHTELBOWROLL.Y, (int)BONE_RIGHTHAND.X, (int)BONE_RIGHTHAND.Y, skeletonColor);
  924.  
  925. // Neck -> Center
  926. DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_SPINE2.X, (int)BONE_SPINE2.Y, skeletonColor);
  927. DrawLine((int)BONE_SPINE2.X, (int)BONE_SPINE2.Y, (int)BONE_SPINE1.X, (int)BONE_SPINE1.Y, skeletonColor);
  928. DrawLine((int)BONE_SPINE1.X, (int)BONE_SPINE1.Y, (int)BONE_SPINE.X, (int)BONE_SPINE.Y, skeletonColor);
  929.  
  930. // Spine -> Left
  931. DrawLine((int)BONE_SPINE.X, (int)BONE_SPINE.Y, (int)BONE_LEFTKNEEROLL.X, (int)BONE_LEFTKNEEROLL.Y, skeletonColor);
  932. DrawLine((int)BONE_LEFTKNEEROLL.X, (int)BONE_LEFTKNEEROLL.Y, (int)BONE_LEFTFOOT.X, (int)BONE_LEFTFOOT.Y, skeletonColor);
  933.  
  934. // Spine -> Right
  935. DrawLine((int)BONE_SPINE.X, (int)BONE_SPINE.Y, (int)BONE_RIGHTKNEEROLL.X, (int)BONE_RIGHTKNEEROLL.Y, skeletonColor);
  936. DrawLine((int)BONE_RIGHTKNEEROLL.X, (int)BONE_RIGHTKNEEROLL.Y, (int)BONE_RIGHTFOOT.X, (int)BONE_RIGHTFOOT.Y, skeletonColor);
  937. }
  938. }
  939.  
  940. private void DrawHealth(int X, int Y, int W, int H, int Health, int MaxHealth)
  941. {
  942. if (Health <= 0)
  943. Health = 1;
  944.  
  945. if (MaxHealth < Health)
  946. MaxHealth = 100;
  947.  
  948. int progress = (int)((float)Health / ((float)MaxHealth / 100));
  949. int w = (int)((float)W / 100 * progress);
  950.  
  951. if (w <= 2)
  952. w = 3;
  953.  
  954. Color color = new Color(255, 0, 0, 255);
  955. if (progress >= 20) color = new Color(255, 165, 0, 255);
  956. if (progress >= 40) color = new Color(255, 255, 0, 255);
  957. if (progress >= 60) color = new Color(173, 255, 47, 255);
  958. if (progress >= 80) color = new Color(0, 255, 0, 255);
  959.  
  960. DrawFillRect(X, Y - 1, W + 1, H + 2, Color.Black);
  961. DrawFillRect(X + 1, Y, w - 1, H, color);
  962. }
  963.  
  964. private void DrawProgress(int X, int Y, int W, int H, int Value, int MaxValue)
  965. {
  966. int progress = (int)((float)Value / ((float)MaxValue / 100));
  967. int w = (int)((float)W / 100 * progress);
  968.  
  969. Color color = new Color(0, 255, 0, 255);
  970. if (progress >= 20) color = new Color(173, 255, 47, 255);
  971. if (progress >= 40) color = new Color(255, 255, 0, 255);
  972. if (progress >= 60) color = new Color(255, 165, 0, 255);
  973. if (progress >= 80) color = new Color(255, 0, 0, 255);
  974.  
  975. DrawFillRect(X, Y - 1, W + 1, H + 2, Color.Black);
  976. if (w >= 2)
  977. {
  978. DrawFillRect(X + 1, Y, w - 1, H, color);
  979. }
  980. }
  981.  
  982. private void DrawAABB(AxisAlignedBox aabb, Matrix tranform, Color color)
  983. {
  984. Vector3 m_Position = new Vector3(tranform.M41, tranform.M42, tranform.M43);
  985. Vector3 fld = Multiply(new Vector3(aabb.Min.X, aabb.Min.Y, aabb.Min.Z), tranform) + m_Position;
  986. Vector3 brt = Multiply(new Vector3(aabb.Max.X, aabb.Max.Y, aabb.Max.Z), tranform) + m_Position;
  987. Vector3 bld = Multiply(new Vector3(aabb.Min.X, aabb.Min.Y, aabb.Max.Z), tranform) + m_Position;
  988. Vector3 frt = Multiply(new Vector3(aabb.Max.X, aabb.Max.Y, aabb.Min.Z), tranform) + m_Position;
  989. Vector3 frd = Multiply(new Vector3(aabb.Max.X, aabb.Min.Y, aabb.Min.Z), tranform) + m_Position;
  990. Vector3 brb = Multiply(new Vector3(aabb.Max.X, aabb.Min.Y, aabb.Max.Z), tranform) + m_Position;
  991. Vector3 blt = Multiply(new Vector3(aabb.Min.X, aabb.Max.Y, aabb.Max.Z), tranform) + m_Position;
  992. Vector3 flt = Multiply(new Vector3(aabb.Min.X, aabb.Max.Y, aabb.Min.Z), tranform) + m_Position;
  993.  
  994. #region WorldToScreen
  995. if (!WorldToScreen(fld, out fld) || !WorldToScreen(brt, out brt)
  996. || !WorldToScreen(bld, out bld) || !WorldToScreen(frt, out frt)
  997. || !WorldToScreen(frd, out frd) || !WorldToScreen(brb, out brb)
  998. || !WorldToScreen(blt, out blt) || !WorldToScreen(flt, out flt))
  999. return;
  1000. #endregion
  1001.  
  1002. #region DrawLines
  1003. DrawLine(fld, flt, color);
  1004. DrawLine(flt, frt, color);
  1005. DrawLine(frt, frd, color);
  1006. DrawLine(frd, fld, color);
  1007. DrawLine(bld, blt, color);
  1008. DrawLine(blt, brt, color);
  1009. DrawLine(brt, brb, color);
  1010. DrawLine(brb, bld, color);
  1011. DrawLine(fld, bld, color);
  1012. DrawLine(frd, brb, color);
  1013. DrawLine(flt, blt, color);
  1014. DrawLine(frt, brt, color);
  1015. #endregion
  1016. }
  1017.  
  1018. private void DrawAABB(AxisAlignedBox aabb, Vector3 m_Position, float Yaw, Color color)
  1019. {
  1020. float cosY = (float)Math.Cos(Yaw);
  1021. float sinY = (float)Math.Sin(Yaw);
  1022.  
  1023. Vector3 fld = new Vector3(aabb.Min.Z * cosY - aabb.Min.X * sinY, aabb.Min.Y, aabb.Min.X * cosY + aabb.Min.Z * sinY) + m_Position; // 0
  1024. Vector3 brt = new Vector3(aabb.Min.Z * cosY - aabb.Max.X * sinY, aabb.Min.Y, aabb.Max.X * cosY + aabb.Min.Z * sinY) + m_Position; // 1
  1025. Vector3 bld = new Vector3(aabb.Max.Z * cosY - aabb.Max.X * sinY, aabb.Min.Y, aabb.Max.X * cosY + aabb.Max.Z * sinY) + m_Position; // 2
  1026. Vector3 frt = new Vector3(aabb.Max.Z * cosY - aabb.Min.X * sinY, aabb.Min.Y, aabb.Min.X * cosY + aabb.Max.Z * sinY) + m_Position; // 3
  1027. Vector3 frd = new Vector3(aabb.Max.Z * cosY - aabb.Min.X * sinY, aabb.Max.Y, aabb.Min.X * cosY + aabb.Max.Z * sinY) + m_Position; // 4
  1028. Vector3 brb = new Vector3(aabb.Min.Z * cosY - aabb.Min.X * sinY, aabb.Max.Y, aabb.Min.X * cosY + aabb.Min.Z * sinY) + m_Position; // 5
  1029. Vector3 blt = new Vector3(aabb.Min.Z * cosY - aabb.Max.X * sinY, aabb.Max.Y, aabb.Max.X * cosY + aabb.Min.Z * sinY) + m_Position; // 6
  1030. Vector3 flt = new Vector3(aabb.Max.Z * cosY - aabb.Max.X * sinY, aabb.Max.Y, aabb.Max.X * cosY + aabb.Max.Z * sinY) + m_Position; // 7
  1031.  
  1032. #region WorldToScreen
  1033. if (!WorldToScreen(fld, out fld) || !WorldToScreen(brt, out brt)
  1034. || !WorldToScreen(bld, out bld) || !WorldToScreen(frt, out frt)
  1035. || !WorldToScreen(frd, out frd) || !WorldToScreen(brb, out brb)
  1036. || !WorldToScreen(blt, out blt) || !WorldToScreen(flt, out flt))
  1037. return;
  1038. #endregion
  1039.  
  1040. #region DrawLines
  1041. DrawLine(fld, brt, color);
  1042. DrawLine(brb, blt, color);
  1043. DrawLine(fld, brb, color);
  1044. DrawLine(brt, blt, color);
  1045.  
  1046. DrawLine(frt, bld, color);
  1047. DrawLine(frd, flt, color);
  1048. DrawLine(frt, frd, color);
  1049. DrawLine(bld, flt, color);
  1050.  
  1051. DrawLine(frt, fld, color);
  1052. DrawLine(frd, brb, color);
  1053. DrawLine(brt, bld, color);
  1054. DrawLine(blt, flt, color);
  1055. #endregion
  1056. }
  1057.  
  1058. private void DrawMenu(int X, int Y)
  1059. {
  1060. Color selectedColor = new Color(255, 214, 0, 255);
  1061. DrawText(X, Y, "F5: ESP Box", ESP_Box ? selectedColor : Color.White, true, fontSmall);
  1062. DrawText(X + 100, Y, "F6: ESP Bone", ESP_Bone ? selectedColor : Color.White, true, fontSmall);
  1063. DrawText(X + 200, Y, "F7: ESP Health", ESP_Health ? selectedColor : Color.White, true, fontSmall);
  1064. DrawText(X + 310, Y, "F8: ESP Distance", ESP_Distance ? selectedColor : Color.White, true, fontSmall);
  1065. DrawText(X + 430, Y, "F9: ESP Vehicle", ESP_Vehicle ? selectedColor : Color.White, true, fontSmall);
  1066. }
  1067.  
  1068. private void DrawWarn(int X, int Y, int W, int H)
  1069. {
  1070. RoundedRectangle rect = new RoundedRectangle();
  1071. rect.RadiusX = 4;
  1072. rect.RadiusY = 4;
  1073. rect.Rect = new RectangleF(X, Y, W, H);
  1074.  
  1075. solidColorBrush.Color = new Color(196, 26, 31, 210);
  1076. device.FillRoundedRectangle(ref rect, solidColorBrush);
  1077.  
  1078. DrawText(X + 20, Y + 5, "Spectator on the server.", Color.White, true);
  1079. DrawText(X + 20, Y + 25, "Watching You!", Color.White, true);
  1080. }
  1081. #endregion
  1082. }
  1083. }
Add Comment
Please, Sign In to add comment