private ulong PegaClienteSoldadodEntidade(ulong pClientPlayer, GPlayer player) { if (bRPM.IsValid(bRPM.Read <ulong>(pClientPlayer + Offsets.PZ_ClientPlayer.m_pAttachedControllable))) { ulong num = bRPM.Read <ulong>(bRPM.Read <ulong>(pClientPlayer + Offsets.PZ_ClientPlayer.m_character)) - 8; if (bRPM.IsValid(num)) { player.InVehicle = true; ulong num2 = bRPM.Read <ulong>(pClientPlayer + Offsets.PZ_ClientPlayer.m_pAttachedControllable); if (bRPM.IsValid(num2)) { ulong num3 = bRPM.Read <ulong>(num2 + Offsets.PZ_ClientSoldierEntity.m_data); if (bRPM.IsValid(num3)) { string text = bRPM.ReadString(bRPM.Read <UInt64>(num3 + Offsets.PZ_VehicleEntityData.m_NameSid), 0X14); if (text.Length > 11) { ulong num4 = bRPM.Read <ulong>(bRPM.Read <UInt64>(num + Offsets.PZ_ClientPlayer.m_pAttachedControllable) + Offsets.PZ_ClientSoldierEntity.m_pHealthComponent); player.VehicleHealth = bRPM.Read <float>(num4 + Offsets.PZ_HealthComponent.m_vehicleHealth); player.VehicleMaxHealth = bRPM.Read <float>(num3 + Offsets.PZ_VehicleEntityData.m_FrontMaxHealth); player.VehicleName = text.Remove(0, 11); player.IsDriver = true; } } } } return(num); } return(bRPM.Read <ulong>(pClientPlayer + Offsets.PZ_ClientPlayer.m_pControlledControllable)); }
// Init public Overlay() { // Init player array localPlayer = new GPlayer(); players = new List <GPlayer>(); // initialize a new Charm instance Charm charm = new Charm(); // Make the overlay only render when the taget's window is active, and draw the fps charm.CharmSetOptions(Charm.CharmSettings.CHARM_REQUIRE_FOREGROUND | Charm.CharmSettings.CHARM_VSYNC | Charm.CharmSettings.CHARM_DRAW_FPS); // initialize the overlay, with our callback function above, and the name of the game to adhere to charm.CharmInit(DrawLoop, "bf1"); // Init Key Listener KeyAssign(); }
private void DrawBone(GPlayer player) { Vector3 BONE_HEAD, BONE_NECK, BONE_SPINE2, BONE_SPINE1, BONE_SPINE, BONE_LEFTSHOULDER, BONE_RIGHTSHOULDER, BONE_LEFTELBOWROLL, BONE_RIGHTELBOWROLL, BONE_LEFTHAND, BONE_RIGHTHAND, BONE_LEFTKNEEROLL, BONE_RIGHTKNEEROLL, BONE_LEFTFOOT, BONE_RIGHTFOOT; if (bRANDER.WorldToScreen(player.Bone.BONE_HEAD, out BONE_HEAD) && bRANDER.WorldToScreen(player.Bone.BONE_NECK, out BONE_NECK) && bRANDER.WorldToScreen(player.Bone.BONE_SPINE2, out BONE_SPINE2) && bRANDER.WorldToScreen(player.Bone.BONE_SPINE1, out BONE_SPINE1) && bRANDER.WorldToScreen(player.Bone.BONE_SPINE, out BONE_SPINE) && bRANDER.WorldToScreen(player.Bone.BONE_LEFTSHOULDER, out BONE_LEFTSHOULDER) && bRANDER.WorldToScreen(player.Bone.BONE_RIGHTSHOULDER, out BONE_RIGHTSHOULDER) && bRANDER.WorldToScreen(player.Bone.BONE_LEFTELBOWROLL, out BONE_LEFTELBOWROLL) && bRANDER.WorldToScreen(player.Bone.BONE_RIGHTELBOWROLL, out BONE_RIGHTELBOWROLL) && bRANDER.WorldToScreen(player.Bone.BONE_LEFTHAND, out BONE_LEFTHAND) && bRANDER.WorldToScreen(player.Bone.BONE_RIGHTHAND, out BONE_RIGHTHAND) && bRANDER.WorldToScreen(player.Bone.BONE_LEFTKNEEROLL, out BONE_LEFTKNEEROLL) && bRANDER.WorldToScreen(player.Bone.BONE_RIGHTKNEEROLL, out BONE_RIGHTKNEEROLL) && bRANDER.WorldToScreen(player.Bone.BONE_LEFTFOOT, out BONE_LEFTFOOT) && bRANDER.WorldToScreen(player.Bone.BONE_RIGHTFOOT, out BONE_RIGHTFOOT)) { int stroke = 3; int strokeW = stroke % 2 == 0 ? stroke / 2 : (stroke - 1) / 2; // Color var skeletonColor = (player.Team == localPlayer.Team) ? Color.FromArgb(0, 255, 231, 255) : player.IsVisible() ? Color.FromArgb(251, 255, 0, 255) : Color.FromArgb(255, 161, 0, 255); var colordist = (player.Team == localPlayer.Team) ? Color.FromArgb(0, 0, 255, 255) : player.IsVisible() ? Color.FromArgb(5, 142, 246, 255) : Color.FromArgb(151, 247, 241, 255); var applycolor = (ESP_Spot ? player.Distance <= 50 ? colordist : skeletonColor : skeletonColor); // RECT's bRANDER.DrawCircle((int)BONE_HEAD.X - strokeW, (int)BONE_HEAD.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_NECK.X - strokeW, (int)BONE_NECK.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_LEFTSHOULDER.X - strokeW, (int)BONE_LEFTSHOULDER.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_LEFTELBOWROLL.X - strokeW, (int)BONE_LEFTELBOWROLL.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_LEFTHAND.X - strokeW, (int)BONE_LEFTHAND.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_RIGHTSHOULDER.X - strokeW, (int)BONE_RIGHTSHOULDER.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_RIGHTELBOWROLL.X - strokeW, (int)BONE_RIGHTELBOWROLL.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_RIGHTHAND.X - strokeW, (int)BONE_RIGHTHAND.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_SPINE2.X - strokeW, (int)BONE_SPINE2.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_SPINE1.X - strokeW, (int)BONE_SPINE1.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_SPINE.X - strokeW, (int)BONE_SPINE.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_LEFTKNEEROLL.X - strokeW, (int)BONE_LEFTKNEEROLL.Y - strokeW, stroke, stroke, applycolor, true); bRANDER.DrawCircle((int)BONE_RIGHTKNEEROLL.X - strokeW, (int)BONE_RIGHTKNEEROLL.Y - strokeW, 2, 2, applycolor, true); bRANDER.DrawCircle((int)BONE_LEFTFOOT.X - strokeW, (int)BONE_LEFTFOOT.Y - strokeW, 2, 2, applycolor, true); bRANDER.DrawCircle((int)BONE_RIGHTFOOT.X - strokeW, (int)BONE_RIGHTFOOT.Y - strokeW, 2, 2, applycolor, true); // Head -> Neck bRANDER.DrawLine((int)BONE_HEAD.X, (int)BONE_HEAD.Y, (int)BONE_NECK.X, (int)BONE_NECK.Y, 1, applycolor); // Neck -> Left bRANDER.DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_LEFTSHOULDER.X, (int)BONE_LEFTSHOULDER.Y, 1, applycolor); bRANDER.DrawLine((int)BONE_LEFTSHOULDER.X, (int)BONE_LEFTSHOULDER.Y, (int)BONE_LEFTELBOWROLL.X, (int)BONE_LEFTELBOWROLL.Y, 1, applycolor); bRANDER.DrawLine((int)BONE_LEFTELBOWROLL.X, (int)BONE_LEFTELBOWROLL.Y, (int)BONE_LEFTHAND.X, (int)BONE_LEFTHAND.Y, 1, applycolor); // Neck -> Right bRANDER.DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_RIGHTSHOULDER.X, (int)BONE_RIGHTSHOULDER.Y, 1, applycolor); bRANDER.DrawLine((int)BONE_RIGHTSHOULDER.X, (int)BONE_RIGHTSHOULDER.Y, (int)BONE_RIGHTELBOWROLL.X, (int)BONE_RIGHTELBOWROLL.Y, 1, applycolor); bRANDER.DrawLine((int)BONE_RIGHTELBOWROLL.X, (int)BONE_RIGHTELBOWROLL.Y, (int)BONE_RIGHTHAND.X, (int)BONE_RIGHTHAND.Y, 1, applycolor); // Neck -> Center bRANDER.DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_SPINE2.X, (int)BONE_SPINE2.Y, 1, applycolor); bRANDER.DrawLine((int)BONE_SPINE2.X, (int)BONE_SPINE2.Y, (int)BONE_SPINE1.X, (int)BONE_SPINE1.Y, 1, applycolor); bRANDER.DrawLine((int)BONE_SPINE1.X, (int)BONE_SPINE1.Y, (int)BONE_SPINE.X, (int)BONE_SPINE.Y, 1, applycolor); // Spine -> Left bRANDER.DrawLine((int)BONE_SPINE.X, (int)BONE_SPINE.Y, (int)BONE_LEFTKNEEROLL.X, (int)BONE_LEFTKNEEROLL.Y, 1, applycolor); bRANDER.DrawLine((int)BONE_LEFTKNEEROLL.X, (int)BONE_LEFTKNEEROLL.Y, (int)BONE_LEFTFOOT.X, (int)BONE_LEFTFOOT.Y, 1, applycolor); // Spine -> Right bRANDER.DrawLine((int)BONE_SPINE.X, (int)BONE_SPINE.Y, (int)BONE_RIGHTKNEEROLL.X, (int)BONE_RIGHTKNEEROLL.Y, 1, applycolor); bRANDER.DrawLine((int)BONE_RIGHTKNEEROLL.X, (int)BONE_RIGHTKNEEROLL.Y, (int)BONE_RIGHTFOOT.X, (int)BONE_RIGHTFOOT.Y, 1, applycolor); } }
private void MainScan() { Array.Clear(this.data, 0, this.data.Length); players.Clear(); MemoryMappedViewStream memoryMappedViewStream = MemoryMappedFile.OpenExisting("DataSend").CreateViewStream(); byte[] array = new byte[560]; memoryMappedViewStream.Read(array, 0, 560); Buffer.BlockCopy(array, 0, this.data, 0, array.Length); memoryMappedViewStream.Flush(); memoryMappedViewStream.Dispose(); #region Get Local Player for (uint i = 0; i < 70; i++) { GPlayer player = new GPlayer(); ulong num = this.data[i]; if (bRPM.IsValid(num)) { string text = bRPM.ReadString2(num + Offsets.PZ_ClientPlayer.szName, 0xF); string value = Pro.NamePlayer.Substring(0, 4); if (text.Substring(0, 4).Equals(value, StringComparison.InvariantCultureIgnoreCase)) { pLocalPlayerDecrypted = num; ulong pLocalSoldier = PegaClienteSoldadodEntidade(num, localPlayer); localPlayer.pSoldier = pLocalSoldier; localPlayer.Team = bRPM.Read <uint>(num + Offsets.PZ_ClientPlayer.m_teamId); if (!bRPM.IsValid(pLocalSoldier)) { return; } ulong pHealthComponent = bRPM.Read <ulong>(pLocalSoldier + Offsets.PZ_ClientSoldierEntity.m_pHealthComponent); // Health localPlayer.Health = bRPM.Read <float>(pHealthComponent + Offsets.PZ_HealthComponent.m_Health); localPlayer.MaxHealth = bRPM.Read <float>(pHealthComponent + Offsets.PZ_HealthComponent.m_MaxHealth); // Origin localPlayer.Origin = bRPM.Read <Vector3>(pLocalSoldier + 0X0990); localPlayer.IsOccluded = bRPM.Read <byte>(pLocalSoldier + Offsets.PZ_ClientSoldierEntity.m_occluded); localPlayer.IsFriendly = (player.Team == localPlayer.Team); #endregion #region Get Other Players by Id } ulong num9 = PegaClienteSoldadodEntidade(num, player); if (bRPM.IsValid(num9) && num != pLocalPlayerDecrypted) { ulong pGameRenderer = bRPM.Read <ulong>(Offsets.OFFSET_GAMERENDERER); ulong pRenderView = bRPM.Read <ulong>(pGameRenderer + Offsets.PZ_GameRenderer.m_pRenderView); // Read Screen Matrix4x4 localPlayer.ViewProj = bRPM.Read <Matrix4x4>(pRenderView + Offsets.PZ_RenderView.m_viewProj); if (player.IsSpectator) { spectatorCount++; } player.Name = bRPM.ReadString(num + Offsets.PZ_ClientPlayer.szName, 10); player.pSoldier = num9; ulong pEnemyHealthComponent = bRPM.Read <ulong>(num9 + Offsets.PZ_ClientSoldierEntity.m_pHealthComponent); // Health player.Health = bRPM.Read <float>(pEnemyHealthComponent + Offsets.PZ_HealthComponent.m_Health); player.MaxHealth = bRPM.Read <float>(pEnemyHealthComponent + Offsets.PZ_HealthComponent.m_MaxHealth); // Origin (Position in Game X, Y, Z) player.Origin = bRPM.Read <Vector3>(num9 + 0X0990); player.Team = bRPM.Read <uint>(num + Offsets.PZ_ClientPlayer.m_teamId); player.Pose = bRPM.Read <uint>(num9 + Offsets.PZ_ClientSoldierEntity.m_poseType); player.Yaw = bRPM.Read <float>(num9 + Offsets.PZ_ClientSoldierEntity.m_authorativeYaw); player.IsOccluded = bRPM.Read <byte>(num9 + Offsets.PZ_ClientSoldierEntity.m_occluded); player.IsFriendly = (player.Team == localPlayer.Team); // Distance to You player.Distance = Vector3.Distance(localPlayer.Origin, player.Origin); bRANDER.SetViewProjection(localPlayer.ViewProj); players.Add(player); if (player.IsValid()) { // Player Bone bBoneOk = (GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTELBOWROLL, out player.Bone.BONE_RIGHTELBOWROLL) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTFOOT, out player.Bone.BONE_RIGHTFOOT) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTHAND, out player.Bone.BONE_RIGHTHAND) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTKNEEROLL, out player.Bone.BONE_RIGHTKNEEROLL) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTSHOULDER, out player.Bone.BONE_RIGHTSHOULDER) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_SPINE, out player.Bone.BONE_SPINE) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_SPINE1, out player.Bone.BONE_SPINE1) && GetBoneById(num9, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_SPINE2, out player.Bone.BONE_SPINE2)); #region Drawing ESP on Overlay // Desconsidera Aliados if (!bEspAllies && (player.Team == localPlayer.Team)) { continue; } #region ESP Bone if (bBoneOk && ESP_Bone) { DrawBone(player); } #endregion Vector3 textPos = new Vector3(player.Origin.X, player.Origin.Y, player.Origin.Z); if (bRANDER.WorldToScreen(textPos, out Vector3 w2sFoot) && bRANDER.WorldToScreen(textPos, player.Pose, out Vector3 w2sHead)) { float H = w2sFoot.Y - w2sHead.Y; float W = H / 2; float X = w2sHead.X - W / 2; float heightoffset = Distance3D(w2sFoot, w2sHead); #region ESP Color var color = (player.Team == localPlayer.Team) ? Color.FromArgb(0, 0, 255) : player.IsVisible() ? Color.FromArgb(0, 255, 0) : Color.FromArgb(255, 0, 0); var colordist = (player.Team == localPlayer.Team) ? Color.FromArgb(0, 0, 255) : player.IsVisible() ? Color.FromArgb(255, 0, 137) : Color.FromArgb(255, 156, 210); var applycolor = (ESP_Spot ? player.Distance <= 50 ? colordist : color : color); #endregion #region ESP Box // ESP Box if (ESP_Box) { if (bEsp3D) { DrawAABB(player.GetAABB(), player.Origin, player.Yaw, applycolor); // 3D Box } else { float factor = (heightoffset / 5); Vector3 m2 = new Vector3(w2sHead.X - factor, w2sHead.Y, 0); Vector3 m1 = new Vector3(w2sHead.X + factor, w2sHead.Y, 0); Vector3 m3 = new Vector3(w2sFoot.X - factor, w2sFoot.Y, 0); Vector3 m4 = new Vector3(w2sFoot.X + factor, w2sFoot.Y, 0); bRANDER.DrawLine(m1.X, m1.Y, m2.X, m2.Y, 3, applycolor); bRANDER.DrawLine(m2.X, m2.Y, m3.X, m3.Y, 3, applycolor); bRANDER.DrawLine(m3.X, m3.Y, m4.X, m4.Y, 3, applycolor); bRANDER.DrawLine(m4.X, m4.Y, m1.X, m1.Y, 3, applycolor); } } #endregion #region ESP Vehicle if (ESP_Vehicle) { DrawAABB(player.VehicleAABB, player.VehicleTranfsorm, applycolor); } #endregion #region ESP Name if (ESP_Name) { int fontsize = 20; float offset = (player.Name.Length * fontsize) / 5; bRANDER.DrawString(w2sHead.X - offset, w2sHead.Y - (heightoffset / 4) - fontsize, player.Name, Color.FromArgb(255, 255, 255)); } #endregion #region ESP Distance if (ESP_Distance) { bRANDER.DrawString(w2sFoot.X, w2sFoot.Y, (int)player.Distance + "m", Color.FromArgb(240, 240, 240, 255)); } #endregion #region ESP Health if (ESP_Health) { if (player.Health <= 0) { player.Health = 1; } if (player.MaxHealth < player.Health) { player.MaxHealth = 100; } float factor = (-heightoffset / 4 - 8); Vector3 m1 = new Vector3(w2sHead.X + factor, w2sHead.Y, 0); Vector3 m2 = new Vector3(w2sFoot.X + factor, w2sFoot.Y, 0); int progress = (int)((float)player.Health / ((float)player.MaxHealth / 100)); float perc = (player.Health / player.MaxHealth); int xnxx = (int)perc; float thicc = heightoffset / 18; if (thicc < 4) { thicc = 4; } var HealthColor = Color.FromArgb(1 - xnxx, xnxx, 0); bRANDER.DrawLine(m1.X + thicc / 2, m1.Y - 2, m2.X + thicc / 2, m2.Y + 2, thicc + 4, Color.FromArgb(1, 1, 1)); bRANDER.DrawLine(m1.X + thicc / 2, m1.Y + ((m2.Y - m1.Y) * (1 - perc)), m2.X + thicc / 2, m2.Y, thicc, Color.Green); bRANDER.DrawString(m1.X + thicc - 9, m1.Y - 10, "%" + progress, Color.FromArgb(255, 255, 255, 255)); } #endregion #region ESP DMG Vehicle if (ESP_dmg_Vehicle) { if (player.InVehicle && player.IsDriver) { DrawHealth((int)X, (int)w2sHead.Y - 30, (int)W + 65, 6, (int)player.VehicleHealth, (int)player.VehicleMaxHealth); } } #endregion if (ESP_Line) { bRANDER.DrawLine(w2sFoot.X, w2sFoot.Y, (rect.Right - rect.Left) / 2, rect.Bottom - rect.Top, 3, applycolor); } if (ESP_Spot && player.Distance <= 50) { DrawProximityAlert(rect.Width / 2 + 300, rect.Height - 80, 155, 50); } if (ESP_SpectatorWarn && spectatorCount > 0) { DrawSpectatorWarn(rect.Bottom - 125, 25, 350, 55); } } #endregion } #endregion } } } }
private void DrawBone(GPlayer player) { Vector3 BONE_HEAD, BONE_NECK, BONE_SPINE2, BONE_SPINE1, BONE_SPINE, BONE_LEFTSHOULDER, BONE_RIGHTSHOULDER, BONE_LEFTELBOWROLL, BONE_RIGHTELBOWROLL, BONE_LEFTHAND, BONE_RIGHTHAND, BONE_LEFTKNEEROLL, BONE_RIGHTKNEEROLL, BONE_LEFTFOOT, BONE_RIGHTFOOT; if (WorldToScreen(player.Bone.BONE_HEAD, out BONE_HEAD) && WorldToScreen(player.Bone.BONE_NECK, out BONE_NECK) && WorldToScreen(player.Bone.BONE_SPINE2, out BONE_SPINE2) && WorldToScreen(player.Bone.BONE_SPINE1, out BONE_SPINE1) && WorldToScreen(player.Bone.BONE_SPINE, out BONE_SPINE) && WorldToScreen(player.Bone.BONE_LEFTSHOULDER, out BONE_LEFTSHOULDER) && WorldToScreen(player.Bone.BONE_RIGHTSHOULDER, out BONE_RIGHTSHOULDER) && WorldToScreen(player.Bone.BONE_LEFTELBOWROLL, out BONE_LEFTELBOWROLL) && WorldToScreen(player.Bone.BONE_RIGHTELBOWROLL, out BONE_RIGHTELBOWROLL) && WorldToScreen(player.Bone.BONE_LEFTHAND, out BONE_LEFTHAND) && WorldToScreen(player.Bone.BONE_RIGHTHAND, out BONE_RIGHTHAND) && WorldToScreen(player.Bone.BONE_LEFTKNEEROLL, out BONE_LEFTKNEEROLL) && WorldToScreen(player.Bone.BONE_RIGHTKNEEROLL, out BONE_RIGHTKNEEROLL) && WorldToScreen(player.Bone.BONE_LEFTFOOT, out BONE_LEFTFOOT) && WorldToScreen(player.Bone.BONE_RIGHTFOOT, out BONE_RIGHTFOOT)) { int stroke = 3; int strokeW = stroke % 2 == 0 ? stroke / 2 : (stroke - 1) / 2; // Color var skeletonColor = player.Team == localPlayer.Team ? d2d.CreateBrush(0, 0, 255, 255) : d2d.CreateBrush(255, 200, 0, 255); // RECT's d2d.FillRectangle((int)BONE_HEAD.X - strokeW, (int)BONE_HEAD.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_NECK.X - strokeW, (int)BONE_NECK.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_LEFTSHOULDER.X - strokeW, (int)BONE_LEFTSHOULDER.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_LEFTELBOWROLL.X - strokeW, (int)BONE_LEFTELBOWROLL.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_LEFTHAND.X - strokeW, (int)BONE_LEFTHAND.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_RIGHTSHOULDER.X - strokeW, (int)BONE_RIGHTSHOULDER.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_RIGHTELBOWROLL.X - strokeW, (int)BONE_RIGHTELBOWROLL.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_RIGHTHAND.X - strokeW, (int)BONE_RIGHTHAND.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_SPINE2.X - strokeW, (int)BONE_SPINE2.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_SPINE1.X - strokeW, (int)BONE_SPINE1.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_SPINE.X - strokeW, (int)BONE_SPINE.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_LEFTKNEEROLL.X - strokeW, (int)BONE_LEFTKNEEROLL.Y - strokeW, stroke, stroke, skeletonColor); d2d.FillRectangle((int)BONE_RIGHTKNEEROLL.X - strokeW, (int)BONE_RIGHTKNEEROLL.Y - strokeW, 2, 2, skeletonColor); d2d.FillRectangle((int)BONE_LEFTFOOT.X - strokeW, (int)BONE_LEFTFOOT.Y - strokeW, 2, 2, skeletonColor); d2d.FillRectangle((int)BONE_RIGHTFOOT.X - strokeW, (int)BONE_RIGHTFOOT.Y - strokeW, 2, 2, skeletonColor); // Head -> Neck d2d.DrawLine((int)BONE_HEAD.X, (int)BONE_HEAD.Y, (int)BONE_NECK.X, (int)BONE_NECK.Y, 1, skeletonColor); // Neck -> Left d2d.DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_LEFTSHOULDER.X, (int)BONE_LEFTSHOULDER.Y, 1, skeletonColor); d2d.DrawLine((int)BONE_LEFTSHOULDER.X, (int)BONE_LEFTSHOULDER.Y, (int)BONE_LEFTELBOWROLL.X, (int)BONE_LEFTELBOWROLL.Y, 1, skeletonColor); d2d.DrawLine((int)BONE_LEFTELBOWROLL.X, (int)BONE_LEFTELBOWROLL.Y, (int)BONE_LEFTHAND.X, (int)BONE_LEFTHAND.Y, 1, skeletonColor); // Neck -> Right d2d.DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_RIGHTSHOULDER.X, (int)BONE_RIGHTSHOULDER.Y, 1, skeletonColor); d2d.DrawLine((int)BONE_RIGHTSHOULDER.X, (int)BONE_RIGHTSHOULDER.Y, (int)BONE_RIGHTELBOWROLL.X, (int)BONE_RIGHTELBOWROLL.Y, 1, skeletonColor); d2d.DrawLine((int)BONE_RIGHTELBOWROLL.X, (int)BONE_RIGHTELBOWROLL.Y, (int)BONE_RIGHTHAND.X, (int)BONE_RIGHTHAND.Y, 1, skeletonColor); // Neck -> Center d2d.DrawLine((int)BONE_NECK.X, (int)BONE_NECK.Y, (int)BONE_SPINE2.X, (int)BONE_SPINE2.Y, 1, skeletonColor); d2d.DrawLine((int)BONE_SPINE2.X, (int)BONE_SPINE2.Y, (int)BONE_SPINE1.X, (int)BONE_SPINE1.Y, 1, skeletonColor); d2d.DrawLine((int)BONE_SPINE1.X, (int)BONE_SPINE1.Y, (int)BONE_SPINE.X, (int)BONE_SPINE.Y, 1, skeletonColor); // Spine -> Left d2d.DrawLine((int)BONE_SPINE.X, (int)BONE_SPINE.Y, (int)BONE_LEFTKNEEROLL.X, (int)BONE_LEFTKNEEROLL.Y, 1, skeletonColor); d2d.DrawLine((int)BONE_LEFTKNEEROLL.X, (int)BONE_LEFTKNEEROLL.Y, (int)BONE_LEFTFOOT.X, (int)BONE_LEFTFOOT.Y, 1, skeletonColor); // Spine -> Right d2d.DrawLine((int)BONE_SPINE.X, (int)BONE_SPINE.Y, (int)BONE_RIGHTKNEEROLL.X, (int)BONE_RIGHTKNEEROLL.Y, 1, skeletonColor); d2d.DrawLine((int)BONE_RIGHTKNEEROLL.X, (int)BONE_RIGHTKNEEROLL.Y, (int)BONE_RIGHTFOOT.X, (int)BONE_RIGHTFOOT.Y, 1, skeletonColor); } }
// Init public Overlay(Process process) { this.process = process; // check the game window exists then create the overlay while (true) { handle = NativeMethods.FindWindow(null, "Battlefield 4"); if (handle != IntPtr.Zero) { break; } } gameCheckThread = new Thread(new ParameterizedThreadStart(GameCheck)); gameCheckThread.Start(); if (process.MainWindowHandle == IntPtr.Zero) { Thread.Sleep(1000); } RPM.OpenProcess(process.Id); // setup the overlay var rendererOptions = new Direct2DRendererOptions() { AntiAliasing = OPTIONS_AA, Hwnd = IntPtr.Zero, MeasureFps = OPTIONS_ShowFPS, VSync = OPTIONS_VSync }; OverlayManager manager = new OverlayManager(handle, rendererOptions); overlay = manager.Window; d2d = manager.Graphics; clearBrush = d2d.CreateBrush(0xF5, 0xF5, 0xF5, 0); // our transparent colour // Init player array localPlayer = new GPlayer(); //localPlayer.CurrentWeapon = new Weapon(); localWeapons = new List <Gun>(); players = new List <GPlayer>(); targetEnimies = new List <GPlayer>(); // Init update thread updateStream = new Thread(new ParameterizedThreadStart(Update)); updateStream.Start(); ScreenCapture sc = new ScreenCapture(); sc.CaptureWindowToFile(process.MainWindowHandle, @"C:\PZ_BF4_FAIRFIGHT_GAME_SS.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); // Init Key Listener KeyAssign(); }
private void MainScan() { var font = d2d.CreateFont("Consolas", 11); players.Clear(); targetEnimies.Clear(); // Read Local #region Get Local Player // Render View Int64 pGameRenderer = RPM.ReadInt64(Offsets.OFFSET_GAMERENDERER); Int64 pRenderView = RPM.ReadInt64(pGameRenderer + Offsets.PZ_GameRenderer.m_pRenderView); // Read Screen Matrix localPlayer.ViewProj = RPM.ReadMatrix(pRenderView + Offsets.PZ_RenderView.m_viewProj); Int64 pGContext = RPM.ReadInt64(Offsets.OFFSET_CLIENTGAMECONTEXT); if (!RPM.IsValid(pGContext)) { return; } Int64 pPlayerManager = RPM.ReadInt64(pGContext + Offsets.PZ_ClientGameContext.m_pPlayerManager); if (!RPM.IsValid(pPlayerManager)) { return; } Int64 plocalPlayer = RPM.ReadInt64(pPlayerManager + Offsets.PZ_ClientPlayerManager.m_pLocalPlayer); if (!RPM.IsValid(plocalPlayer)) { return; } localPlayer.Team = RPM.ReadInt32(plocalPlayer + Offsets.PZ_ClientPlayer.m_teamId); Int64 pLocalSoldier = GetClientSoldierEntity(plocalPlayer, localPlayer); if (!RPM.IsValid(pLocalSoldier)) { return; } Int64 pHealthComponent = RPM.ReadInt64(pLocalSoldier + Offsets.PZ_ClientSoldierEntity.m_pHealthComponent); if (!RPM.IsValid(pHealthComponent)) { return; } Int64 pPredictedController = RPM.ReadInt64(pLocalSoldier + Offsets.PZ_ClientSoldierEntity.m_pPredictedController); if (!RPM.IsValid(pPredictedController)) { return; } // Health localPlayer.Health = RPM.ReadFloat(pHealthComponent + Offsets.PZ_HealthComponent.m_Health); localPlayer.MaxHealth = RPM.ReadFloat(pHealthComponent + Offsets.PZ_HealthComponent.m_MaxHealth); if (localPlayer.IsDead()) { return; } // Origin localPlayer.Origin = RPM.ReadVector3(pPredictedController + Offsets.PZ_ClientSoldierPrediction.m_Position); localPlayer.Velocity = RPM.ReadVector3(pPredictedController + Offsets.PZ_ClientSoldierPrediction.m_Velocity); // Other localPlayer.Pose = RPM.ReadInt32(pLocalSoldier + Offsets.PZ_ClientSoldierEntity.m_poseType); localPlayer.Yaw = RPM.ReadFloat(pLocalSoldier + Offsets.PZ_ClientSoldierEntity.m_authorativeYaw); localPlayer.IsOccluded = RPM.ReadByte(pLocalSoldier + Offsets.PZ_ClientSoldierEntity.m_occluded); #endregion // Pointer to Players Array Int64 m_ppPlayer = RPM.ReadInt64(pPlayerManager + Offsets.PZ_ClientPlayerManager.m_ppPlayer); if (!RPM.IsValid(m_ppPlayer)) { return; } #region Get Other Players by Id for (uint i = 0; i < 64; i++) { // Create new Player GPlayer player = new GPlayer(); // Pointer to ClientPlayer class (Player Array + (Id * Size of Pointer)) Int64 pEnemyPlayer = RPM.ReadInt64(m_ppPlayer + (i * sizeof(Int64))); if (!RPM.IsValid(pEnemyPlayer)) { continue; } player.Name = RPM.ReadString(pEnemyPlayer + Offsets.PZ_ClientPlayer.szName, 10); Int64 pEnemySoldier = GetClientSoldierEntity(pEnemyPlayer, player); if (!RPM.IsValid(pEnemySoldier)) { continue; } Int64 pEnemyHealthComponent = RPM.ReadInt64(pEnemySoldier + Offsets.PZ_ClientSoldierEntity.m_pHealthComponent); if (!RPM.IsValid(pEnemyHealthComponent)) { continue; } Int64 pEnemyPredictedController = RPM.ReadInt64(pEnemySoldier + Offsets.PZ_ClientSoldierEntity.m_pPredictedController); if (!RPM.IsValid(pEnemyPredictedController)) { continue; } // Health player.Health = RPM.ReadFloat(pEnemyHealthComponent + Offsets.PZ_HealthComponent.m_Health); player.MaxHealth = RPM.ReadFloat(pEnemyHealthComponent + Offsets.PZ_HealthComponent.m_MaxHealth); if (player.Health <= 0.1f) // DEAD { continue; } // Origin (Position in Game X, Y, Z) player.Origin = RPM.ReadVector3(pEnemyPredictedController + Offsets.PZ_ClientSoldierPrediction.m_Position); player.Velocity = RPM.ReadVector3(pEnemyPredictedController + Offsets.PZ_ClientSoldierPrediction.m_Velocity); // Other player.Team = RPM.ReadInt32(pEnemyPlayer + Offsets.PZ_ClientPlayer.m_teamId); player.Pose = RPM.ReadInt32(pEnemySoldier + Offsets.PZ_ClientSoldierEntity.m_poseType); player.Yaw = RPM.ReadFloat(pEnemySoldier + Offsets.PZ_ClientSoldierEntity.m_authorativeYaw); player.IsOccluded = RPM.ReadByte(pEnemySoldier + Offsets.PZ_ClientSoldierEntity.m_occluded); // Distance to You player.Distance = Vector3.Distance(localPlayer.Origin, player.Origin); players.Add(player); if (player.IsValid()) { // Player Bone bBoneOk = (GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_HEAD, out player.Bone.BONE_HEAD) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTELBOWROLL, out player.Bone.BONE_LEFTELBOWROLL) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTFOOT, out player.Bone.BONE_LEFTFOOT) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTHAND, out player.Bone.BONE_LEFTHAND) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTKNEEROLL, out player.Bone.BONE_LEFTKNEEROLL) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_LEFTSHOULDER, out player.Bone.BONE_LEFTSHOULDER) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_NECK, out player.Bone.BONE_NECK) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTELBOWROLL, out player.Bone.BONE_RIGHTELBOWROLL) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTFOOT, out player.Bone.BONE_RIGHTFOOT) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTHAND, out player.Bone.BONE_RIGHTHAND) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTKNEEROLL, out player.Bone.BONE_RIGHTKNEEROLL) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_RIGHTSHOULDER, out player.Bone.BONE_RIGHTSHOULDER) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_SPINE, out player.Bone.BONE_SPINE) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_SPINE1, out player.Bone.BONE_SPINE1) && GetBoneById(pEnemySoldier, (int)Offsets.PZ_UpdatePoseResultData.BONES.BONE_SPINE2, out player.Bone.BONE_SPINE2)); #region Drawing ESP on Overlay // Desconsidera Aliados if (!bEspAllies && (player.Team == localPlayer.Team)) { continue; } // Desconsidera os "Não Visíveis" if (bEspVisiblesOnly && (!player.IsVisible() || player.Distance > 75) && !player.InVehicle) { continue; } #region ESP Bone if (bBoneOk && ESP_Bone) { DrawBone(player); } #endregion Vector3 w2sFoot, w2sHead; if (WorldToScreen(player.Origin, out w2sFoot) && WorldToScreen(player.Origin, player.Pose, out w2sHead)) { float H = w2sFoot.Y - w2sHead.Y; float W = H / 2; float X = w2sHead.X - W / 2; int iAux; #region ESP Color var color = (player.Team == localPlayer.Team) ? d2d.CreateBrush(0, 0, 255, 255) : player.IsVisible() ? d2d.CreateBrush(0, 255, 0, 255) : d2d.CreateBrush(255, 0, 0, 255); #endregion #region ESP Box // ESP Box if (ESP_Box && !bEspVisiblesOnly) { if (bEsp3D) { DrawAABB(player.GetAABB(), player.Origin, player.Yaw, color); // 3D Box } else { d2d.DrawRectangle((int)X, (int)w2sHead.Y, (int)W, (int)H, 2, color); // 2D Box } } #endregion #region ESP Vehicle if (ESP_Vehicle) { DrawAABB(player.VehicleAABB, player.VehicleTranfsorm, player.Team == localPlayer.Team ? d2d.CreateBrush(64, 154, 200, 255) : d2d.CreateBrush(255, 129, 72, 255)); } #endregion #region ESP Name if (ESP_Name && !bEspVisiblesOnly) { d2d.DrawTextWithBackground(player.Name, (int)X, (int)w2sFoot.Y, font, d2d.CreateBrush(240, 240, 240, 255), d2d.CreateBrush(0, 0, 0, 255)); } #endregion #region ESP Distance if (ESP_Distance && !bEspVisiblesOnly) { iAux = (int)w2sFoot.Y; if (ESP_Name) { iAux = iAux + 13; } d2d.DrawTextWithBackground((int)player.Distance + "m", (int)X, iAux, font, d2d.CreateBrush(240, 240, 240, 255), d2d.CreateBrush(0, 0, 0, 255)); } #endregion #region ESP Health if (ESP_Health && !bEspVisiblesOnly) { DrawHealth((int)X, (int)w2sHead.Y - 6, (int)W, 3, (int)player.Health, (int)player.MaxHealth); if (player.InVehicle && player.IsDriver) { DrawHealth((int)X, (int)w2sHead.Y - 10, (int)W, 3, (int)player.VehicleHealth, (int)player.VehicleMaxHealth); } } #endregion } #endregion } } #endregion }
private Int64 GetClientSoldierEntity(Int64 pClientPlayer, GPlayer player) { player.InVehicle = false; player.IsDriver = false; Int64 pAttached = RPM.ReadInt64(pClientPlayer + Offsets.PZ_ClientPlayer.m_pAttachedControllable); if (RPM.IsValid(pAttached)) { Int64 m_ClientSoldier = RPM.ReadInt64(RPM.ReadInt64(pClientPlayer + Offsets.PZ_ClientPlayer.m_character)) - sizeof(Int64); if (RPM.IsValid(m_ClientSoldier)) { player.InVehicle = true; Int64 pVehicleEntity = RPM.ReadInt64(pClientPlayer + Offsets.PZ_ClientPlayer.m_pAttachedControllable); if (RPM.IsValid(pVehicleEntity)) { // Driver if (RPM.ReadInt32(pClientPlayer + Offsets.PZ_ClientPlayer.m_attachedEntryId) == 0) { // Vehicle AABB if (ESP_Vehicle) { Int64 pDynamicPhysicsEntity = RPM.ReadInt64(pVehicleEntity + Offsets.PZ_ClientVehicleEntity.m_pPhysicsEntity); if (RPM.IsValid(pDynamicPhysicsEntity)) { Int64 pPhysicsEntity = RPM.ReadInt64(pDynamicPhysicsEntity + Offsets.PZ_DynamicPhysicsEntity.m_EntityTransform); player.VehicleTranfsorm = RPM.ReadMatrix(pPhysicsEntity + Offsets.PZ_PhysicsEntityTransform.m_Transform); player.VehicleAABB = RPM.ReadAABB(pVehicleEntity + Offsets.PZ_ClientVehicleEntity.m_childrenAABB); } } Int64 _EntityData = RPM.ReadInt64(pVehicleEntity + Offsets.PZ_ClientSoldierEntity.m_data); if (RPM.IsValid(_EntityData)) { Int64 _NameSid = RPM.ReadInt64(_EntityData + Offsets.PZ_VehicleEntityData.m_NameSid); string strName = RPM.ReadName(_NameSid, 20); if (strName.Length > 11) { Int64 pAttachedClient = RPM.ReadInt64(m_ClientSoldier + Offsets.PZ_ClientSoldierEntity.m_pPlayer); // AttachedControllable Max Health Int64 p = RPM.ReadInt64(pAttachedClient + Offsets.PZ_ClientPlayer.m_pAttachedControllable); Int64 p2 = RPM.ReadInt64(p + Offsets.PZ_ClientSoldierEntity.m_pHealthComponent); player.VehicleHealth = RPM.ReadFloat(p2 + Offsets.PZ_HealthComponent.m_vehicleHealth); // AttachedControllable Health player.VehicleMaxHealth = RPM.ReadFloat(_EntityData + Offsets.PZ_VehicleEntityData.m_FrontMaxHealth); // AttachedControllable Name player.VehicleName = strName.Remove(0, 11); player.IsDriver = true; } } } } } return(m_ClientSoldier); } return(RPM.ReadInt64(pClientPlayer + Offsets.PZ_ClientPlayer.m_pControlledControllable)); }