public void DumpActors() { var sb = new System.Text.StringBuilder(); var World = new UEObject(Engine.GWorld); var Levels = World["Levels"]; for (var levelIndex = 0u; levelIndex < Levels.Num; levelIndex++) { var Level = Levels[levelIndex]; var Actors = new Engine.UEObject(Level.Address + 0xA8); for (var i = 0u; i < Actors.Num; i++) { var Actor = Actors[i]; var debug = GetFullName(Actor.Address) + " || " + Actor.ClassName + " || " + DumpClass(Actor.ClassAddr); sb.AppendLine(i + " : " + debug); } } System.IO.File.WriteAllText("actors.txt", sb.ToString()); }
void DrawEsp() { var World = new Engine.UEObject(Engine.GWorld); //var PersistentLevel = World["PersistentLevel"]; var Levels = World["Levels"]; var OwningGameInstance = World["OwningGameInstance"]; //var IsInGameplay = OwningGameInstance["IsInGameplay"]; //IsInGameplay.Invoke(); var LocalPlayers = OwningGameInstance["LocalPlayers"]; var PlayerController = LocalPlayers[0]["PlayerController"]; var Player = PlayerController["Player"]; var AcknowledgedPawn = PlayerController["AcknowledgedPawn"]; if (AcknowledgedPawn == null || !AcknowledgedPawn.IsA("Class Engine.Character")) { return; } //Console.WriteLine(Engine.Instance.DumpClass(PlayerController.ClassAddr)); var ComputeOffenseLevel = AcknowledgedPawn["ComputeOffenseLevel"].Invoke <UInt32>(); var RangedWeapon = new Engine.UEObject(AcknowledgedPawn["GetCurrentRangedWeapon"].Invoke <UInt64>()); Console.WriteLine(Engine.Instance.DumpClass(PlayerController.ClassAddr)); if (GetKeyState((int)Keys.F5) == 1) { Engine.Memory.WriteProcessMemory(AcknowledgedPawn["Stamina"]["Value"].Address, BitConverter.GetBytes(50.0f)); Engine.Memory.WriteProcessMemory(AcknowledgedPawn["LongGunAmmo"]["Value"].Address, BitConverter.GetBytes(100.0f)); Engine.Memory.WriteProcessMemory(AcknowledgedPawn["HandGunAmmo"]["Value"].Address, BitConverter.GetBytes(100.0f)); var CachedInventory = AcknowledgedPawn["CachedInventory"]; var Items = CachedInventory["Items"]; // item is struct, bigger than normal... need to update class to do Items[itemIndex] correctly var ItemsAddr = Engine.Memory.ReadProcessMemory <UInt64>(Items.Address); for (var itemIndex = 0u; itemIndex < Items.Num; itemIndex++) { var ItemInstanceData = new Engine.UEObject(Engine.Memory.ReadProcessMemory <UInt64>(ItemsAddr + 3 * 8 + itemIndex * 5 * 8)); if (ItemInstanceData.IsA("Class GunfireRuntime.RangedWeaponInstanceData")) { Engine.Memory.WriteProcessMemory(ItemInstanceData["AmmoInClip"].Address, BitConverter.GetBytes(50)); } //if (ItemInstanceData.IsA("Class GunfireRuntime.RangedWeaponInstanceData")) // Console.WriteLine(Engine.Instance.DumpClass(ItemInstanceData.ClassAddr)); } } var PersistentBuffs = AcknowledgedPawn["PersistentBuffs"]; var BuffsAddr = Engine.Memory.ReadProcessMemory <UInt64>(PersistentBuffs.Address); for (var buffIndex = 0u; buffIndex < PersistentBuffs.Num; buffIndex++) { var ItemInstanceData1 = new Engine.UEObject(Engine.Memory.ReadProcessMemory <UInt64>(BuffsAddr + 4 * 8 + buffIndex * 5 * 8)); var ItemInstanceData2 = new Engine.UEObject(Engine.Memory.ReadProcessMemory <UInt64>(BuffsAddr)); //if (ItemInstanceData.IsA("Class GunfireRuntime.RangedWeaponInstanceData")) //Console.WriteLine(Engine.Instance.DumpClass(ItemInstanceData1.ClassAddr)); //Console.WriteLine(Engine.Instance.DumpClass(ItemInstanceData2.ClassAddr)); } var PlayerCameraManager = PlayerController["PlayerCameraManager"]; //Console.WriteLine(Engine.Instance.DumpClass(PlayerCameraManager.ClassAddr)); var CameraCache = PlayerCameraManager["CameraCachePrivate"]; //Console.WriteLine(Engine.Instance.DumpClass(CameraCache.ClassAddr)); var CameraPOV = CameraCache["POV"]; var CameraLocation = Engine.Memory.ReadProcessMemory <Vector3>(CameraPOV["Location"].Address); var CameraRotation = Engine.Memory.ReadProcessMemory <Vector3>(CameraPOV["Rotation"].Address); var CameraFOV = Engine.Memory.ReadProcessMemory <Single>(CameraPOV["FOV"].Address); var PlayerRoot = AcknowledgedPawn["RootComponent"]; var PlayerRelativeLocation = PlayerRoot["RelativeLocation"]; var PlayerLocation = Engine.Memory.ReadProcessMemory <Vector3>(PlayerRelativeLocation.Address); //Console.WriteLine(Engine.Instance.DumpClass(PlayerRoot.ClassAddr)); //var PlayerRotation = Engine.Memory.ReadProcessMemory<Vector3>(PlayerRelativeLocation.Address + 24); //var SetHealth = AcknowledgedPawn["SetActorScale3D"]; //var GetHealthMax = AcknowledgedPawn["GetHealthMax"]; //GetHealthMax.Invoke(); //var rot = Player["ViewportClient"]; //var ro2t = Engine.Memory.ReadProcessMemory<Vector3>(PlayerController["ControlRotation"].Address); //var ro3t = Engine.Memory.ReadProcessMemory<Vector3>(PlayerController["TargetViewRotation"].Address); //var rot = Engine.Memory.ReadProcessMemory<Vector3>(AcknowledgedPawn["ViewRotation"].Address);; DrawArrow(PlayerLocation, CameraRotation, PlayerLocation, CameraRotation); var bestAngle = Single.MaxValue; var bestTurn = Vector3.Zero; var bestLocation = Vector3.Zero; var bestRotation = Vector3.Zero; var target = Vector2.Zero; for (var levelIndex = 1u; levelIndex < Levels.Num; levelIndex++) { var Level = Levels[levelIndex]; // https://github.com/EpicGames/UnrealEngine/blob/4.22.3-release/Engine/Source/Runtime/Engine/Classes/Engine/Level.h#L376 doesn't exist by string var Actors = new Engine.UEObject(Level.Address + 0xA8); for (var i = 0u; i < Actors.Num; i++) { var Actor = Actors[i]; if (Actor.Address == 0) { continue; } if (Actor.Value == 0) { continue; } if (Actor.IsA("Class Remnant.RemnantWeaponMod")) { Console.WriteLine("rawr"); } if (Actor.IsA("Class GunfireRuntime.Item") || Actor.IsA("Class Remnant.LootContainer")) { var RootComponent = Actor["RootComponent"]; if (RootComponent == null || RootComponent.Address == 0 || !RootComponent.ClassName.Contains("Component")) { continue; } var RelativeLocation = RootComponent["RelativeLocation"]; var Location = Engine.Memory.ReadProcessMemory <Vector3>(RelativeLocation.Address); if (Actor["bActorIsBeingDestroyed"].Value == 1) { continue; } var loc = WorldToScreen(Location, CameraLocation, CameraRotation, CameraFOV); if (loc.X > 0 && loc.Y > 0 && loc.X < Width && loc.Y < Height) { var dist = ((CameraLocation - Location).Length() / 100.0f).ToString("0.0"); if (GetKeyState((int)Keys.F2) == 0) { if (Actor.ClassName.Contains("TraitBook")) { SpriteBatch.DrawString(SpriteFont, "Trait(" + dist + ")", loc, Color.CornflowerBlue); } else if (Actor.ClassName.Contains("LootContainer")) { var tag = Engine.Memory.ReadProcessMemory <UInt16>(Actor.Address + 0x198); if (tag != 1) { SpriteBatch.DrawString(SpriteFont, "Box(" + dist + ")", loc, Color.Cyan); } //else SpriteBatch.DrawString(SpriteFont, "BoxOpened(" + dist + ")", loc, Color.Cyan); } else if (Actor.ClassName.Contains("Trinket")) { var ItemName = Actor.ClassName.Substring(Actor.ClassName.IndexOf("Trinket") + 8); ItemName = ItemName.Substring(0, ItemName.IndexOf("Trinket") - 1); SpriteBatch.DrawString(SpriteFont, ItemName + "(" + dist + ")", loc, Color.Magenta); } else if (Actor.ClassName.Contains("GenericItem") || Actor.ClassName.Contains("Traits")) { var InteractLabel = Engine.Memory.ReadProcessMemory <UInt64>(Actor["InteractLabel"].Address); var ItemNameAddr = Engine.Memory.ReadProcessMemory <UInt64>(InteractLabel + 0x28);; var ItemName = Engine.Memory.ReadProcessMemory <String>(ItemNameAddr); SpriteBatch.DrawString(SpriteFont, ItemName + "(" + dist + ")", loc, Color.Magenta); } } if (GetKeyState((int)Keys.F3) == 1) { if (Actor.ClassName.Contains("Scraps")) { SpriteBatch.DrawString(SpriteFont, "Scrap(" + dist + ")", loc, Color.PaleGoldenrod); } else if (Actor.ClassName.Contains("Ammo_HandGun")) { SpriteBatch.DrawString(SpriteFont, "SAmmo(" + dist + ")", loc, Color.White); } else if (Actor.ClassName.Contains("Ammo_LongGun")) { SpriteBatch.DrawString(SpriteFont, "PAmmo(" + dist + ")", loc, Color.Red); } else if (Actor.ClassName.Contains("Consumable")) { SpriteBatch.DrawString(SpriteFont, "Item(" + dist + ")", loc, Color.Green); } else if (Actor.ClassName.Contains("Iron")) { SpriteBatch.DrawString(SpriteFont, "Iron(" + dist + ")", loc, Color.PaleGoldenrod); } } if (GetKeyState((int)Keys.F4) == 1) { SpriteBatch.DrawString(SpriteFont, "Debug(" + dist + ")" + Actor.ClassName, loc, Color.White); } } } if (GetKeyState((int)Keys.F1) == 0 && Actor.IsA("Class Engine.Character")) { var RootComponent = Actor["RootComponent"]; if (RootComponent == null || RootComponent.Address == 0 || !RootComponent.IsA("Class Engine.CapsuleComponent")) { continue; } var RelativeLocation = RootComponent["RelativeLocation"]; var Location = Engine.Memory.ReadProcessMemory <Vector3>(RelativeLocation.Address); //var RelativeRotation = RootComponent["RelativeRotation"]; var Rotation = Engine.Memory.ReadProcessMemory <Vector3>(RelativeLocation.Address + 24); if (Actor["bActorIsBeingDestroyed"].Value == 1) { continue; } var hp = Engine.Memory.ReadProcessMemory <Single>(Actor["HealthNormalized"].Address); if (hp == 0) { continue; } DrawBox(Location, Rotation, CameraLocation, CameraRotation, CameraFOV, Color.Red); DrawArrow(Location, Rotation, PlayerLocation, CameraRotation); var Silhouette = Actor["Silhouette"]; var RemnantSilhouette = Actor["RemnantSilhouette"]; var DisplayInfoComponent = Actor["DisplayInfoComponent"]; var Dormant_Emis = Actor["NonDormant_Emis"]; var q = Engine.Memory.ReadProcessMemory <Vector3>(Dormant_Emis.Address);; var MaxDistance = Silhouette["MaxDistance"]; var OutlineAddr = Silhouette["DefaultSilhouetteColorIdx"].Address + 4; //Engine.Memory.WriteProcessMemory(OutlineAddr, BitConverter.GetBytes((UInt16)0x101)); var targetTest = WorldToScreen(Location, CameraLocation, CameraRotation, CameraFOV); var test1 = Engine.Memory.ReadProcessMemory <UInt32>(MaxDistance.Address); var test3 = Engine.Memory.ReadProcessMemory <UInt16>(OutlineAddr).ToString("X"); var test4 = Engine.Memory.ReadProcessMemory <UInt64>(Silhouette["DefaultSilhouetteColorIdx"].Address + 0x10).ToString("X"); /*SpriteBatch.DrawString(SpriteFont, "Debug" + BitConverter.ToSingle(BitConverter.GetBytes(test1), 0) + ": " + test3 + " : rt" + Silhouette["bIsActive"].Value.ToString("X") + " : vt" + Silhouette["ViewerTag"].Value.ToString("X") + " : vis" + Silhouette["Visibility"].Value.ToString("X") + " : dc" + Silhouette["DefaultSilhouetteColorIdx"].Value.ToString("X") + " : ??" + test4 + , targetTest, Color.White);*/ SpriteBatch.DrawString(SpriteFont, Actor.Address.ToString("X") , targetTest, Color.White); // Console.WriteLine(Engine.Instance.DumpClass(DisplayInfoComponent.ClassAddr)); if ((GetKeyState((int)Keys.RButton) & 0x100) != 0) { var turnVector = CameraLocation.CalcRotation(Location, CameraRotation, 0.0f); var turnWeight = (Single)(CameraRotation - turnVector).Length(); if (turnWeight < bestAngle) { bestTurn = turnVector; bestAngle = turnWeight; bestLocation = Location; bestRotation = Rotation; target = WorldToScreen(Location, CameraLocation, CameraRotation, CameraFOV); } } } } } if ((GetKeyState((int)Keys.RButton) & 0x100) != 0) { DrawBox(bestLocation, bestRotation, CameraLocation, CameraRotation, CameraFOV, Color.Green); //PlayerController["SetControlRotation"].Invoke<UInt32>(bestTurn, true); //PlayerController["ClientSetLocation"].Invoke<UInt32>(CameraLocation, CameraRotation); //AcknowledgedPawn["Jump"].Invoke<UInt32>(); //AcknowledgedPawn["SetControlRotation"].Invoke<UInt32>(); //PlayerCameraManager["K2_SetActorRotation"].Invoke<UInt32>(bestTurn, true, true); //AcknowledgedPawn["K2_SetActorRotation"].Invoke<UInt32>(bestTurn, true, true); PlayerController["StartFire"].Invoke <UInt32>(true); PlayerController["ServerUpdateCamera"].Invoke <UInt32>("wtffix"); PlayerController["GetHud"].Invoke <UInt32>("wtffix"); //RangedWeapon["OnFire"].Invoke<UInt32>(PlayerLocation, bestLocation, 1.0f); //RangedWeapon["ServerFire"].Invoke<UInt32>(PlayerLocation, bestLocation, 1.0f, (Int32)123, 0, 0, 0, 0, 0, 0); //RangedWeapon["ServerUse"].Invoke<UInt32>(); //AimAtPos(target); //Engine.Memory.WriteProcessMemory(PlayerController["ControlRotation"].Address, bestTurn); //Engine.Memory.WriteProcessMemory(CameraPOV["Rotation"].Address, bestTurn); } }