Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.50 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading;
  7. using System.Threading.Tasks;
  8.  
  9. namespace BATTLEGROUNDS_EXERNAL
  10. {
  11. #region Enums
  12. enum EMovementMode : byte
  13. {
  14. MOVE_None = 0,
  15. MOVE_Walking = 1,
  16. MOVE_NavWalking = 2,
  17. MOVE_Falling = 3,
  18. MOVE_Swimming = 4,
  19. MOVE_Flying = 5,
  20. MOVE_Custom = 6,
  21. MOVE_MAX = 7
  22. }
  23. public enum EFiringMode : byte
  24. {
  25. Normal = 0,
  26. Burst = 1,
  27. FullAuto = 2,
  28. EFiringMode_MAX = 3
  29. }
  30. public enum EWeaponReloadMethod : byte
  31. {
  32. Magazine = 0,
  33. OneByOne = 1,
  34. OneByOneAndClip = 2,
  35. EWeaponReloadMethod_MAX = 3
  36. }
  37. public enum EWeaponGripLeftHand : byte
  38. {
  39. EWeaponGripLeftHand__NormalRifle = 0,
  40. EWeaponGripLeftHand__Foregrip1 = 1,
  41. EWeaponGripLeftHand__Foregrip2 = 2,
  42. EWeaponGripLeftHand__Thompson = 3,
  43. EWeaponGripLeftHand__EWeaponGripLeftHand_MAX = 4
  44. }
  45. public enum EWeaponClass : byte
  46. {
  47. Class_Pistol = 0,
  48. Class_SMG = 1,
  49. Class_Rifle = 2,
  50. Class_Carbine = 3,
  51. Class_Shotgun = 4,
  52. Class_Sniper = 5,
  53. Class_DMR = 6,
  54. Class_LMG = 7,
  55. Class_Melee = 8,
  56. Class_Throwable = 9,
  57. Class_MAX = 10
  58. }
  59. public enum EThrownWeaponType : byte
  60. {
  61. Thrown_Grenade = 0,
  62. Thrown_Molotov = 1,
  63. Thrown_Other = 2,
  64. Thrown_MAX = 3
  65. }
  66. public enum EStanceMode : byte
  67. {
  68. STANCE_None = 0,
  69. STANCE_Stand = 1,
  70. STANCE_Crouch = 2,
  71. STANCE_Prone = 3,
  72. STANCE_MAX = 4
  73. }
  74. #endregion
  75. #region Structs
  76. [StructLayout(LayoutKind.Explicit)]
  77. public struct UWorld
  78. {
  79. [FieldOffset(0x0020)]
  80. public IntPtr pPersistentLevel;
  81.  
  82. [FieldOffset(0x0058)]
  83. public IntPtr pNetworkManager;
  84.  
  85. [FieldOffset(0x0240)]
  86. public IntPtr pOwningGameInstance;
  87.  
  88. public AGameNetworkManager NetworkManager
  89. {
  90. get
  91. {
  92. return M.Read<AGameNetworkManager>(this.pNetworkManager);
  93. }
  94. }
  95.  
  96. }
  97. [StructLayout(LayoutKind.Sequential)]
  98. public unsafe struct AGameNetworkManager
  99. {
  100. private fixed byte pad0[0x0388];
  101. public int AdjustedNetSpeed; // 0x0388(0x0004) (CPF_ZeroCo
  102. public float LastNetSpeedUpdateTime; // 0x038C(0x0004) (CPF_ZeroCo
  103. public int TotalNetBandwidth; // 0x0390(0x0004) (CPF_ZeroCo
  104. public int MinDynamicBandwidth; // 0x0394(0x0004) (CPF_ZeroCo
  105. public int MaxDynamicBandwidth; // 0x0398(0x0004) (CPF_ZeroCo
  106. public byte bIsStandbyCheckingEnabled; // 0x039C(0x0001) (CPF_Config
  107. public byte bHasStandbyCheatTriggered; // 0x039C(0x0001)
  108. fixed byte UnknownData00[0x3]; // 0x039D(0x0003) MISSED OFFS
  109. public float StandbyRxCheatTime; // 0x03A0(0x0004) (CPF_ZeroCo
  110. public float StandbyTxCheatTime; // 0x03A4(0x0004) (CPF_ZeroCo
  111. public int BadPingThreshold; // 0x03A8(0x0004) (CPF_ZeroCo
  112. public float PercentMissingForRxStandby; // 0x03AC(0x0004) (CPF_ZeroCo
  113. public float PercentMissingForTxStandby; // 0x03B0(0x0004) (CPF_ZeroCo
  114. public float PercentForBadPing; // 0x03B4(0x0004) (CPF_ZeroCo
  115. public float JoinInProgressStandbyWaitTime; // 0x03B8(0x0004) (CPF_ZeroCo
  116. public float MoveRepSize; // 0x03BC(0x0004) (CPF_ZeroCo
  117. public float MAXPOSITIONERRORSQUARED; // 0x03C0(0x0004) (CPF_ZeroCo
  118. public float MAXNEARZEROVELOCITYSQUARED; // 0x03C4(0x0004) (CPF_ZeroCo
  119. public float CLIENTADJUSTUPDATECOST; // 0x03C8(0x0004) (CPF_ZeroCo
  120. public float MAXCLIENTUPDATEINTERVAL; // 0x03CC(0x0004) (CPF_ZeroCo
  121. public float MaxMoveDeltaTime; // 0x03D0(0x0004) (CPF_ZeroCo
  122. public byte ClientAuthorativePosition; // 0x03D4(0x0001) (CPF_ZeroCo
  123. fixed byte UnknownData01[0x3]; // 0x03D5(0x0003) MISSED OFFS
  124. public float ClientErrorUpdateRateLimit; // 0x03D8(0x0004) (CPF_ZeroCo
  125. public byte bMovementTimeDiscrepancyDetection; // 0x03DC(0x0001) (CPF_ZeroCo
  126. public byte bMovementTimeDiscrepancyResolution; // 0x03DD(0x0001) (CPF_ZeroCo
  127. fixed byte UnknownData02[0x2]; // 0x03DE(0x0002) MISSED OFFS
  128. public float MovementTimeDiscrepancyMaxTimeMargin; // 0x03E0(0x0004) (CPF_ZeroCo
  129. public float MovementTimeDiscrepancyMinTimeMargin; // 0x03E4(0x0004) (CPF_ZeroCo
  130. public float MovementTimeDiscrepancyResolutionRate; // 0x03E8(0x0004) (CPF_ZeroCo
  131. public float MovementTimeDiscrepancyDriftAllowance; // 0x03EC(0x0004) (CPF_ZeroCo
  132. public byte bMovementTimeDiscrepancyForceCorrectionsDuringResolution; // 0x03F0(0x0001)
  133. public byte bUseDistanceBasedRelevancy; // 0x03F1(0x0001) (CPF_ZeroCo
  134.  
  135. }
  136. [StructLayout(LayoutKind.Explicit)]
  137. public struct ULevel
  138. {
  139. [FieldOffset(0x0008)]
  140. public TArray<AActor> AActors;
  141. }
  142. [StructLayout(LayoutKind.Explicit)]
  143. public struct AActor
  144. {
  145. [FieldOffset(0x0)]
  146. public IntPtr BasePointer;
  147.  
  148. [FieldOffset(0x00B8)]
  149. public int Id;
  150.  
  151. [FieldOffset(0x03A8)]
  152. public IntPtr pPawn;
  153.  
  154. [FieldOffset(0x0180)]
  155. public IntPtr pRootComponent;
  156.  
  157. [FieldOffset(0x03AC)]
  158. public float BaseEyeHeight;
  159.  
  160. [FieldOffset(0x03A0)]
  161. public TArray<pADroppedItem> DroppedItemArray;
  162.  
  163. [FieldOffset(0x03C0)]
  164. public IntPtr pPlayerState;
  165.  
  166. [FieldOffset(0x0408)]
  167. public IntPtr pCharacterMovement;
  168.  
  169. [FieldOffset(0x04A8)]
  170. public float CrouchedEyeHeight;
  171.  
  172. [FieldOffset(0x09B8)]
  173. public IntPtr pWeaponProcessor;
  174.  
  175. [FieldOffset(0x09C0)]
  176. public byte CharacterState;
  177.  
  178. [FieldOffset(0x0A20)]
  179. public float Punch_Damage;
  180.  
  181. [FieldOffset(0x0A24)]
  182. public float HeavyPunch_Damage;
  183.  
  184. [FieldOffset(0x0A94)]
  185. public float Sprint_MaxSpeed;
  186.  
  187. [FieldOffset(0x0B60)]
  188. public float ReleasingParachuteAltitude;
  189.  
  190. [FieldOffset(0x0B64)]
  191. public float ForceReleasingParachuteAltitude;
  192.  
  193. [FieldOffset(0x1008)]
  194. public float Health;
  195.  
  196. [FieldOffset(0x100C)]
  197. public float HealthMax;
  198.  
  199. [FieldOffset(0x0D5C)]
  200. public float TargetingSpeedModifier;
  201.  
  202. [FieldOffset(0x0D68)]
  203. public float Stand_SprintingSpeedModifier;
  204.  
  205. [FieldOffset(0x0D6C)]
  206. public float Stand_SprintingBigGunModifier;
  207.  
  208. [FieldOffset(0x0D70)]
  209. public float Stand_SprintingRifleModifier;
  210.  
  211. [FieldOffset(0x0D74)]
  212. public float Stand_SprintingSmallGunMOdifier;
  213.  
  214. [FieldOffset(0x0D78)]
  215. public float Crouch_RunningSpeedModifier;
  216.  
  217. [FieldOffset(0x0D7C)]
  218. public float Crouch_SprintingSpeedModifier;
  219.  
  220. [FieldOffset(0x0D80)]
  221. public float Prone_RunningSpeedModifier;
  222.  
  223. [FieldOffset(0x0D84)]
  224. public float Prone_SprintingSpeedModifier;
  225.  
  226. public bool IsPlayer
  227. {
  228. get
  229. {
  230. return this.Id >= 60700 && this.Id <= 60800;
  231. }
  232. }
  233. public bool IsDroppedItemInteractionComponent
  234. {
  235. get
  236. {
  237. return this.Id == 6854;
  238. }
  239. }
  240. public bool IsDroppedItemGroup
  241. {
  242. get
  243. {
  244. return this.Id == 6834;
  245. }
  246. }
  247. public bool IsVehicle
  248. {
  249. get
  250. {
  251. switch (this.Id)
  252. {
  253. /*UAZ*/
  254. case 76152:
  255. case 76156:
  256. case 76166:
  257. case 76165:
  258. case 76169:
  259. return true;
  260.  
  261. /*Dacia*/
  262. case 75657:
  263. case 75653:
  264. case 75665:
  265. case 75679:
  266. case 75675:
  267. return true;
  268.  
  269.  
  270. /*Buggy*/
  271. case 75371:
  272. case 75375:
  273. case 75379:
  274. case 75401:
  275. return true;
  276.  
  277.  
  278. /*Jeep*/
  279. case 76157:
  280. return true;
  281.  
  282. /*Boat*/
  283. case 75301:
  284. return true;
  285.  
  286. /*Motorbike*/
  287. case 75820:
  288. return true;
  289.  
  290. default:
  291. return false;
  292. }
  293.  
  294. //return this.Id >= 75000 && this.Id <= 77000;
  295. }
  296. }
  297. public bool IsAlive
  298. {
  299. get
  300. {
  301. return this.Health > 0;
  302. }
  303. }
  304. public USceneComponent RootComponent
  305. {
  306. get
  307. {
  308. return M.Read<USceneComponent>(this.pRootComponent);
  309. }
  310. }
  311. public UCharacterMovementComponent CharacterMovement
  312. {
  313. get
  314. {
  315. return M.Read<UCharacterMovementComponent>(this.pCharacterMovement);
  316. }
  317. }
  318. public AWeaponProcessor WeaponProcessor
  319. {
  320. get
  321. {
  322. return M.Read<AWeaponProcessor>(this.pWeaponProcessor);
  323. }
  324. }
  325.  
  326. public Vector3 Location
  327. {
  328. get
  329. {
  330. return this.RootComponent.RelativeLocation;
  331. }
  332. }
  333. public Vector3 EyeLocation
  334. {
  335. get
  336. {
  337. var location = this.Location;
  338.  
  339. location.Z += this.BaseEyeHeight;
  340.  
  341. return location;
  342. }
  343. }
  344.  
  345. public static IntPtr g_pLocalPlayer = IntPtr.Zero;
  346. public static AActor GetLocalPlayer()
  347. {
  348. if (g_pLocalPlayer != IntPtr.Zero)
  349. {
  350. var localplayer = M.Read<AActor>(g_pLocalPlayer);
  351. localplayer.BasePointer = g_pLocalPlayer;
  352. return localplayer;
  353. }
  354.  
  355. g_pLocalPlayer = G.OwningGameInstance.LocalPlayer.PlayerController.pLocalPlayer;
  356. return M.Read<AActor>(g_pLocalPlayer);
  357. }
  358. }
  359.  
  360. [StructLayout(LayoutKind.Explicit)]
  361. public struct AWeaponProcessor
  362. {
  363. [FieldOffset(0x03B8)]
  364. public TArray<ATslWeapon> EquippedWeapons;
  365. }
  366. [StructLayout(LayoutKind.Sequential)]
  367. public unsafe struct pADroppedItem
  368. {
  369. public IntPtr pActor;
  370. fixed byte pad0[0x8];
  371. }
  372. [StructLayout(LayoutKind.Sequential)]
  373. public unsafe struct FText
  374. {
  375. fixed byte pad0[0x28];
  376. public FString fstring;
  377. }
  378. [StructLayout(LayoutKind.Sequential)]
  379. public unsafe struct FString
  380. {
  381. fixed sbyte arrName[64];
  382.  
  383. public override string ToString()
  384. {
  385. fixed (sbyte* pName = arrName)
  386. return new string(pName);
  387. }
  388. }
  389. [StructLayout(LayoutKind.Explicit)]
  390. public struct ATslWeapon
  391. {
  392. [FieldOffset(0x0)]
  393. public IntPtr BasePointer;
  394.  
  395. [FieldOffset(0x0538)]
  396. public FWeaponData WeaponConfig;
  397.  
  398. [FieldOffset(0x0254)]
  399. public int AmmoPerClip;
  400.  
  401. [FieldOffset(0x07B4)]
  402. public int CurrentAmmoInClip;
  403.  
  404. [FieldOffset(0x0838)]
  405. public FWeaponGunData WeaponGunConfig;
  406.  
  407. [FieldOffset(0x08F8)]
  408. public FWeaponGunAnim WeaponGunAnim;
  409.  
  410. [FieldOffset(0x09E8)]
  411. public float TrajectoryGravityZ;
  412.  
  413. [FieldOffset(0x09EC)]
  414. public float RecoilSpreadScale;
  415.  
  416. [FieldOffset(0x09F0)]
  417. public byte FireAtViewPoint;
  418.  
  419. [FieldOffset(0x09F4)]
  420. public float DefaultTimerFrequency;
  421.  
  422. [FieldOffset(0x09F8)]
  423. public float CrouchSpreadModifier;
  424.  
  425. [FieldOffset(0x09FC)]
  426. public float ProneSpreadModifier;
  427.  
  428. [FieldOffset(0x0A00)]
  429. public float WalkSpread;
  430.  
  431. [FieldOffset(0x0A04)]
  432. public float RunSpread;
  433.  
  434. [FieldOffset(0x0A08)]
  435. public float JumpSpread;
  436.  
  437. [FieldOffset(0x08B8)]
  438. public FWeaponDeviationData WeaponDeviationConfig;
  439.  
  440. [FieldOffset(0x0A10)]
  441. public FTrajectoryWeaponData TrajectoryConfig;
  442.  
  443. [FieldOffset(0x0A70)]
  444. public FRecoilInfo RecoilInfo;
  445.  
  446. #region ATslWeapon_Melee Variables
  447. [FieldOffset(0x07C0)]
  448. public float Melee_Damage;
  449.  
  450. [FieldOffset(0x07C4)]
  451. public float Melee_WeaponImpact;
  452.  
  453. [FieldOffset(0x07D4)]
  454. public float Melee_AllowedHitRangeLeeway;
  455. #endregion
  456.  
  457. public void SetAmmoInClip(int nAmmo)
  458. {
  459. M.Write<int>(nAmmo, this.BasePointer + 0x784/*CurrentAmmoInClip*/);
  460. }
  461. public void SetBulletGravity(float flTrajectoryGravityZ)
  462. {
  463. M.Write<float>(flTrajectoryGravityZ, this.BasePointer + 0x0990/*TrajectoryGravityZ*/);
  464. }
  465.  
  466. public void SetRecoilSpreadScale(float flRecoilSpreadScale)
  467. {
  468. M.Write<float>(flRecoilSpreadScale, this.BasePointer + 0x0994/*RecoilSpreadScale*/);
  469. }
  470.  
  471. public void SetWalkSpread(float flWalkSpread)
  472. {
  473. M.Write<float>(flWalkSpread, this.BasePointer + 0x09A8/*WalkSpread*/);
  474. }
  475. public void SetRunSpread(float flRunSpread)
  476. {
  477. M.Write<float>(flRunSpread, this.BasePointer + 0x09AC/*RunSpread*/);
  478. }
  479. public void SetJumpSpread(float flJumpSpread)
  480. {
  481. M.Write<float>(flJumpSpread, this.BasePointer + 0x09B0/*JumpSpread*/);
  482. }
  483.  
  484. public void SetFiringMode(int nIndex, EFiringMode FiringMode) => this.WeaponGunConfig.FiringModes.SetValue((byte)FiringMode, nIndex, false);
  485.  
  486. public void WriteStruct(FRecoilInfo RecoilInfo)
  487. {
  488. M.Write(RecoilInfo, BasePointer + 0xA18);
  489. }
  490. public void WriteStruct(FTrajectoryWeaponData TrajectoryConfig)
  491. {
  492. M.Write(TrajectoryConfig, BasePointer + 0x9B8);
  493. }
  494. public void WriteStruct(FWeaponGunData WeaponGunData)
  495. {
  496. M.Write(WeaponGunData, BasePointer + 0x07F8);
  497. }
  498. public void WriteStruct(FWeaponData WeaponConfig)
  499. {
  500. M.Write(WeaponConfig, BasePointer + 0x0518);
  501. }
  502. public void WriteStruct(FWeaponGunAnim WeaponGunAnim)
  503. {
  504. M.Write(WeaponGunAnim, BasePointer + 0x08B8);
  505. }
  506. public void WriteStruct(FWeaponDeviationData WeaponDeviationConfig)
  507. {
  508. M.Write(WeaponDeviationConfig, BasePointer + 0x0878);
  509. }
  510. }
  511.  
  512. [StructLayout(LayoutKind.Sequential)]
  513. public unsafe struct FWeaponData
  514. {
  515. public float TargetingFOV;
  516. public float HoldBreathFOV;
  517. public IntPtr Rarity;
  518. public Vector3 SocketOffset_Shoulder;
  519. Vector3 SocketOffset_Hand;
  520. byte bApplyGripPoseLeft;
  521. EWeaponGripLeftHand WeaponGripLeft;
  522. EWeaponClass WeaponClass;
  523. byte bUseDefaultScoreMultiplier;
  524. public float ScoreMultiplierByDamage;
  525. public float ScoreMultiplierByKill;
  526. public float SwayModifier_Pitch;
  527. public float SwayModifier_YawOffset;
  528. public float SwayModifier_Movement;
  529. public float SwayModifier_Stand;
  530. public float SwayModifier_Crouch;
  531. public float SwayModifier_Prone;
  532. public float CameraDOF_Range;
  533. public float CameraDOF_NearRange;
  534. public float CameraDOF_Power;
  535. public byte bUseDynamicReverbAK;
  536. private fixed byte UnknownData00[0x3];
  537. public float CurrentWeaponZero;
  538. public float MinWeaponZero;
  539. public float MaxWeaponZero;
  540. public float AnimationKick;
  541. private fixed byte UnknownData01[0x4];
  542. public IntPtr RecoilMontage;
  543. public byte DestructibleDoor;
  544. public EThrownWeaponType ThrownType;
  545. private fixed byte UnknownData02[0x2];
  546. public float WeaponEquipDuration;
  547. public float WeaponReadyDuration;
  548. public byte bForceFireAfterEquip;
  549. private fixed byte UnknownData03[0x3];
  550. public float PhysicalBodyHitImpactPower;
  551. }
  552. [StructLayout(LayoutKind.Sequential)]
  553. public struct FWeaponDeviationData
  554. {
  555. public float DeviationBase;
  556. public float DeviationBaseAim;
  557. public float DeviationBaseADS;
  558. public float DeviationRecoilGain;
  559. public float DeviationRecoilGainAim;
  560. public float DeviationRecoilGainADS;
  561. public float DeviationMax;
  562. public float DeviationMinMove;
  563. public float DeviationMaxMove;
  564. public float DeviationMoveMultiplier;
  565. public float DeviationMoveMinReferenceVelocity;
  566. public float DeviationMoveMaxReferenceVelocity;
  567. public float DeviationStanceStand;
  568. public float DeviationStanceCrouch;
  569. public float DeviationStanceProne;
  570. public float DeviationStanceJump;
  571. }
  572.  
  573. [StructLayout(LayoutKind.Sequential)]
  574. public unsafe struct FWeaponGunAnim
  575. {
  576. public IntPtr Fire; // 0x0000
  577. public byte bLoopedFire; // 0x0008
  578. private fixed byte UnknownData00[0x7]; // 0x0009
  579. public IntPtr Reload; // 0x0010
  580. public IntPtr CharacterGripBlendspace; // 0x0018
  581. public IntPtr CharacterLHGripBlendspace; // 0x0020
  582. public IntPtr CharacterFire; // 0x0028
  583. public IntPtr CharacterFireCycle; // 0x0030
  584. public IntPtr CharacterFireSelector; // 0x0038
  585. public IntPtr CharacterReloadTactical; // 0x0040
  586. public IntPtr CharacterReloadCharge; // 0x0048
  587. public IntPtr CharacterReloadByOneStart; // 0x0050
  588. public IntPtr CharacterReloadByOneStop; // 0x0058
  589. public IntPtr CharacterReloadByOneSingle; // 0x0060
  590. public IntPtr WeaponReloadTactical; // 0x0068
  591. public IntPtr WeaponReloadCharge; // 0x0070
  592. public float ReloadDurationTactical; // 0x0078
  593. public float ReloadDurationCharge; // 0x007C
  594. public float ReloadDurationStart; // 0x0080
  595. public float ReloadDurationLoop; // 0x0084
  596. public float ReloadDurationMagOut; // 0x0088
  597. public float FireCycleDelay; // 0x008C
  598. public float FireCycleDuration; // 0x0090
  599. public byte bCycleAfterLastShot; // 0x0094
  600. public byte bCycleDuringReload; // 0x0095
  601. private fixed byte UnknownData01[0x2]; // 0x0096
  602. public IntPtr ShotCameraShake; // 0x0098
  603. public IntPtr ShotCameraShakeIronsight; // 0x00A0
  604. public IntPtr ShotCameraShakeADS; // 0x00A8
  605. public IntPtr CycleCameraAnim; // 0x00B0
  606. public float RecoilKickADS; // 0x00B8
  607. public Vector3 MagDropLinearVelocity; // 0x00BC
  608. public Vector3 MagDropAngularVelocity; // 0x00C8
  609. }
  610.  
  611. [StructLayout(LayoutKind.Sequential)]
  612. public unsafe struct FWeaponGunData
  613. {
  614. public IntPtr AmmoItemClass; // 0x0000(0x0008) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  615. public IntPtr TracerClass; // 0x0008(0x0008) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  616. public int AmmoPerClip; // 0x0010(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  617. public float TimeBetweenShots; // 0x0014(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_BlueprintReadOnly, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  618. public float NoAnimReloadDuration; // 0x0018(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_BlueprintReadOnly, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  619. private fixed byte UnknownData00[0x4]; // 0x001C(0x0004) MISSED OFFSET
  620. public TArray<byte> FiringModes; // 0x0020(0x0010) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance)
  621. public int BurstShots; // 0x0030(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  622. public float BurstDelay; // 0x0034(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  623. public int BulletPerFiring; // 0x0038(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_BlueprintReadOnly, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  624. public float FiringBulletsSpread; // 0x003C(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  625. public byte bIsArrowProjectile; // 0x0040(0x0001) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  626. public byte bRotationFromBarrelWhenScoped; // 0x0041(0x0001) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  627. public EWeaponReloadMethod ReloadMethod; // 0x0042(0x0001) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  628. public byte UnknownData01; // 0x0043(0x0001) MISSED OFFSET
  629. public float ReloadDurationByOneInitial; // 0x0044(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  630. public float ReloadDurationByOneLoop; // 0x0048(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  631. public float MovementModifierAim; // 0x004C(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  632. public float MovementModifierScope; // 0x0050(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  633. public float WeaponLength; // 0x0054(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  634. public float ShoulderLength; // 0x0058(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  635. public float WeaponSuppressorLength; // 0x005C(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  636. public float TraceRadius; // 0x0060(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  637. public float TraceAdditiveZ; // 0x0064(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  638. public byte DebugWeaponCollision; // 0x0068(0x0001) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  639. private fixed byte UnknownData02[0x3]; // 0x0069(0x0003) MISSED OFFSET
  640. public Vector3 HandWeaponOffset; // 0x006C(0x000C) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  641. public byte bManualCycleAfterShot; // 0x0078(0x0001) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  642. private fixed byte UnknownData03[0x3]; // 0x0079(0x0003) MISSED OFFSET
  643. public float LongTailDelay; // 0x007C(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_DisableEditOnInstance, CPF_IsPlainOldData)
  644. }
  645. [StructLayout(LayoutKind.Sequential)]
  646. public struct FTrajectoryWeaponData
  647. {
  648. public float WeaponSpread;
  649. public float AimingSpreadModifier;
  650. public float ScopingSpreadModifier;
  651. public float FiringSpreadBase;
  652. public float StandRecoveryTime;
  653. public float CrouchRecoveryTime;
  654. public float ProneRecoveryTime;
  655. public float RecoveryInterval;
  656. public float RecoilSpeed;
  657. public float RecoilRecoverySpeed;
  658. public float RecoilPatternScale;
  659. public float InitialSpeed;
  660. public int HitDamage;
  661. public float RangeModifier;
  662. public float ReferenceDistance;
  663. public float TravelDistanceMax;
  664. public byte IsPenetrable;
  665. }
  666.  
  667. [StructLayout(LayoutKind.Sequential)]
  668. public unsafe struct FRecoilInfo
  669. {
  670. //[FieldOffset(0x50)]
  671. //public IntPtr BasePointer;
  672.  
  673. public float VerticalRecoilMin;
  674. public float VerticalRecoilMax;
  675. public float VerticalRecoilVariation;
  676. public float VerticalRecoveryModifier;
  677. public float VerticalRecoveryClamp;
  678. public float VerticalRecoveryMax;
  679. public float LeftMax;
  680. public float RightMax;
  681. public float HorizontalTendency;
  682. private fixed byte UnknownData00[0x4];
  683. public IntPtr RecoilCurve;
  684. public int BulletsPerSwitch;
  685. public float TimePerSwitch;
  686. public byte bSwitchOnTime;
  687. private fixed byte UnknownData01[0x3];
  688. public float RecoilSpeed_Vertical;
  689. public float RecoilSpeed_Horizontal;
  690. public float RecoverySpeed_Vertical;
  691. public float RecoilValue_Climb;
  692. public float RecoilValue_Fall;
  693. public float RecoilModifier_Stand;
  694. public float RecoilModifier_Crouch;
  695. public float RecoilModifier_Prone;
  696. }
  697.  
  698. [StructLayout(LayoutKind.Explicit)]
  699. public struct UTslSettings
  700. {
  701. [FieldOffset(0x0028)]
  702. public float RepDistance_Item;
  703.  
  704. [FieldOffset(0x2C)]
  705. public float RepDistance_ItemGroup;
  706.  
  707. [FieldOffset(0x002C)]
  708. public float RepDistance_Character;
  709.  
  710. [FieldOffset(0x0030)]
  711. public float RepDistance_Weapon;
  712.  
  713. [FieldOffset(0x0034)]
  714. public float RepDistance_Vehicle;
  715.  
  716. [FieldOffset(0x0038)]
  717. public float RepDistance_Parachute;
  718.  
  719. [FieldOffset(0x003C)]
  720. public float RepDistance_Door;
  721.  
  722. [FieldOffset(0x0040)]
  723. public float RepDistance_Window;
  724.  
  725. [FieldOffset(0x0044)]
  726. public float RepFrequency_Character;
  727.  
  728. [FieldOffset(0x0048)]
  729. public float RepFrequency_WheeledVehicle;
  730.  
  731. [FieldOffset(0x004C)]
  732. public float RepFrequency_FloatingVehicle;
  733.  
  734. [FieldOffset(0x0050)]
  735. public float RepFrequency_Parachute;
  736.  
  737. [FieldOffset(0x0054)]
  738. public float RepFrequency_Aircraft;
  739.  
  740. [FieldOffset(0x0058)]
  741. public float RepFrequency_CarePackage;
  742.  
  743. [FieldOffset(0x008C)]
  744. public bool bBattlEyeEnabled;
  745.  
  746. [FieldOffset(0x008D)]
  747. public bool bBattlEyeEnabledInPIE;
  748.  
  749. [FieldOffset(0x0090)]
  750. public float BattlEyeReliablePacketIntervalOnClient;
  751.  
  752. [FieldOffset(0x0094)]
  753. public float BattlEyeReliablePacketIntervalOnServer;
  754.  
  755. [FieldOffset(0x0098)]
  756. public float GameStateLogInterval;
  757.  
  758. [FieldOffset(0x009C)]
  759. public float ServerStatLogInterval;
  760.  
  761. [FieldOffset(0x00A0)]
  762. public float CharacterPositionLogInterval;
  763.  
  764. [FieldOffset(0x00A4)]
  765. public float DestructibleComponentMaxDrawDistance;
  766.  
  767. [FieldOffset(0x00E0)]
  768. public float StoppedVehicleSpeedThreshold;
  769.  
  770. [FieldOffset(0x00E8)]
  771. public float LastDriverDuration;
  772.  
  773. [FieldOffset(0x00EC)]
  774. public float InteractableDistanceToleranceOnDedicatedServer;
  775.  
  776. [FieldOffset(0x00F0)]
  777. public float InteractableDistance_ItemDefault;
  778.  
  779. [FieldOffset(0x0120)]
  780. public bool bPreventFinishMatchInPIE;
  781.  
  782. [FieldOffset(0x0121)]
  783. public bool bEnableInitialItemDonator;
  784.  
  785. [FieldOffset(0x0124)]
  786. public float InventoryMaxSpaceDefault;
  787.  
  788. [FieldOffset(0x0154)]
  789. public float GameTimeMultiplier;
  790.  
  791. [FieldOffset(0x0158)]
  792. public byte AimOffsetRayCast;
  793.  
  794. [FieldOffset(0x0270)]
  795. public float ClientSideHitLeeway;
  796.  
  797. [FieldOffset(0x0278)]
  798. public float ClientSideOriginDistanceLeeway;
  799.  
  800. [FieldOffset(0x027C)]
  801. public float TravelDistanceLeeway;
  802.  
  803. [FieldOffset(0x218)]
  804. public bool bUseForceItemActorSpawn;
  805. }
  806.  
  807. [StructLayout(LayoutKind.Explicit)]
  808. public struct UGameInstance
  809. {
  810. [FieldOffset(0x0038)]
  811. public IntPtr pULocalPlayer; // TArray<class ULocalPlayer*>, deref twice
  812.  
  813. public ULocalPlayer LocalPlayer
  814. {
  815. get
  816. {
  817. IntPtr pLocalPlayer = M.Read<IntPtr>(this.pULocalPlayer);
  818. var result = M.Read<ULocalPlayer>(pLocalPlayer);
  819. result.pBase = pLocalPlayer;
  820. return result;
  821. }
  822. }
  823. }
  824. [StructLayout(LayoutKind.Explicit)]
  825. public struct ULocalPlayer
  826. {
  827. [FieldOffset(0x00)]
  828. public IntPtr pBase;
  829.  
  830. [FieldOffset(0x0030)]
  831. public IntPtr pPlayerController;
  832.  
  833. [FieldOffset(0x0058)]
  834. public IntPtr pViewportClient;
  835.  
  836. [FieldOffset(0x70)]
  837. public Vector3 Location;
  838.  
  839. public void SetLocation(Vector3 vecLocation)
  840. {
  841. M.Write<Vector3>(vecLocation, pBase + 0x70/*Location*/);
  842. }
  843.  
  844. public APlayerController PlayerController
  845. {
  846. get
  847. {
  848. return M.Read<APlayerController>(this.pPlayerController);
  849. }
  850. }
  851. public UGameViewportClient ViewportClient
  852. {
  853. get
  854. {
  855. return M.Read<UGameViewportClient>(this.pViewportClient);
  856. }
  857. }
  858.  
  859. }
  860. [StructLayout(LayoutKind.Explicit)]
  861. public struct UGameViewportClient
  862. {
  863. [FieldOffset(0x0080)]
  864. public IntPtr pUWorld;
  865.  
  866. }
  867. [StructLayout(LayoutKind.Explicit)]
  868. public struct APlayerController
  869. {
  870. [FieldOffset(0x3A8)]
  871. public IntPtr pLocalPlayer;
  872.  
  873. [FieldOffset(0x03D0)]
  874. public FRotator ControlRotation;
  875.  
  876. [FieldOffset(0x0438)]
  877. public IntPtr pPlayerCameraManager;
  878.  
  879. public APlayerCameraManager PlayerCameraManager
  880. {
  881. get
  882. {
  883. return M.Read<APlayerCameraManager>(pPlayerCameraManager);
  884. }
  885. }
  886. }
  887.  
  888. [StructLayout(LayoutKind.Explicit)]
  889. public struct APlayerCameraManager
  890. {
  891. [FieldOffset(0x03B8)]
  892. public float DefaultFOV;
  893.  
  894. [FieldOffset(0x03C0)]
  895. public float DefaultOrthoWidth;
  896.  
  897. [FieldOffset(0x03C8)]
  898. public float DefaultAspectRatio;
  899.  
  900. [FieldOffset(0x0410)]
  901. public FCameraCacheEntry CameraCache;
  902. }
  903.  
  904. [StructLayout(LayoutKind.Explicit)]
  905. public struct FCameraCacheEntry
  906. {
  907. [FieldOffset(0x10)]
  908. public FMinimalViewInfo POV;
  909. }
  910.  
  911. [StructLayout(LayoutKind.Sequential)]
  912. public struct FMinimalViewInfo
  913. {
  914. public Vector3 Location; // 0x0028(0x000C) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
  915. public FRotator Rotation; // 0x000C(0x000C) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
  916. public float FOV; // 0x0018(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
  917. public float OrthoWidth; // 0x001C(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
  918. public float OrthoNearClipPlane; // 0x0020(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
  919. public float OrthoFarClipPlane; // 0x0024(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
  920. public float AspectRatio; // 0x0028(0x0004) (CPF_Edit, CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_IsPlainOldData)
  921. public byte bConstrainAspectRatio; // 0x002C(0x0001) (CPF_Edit, CPF_BlueprintVisible)
  922. public byte bUseFieldOfViewForLOD; // 0x002C(0x0001) (CPF_Edit, CPF_BlueprintVisible)
  923. }
  924.  
  925. [StructLayout(LayoutKind.Sequential)]
  926. public struct FRotator
  927. {
  928. public float Pitch;
  929. public float Yaw;
  930. public float Roll;
  931.  
  932. public FRotator(float flPitch, float flYaw, float flRoll)
  933. {
  934. Pitch = flPitch;
  935. Yaw = flYaw;
  936. Roll = flRoll;
  937. }
  938.  
  939. public double Length
  940. {
  941. get
  942. {
  943. return Math.Sqrt(this.Pitch * this.Pitch + this.Yaw * this.Yaw + this.Roll * this.Roll);
  944. }
  945. }
  946.  
  947. public FRotator Clamp()
  948. {
  949. var result = this;
  950.  
  951. if (result.Pitch > 180)
  952. result.Pitch -= 360;
  953.  
  954. else if (result.Pitch < -180)
  955. result.Pitch += 360;
  956.  
  957. if (result.Yaw > 180)
  958. result.Yaw -= 360;
  959.  
  960. else if (result.Yaw < -180)
  961. result.Yaw += 360;
  962.  
  963. if (result.Pitch < -89)
  964. result.Pitch = -89;
  965.  
  966. if (result.Pitch > 89)
  967. result.Pitch = 89;
  968.  
  969. while (result.Yaw < -180.0f)
  970. result.Yaw += 360.0f;
  971.  
  972. while (result.Yaw > 180.0f)
  973. result.Yaw -= 360.0f;
  974.  
  975. result.Roll = 0;
  976.  
  977. return result;
  978. }
  979.  
  980. public void GetAxes(out Vector3 x, out Vector3 y, out Vector3 z)
  981. {
  982. var m = ToMatrix();
  983.  
  984. x = new Vector3(m.M11, m.M12, m.M13);
  985. y = new Vector3(m.M21, m.M22, m.M23);
  986. z = new Vector3(m.M31, m.M32, m.M33);
  987. }
  988.  
  989. public Vector3 ToVector()
  990. {
  991. float radPitch = (float)(this.Pitch * Math.PI / 180f);
  992. float radYaw = (float)(this.Yaw * Math.PI / 180f);
  993.  
  994. float SP = (float)Math.Sin(radPitch);
  995. float CP = (float)Math.Cos(radPitch);
  996. float SY = (float)Math.Sin(radYaw);
  997. float CY = (float)Math.Cos(radYaw);
  998.  
  999. return new Vector3(CP * CY, CP * SY, SP);
  1000. }
  1001.  
  1002. public SharpDX.Matrix ToMatrix(Vector3 origin = default(Vector3))
  1003. {
  1004.  
  1005. float radPitch = (float)(this.Pitch * Math.PI / 180f);
  1006. float radYaw = (float)(this.Yaw * Math.PI / 180f);
  1007. float radRoll = (float)(this.Roll * Math.PI / 180f);
  1008.  
  1009. float SP = (float)Math.Sin(radPitch);
  1010. float CP = (float)Math.Cos(radPitch);
  1011. float SY = (float)Math.Sin(radYaw);
  1012. float CY = (float)Math.Cos(radYaw);
  1013. float SR = (float)Math.Sin(radRoll);
  1014. float CR = (float)Math.Cos(radRoll);
  1015.  
  1016. SharpDX.Matrix m = new SharpDX.Matrix();
  1017. m[0, 0] = CP * CY;
  1018. m[0, 1] = CP * SY;
  1019. m[0, 2] = SP;
  1020. m[0, 3] = 0f;
  1021.  
  1022. m[1, 0] = SR * SP * CY - CR * SY;
  1023. m[1, 1] = SR * SP * SY + CR * CY;
  1024. m[1, 2] = -SR * CP;
  1025. m[1, 3] = 0f;
  1026.  
  1027. m[2, 0] = -(CR * SP * CY + SR * SY);
  1028. m[2, 1] = CY * SR - CR * SP * SY;
  1029. m[2, 2] = CR * CP;
  1030. m[2, 3] = 0f;
  1031.  
  1032. m[3, 0] = origin.X;
  1033. m[3, 1] = origin.Y;
  1034. m[3, 2] = origin.Z;
  1035. m[3, 3] = 1f;
  1036. return m;
  1037. }
  1038.  
  1039. public static FRotator operator +(FRotator angA, FRotator angB) => new FRotator(angA.Pitch + angB.Pitch, angA.Yaw + angB.Yaw, angA.Roll + angB.Roll);
  1040. public static FRotator operator -(FRotator angA, FRotator angB) => new FRotator(angA.Pitch - angB.Pitch, angA.Yaw - angB.Yaw, angA.Roll - angB.Roll);
  1041. public static FRotator operator /(FRotator angA, float flNum) => new FRotator(angA.Pitch / flNum, angA.Yaw / flNum, angA.Roll / flNum);
  1042. public static FRotator operator *(FRotator angA, float flNum) => new FRotator(angA.Pitch * flNum, angA.Yaw * flNum, angA.Roll * flNum);
  1043. public static bool operator ==(FRotator angA, FRotator angB) => angA.Pitch == angB.Pitch && angA.Yaw == angB.Yaw && angA.Yaw == angB.Yaw;
  1044. public static bool operator !=(FRotator angA, FRotator angB) => angA.Pitch != angB.Pitch || angA.Yaw != angB.Yaw || angA.Yaw != angB.Yaw;
  1045. }
  1046.  
  1047. [StructLayout(LayoutKind.Sequential)]
  1048. public struct Vector3
  1049. {
  1050. public float X;
  1051. public float Y;
  1052. public float Z;
  1053.  
  1054. public Vector3(float x, float y, float z)
  1055. {
  1056. X = x;
  1057. Y = y;
  1058. Z = z;
  1059. }
  1060.  
  1061. public double Length
  1062. {
  1063. get
  1064. {
  1065. return Math.Sqrt(this.X * this.X + this.Y * this.Y + this.Z * this.Z);
  1066. }
  1067. }
  1068. public Vector2 To2D()
  1069. {
  1070. return new Vector2(this.X, this.Y);
  1071. }
  1072. public FRotator ToFRotator()
  1073. {
  1074. FRotator rot = new FRotator();
  1075.  
  1076. float RADPI = (float)(180 / Math.PI);
  1077. rot.Yaw = (float)Math.Atan2(this.Y, this.X) * RADPI;
  1078. rot.Pitch = (float)Math.Atan2(this.Z, Math.Sqrt((this.X * this.X) + (this.Y * this.Y))) * RADPI;
  1079. rot.Roll = 0;
  1080.  
  1081. return rot;
  1082. }
  1083.  
  1084. public static float DotProduct(Vector3 vecA, Vector3 vecB) => vecA.X * vecB.X + vecA.Y * vecB.Y + vecA.Z * vecB.Z;
  1085.  
  1086. #region Overrides
  1087. public override string ToString()
  1088. {
  1089. return $"{X},{Y},{Z}";
  1090. }
  1091. #endregion
  1092. #region Operators
  1093. public static Vector3 operator +(Vector3 vecA, Vector3 vecB) => new Vector3(vecA.X + vecB.X, vecA.Y + vecB.Y, vecA.Z + vecB.Z);
  1094. public static Vector3 operator -(Vector3 vecA, Vector3 vecB) => new Vector3(vecA.X - vecB.X, vecA.Y - vecB.Y, vecA.Z - vecB.Z);
  1095. public static Vector3 operator *(Vector3 vecA, Vector3 vecB) => new Vector3(vecA.X * vecB.X, vecA.Y * vecB.Y, vecA.Z * vecB.Z);
  1096. public static Vector3 operator *(Vector3 vecA, int n) => new Vector3(vecA.X * n, vecA.Y * n, vecA.Z * n);
  1097. public static Vector3 operator /(Vector3 vecA, Vector3 vecB) => new Vector3(vecA.X / vecB.X, vecA.Y / vecB.Y, vecA.Z / vecB.Z);
  1098.  
  1099. public static bool operator ==(Vector3 vecA, Vector3 vecB) => vecA.X == vecB.X && vecA.Y == vecB.Y && vecA.Y == vecB.Y;
  1100. public static bool operator !=(Vector3 vecA, Vector3 vecB) => vecA.X != vecB.X || vecA.Y != vecB.Y || vecA.Y != vecB.Y;
  1101. #endregion
  1102. }
  1103.  
  1104. [StructLayout(LayoutKind.Sequential)]
  1105. public struct Vector2
  1106. {
  1107. public float X;
  1108. public float Y;
  1109.  
  1110. public Vector2(float x, float y)
  1111. {
  1112. X = x;
  1113. Y = y;
  1114. }
  1115. public Vector2(double x, double y)
  1116. {
  1117. X = (float)x;
  1118. Y = (float)y;
  1119. }
  1120.  
  1121. public double Length
  1122. {
  1123. get
  1124. {
  1125. return Math.Sqrt(this.X * this.X + this.Y * this.Y);
  1126. }
  1127. }
  1128. #region Functions
  1129. public Vector2 Rotate(Vector2 centerpoint, double angle, bool bAngleInRadians = false)
  1130. {
  1131. if (!bAngleInRadians)
  1132. angle = Math.PI * angle / 180.0;
  1133.  
  1134. return new Vector2(this.X * Math.Cos(angle) - this.Y * Math.Sin(angle), this.X * Math.Sin(angle) + this.Y * Math.Cos(angle));
  1135. }
  1136. #endregion
  1137. #region Overrides
  1138. public override string ToString()
  1139. {
  1140. return $"{X},{Y}";
  1141. }
  1142. #endregion
  1143. #region Operators
  1144. public static Vector2 operator +(Vector2 vecA, Vector2 vecB) => new Vector2(vecA.X + vecB.X, vecA.Y + vecB.Y);
  1145. public static Vector2 operator -(Vector2 vecA, Vector2 vecB) => new Vector2(vecA.X - vecB.X, vecA.Y - vecB.Y);
  1146. public static Vector2 operator *(Vector2 vecA, int n) => new Vector2(vecA.X * n, vecA.Y * n);
  1147. public static Vector2 operator /(Vector2 vecA, Vector2 vecB) => new Vector2(vecA.X / vecB.X, vecA.Y / vecB.Y);
  1148.  
  1149. public static Vector2 operator +(Vector2 vecA, float val) => new Vector2(vecA.X + val, vecA.Y + val);
  1150. public static Vector2 operator -(Vector2 vecA, float val) => new Vector2(vecA.X - val, vecA.Y - val);
  1151. public static Vector2 operator *(Vector2 vecA, float val) => new Vector2(vecA.X * val, vecA.Y * val);
  1152. public static Vector2 operator /(Vector2 vecA, float val) => new Vector2(vecA.X / val, vecA.Y / val);
  1153.  
  1154.  
  1155. public static bool operator ==(Vector2 vecA, Vector2 vecB) => vecA.X == vecB.X && vecA.Y == vecB.Y && vecA.Y == vecB.Y;
  1156. public static bool operator !=(Vector2 vecA, Vector2 vecB) => vecA.X != vecB.X || vecA.Y != vecB.Y || vecA.Y != vecB.Y;
  1157. #endregion
  1158. }
  1159.  
  1160.  
  1161. [StructLayout(LayoutKind.Sequential)]
  1162. public struct TArray<T> where T : struct
  1163. {
  1164. public IntPtr pData;
  1165. public int Count;
  1166. public int Max;
  1167.  
  1168. public IntPtr this[int nIndex]
  1169. {
  1170. get
  1171. {
  1172. return pData + nIndex * IntPtr.Size;
  1173. }
  1174. }
  1175. public T ReadValue(int nIndex, bool bDeref)
  1176. {
  1177. IntPtr ptrData = pData + nIndex * IntPtr.Size;
  1178.  
  1179. if (bDeref)
  1180. ptrData = M.Read<IntPtr>(ptrData);
  1181.  
  1182. return M.Read<T>(ptrData);
  1183. }
  1184. public void SetValue(T value, int nIndex, bool bDeref)
  1185. {
  1186. IntPtr ptrData = pData + nIndex * IntPtr.Size;
  1187.  
  1188. if (bDeref)
  1189. ptrData = M.Read<IntPtr>(ptrData);
  1190.  
  1191. M.Write<T>(value, ptrData);
  1192. }
  1193. }
  1194.  
  1195. [StructLayout(LayoutKind.Explicit)]
  1196. public struct USceneComponent
  1197. {
  1198. [FieldOffset(0x0160)]
  1199. public byte nBitFlags;
  1200.  
  1201. [FieldOffset(0x0038)]
  1202. public Vector3 RelativeLocation;
  1203.  
  1204. [FieldOffset(0x0044)]
  1205. public Vector3 RelativeRotation; // Pitch, Yaw, Roll
  1206.  
  1207. [FieldOffset(0x0050)]
  1208. public Vector3 RelativeScale3D;
  1209.  
  1210. [FieldOffset(0x0258)]
  1211. public Vector3 ComponentVelocity;
  1212.  
  1213. public static void SetLocation(IntPtr pUSceneComponent, Vector3 value)
  1214. {
  1215. M.Write<Vector3>(value, pUSceneComponent + 0x1A0);
  1216. }
  1217. }
  1218.  
  1219. [StructLayout(LayoutKind.Explicit)]
  1220. public struct UCharacterMovementComponent
  1221. {
  1222. [FieldOffset(0x0198)]
  1223. public float GravityScale;
  1224.  
  1225. [FieldOffset(0x01A0)]
  1226. public float JumpZVelocity;
  1227.  
  1228. [FieldOffset(0x01BC)]
  1229. public byte MovementMode;
  1230.  
  1231. [FieldOffset(0x01E4)]
  1232. public float MaxWalkSpeed;
  1233.  
  1234. [FieldOffset(0x01E8)]
  1235. public float MaxWalkSpeedCrouched;
  1236.  
  1237. [FieldOffset(0x01F8)]
  1238. public float MaxAcceleration;
  1239.  
  1240. [FieldOffset(0x021C)]
  1241. public float AirControlBoostMultiplier;
  1242.  
  1243. [FieldOffset(0x0290)]
  1244. public float CrouchedSpeedMultiplier;
  1245.  
  1246. [FieldOffset(0x0298)]
  1247. public Vector3 Acceleration;
  1248.  
  1249. [FieldOffset(0x02A4)]
  1250. public Vector3 LastUpdateLocation;
  1251.  
  1252. [FieldOffset(0x03CD)]
  1253. public bool Flying;
  1254.  
  1255. [FieldOffset(0x03D0)]
  1256. private byte StanceMode;
  1257.  
  1258. [FieldOffset(0x0740)]
  1259. public float MaxProneSpeed;
  1260.  
  1261. [FieldOffset(0x0760)]
  1262. public float MinWalkSpeedModifier;
  1263.  
  1264. [FieldOffset(0x0764)]
  1265. public float WalkSpeedModifierUnit;
  1266.  
  1267. public static void SetGravityScale(IntPtr pMovement, float scale)
  1268. {
  1269. M.Write<float>(scale, pMovement + 0x190);
  1270. }
  1271. public EStanceMode Stance
  1272. {
  1273. get
  1274. {
  1275. return (EStanceMode)this.StanceMode;
  1276. }
  1277. }
  1278. }
  1279.  
  1280. [StructLayout(LayoutKind.Sequential)]
  1281. public struct GNames
  1282. {
  1283. public IntPtr pData;
  1284. public int Num;
  1285. public int Max;
  1286.  
  1287. public TStaticIndirectArrayThreadSafeRead GetStaticArray()
  1288. {
  1289. return M.Read<TStaticIndirectArrayThreadSafeRead>(this.pData);
  1290. }
  1291. }
  1292.  
  1293. // Thanks ApocDev :)
  1294. [StructLayout(LayoutKind.Sequential)]
  1295. public unsafe struct TStaticIndirectArrayThreadSafeRead
  1296. {
  1297. private const int MaxTotalElements = 0x200000;
  1298. private const int ElementsPerChunk = 0x4000;
  1299. private const int ChunkCount = 128;
  1300.  
  1301. public fixed long Chunks[ChunkCount];
  1302.  
  1303. public int NumElements;
  1304. public int NumChunks;
  1305.  
  1306. public List<byte[]> ChunkData
  1307. {
  1308. get
  1309. {
  1310. List<byte[]> listChunkdata = new List<byte[]>();
  1311.  
  1312.  
  1313. fixed (long* arrChunkPointers = Chunks)
  1314. for (int nChunk = 0; nChunk < ChunkCount; nChunk++)
  1315. listChunkdata.Add(M.Read((IntPtr)arrChunkPointers[nChunk], ElementsPerChunk * IntPtr.Size));
  1316.  
  1317. return listChunkdata;
  1318. }
  1319. }
  1320.  
  1321. public IntPtr this[int nIndex]
  1322. {
  1323. get
  1324. {
  1325. fixed (long* chunks = Chunks)
  1326. {
  1327. var pChunk = (IntPtr)chunks[nIndex / ElementsPerChunk];
  1328. var arrChunkData = ChunkData[nIndex / ElementsPerChunk];
  1329. return (IntPtr)BitConverter.ToInt64(arrChunkData, nIndex % ElementsPerChunk * IntPtr.Size);
  1330. }
  1331. }
  1332. }
  1333. public string[] DumpNames()
  1334. {
  1335. string[] arrNames = new string[MaxTotalElements];
  1336. var arrChunkData = ChunkData;
  1337.  
  1338. for (int nIndex = 0; nIndex < MaxTotalElements; nIndex++)
  1339. {
  1340. byte[] arrCurrentChunkData = arrChunkData[nIndex / ElementsPerChunk];
  1341.  
  1342. IntPtr pName = (IntPtr)BitConverter.ToInt64(arrCurrentChunkData, nIndex % ElementsPerChunk * IntPtr.Size);
  1343.  
  1344. // Neccessary?
  1345. //if (pName == IntPtr.Zero)
  1346. // arrNames[nIndex] = "NO_NAME";
  1347. //else
  1348. if (pName != IntPtr.Zero)
  1349. arrNames[nIndex] = M.Read<FNameEntry>(pName).ToString();
  1350. }
  1351.  
  1352. return arrNames;
  1353. }
  1354.  
  1355. }
  1356.  
  1357.  
  1358. [StructLayout(LayoutKind.Explicit)]
  1359. public unsafe struct FNameEntry
  1360. {
  1361. [FieldOffset(0x10)]
  1362. fixed sbyte arrName[64];
  1363.  
  1364. public override string ToString()
  1365. {
  1366. fixed (sbyte* pName = arrName)
  1367. return new string(pName);
  1368. }
  1369. }
  1370.  
  1371. [StructLayout(LayoutKind.Explicit)]
  1372. public struct Template
  1373. {
  1374.  
  1375. }
  1376.  
  1377. #endregion
  1378. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement