Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.57 KB | None | 0 0
  1. #pragma once
  2. #include "imports.h"
  3.  
  4. namespace globals {
  5. bool aimtab = true;
  6. bool visualtab = false;
  7. bool misctab = false;
  8.  
  9. bool esp = false;
  10. bool clip = false;
  11. bool recoil = false;
  12. bool spread = false;
  13. bool damage = false;
  14. bool fov = false;
  15. bool aimbot = false;
  16. bool silent = false;
  17. bool glow = false;
  18. bool flash = false;
  19. bool impact = false;
  20. bool unlock = false;
  21. bool invisible = false;
  22.  
  23. bool debug = false;
  24.  
  25. float aimbotfov = 30.0f;
  26. float spreadmultiplier = 0.0f;
  27. float recoilmultiplier = 0.0f;
  28. int damagemultiplier = 0.0f;
  29. float customfov = 90.0f;
  30. float fovW = 0.900f;
  31. float fovP = 1.550f;
  32.  
  33. uint64_t window_width = 300;
  34. uint64_t window_height = 425;
  35.  
  36. static IDXGISwapChain* swap_chain;
  37. static ID3D11Device* device;
  38. static ID3D11DeviceContext* context;
  39. static ID3D11RenderTargetView* rt_view;
  40. }
  41.  
  42. namespace offsets {
  43. // game manager
  44. constexpr uintptr_t game_manager = 0x52B95C8;
  45. constexpr uintptr_t entity_count = 0x1d0;
  46. constexpr uintptr_t entity_list = 0x1C8;
  47.  
  48. constexpr uintptr_t entity_component = 0xd8;
  49. constexpr uintptr_t entity_component_list = 0x8;
  50. constexpr uintptr_t entity_marker_vt_offset = 0x3929750;
  51. constexpr uintptr_t entity_marker_enabled_offset = 0x530;
  52.  
  53. constexpr uintptr_t offset_entity_head = 0x180;
  54. constexpr uintptr_t offset_entity_feet = 0x1d0;
  55.  
  56. constexpr uintptr_t offset_entity_skeleton = 0x20;
  57. constexpr uintptr_t offset_skeleton_position = 0x6c0;
  58. constexpr uintptr_t offset_skeleton_headposition = 0x660;
  59. constexpr uintptr_t offset_entitypawn_feet = 0x6c0;
  60.  
  61. constexpr uintptr_t entity_health = 0x148;
  62. constexpr uintptr_t entity_head = 0x660;
  63. constexpr uintptr_t entity_pelvis = 0xfa0;
  64. constexpr uintptr_t entity_feet = 0x6c0;
  65. constexpr uintptr_t entity_rhand = 0x680;
  66.  
  67. constexpr uintptr_t entity_replication = 0xa8;
  68. constexpr uintptr_t entity_replication_team = 0x19e;
  69. constexpr uintptr_t entity_replication_name = 0x1c8;
  70.  
  71. constexpr uintptr_t offset_entity_pawn = 0x20;
  72. constexpr uintptr_t offset_maincomponent_espchain = 0x78;
  73. constexpr uintptr_t offset_espchain_write1 = 0x532;
  74. constexpr uintptr_t offset_espchain_write2 = 0x534;
  75.  
  76. constexpr uintptr_t offset_espchain_check = 0x531;
  77.  
  78. // renderer manager
  79. constexpr uintptr_t renderer_manager = 0x52a6798;
  80. constexpr uintptr_t game_renderer_deref = 0x0;
  81.  
  82. // status manager
  83. constexpr uintptr_t status_manager = 0x52A8E68;
  84. constexpr uintptr_t status_manager_container = 0x68;
  85. constexpr uintptr_t status_manager_localentity = 0x28;
  86.  
  87. constexpr uintptr_t offset_status_manager_localentity = 0x28;
  88. constexpr uintptr_t offset_status_manager_container = 0x370;
  89.  
  90. // camera manager
  91. constexpr uintptr_t camera_manager = 0x52a8e38;
  92. constexpr uintptr_t camera_enginelink = 0x120;
  93. constexpr uintptr_t camera_engine = 0x1d8;
  94. constexpr uintptr_t camera_engine_camera = 0x08;
  95.  
  96. constexpr uintptr_t camera_right = 0x1C0;
  97. constexpr uintptr_t camera_up = 0x1D0;
  98. constexpr uintptr_t camera_forward = 0x1E0;
  99. constexpr uintptr_t camera_translation = 0x1F0;
  100. constexpr uintptr_t camera_fovx = 0x380;
  101. constexpr uintptr_t camera_fovy = 0x384;
  102.  
  103. // network manager
  104. constexpr uintptr_t network_manager = 0x52a8e58;
  105.  
  106. // glow manager
  107. constexpr uintptr_t glow_manager = 0x5f39bc8;
  108.  
  109. // profile manager, interface manager, player manager
  110. constexpr uintptr_t profile_manager = 0x52A8E68;
  111.  
  112. // fov manager
  113. constexpr uintptr_t fov_manager = 0x51cb730;
  114.  
  115. // spoof specate manager
  116. constexpr uintptr_t spoof_spectate = 0x52a8e50;
  117.  
  118. // round manager
  119. constexpr uintptr_t round_manager = 0x52a8e98;
  120.  
  121. // unlocks manager
  122. constexpr uintptr_t unlocks_manager = 0x11335F0;
  123.  
  124. // trigger manager
  125. constexpr uintptr_t trigger_manager = 0x51cb748;
  126. constexpr uintptr_t trigger_1 = 0x50;
  127. constexpr uintptr_t trigger_2 = 0x80;
  128. constexpr uintptr_t trigger_3 = 0x58;
  129. constexpr uintptr_t trigger_4 = 0x418;
  130. constexpr uintptr_t trigger_5 = 0x304;
  131. }
  132.  
  133. class RainbowSix {
  134. public:
  135. uintptr_t base_address;
  136.  
  137. RainbowSix() {
  138. process_id = get_process_id("RainbowSix.exe");
  139. base_address = get_module_base_address("RainbowSix.exe");
  140. }
  141.  
  142. bool enemy_entities(std::vector<uintptr_t>& players) {
  143. unsigned short local_team = entity_team(local_entity());
  144. std::cout << "[+] Local team: " << local_team << std::endl;
  145. unsigned int count = entity_team(base_address);
  146. std::cout << "[+] count: " << count << std::endl;
  147.  
  148. if (count > 255)
  149. return false;
  150.  
  151. for (unsigned int i = 0; i < count; i++)
  152. {
  153. uintptr_t target_player = entity_id(i);
  154.  
  155. if (!target_player)
  156. continue;
  157.  
  158. const auto lentity = local_entity();
  159.  
  160. if (!lentity)
  161. continue;
  162.  
  163. if (target_player == lentity)
  164. continue;
  165.  
  166. if (entity_team(target_player) == local_team)
  167. continue;
  168.  
  169. players.push_back(target_player);
  170. }
  171.  
  172. return true;
  173. }
  174.  
  175. uintptr_t entity_id(unsigned int id) {
  176. uintptr_t game_manager = Read<uintptr_t>(base_address + offsets::game_manager);
  177. if (!game_manager)
  178. return NULL;
  179.  
  180. uintptr_t entity_list = Read<uintptr_t>(game_manager + offsets::entity_list);
  181. if (!entity_list)
  182. return NULL;
  183.  
  184. uintptr_t entity = Read<uintptr_t>(entity_list + (sizeof(PVOID) * id));
  185. if (!entity)
  186. return NULL;
  187.  
  188. return entity;
  189. }
  190.  
  191. std::uint8_t entity_team(uintptr_t entity) {
  192.  
  193. if (!entity)
  194. return 0xFF;
  195.  
  196. uintptr_t replication = Read<uintptr_t>(entity + offsets::entity_replication);
  197. std::cout << "replication " << replication << std::endl;
  198. if (!replication) {
  199. return 0xFF;
  200. }
  201.  
  202. unsigned long online_team_id = Read<unsigned long>(replication + offsets::entity_replication_team);
  203. std::cout << "online_team_id " << online_team_id << std::endl;
  204. if (!online_team_id) {
  205. return 0xFF;
  206. }
  207.  
  208. return online_team_id;
  209. }
  210.  
  211. uintptr_t local_entity() {
  212.  
  213. uintptr_t status_manager = Read<uintptr_t>(base_address + offsets::status_manager);
  214.  
  215. if (!status_manager)
  216. return 0;
  217.  
  218. uintptr_t entity_container = Read<uintptr_t>(status_manager + offsets::status_manager_container);
  219.  
  220. if (!entity_container)
  221. return 0;
  222.  
  223. entity_container = Read<uintptr_t>(entity_container);
  224. if (!entity_container)
  225. return 0;
  226.  
  227. entity_container = Read<uintptr_t>(entity_container + offsets::offset_status_manager_localentity);
  228.  
  229. if (!entity_container)
  230. return 0;
  231.  
  232. return entity_container;
  233. }
  234.  
  235. unsigned long entity_count() {
  236. uintptr_t game_manager = Read<uintptr_t>(base_address + offsets::game_manager);
  237. if (!game_manager)
  238. return NULL;
  239.  
  240. return Read<unsigned long>(game_manager + offsets::entity_count) & 0x3fffffff;
  241. }
  242.  
  243. bool glow() {
  244. if (globals::glow)
  245. {
  246. uint64_t glowmanager = Read<uint64_t>(base_address + offsets::glow_manager);
  247.  
  248. uint64_t glowmanager1 = Read<uint64_t>(glowmanager + 0xB8);
  249.  
  250. if (!glowmanager)
  251. return false;
  252. if (!glowmanager1)
  253. return false;
  254.  
  255. if (globals::glow) {
  256. std::random_device seeder;
  257. std::ranlux48 gen(seeder());
  258. std::uniform_int_distribution<int> uniform_0_255(0, 255);
  259.  
  260. Write<float>(glowmanager1 + 0x110, uniform_0_255(gen)); // red
  261. Write<float>(glowmanager1 + 0x114, uniform_0_255(gen)); // green
  262. Write<float>(glowmanager1 + 0x118, uniform_0_255(gen)); // blue
  263. Write<float>(glowmanager1 + 0x13C, 3); // opcacity.
  264. Write<float>(glowmanager1 + 0x130, 0); // dist.
  265. Write<float>(glowmanager1 + 0x130 + 0x4, 0); // dist.
  266. }
  267. else {
  268. Write<float>(glowmanager1 + 0x110, 0); // red
  269. Write<float>(glowmanager1 + 0x114, 0); // green
  270. Write<float>(glowmanager1 + 0x118, 0); // blue
  271. Write<float>(glowmanager1 + 0x13C, 0); // opcacity.
  272. Write<float>(glowmanager1 + 0x130, 0); // dist.
  273. Write<float>(glowmanager1 + 0x130 + 0x4, 0); // dist.
  274. }
  275. }
  276. return true;
  277. }
  278.  
  279. bool patch_terminate()
  280. {
  281. HMODULE module = GetModuleHandle(("kernelbase.dll"));
  282.  
  283. if (!module)
  284. return false;
  285.  
  286. uint64_t r6_module = get_module_base_address("kernelbase.dll");
  287.  
  288. if (!r6_module)
  289. return false;
  290.  
  291. uint64_t api = reinterpret_cast<uint64_t>(GetProcAddress(module, ("TerminateProcess"))) - reinterpret_cast<uint64_t>(module) + r6_module;
  292.  
  293. printf("[+] Cheeto Threads: %llx\n", api);
  294.  
  295. if (change_protection(process_id, api, PAGE_EXECUTE_READWRITE, 0x64) == 0)
  296. {
  297. uint8_t ret_stub[] = { 0xC3, 0x90, 0x90, 0x90 };
  298.  
  299. WriteVirtualMemoryRaw(api, reinterpret_cast<uintptr_t>(ret_stub), sizeof(ret_stub));
  300. change_protection(process_id, api, PAGE_EXECUTE_READ, 0x64);
  301. }
  302.  
  303. return true;
  304. }
  305.  
  306. bool all_unlocks()
  307. {
  308. if (globals::unlock) {
  309. /* uint64_t instruction = this->base_address + OFFSET_UNLOCKS;
  310. uint8_t operand = Read<uint8_t>( instruction + 3 );
  311.  
  312. if ( change_protection( PID, instruction, PAGE_EXECUTE_READWRITE, 0x64 ) == 0 )
  313. {
  314. uint8_t unlocks_on[] = { 0xC6, 0x47, 0x38, 0x00 };
  315. uint8_t unlocks_off[] = { 0xC6, 0x47, 0x38, 0x01 };
  316.  
  317. if ( enabled )
  318. WriteVirtualMemoryRaw( instruction, reinterpret_cast<uintptr_t>( unlocks_on ), sizeof( unlocks_on ) );
  319. else
  320. WriteVirtualMemoryRaw( instruction, reinterpret_cast<uintptr_t>( unlocks_off ), sizeof( unlocks_off ) );
  321.  
  322. change_protection( PID, instruction, PAGE_EXECUTE_READ, 0x64 );
  323. }*/
  324.  
  325. auto instruction = this->base_address + globals::unlock;
  326.  
  327. if (change_protection(process_id, instruction, PAGE_EXECUTE_READWRITE, 4) == 0)
  328. {
  329. Write<std::uint8_t>(instruction + 3, globals::unlock ? 0 : 1);
  330.  
  331. change_protection(process_id, instruction, PAGE_EXECUTE_READ, 4);
  332. }
  333. }
  334. return true;
  335. }
  336.  
  337. void invisible()
  338. {
  339. if (globals::invisible) {
  340. auto profile_manager = Read<uintptr_t>(this->base_address + offsets::profile_manager);
  341.  
  342. if (!profile_manager)
  343. return;
  344.  
  345. auto entity_list = Read<uintptr_t>(Read<uintptr_t>(profile_manager + 0x68));
  346.  
  347. if (!entity_list)
  348. return;
  349.  
  350. auto operator_list = Read<uintptr_t>(entity_list + 0x2d0);
  351.  
  352. if (!operator_list)
  353. return;
  354.  
  355. for (auto i = 0; i < 100; i++)
  356. {
  357. auto coperator = Read<uintptr_t>(operator_list + (i * 8));
  358.  
  359. if (!coperator)
  360. continue;
  361.  
  362. auto headgear = Read<uintptr_t>(coperator + 0x68);
  363.  
  364. if (!headgear)
  365. continue;
  366.  
  367. Write<uintptr_t>(coperator + 0x98, headgear);
  368. }
  369. }
  370. }
  371.  
  372. bool esp()
  373. {
  374. if (globals::esp) {
  375. uintptr_t game_manager = Read<uintptr_t>(base_address + offsets::game_manager);
  376. if (!game_manager)
  377. return NULL;
  378.  
  379. uintptr_t entity_list = Read<uintptr_t>(game_manager + offsets::entity_list);
  380. int entity_count = Read<DWORD>(game_manager + offsets::entity_count) & 0x3fffffff;
  381. if (entity_count == NULL) return false;
  382.  
  383. for (int i = 0; i < entity_count; i++)
  384. {
  385. uintptr_t entity_object = Read<uintptr_t>(entity_list + i * 0x8);
  386.  
  387. uintptr_t addr2 = Read<uintptr_t>(entity_object + 0x28);
  388. if (addr2 == NULL) continue;
  389. uintptr_t addr3 = Read<uintptr_t>(addr2 + 0xD8);
  390. if (addr3 == NULL) continue;
  391.  
  392. for (auto current_component = 0x80; current_component < 0xf0; current_component += sizeof(std::uintptr_t))
  393. {
  394. uintptr_t addr4 = Read<uintptr_t>(addr3 + current_component);
  395. if (addr4 == NULL) continue;
  396.  
  397. if (Read<uintptr_t>(addr4) != (base_address + offsets::entity_marker_vt_offset)) //vt marker
  398. continue;
  399.  
  400. Write<BYTE>(addr4 + 0x532, globals::esp);
  401. Write<BYTE>(addr4 + 0x534, globals::esp);
  402. }
  403. }
  404. }
  405. }
  406.  
  407. bool fov()
  408. {
  409. if (globals::fov) {
  410. uint64_t OFFSET_FOV = Read<uint64_t>(base_address + offsets::fov_manager);
  411.  
  412. if (!OFFSET_FOV)
  413. return false;
  414.  
  415. uint64_t weapon_fov = Read<uint64_t>(OFFSET_FOV + 0x28);
  416. uint64_t class1_unknown = Read<uint64_t>(weapon_fov + 0x0);
  417.  
  418. Write<float>(class1_unknown + 0x3C, globals::fovW);
  419. Write<float>(class1_unknown + 0x38, globals::fovP);
  420. }
  421. }
  422.  
  423. bool outline()
  424. {
  425. uint64_t outline = Read<uint64_t>(base_address + 0x50660B0);
  426.  
  427. if (!outline)
  428. return false;
  429.  
  430. uint64_t teamo = Read<uint64_t>(outline + 0x88);
  431. uint64_t teamou = Read<uint64_t>(teamo + 0x38);
  432. uint64_t teamout = Read<uint64_t>(teamou + 0x68);
  433.  
  434. Write<unsigned int>(teamout + 0x20, 5);
  435.  
  436. return true;
  437. }
  438.  
  439. bool no_recoil()
  440. {
  441. if (globals::recoil) {
  442. uintptr_t LpVisualCompUnk = Read<uintptr_t>(local_entity() + 0x78);
  443.  
  444. if (!LpVisualCompUnk)
  445. return false;
  446.  
  447. uintptr_t LpWeapon = Read<uintptr_t>(LpVisualCompUnk + 0xC8);
  448.  
  449. if (!LpWeapon)
  450. return false;
  451.  
  452. uintptr_t LpCurrentDisplayWeapon = Read<uintptr_t>(LpWeapon + 0x208);
  453.  
  454. if (!LpCurrentDisplayWeapon)
  455. return false;
  456.  
  457. float recoilNumberOne;
  458. float recoilNumberTwo;
  459.  
  460. if (globals::recoil == true) {
  461. recoilNumberOne = Read<float>(LpCurrentDisplayWeapon + 0x50); //spread
  462. recoilNumberTwo = Read<float>(LpCurrentDisplayWeapon + 0xB0); //recoil
  463.  
  464. Write<float>(LpCurrentDisplayWeapon + 0x50, 0.0f); //spread
  465. Write<float>(LpCurrentDisplayWeapon + 0xB0, 0.0f); //recoil
  466. }
  467. else {
  468.  
  469. Write<float>(LpCurrentDisplayWeapon + 0x50, recoilNumberOne); //spread
  470. Write<float>(LpCurrentDisplayWeapon + 0xB0, recoilNumberTwo); //recoil
  471. }
  472. }
  473. return true;
  474. }
  475.  
  476. bool no_flash() {
  477. if (globals::flash) {
  478. uint8_t Activate = 0;
  479. uintptr_t lpEventManager = Read<uintptr_t>(local_entity() + 0x30);
  480. uintptr_t lpFxArray = Read<uintptr_t>(lpEventManager + 0x30);
  481. const UINT uStunIndex = 5;
  482. uintptr_t lpFxStun = Read<uintptr_t>(lpFxArray + (uStunIndex * sizeof(PVOID)));
  483. Write<uint8_t>(lpFxStun + 0x40, Activate);
  484. }
  485. return true;
  486. }
  487.  
  488. void no_clip() {
  489. if (globals::clip) {
  490. uintptr_t networkManager = Read<uintptr_t>(base_address + offsets::network_manager); //network M
  491. uintptr_t noclipPtr = Read<uintptr_t>(networkManager + 0xF8);
  492.  
  493. noclipPtr = Read<uintptr_t>(noclipPtr + 0x8); //no clip 2
  494.  
  495. noclipPtr += 0x530; //no clip 3
  496.  
  497. Vector3 emptyVector = Vector3(0, 0, 0);
  498. Vector3 defaultVector = Vector3(0.0001788139343f, 0.0001788139343f, 0.03051757626f);
  499.  
  500. Write<Vector3>(noclipPtr, (globals::clip ? emptyVector : defaultVector));
  501. }
  502. }
  503.  
  504. uintptr_t get_closest_enemy()
  505. {
  506. const auto getViewangle = [](std::uintptr_t entity)
  507. {
  508. auto r1 = Read<uintptr_t>(entity + 0x20);
  509. auto r2 = Read<uintptr_t>(r1 + 0x1170);
  510. return Read<Vector4>(r2 + 0xc0);
  511. };
  512.  
  513. std::uintptr_t resultant_entity = 0;
  514. static auto resultant_fov = 360.f;
  515.  
  516. for (auto i = 0ul; i < this->entity_count(); i++)
  517. {
  518. const auto entity = this->entity_id(i);
  519.  
  520. const auto health = this->entity_health(entity);
  521.  
  522. if (health <= 0 || health > 200)
  523. continue;
  524.  
  525. const auto lentity = local_entity();
  526.  
  527. if (this->entity_team(lentity) == this->entity_team(entity))
  528. continue;
  529.  
  530. const auto fov_result = closest_to_fov(this->entity_head(lentity), this->entity_head(entity), calculate_euler(getViewangle(lentity)));
  531.  
  532. if (fov_result < resultant_fov)
  533. {
  534. resultant_fov = fov_result;
  535. resultant_entity = entity;
  536. }
  537. }
  538.  
  539. return resultant_entity;
  540. }
  541.  
  542. uintptr_t get_closest_enemy_to_local_head() {
  543. uintptr_t game_manager = Read<uintptr_t>(base_address + offsets::game_manager);
  544. if (!game_manager)
  545. return NULL;
  546.  
  547. int num = Read<DWORD>(game_manager + 0x1D0);
  548.  
  549. Vector3 CurrentViewAngles = entity_head(local_entity());
  550. uintptr_t entity_object;
  551. float bestDelta = FLT_MAX;
  552. uintptr_t BestEntity;
  553. uint64_t EntList = Read<uint64_t>(game_manager + 0x1C8);
  554.  
  555. for (int i = 0; i < num; i++) {
  556. entity_object = Read<uint64_t>(EntList + i * 0x8);
  557.  
  558. Vector3 angles = calc_angle(entity_head(local_entity()), entity_head(entity_object));
  559.  
  560. (angles - CurrentViewAngles).clamp();
  561.  
  562. float Delta = angles.y;
  563.  
  564. if (Delta < bestDelta && local_entity() != entity_object) {
  565. bestDelta = Delta;
  566. BestEntity = entity_object;
  567. return BestEntity;
  568. }
  569. }
  570. }
  571.  
  572. Vector3 entity_feet(uintptr_t entity) {
  573. uint64_t addr1 = Read<uint64_t>(entity + offsets::offset_entity_pawn);
  574. return Read<Vector3>(addr1 + offsets::offset_entitypawn_feet);
  575. }
  576.  
  577. Vector3 entity_head(uintptr_t player)
  578. {
  579. uint64_t pSkeleton = Read<uint64_t>(player + 0x20);
  580.  
  581. if (!pSkeleton)
  582. return Vector3();
  583.  
  584. return Read<Vector3>(pSkeleton + offsets::offset_skeleton_headposition); // Ox6A0
  585. }
  586.  
  587. bool world_to_screen(Vector3 position, Vector2* screen)
  588. {
  589. uintptr_t camera_manager = Read<uintptr_t>(base_address + offsets::camera_manager);
  590. if (!camera_manager)
  591. return false;
  592.  
  593. Vector3 temp = position - view_translation();
  594.  
  595. float x = temp.Dot(view_right());
  596. float y = temp.Dot(view_up());
  597. float z = temp.Dot(view_forward() * -1.f);
  598.  
  599. RECT desktop;
  600. const HWND hDesktop = GetDesktopWindow();
  601. GetWindowRect(hDesktop, &desktop);
  602. int horizontal = desktop.right;
  603. int vertical = desktop.bottom;
  604.  
  605. screen->x = (horizontal / 2.f) * (1.f + x / view_fovx() / z);
  606. screen->y = (vertical / 2.f) * (1.f - y / view_fovy() / z);
  607.  
  608. return z >= 1.0f ? true : false;
  609. }
  610.  
  611. Vector3 view_translation()
  612. {
  613. uintptr_t camera_manager = Read<uintptr_t>(base_address + offsets::camera_manager);
  614. if (!camera_manager)
  615. return Vector3();
  616.  
  617. return Read<Vector3>(camera_manager + offsets::camera_translation);
  618. }
  619. Vector3 view_right()
  620. {
  621. uintptr_t camera_manager = Read<uintptr_t>(base_address + offsets::camera_manager);
  622. if (!camera_manager)
  623. return Vector3();
  624.  
  625. return Read<Vector3>(camera_manager + offsets::camera_right);
  626. }
  627. Vector3 view_up()
  628. {
  629. uintptr_t camera_manager = Read<uintptr_t>(base_address + offsets::camera_manager);
  630. if (!camera_manager)
  631. return Vector3();
  632.  
  633. return Read<Vector3>(camera_manager + offsets::camera_up);
  634. }
  635.  
  636. Vector3 view_forward()
  637. {
  638. uintptr_t camera_manager = Read<uintptr_t>(base_address + offsets::camera_manager);
  639. if (!camera_manager)
  640. return Vector3();
  641.  
  642. return Read<Vector3>(camera_manager + offsets::camera_forward);
  643. }
  644.  
  645. float view_fovx()
  646. {
  647. uintptr_t camera_manager = Read<uintptr_t>(base_address + offsets::camera_manager);
  648. if (!camera_manager)
  649. return 0.0f;
  650.  
  651. return Read<float>(camera_manager + offsets::camera_fovx);
  652. }
  653.  
  654. float view_fovy()
  655. {
  656. uintptr_t camera_manager = Read<uintptr_t>(base_address + offsets::camera_manager);
  657. if (!camera_manager)
  658. return 0.0f;
  659.  
  660. return Read<float>(camera_manager + offsets::camera_fovy);
  661. }
  662.  
  663. Vector3 calc_angle(Vector3 enemypos, Vector3 camerapos)
  664. {
  665. Vector3 dir = enemypos - camerapos;
  666.  
  667. float x = asin(dir.z / dir.Length()) * 57.2957795131f;
  668. float z = atan(dir.y / dir.x) * 57.2957795131f;
  669.  
  670. if (dir.x >= 0.f) z += 180.f;
  671. if (x > 179.99f) x -= 360.f;
  672. else if (x < -179.99f) x += 360.f;
  673.  
  674. return Vector3(x, 0.f, z + 90.f);
  675. }
  676.  
  677. bool damage_multiplier() {
  678. if (globals::damage) {
  679. uint64_t damgebase = Read<uint64_t>(base_address + offsets::game_manager); //game M
  680.  
  681. if (!damgebase)
  682. return false;
  683.  
  684. uint64_t dmage = Read<uint64_t>(damgebase + 0x1F8);
  685. uint64_t dmage1 = Read<uint64_t>(dmage + 0xD8);
  686. uint64_t dmage2 = Read<uint64_t>(dmage1 + 0x48);
  687. uint64_t dmage3 = Read<uint64_t>(dmage2 + 0x130);
  688. uint64_t dmage4 = Read<uint64_t>(dmage3 + 0x130);
  689. uint64_t dmage5 = Read<uint64_t>(dmage4 + 0x0);
  690.  
  691. Write<unsigned int>(dmage5 + 0x40, globals::damagemultiplier); //dmg
  692. }
  693. return true;
  694. }
  695.  
  696. uint32_t entity_health(uintptr_t entity)
  697. {
  698. auto r1 = Read<uintptr_t>(entity + 0x28);
  699. auto r2 = Read<uintptr_t>(r1 + 0xd8);
  700. auto r3 = Read<uintptr_t>(r2 + 0x8);
  701. return Read<uint32_t>(r3 + 0x148);
  702. }
  703.  
  704. Vector4 calculate_quaternion(Vector3 euler)
  705. {
  706. Vector4 result{};
  707.  
  708. auto yaw = (euler.z * 0.01745329251f) * 0.5f;
  709. auto sy = std::sin(yaw);
  710. auto cy = std::cos(yaw);
  711.  
  712. auto roll = (euler.x * 0.01745329251f) * 0.5f;
  713. auto sr = std::sin(roll);
  714. auto cr = std::cos(roll);
  715.  
  716. constexpr auto sp = 0.f;
  717. constexpr auto cp = 1.f;
  718.  
  719. result.x = cy * sr * cp - sy * cr * sp;
  720. result.y = cy * cr * sp + sy * sr * cp;
  721. result.z = sy * cr * cp - cy * sr * sp;
  722. result.w = cy * cr * cp + sy * sr * sp;
  723.  
  724. return result;
  725. }
  726.  
  727. std::uintptr_t closest_to_fov(Vector3 source_head, Vector3 entity_head, Vector3 source_angle)
  728. {
  729. const auto calc_angle = [](Vector3 src, Vector3 dest)
  730. {
  731. auto delta = src - dest;
  732.  
  733. auto y = -asin(delta.z / src.Distance(dest)) * 57.2957795131f;
  734. auto x = (atan2(delta.y, delta.x) * 57.2957795131f) + 90.f;
  735.  
  736. if (x > 180.f) x -= 360.f;
  737. else if (x < -180.f) x += 360.f;
  738.  
  739. auto clamp = [](Vector3& angle)
  740. {
  741. if (angle.y > 75.f) angle.y = 75.f;
  742. else if (angle.y < -75.f) angle.y = -75.f;
  743. if (angle.x < -180.f) angle.x += -360.f;
  744. else if (angle.x > 180.f) angle.x -= 360.f;
  745.  
  746. angle.z = 0.f;
  747. };
  748.  
  749. auto angle = Vector3(x, y, 0.f);
  750. clamp(angle);
  751.  
  752. return angle;
  753. };
  754.  
  755. auto aim_angle = calc_angle(source_head, entity_head);
  756.  
  757. auto calc_fov = [](Vector3 src, Vector3 aim)
  758. {
  759. aim -= src;
  760.  
  761. if (aim.x > 180.f)
  762. aim.x -= 360.f;
  763. else if (aim.x < -180.f)
  764. aim.x += 360.f;
  765. if (aim.y > 180.f)
  766. aim.y -= 360.f;
  767. else if (aim.y < -180.f)
  768. aim.y += 360.f;
  769.  
  770. return aim;
  771. };
  772.  
  773. auto angle = calc_fov(source_angle, aim_angle);
  774.  
  775. angle.x = std::abs(angle.x);
  776. angle.y = std::abs(angle.y);
  777.  
  778. return angle.x + angle.y;
  779. }
  780.  
  781. Vector3 calculate_euler(Vector4 quat)
  782. {
  783. auto y_p2 = quat.y * quat.y;
  784.  
  785. auto x = std::atan2(2.f * (quat.w * quat.z + quat.x * quat.y), (1.f - 2.f * (y_p2 + quat.z * quat.z))) * 57.2957795131f;
  786. auto y = std::atan2(2.f * (quat.w * quat.x + quat.y * quat.z), (1.f - 2.f * (quat.x * quat.x + y_p2))) * 57.2957795131f;
  787.  
  788. return Vector3(x, y, 0.f);
  789. }
  790.  
  791. void set_viewangle(std::uintptr_t entity, std::uintptr_t offset, Vector4 value)
  792. {
  793. auto r1 = Read<uintptr_t>(entity + 0x20);
  794. auto r2 = Read<uintptr_t>(r1 + 0x1170);
  795.  
  796. Write<Vector4>(r2 + offset, value);
  797. }
  798. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement