Exemplo n.º 1
0
        void OnRPC_OnProjectileAttack(Message packet)
        {
            PlayerProjectileAttack ppAttack     = PlayerProjectileAttack.Deserialize(packet.read);
            PlayerAttack           playerAttack = ppAttack.playerAttack;

            if (firedProjectiles.TryGetValue(playerAttack.projectileID, out ItemInformation info))
            {
                firedProjectiles.Remove(playerAttack.projectileID);

                if (Find(playerAttack.attack.hitID, out BaseEntity hitEntity))
                {
                    if (hitEntity is BaseCombatEntity hitCombatEntity)
                    {
                        hitCombatEntity.Hurt(info.BaseProjectile?.Damage ?? info.BaseMelee.Damage);
                    }
                }
            }

            Release();

            void Release()
            {
                Pool.Free(ref ppAttack);
            }
        }
Exemplo n.º 2
0
        public static bool Silent(PlayerProjectileAttack attack)
        {
            if (Instance.TargetPlayer != null)
            {
                EHumanBone typeHit = OpCodes.GetTargetHit(0, Settings.Aimbot_Range_Manual_AutoHeadshot);

                var hitPosition = Instance.TargetPlayer.Position + new Vector3(0, 50, 0);
                var distance    = Vector3.Distance(LocalPlayer.EyePos, hitPosition);
                var distance2   = Vector3.Distance(LocalPlayer.Position, attack.playerAttack.attack.hitPositionWorld);
//                ConsoleSystem.Log("Distance2 => " +distance2);
//                ConsoleSystem.Log("Distance => " +GetTimeout(FiredProjectiles[attack.playerAttack.projectileID], distance2));
                float timeout = 0;
                if (distance2 < distance)
                {
                    timeout = GetTimeout(FiredProjectiles[attack.playerAttack.projectileID], distance - distance2);
                }
                if (timeout <= 0)
                {
                    timeout = 0.001f;
                }
                ConsoleSystem.LogWarning("[Silent] Sleep => " + timeout);
                var player     = Instance.TargetPlayer;
                var attackCopy = attack.Copy();
                SapphireEngine.Functions.Timer.SetTimeout(() => SendRangeAttack(player, typeHit, attackCopy, hitPosition), timeout);
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
 private bool RPC_OnProjectileAttack(ERPCNetworkType type, Message message)
 {
     using (PlayerProjectileAttack attack = PlayerProjectileAttack.Deserialize(message.read))
     {
         UInt32 hitId     = attack.playerAttack.attack.hitID;
         UInt32 hitBone   = attack.playerAttack.attack.hitBone;
         var    hitPlayer = Get <BasePlayer>(hitId);
         if (Settings.Aimbot_Range_Silent)
         {
             if (hitId == 0)
             {
                 return(RangeAim.Silent(attack));
             }
             if (hitPlayer == null && hitId != 0 && RangeAim.Instance.TargetPlayer != null)
             {
                 var hitPost = attack.playerAttack.attack.hitPositionWorld;
                 if (Vector3.Distance(Position, RangeAim.Instance.TargetPlayer.Position) < 2.5f ||
                     Vector3.Distance(Position, hitPost) > 2.5f)
                 {
                     ConsoleSystem.Log("near wall not found");
                     return(RangeAim.Silent(attack));
                 }
                 ConsoleSystem.Log("Ignore because near wall");
                 return(false);
             }
         }
         if (hitPlayer && hitPlayer.IsAlive)
         {
             RangeAim.Instance.TargetPlayer = Get <BasePlayer>(hitId);
             return(RangeAim.Manual(attack));
         }
     }
     return(false);
 }
Exemplo n.º 4
0
        // Token: 0x0600012B RID: 299 RVA: 0x0000A294 File Offset: 0x00008494
        public static bool SendRangeAttack(BasePlayer target, EHumanBone typeHit, PlayerProjectileAttack parentAttack, Vector3 pos)
        {
            bool isAlive = target.IsAlive;

            if (isAlive)
            {
                parentAttack.hitDistance = Vector3.Distance(target.Position, BasePlayer.LocalPlayer.Position);
                HitInfo hitInfo = OpCodes.GetTargetHitInfo(typeHit);
                parentAttack.playerAttack.attack.hitBone          = hitInfo.HitBone;
                parentAttack.playerAttack.attack.hitPartID        = hitInfo.HitPartID;
                parentAttack.playerAttack.attack.hitNormalLocal   = hitInfo.HitNormalPos;
                parentAttack.playerAttack.attack.hitPositionLocal = hitInfo.HitLocalPos;
                parentAttack.playerAttack.attack.hitID            = target.UID;
                float height = target.GetHeight();
                parentAttack.playerAttack.attack.hitPositionWorld = pos;
                parentAttack.playerAttack.attack.hitNormalWorld   = pos;
                parentAttack.playerAttack.attack.pointEnd         = pos;
                VirtualServer.BaseClient.write.Start();
                VirtualServer.BaseClient.write.PacketID(Message.Type.RPCMessage);
                VirtualServer.BaseClient.write.UInt32(RangeAim.LocalPlayer.UID);
                VirtualServer.BaseClient.write.UInt32(3322107216u);
                PlayerProjectileAttack.Serialize(VirtualServer.BaseClient.write, parentAttack);
                VirtualServer.BaseClient.write.Send(new SendInfo(VirtualServer.BaseClient.Connection));
            }
            return(true);
        }
Exemplo n.º 5
0
 public static bool Manual(PlayerProjectileAttack attack)
 {
     if (Instance.TargetPlayer != null)
     {
         EHumanBone typeHit = OpCodes.GetTargetHit((EHumanBone)attack.playerAttack.attack.hitBone, Settings.Aimbot_Range_Manual_AutoHeadshot);
         SendRangeAttack(Instance.TargetPlayer, typeHit, attack, Instance.TargetPlayer.Position);
         return(true);
     }
     return(false);
 }
Exemplo n.º 6
0
        // Token: 0x0600012A RID: 298 RVA: 0x0000A22C File Offset: 0x0000842C
        public static bool Manual(PlayerProjectileAttack attack)
        {
            bool flag = RangeAim.Instance.TargetPlayer != null;
            bool result;

            if (flag)
            {
                EHumanBone typeHit = OpCodes.GetTargetHit((EHumanBone)attack.playerAttack.attack.hitBone, Settings.Aimbot_Range_Manual_AutoHeadshot);
                RangeAim.SendRangeAttack(RangeAim.Instance.TargetPlayer, typeHit, attack, RangeAim.Instance.TargetPlayer.Position);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Exemplo n.º 7
0
        // Token: 0x06000129 RID: 297 RVA: 0x0000A110 File Offset: 0x00008310
        public static bool Silent(PlayerProjectileAttack attack)
        {
            bool aimbot_Range_Manual_AutoHeadshot = Settings.Aimbot_Range_Manual_AutoHeadshot;

            if (aimbot_Range_Manual_AutoHeadshot)
            {
            }
            bool flag = RangeAim.Instance.TargetPlayer != null;
            bool result;

            if (flag)
            {
                EHumanBone typeHit     = OpCodes.GetTargetHit((EHumanBone)0u, Settings.Aimbot_Range_Manual_AutoHeadshot);
                Vector3    hitPosition = RangeAim.Instance.TargetPlayer.Position;
                float      distance    = Vector3.Distance(RangeAim.LocalPlayer.EyePos, hitPosition);
                float      distance2   = Vector3.Distance(RangeAim.LocalPlayer.Position, attack.playerAttack.attack.hitPositionWorld);
                float      timeout     = 0f;
                bool       flag2       = distance2 < distance;
                if (flag2)
                {
                    timeout = RangeAim.GetTimeout(RangeAim.FiredProjectiles[attack.playerAttack.projectileID], distance - distance2);
                }
                bool flag3 = timeout <= 0f;
                if (flag3)
                {
                    timeout = 0.001f;
                }
                BasePlayer             player     = RangeAim.Instance.TargetPlayer;
                PlayerProjectileAttack attackCopy = attack.Copy();
                Timer.SetTimeout(delegate
                {
                    RangeAim.SendRangeAttack(player, typeHit, attackCopy, hitPosition);
                }, timeout);
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Exemplo n.º 8
0
        public static bool SendRangeAttack(BasePlayer target, EHumanBone typeHit,
                                           PlayerProjectileAttack parentAttack, Vector3 pos)
        {
            if (target.IsAlive)
            {
                parentAttack.hitDistance = Vector3.Distance(target.Position, BasePlayer.LocalPlayer.Position);
                var hitInfo = OpCodes.GetTargetHitInfo(typeHit);
                parentAttack.playerAttack.attack.hitBone          = hitInfo.HitBone;
                parentAttack.playerAttack.attack.hitPartID        = hitInfo.HitPartID;
                parentAttack.playerAttack.attack.hitNormalLocal   = hitInfo.HitNormalPos;
                parentAttack.playerAttack.attack.hitPositionLocal = hitInfo.HitLocalPos;
                parentAttack.playerAttack.attack.hitID            = target.UID;

                float height = target.GetHeight();
                // TODO: Change this

                /*if (pos == Vector3.zero)
                 *  pos = target.Position + new Vector3(0, 50, 0);*/
                //DDraw.Arrow(target.Position + new Vector3(0, height, 0), pos, 0.1f, Color.blue, 15f);
                parentAttack.playerAttack.attack.hitPositionWorld = pos;
                parentAttack.playerAttack.attack.hitNormalWorld   = pos;
                parentAttack.playerAttack.attack.pointEnd         = pos;

//                var forward = GetForward();
//                parentAttack.playerAttack.attack.hitPositionWorld = EyePos + GetForward();
//                parentAttack.playerAttack.attack.hitNormalWorld = EyePos + GetForward();
//                parentAttack.playerAttack.attack.pointEnd = EyePos + GetForward();

                VirtualServer.BaseClient.write.Start();
                VirtualServer.BaseClient.write.PacketID(Message.Type.RPCMessage);
                VirtualServer.BaseClient.write.UInt32(LocalPlayer.UID);
                VirtualServer.BaseClient.write.UInt32((uint)ERPCMethodUID.OnProjectileAttack);
                PlayerProjectileAttack.Serialize(VirtualServer.BaseClient.write, parentAttack);
                VirtualServer.BaseClient.write.Send(new SendInfo(VirtualServer.BaseClient.Connection));
            }
            return(true);
        }