Guest User

Untitled

a guest
Oct 5th, 2025
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.62 KB | None | 0 0
  1. #include <windows.h>
  2. #include <vector>
  3. #include <string>
  4. #include <map>
  5. #include <set>
  6. #include "Vectors.h"
  7. #include <iostream>
  8. #include "Memory.h"
  9. #include <math.h>
  10. #include <algorithm>
  11.  
  12. namespace Game
  13. {
  14.  
  15. enum EntityType {
  16. UNKNOWN = 0,
  17. PLAYER,
  18. ZOMBIE,
  19. CAR,
  20. BOAT,
  21. ANIMAL,
  22. RARE,
  23. BACKPACK,
  24. CLOTHING,
  25. WEAPON,
  26. PROXYMAGAZINES,
  27. FOOD,
  28. AMMO,
  29. GROUNDITEM,
  30. OPTICS,
  31. BASE,
  32. MELEE,
  33. EXPLOSIVES,
  34. BUILDING
  35. };
  36.  
  37. std::string ReadArmaString(uint64_t address)
  38. {
  39. constexpr size_t MaxLength = 256;
  40. char buffer[MaxLength] = { 0 };
  41. SIZE_T bytesRead = 0;
  42. if (ReadProcessMemory(Memory::hProcess, reinterpret_cast<LPCVOID>(address), buffer, MaxLength - 1, &bytesRead))
  43. {
  44. buffer[bytesRead < MaxLength ? bytesRead : MaxLength - 1] = '\0';
  45. return std::string(buffer);
  46. }
  47. return "";
  48. }
  49.  
  50. uint64_t NearEntityTable()
  51. {
  52. return Memory::ReadMemory<uint64_t>(globals.World + 0xF48);
  53. }
  54.  
  55. uint32_t NearEntityTableSize()
  56. {
  57. return Memory::ReadMemory<uint32_t>(globals.World + 0xF48 + 0x8);
  58. }
  59.  
  60. uint64_t GetEntity(uint64_t PlayerList, uint64_t SelectedPlayer)
  61. {
  62. return Memory::ReadMemory<uint64_t>(PlayerList + SelectedPlayer * 0x8);
  63. }
  64. uint64_t GetLocalPlayerFromNearTable()
  65. {
  66. uint32_t nearSize = NearEntityTableSize();
  67. uint64_t nearTable = NearEntityTable();
  68.  
  69. if (nearTable && nearSize > 0)
  70. {
  71. // Индекс 0 - это локальный игрок
  72. return GetEntity(nearTable, 0);
  73. }
  74.  
  75. return 0;
  76. }
  77. std::string GetEntityTypeName(uint64_t Entity)
  78. {
  79. uint64_t entityTypePtr = Memory::ReadMemory<uint64_t>(Entity + 0x180);
  80. if (!entityTypePtr) return "";
  81.  
  82. uint64_t configNamePtr = Memory::ReadMemory<uint64_t>(entityTypePtr + 0xA8);
  83. if (!configNamePtr) return "";
  84.  
  85. return ReadArmaString(configNamePtr + 0x10);
  86. }
  87.  
  88. std::string GetEntityName(uint64_t Entity)
  89. {
  90. uint64_t entityTypePtr = Memory::ReadMemory<uint64_t>(Entity + 0x180);
  91. if (!entityTypePtr) return "";
  92.  
  93. uint64_t configNamePtr = Memory::ReadMemory<uint64_t>(entityTypePtr + 0x4F0);
  94. if (!configNamePtr) return "";
  95.  
  96. return ReadArmaString(configNamePtr + 0x10);
  97. }
  98.  
  99. std::string GetEntityModelName(uint64_t Entity)
  100. {
  101. uint64_t entityTypePtr = Memory::ReadMemory<uint64_t>(Entity + 0x180);
  102. if (!entityTypePtr) return "";
  103.  
  104. uint64_t configNamePtr = Memory::ReadMemory<uint64_t>(entityTypePtr + 0x88);
  105. if (!configNamePtr) return "";
  106.  
  107. std::string fullPath = ReadArmaString(configNamePtr + 0x10);
  108.  
  109. size_t lastSlash = fullPath.find_last_of("\\/");
  110. std::string fileName = (lastSlash != std::string::npos) ?
  111. fullPath.substr(lastSlash + 1) : fullPath;
  112.  
  113. size_t dotPos = fileName.find_last_of('.');
  114. std::string nameWithoutExt = (dotPos != std::string::npos) ?
  115. fileName.substr(0, dotPos) : fileName;
  116.  
  117. std::string result = nameWithoutExt;
  118. std::replace(result.begin(), result.end(), '_', ' ');
  119.  
  120. return result;
  121. }
  122.  
  123.  
  124. uint64_t FarEntityTable()
  125. {
  126. return Memory::ReadMemory<uint64_t>(globals.World + 0x1090);
  127. }
  128.  
  129. uint32_t FarEntityTableSize()
  130. {
  131. return Memory::ReadMemory<uint32_t>(globals.World + 0x1090 + 0x08);
  132. }
  133.  
  134. Vector3 GetCoordinate(uint64_t Entity)
  135. {
  136. uint64_t visualState = Memory::ReadMemory<uint64_t>(Entity + 0x1C8);
  137. if (!visualState) return Vector3();
  138. return Vector3(Memory::ReadMemory<Vector3>(visualState + 0x2C));
  139. }
  140.  
  141. Vector3 GetCoordinateItem(uint64_t Entity)
  142. {
  143. uint64_t visualState = Memory::ReadMemory<uint64_t>(Entity + 0x1C8);
  144. if (!visualState) return Vector3();
  145. Vector3 coordinate = Memory::ReadMemory<Vector3>(visualState + 0x2C);
  146. return Vector3(coordinate.x, coordinate.z, coordinate.y);
  147. }
  148.  
  149. uint64_t GetCamera()
  150. {
  151. return Memory::ReadMemory<uint64_t>(globals.World + 0x1B8);
  152. }
  153.  
  154. Vector3 GetInvertedViewTranslation()
  155. {
  156. uint64_t camera = GetCamera();
  157. if (!camera) return Vector3();
  158. return Vector3(Memory::ReadMemory<Vector3>(camera + 0x2C));
  159. }
  160.  
  161. Vector3 GetInvertedViewRight()
  162. {
  163. uint64_t camera = GetCamera();
  164. if (!camera) return Vector3();
  165. return Vector3(Memory::ReadMemory<Vector3>(camera + 0x8));
  166. }
  167.  
  168. Vector3 GetInvertedViewUp()
  169. {
  170. uint64_t camera = GetCamera();
  171. if (!camera) return Vector3();
  172. return Vector3(Memory::ReadMemory<Vector3>(camera + 0x14));
  173. }
  174.  
  175. Vector3 GetInvertedViewForward()
  176. {
  177. uint64_t camera = GetCamera();
  178. if (!camera) return Vector3();
  179. return Vector3(Memory::ReadMemory<Vector3>(camera + 0x20));
  180. }
  181.  
  182. Vector3 GetViewportSize()
  183. {
  184. uint64_t camera = GetCamera();
  185. if (!camera) return Vector3();
  186. return Vector3(Memory::ReadMemory<Vector3>(camera + 0x58));
  187. }
  188.  
  189. Vector3 GetProjectionD1()
  190. {
  191. uint64_t camera = GetCamera();
  192. if (!camera) return Vector3();
  193. return Vector3(Memory::ReadMemory<Vector3>(camera + 0xD0));
  194. }
  195.  
  196. Vector3 GetProjectionD2()
  197. {
  198. uint64_t camera = GetCamera();
  199. if (!camera) return Vector3();
  200. return Vector3(Memory::ReadMemory<Vector3>(camera + 0xDC));
  201. }
  202.  
  203. Vector3 WorldToScreen(Vector3 Position)
  204. {
  205. uint64_t camera = GetCamera();
  206. if (!camera) return Vector3();
  207. Vector3 temp = Position - GetInvertedViewTranslation();
  208. float x = temp.Dot(GetInvertedViewRight());
  209. float y = temp.Dot(GetInvertedViewUp());
  210. float z = temp.Dot(GetInvertedViewForward());
  211. if (z > 0)
  212. {
  213. return Vector3(
  214. GetViewportSize().x * (1 + (x / GetProjectionD1().x / z)),
  215. GetViewportSize().y * (1 - (y / GetProjectionD2().y / z)),
  216. z);
  217. }
  218. return Vector3();
  219. }
  220.  
  221. float GetDistanceToMe(Vector3 Entity)
  222. {
  223. return Entity.Distance(GetCoordinate(GetLocalPlayerFromNearTable()));
  224. }
  225.  
  226. uint64_t GetSlowEntityTable()
  227. {
  228. return Memory::ReadMemory<uint64_t>(globals.World + 0x2010);
  229. }
  230.  
  231. uint32_t GetSlowEntityTableSize()
  232. {
  233. return Memory::ReadMemory<uint32_t>(globals.World + 0x2010 + 0x08);
  234. }
  235.  
  236. uint32_t GetItemTableCountAlloc()
  237. {
  238. return Memory::ReadMemory<uint32_t>(globals.World + 0x2060 + 0x8);
  239. }
  240.  
  241. uint32_t GetItemTableCount()
  242. {
  243. return Memory::ReadMemory<uint32_t>(globals.World + 0x2060 + 0x8 + 0x8);
  244. }
  245.  
  246. uint64_t GetItemTable()
  247. {
  248. return Memory::ReadMemory<uint64_t>(globals.World + 0x2060);
  249. }
  250.  
  251.  
  252. EntityType GetEntityType(uint64_t Entity)
  253. {
  254. std::string entityTypeName = GetEntityTypeName(Entity);
  255. std::string modelName = GetEntityModelName(Entity);
  256.  
  257. std::string lowerTypeName = entityTypeName;
  258. std::transform(lowerTypeName.begin(), lowerTypeName.end(), lowerTypeName.begin(), ::tolower);
  259.  
  260. std::string lowerModelName = modelName;
  261. std::transform(lowerModelName.begin(), lowerModelName.end(), lowerModelName.begin(), ::tolower);
  262.  
  263.  
  264. if (lowerTypeName == "dayzplayer") return PLAYER;
  265. if (lowerTypeName == "dayzinfected") return ZOMBIE;
  266. if (lowerTypeName == "car") return CAR;
  267. if (lowerTypeName == "boat") return BOAT;
  268. if (lowerTypeName == "dayzanimal") return ANIMAL;
  269. if (lowerTypeName == "clothing") return CLOTHING;
  270. if (lowerTypeName == "proxymagazines") return PROXYMAGAZINES;
  271. if (lowerTypeName == "weapon") return WEAPON;
  272. if (lowerTypeName == "itemoptics") return OPTICS;
  273.  
  274.  
  275. if (lowerModelName.find("backpack") != std::string::npos ||
  276. lowerModelName.find("bag") != std::string::npos) return BACKPACK;
  277.  
  278. if (lowerModelName.find("food") != std::string::npos) return FOOD;
  279. if (lowerModelName.find("ammo") != std::string::npos ||
  280. lowerModelName.find("magazine") != std::string::npos) return AMMO;
  281. if (lowerModelName.find("camping") != std::string::npos ||
  282. lowerModelName.find("tent") != std::string::npos) return BASE;
  283. if (lowerModelName.find("melee") != std::string::npos) return MELEE;
  284. if (lowerModelName.find("explosive") != std::string::npos) return EXPLOSIVES;
  285.  
  286.  
  287.  
  288. return UNKNOWN;
  289. }
  290.  
  291.  
  292. ImColor GetColorByEntityType(EntityType type)
  293. {
  294. switch (type)
  295. {
  296. case PLAYER: return ImColor(0, 255, 255, 255); // Голубой
  297. case ZOMBIE: return ImColor(255, 0, 0, 255); // Красный
  298. case CAR: return ImColor(255, 0, 245, 255); // Розовый
  299. case BOAT: return ImColor(255, 0, 245, 255); // Розовый
  300. case ANIMAL: return ImColor(0, 255, 0, 255); // Зеленый
  301. case RARE: return ImColor(255, 0, 255, 255); // Фиолетовый
  302. case BACKPACK: return ImColor(175, 255, 0, 255); // Лаймовый
  303. case CLOTHING: return ImColor(255, 255, 0, 255); // Желтый
  304. case WEAPON: return ImColor(255, 0, 100, 255); // Темно-розовый
  305. case PROXYMAGAZINES: return ImColor(255, 117, 50, 255); // Оранжевый
  306. case FOOD: return ImColor(50, 140, 50, 255); // Темно-зеленый
  307. case AMMO: return ImColor(255, 117, 50, 255); // Оранжевый
  308. case GROUNDITEM: return ImColor(255, 255, 255, 255); // Белый
  309. case OPTICS: return ImColor(0, 150, 255, 255); // Синий
  310. case BASE: return ImColor(0, 150, 255, 255); // Синий
  311. case MELEE: return ImColor(0, 150, 255, 255); // Синий
  312. case EXPLOSIVES: return ImColor(255, 0, 50, 255); // Темно-красный
  313. default: return ImColor(255, 255, 255, 255); // Белый по умолчанию
  314. }
  315. }
  316.  
  317.  
  318. std::string GetEntityTypeString(EntityType type)
  319. {
  320. switch (type)
  321. {
  322. case PLAYER: return "Player";
  323. case ZOMBIE: return "Zombie";
  324. case CAR: return "Car";
  325. case BOAT: return "Boat";
  326. case ANIMAL: return "Animal";
  327. case RARE: return "Rare";
  328. case BACKPACK: return "Backpack";
  329. case CLOTHING: return "Clothing";
  330. case WEAPON: return "Weapon";
  331. case PROXYMAGAZINES: return "Magazine";
  332. case FOOD: return "Food";
  333. case AMMO: return "Ammo";
  334. case GROUNDITEM: return "Item";
  335. case OPTICS: return "Optic";
  336. case BASE: return "Base";
  337. case MELEE: return "Melee";
  338. case EXPLOSIVES: return "Explosive";
  339. default: return "Unknown";
  340. }
  341. }
  342.  
  343.  
  344. std::vector<uint64_t> EntityList()
  345. {
  346. std::vector<uint64_t> arrayList;
  347.  
  348. // --- Near entities ---
  349. uint32_t nearSize = NearEntityTableSize();
  350. uint64_t nearTable = NearEntityTable();
  351. for (uint32_t i = 1; i < nearSize; ++i) {
  352. uint64_t entity = GetEntity(nearTable, i);
  353. if (entity) arrayList.push_back(entity);
  354. }
  355.  
  356. // --- Far entities ---
  357. uint32_t farSize = FarEntityTableSize();
  358. uint64_t farTable = FarEntityTable();
  359. for (uint32_t i = 0; i < farSize; ++i) {
  360. uint64_t entity = GetEntity(farTable, i);
  361. if (entity) arrayList.push_back(entity);
  362. }
  363.  
  364. // --- Slow entities ---
  365. uint64_t slowTable = GetSlowEntityTable();
  366. uint32_t slowAllocSize = GetSlowEntityTableSize();
  367. uint32_t slowValidSize = Memory::ReadMemory<uint32_t>(globals.World + 0x1F90 + 0x8 + 0x8);
  368. uint32_t addedCount = 0;
  369. for (uint32_t i = 0; i < slowAllocSize; ++i) {
  370. uint16_t flag = Memory::ReadMemory<uint16_t>(slowTable + i * 0x18);
  371. if (flag != 1) continue;
  372.  
  373. uint64_t entity = Memory::ReadMemory<uint64_t>(slowTable + i * 0x18 + 0x8);
  374. if (!entity) continue;
  375.  
  376. arrayList.push_back(entity);
  377. addedCount++;
  378. if (addedCount >= slowValidSize) break;
  379. }
  380.  
  381. // --- Item table ---
  382. uint64_t itemTable = GetItemTable();
  383. uint32_t itemAllocSize = GetItemTableCountAlloc();
  384. uint32_t itemValidSize = GetItemTableCount();
  385. addedCount = 0;
  386. for (uint32_t i = 0; i < itemAllocSize; ++i) {
  387. uint16_t flag = Memory::ReadMemory<uint16_t>(itemTable + i * 0x18);
  388. if (flag != 1) continue;
  389.  
  390. uint64_t entity = Memory::ReadMemory<uint64_t>(itemTable + i * 0x18 + 0x8);
  391. if (!entity) continue;
  392.  
  393. uint64_t visualState = Memory::ReadMemory<uint64_t>(entity + 0x1C8);
  394. uint64_t typePtr = Memory::ReadMemory<uint64_t>(entity + 0x180);
  395. if (!visualState || !typePtr) continue;
  396.  
  397. arrayList.push_back(entity);
  398. addedCount++;
  399. if (addedCount >= itemValidSize) break;
  400. }
  401.  
  402. return arrayList;
  403. }
  404.  
  405.  
  406. }
Advertisement
Add Comment
Please, Sign In to add comment