Пример #1
0
        // Token: 0x06000238 RID: 568 RVA: 0x00015488 File Offset: 0x00013688
        public static bool GenerateRaycast(out RaycastInfo info)
        {
            ItemWeaponAsset itemWeaponAsset = Player.player.equipment.asset as ItemWeaponAsset;
            float           range           = (itemWeaponAsset != null) ? Mathf.Max(itemWeaponAsset.range, 20f) : 20f;
            GameObject      @object;
            Vector3         point;

            if (!RaycastUtilities.GetTargetObject(out @object, out point, range))
            {
                info = RaycastUtilities.GenerateOriginalRaycast(new Ray(Player.player.look.aim.position, Player.player.look.aim.forward), range, RayMasks.DAMAGE_CLIENT, null);
                return(false);
            }
            info = RaycastUtilities.GenerateRaycast(@object, point);
            return(true);
        }
        public static RaycastInfo OV_raycast(Ray ray, float range, int mask, Player ignorePlayer)
        {
            OverrideType ovtype = OV_DamageTool.OVType;

            if (ovtype == OverrideType.Extended)
            {
                RaycastInfo raycastInfo = RaycastUtilities.GenerateOriginalRaycast(ray, Mathf.Max(20f, range), mask, ignorePlayer);
                float       num         = MiscOptions.ExtendRangeBypass ? range : Mathf.Max(5.5f, range);
                raycastInfo.point = ((Vector3.Distance(raycastInfo.point, ray.origin) > num) ? (ray.direction * num + ray.origin) : raycastInfo.point);
                return(raycastInfo);
            }
            if (ovtype == OverrideType.SilentAimMelee)
            {
                RaycastInfo raycastInfo2;
                if (!RaycastUtilities.GenerateRaycast(out raycastInfo2) && !MiscOptions.ExtendMeleeRange)
                {
                    raycastInfo2 = RaycastUtilities.GenerateOriginalRaycast(ray, range, mask, ignorePlayer);
                }
                float num2 = MiscOptions.ExtendRangeBypass ? range : Mathf.Max(5.5f, range);
                raycastInfo2.point = ((Vector3.Distance(raycastInfo2.point, ray.origin) > num2) ? (ray.direction * num2 + ray.origin) : raycastInfo2.point);
                return(raycastInfo2);
            }
            return(RaycastUtilities.GenerateOriginalRaycast(ray, range, mask, ignorePlayer));
        }
        public void OV_ballistics()
        {
            if (Provider.isServer || MiscOptions.PanicMode)
            {
                OverrideUtilities.CallOriginal(this, Array.Empty <object>());
                return;
            }
            if (Time.realtimeSinceStartup - PlayerLifeUI.hitmarkers[0].lastHit > PlayerUI.HIT_TIME)
            {
                PlayerLifeUI.hitmarkers[0].hitBuildImage.isVisible    = false;
                PlayerLifeUI.hitmarkers[0].hitCriticalImage.isVisible = false;
                PlayerLifeUI.hitmarkers[0].hitEntitiyImage.isVisible  = false;
            }
            ItemGunAsset itemGunAsset = (ItemGunAsset)Player.player.equipment.asset;
            PlayerLook   look         = Player.player.look;

            if (itemGunAsset.projectile != null)
            {
                return;
            }
            List <BulletInfo> list = (List <BulletInfo>)OV_UseableGun.BulletsField.GetValue(this);

            if (list.Count == 0)
            {
                return;
            }
            RaycastInfo raycastInfo = null;

            if (RaycastOptions.Enabled)
            {
                RaycastUtilities.GenerateRaycast(out raycastInfo);
            }
            if (Provider.modeConfigData.Gameplay.Ballistics)
            {
                if (raycastInfo == null)
                {
                    if (AimbotCoroutines.IsAiming && AimbotCoroutines.LockedObject != null)
                    {
                        Vector3    aimPosition = AimbotCoroutines.GetAimPosition(AimbotCoroutines.LockedObject.transform, "Skull");
                        Ray        aimRay      = VectorUtilities.GetAimRay(look.aim.position, aimPosition);
                        float      maxDistance = Vector3.Distance(look.aim.position, aimPosition);
                        RaycastHit raycastHit;
                        if (!Physics.Raycast(aimRay, out raycastHit, maxDistance, RayMasks.DAMAGE_SERVER))
                        {
                            raycastInfo = RaycastUtilities.GenerateOriginalRaycast(aimRay, itemGunAsset.range, RayMasks.ENEMY, null);
                        }
                    }
                    if (raycastInfo == null)
                    {
                        OverrideUtilities.CallOriginal(this, Array.Empty <object>());
                        return;
                    }
                }
                for (int i = 0; i < list.Count; i++)
                {
                    BulletInfo bulletInfo = list[i];
                    float      num        = Vector3.Distance(Player.player.transform.position, raycastInfo.point);
                    if ((float)bulletInfo.steps * itemGunAsset.ballisticTravel >= num)
                    {
                        EPlayerHit newHit = OV_UseableGun.CalcHitMarker(itemGunAsset, ref raycastInfo);
                        PlayerUI.hitmark(0, Vector3.zero, false, newHit);
                        Player.player.input.sendRaycast(raycastInfo);
                        bulletInfo.steps = 254;
                    }
                }
                for (int j = list.Count - 1; j >= 0; j--)
                {
                    BulletInfo bulletInfo2 = list[j];
                    bulletInfo2.steps += 1;
                    if (bulletInfo2.steps >= itemGunAsset.ballisticSteps)
                    {
                        list.RemoveAt(j);
                    }
                }
                return;
            }
            if (raycastInfo == null)
            {
                OverrideUtilities.CallOriginal(this, Array.Empty <object>());
                return;
            }
            for (int k = 0; k < list.Count; k++)
            {
                EPlayerHit newHit2 = OV_UseableGun.CalcHitMarker(itemGunAsset, ref raycastInfo);
                PlayerUI.hitmark(0, Vector3.zero, false, newHit2);
                Player.player.input.sendRaycast(raycastInfo);
            }
            list.Clear();
        }
Пример #4
0
        // Token: 0x0600023A RID: 570 RVA: 0x000155C4 File Offset: 0x000137C4
        public static bool GetTargetObject(out GameObject Object, out Vector3 Point, float Range)
        {
            float num  = Range + 1f;
            float num2 = RaycastOptions.SilentAimFOV;

            Object = null;
            Point  = Vector3.zero;
            Vector3 position = Player.player.look.aim.position;
            Vector3 forward  = Player.player.look.aim.forward;

            foreach (GameObject gameObject in RaycastUtilities.Objects)
            {
                if (gameObject)
                {
                    Player component = gameObject.GetComponent <Player>();
                    if (!component || (!component.life.isDead && !FriendUtilities.IsFriendly(component) && (!RaycastOptions.WallCheck || RaycastUtilities.WallCheck(gameObject.transform))))
                    {
                        Zombie componentInParent  = gameObject.GetComponentInParent <Zombie>();
                        Animal componentInParent2 = gameObject.GetComponentInParent <Animal>();
                        if ((!componentInParent || !componentInParent.isDead) && (!componentInParent2 || !componentInParent2.isDead))
                        {
                            if (!gameObject.GetComponent <RaycastComponent>())
                            {
                                gameObject.AddComponent <RaycastComponent>();
                            }
                            Transform transform = gameObject.transform;
                            Vector3   vector    = transform.position;
                            float     num3      = Vector3.Distance(position, vector);
                            if (num3 <= Range)
                            {
                                if (RaycastOptions.SilentAimUseFOV)
                                {
                                    if (transform.CompareTag("Player") || transform.CompareTag("Enemy") || transform.CompareTag("Zombie") || transform.CompareTag("Animal"))
                                    {
                                        foreach (Transform transform2 in transform.GetComponentsInChildren <Transform>())
                                        {
                                            if (transform2.name.Equals("Skull"))
                                            {
                                                vector = transform2.position + new Vector3(0f, 0.4f, 0f);
                                                break;
                                            }
                                        }
                                    }
                                    float angleDelta = VectorUtilities.GetAngleDelta(position, forward, vector);
                                    if (angleDelta > num2)
                                    {
                                        continue;
                                    }
                                    num2 = angleDelta;
                                }
                                else if (num3 > num)
                                {
                                    continue;
                                }
                                if (SphereUtilities.GetRaycast(gameObject, position, out Point))
                                {
                                    Object = gameObject;
                                    num    = num3;
                                }
                            }
                        }
                    }
                }
            }
            return(Object != null);
        }