public static bool Prefix(Scp106PlayerScript __instance)
        {
            try
            {
                if (!__instance._interactRateLimit.CanExecute(true))
                {
                    return(false);
                }
                if (!__instance.GetComponent <FallDamage>().isGrounded)
                {
                    return(false);
                }

                bool allow = true;

                Events.InvokeScp106Teleport(__instance.gameObject, __instance.portalPosition, ref allow);

                if (!allow)
                {
                    return(false);
                }

                if (__instance.iAm106 && __instance.portalPosition != Vector3.zero && !__instance.goingViaThePortal)
                {
                    Timing.RunCoroutine(__instance._DoTeleportAnimation(), Segment.Update);
                }
                return(true);
            }
            catch (Exception e)
            {
                Log.Error($"SCP106Portal Error: {e}");
                return(true);
            }
        }
Exemplo n.º 2
0
        private static bool Prefix(Scp106PlayerScript __instance)
        {
            if (!__instance._interactRateLimit.CanExecute(false) || !__instance.GetComponent <FallDamage>().isGrounded)
            {
                return(false);
            }

            var ev = new TeleportingEventArgs(API.Features.Player.Get(__instance.gameObject), __instance.portalPosition);

            Scp106.OnTeleporting(ev);

            __instance.portalPosition = ev.PortalPosition;

            if (!ev.IsAllowed)
            {
                return(false);
            }

            if (__instance.iAm106 && __instance.portalPosition != Vector3.zero && !__instance.goingViaThePortal)
            {
                Timing.RunCoroutine(__instance._DoTeleportAnimation(), Segment.Update);
            }

            return(true);
        }
Exemplo n.º 3
0
        public static bool Prefix(Scp106PlayerScript __instance)
        {
            if (ForceDisable)
            {
                return(true);
            }
            if (!__instance.GetComponent <FallDamage>().isGrounded || !__instance.iAm106 || __instance.goingViaThePortal)
            {
                return(false);
            }

            return(StalkyMethods.Stalk(__instance));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Prefix of <see cref="Scp106PlayerScript.CallCmdMakePortal"/>.
        /// </summary>
        /// <param name="__instance">The <see cref="Scp106PlayerScript"/> instance.</param>
        /// <returns>Returns a value indicating whether the original method has to be executed or not.</returns>
        private static bool Prefix(Scp106PlayerScript __instance)
        {
            if (!__instance._interactRateLimit.CanExecute(true) || !__instance.GetComponent <FallDamage>().isGrounded)
            {
                return(false);
            }

            bool rayCastHit = Physics.Raycast(new Ray(__instance.transform.position, -__instance.transform.up), out RaycastHit raycastHit, 10f, __instance.teleportPlacementMask);

            var ev = new CreatingPortalEventArgs(API.Features.Player.Get(__instance.gameObject), raycastHit.point - Vector3.up);

            Scp106.OnCreatingPortal(ev);

            Debug.DrawRay(__instance.transform.position, -__instance.transform.up, Color.red, 10f);

            if (ev.IsAllowed && __instance.iAm106 && !__instance.goingViaThePortal && rayCastHit)
            {
                __instance.SetPortalPosition(ev.Position);
            }

            return(false);
        }
Exemplo n.º 5
0
        public static bool Prefix(Scp106PlayerScript __instance)
        {
            if (EventPlugin.Scp106CreatedPortalEventDisable)
            {
                return(true);
            }

            try
            {
                if (!__instance._interactRateLimit.CanExecute(true) || !__instance.GetComponent <FallDamage>().isGrounded)
                {
                    return(false);
                }

                bool rayCastHit = Physics.Raycast(new Ray(__instance.transform.position, -__instance.transform.up), out RaycastHit raycastHit, 10f, __instance.teleportPlacementMask);

                bool    allow          = true;
                Vector3 portalPosition = raycastHit.point - Vector3.up;

                Events.InvokeScp106CreatedPortal(__instance.gameObject, ref allow, ref portalPosition);

                Debug.DrawRay(__instance.transform.position, -__instance.transform.up, Color.red, 10f);

                if (allow && __instance.iAm106 && !__instance.goingViaThePortal && rayCastHit)
                {
                    __instance.SetPortalPosition(portalPosition);
                }

                return(false);
            }
            catch (Exception exception)
            {
                Log.Error($"Scp106CreatedPortalEvent error: {exception}");
                return(true);
            }
        }
Exemplo n.º 6
0
        private static bool Prefix(Scp106PlayerScript __instance, GameObject ply, int t)
        {
            try
            {
                if (!__instance._iawRateLimit.CanExecute(true))
                {
                    return(false);
                }
                if (ply == null)
                {
                    return(false);
                }

                ReferenceHub          hub       = ReferenceHub.GetHub(ply);
                CharacterClassManager component = hub.characterClassManager;
                if (component == null)
                {
                    return(false);
                }
                if (!ServerTime.CheckSynchronization(t) || !__instance.iAm106 ||
                    Vector3.Distance(__instance.GetComponent <PlayerMovementSync>().RealModelPosition, ply.transform.position) >= 3f || !component.IsHuman())
                {
                    return(false);
                }

                if (component.GodMode)
                {
                    return(false);
                }
                if (component.Classes.SafeGet(component.CurClass).team == Team.SCP)
                {
                    return(false);
                }

                __instance.GetComponent <CharacterClassManager>().RpcPlaceBlood(ply.transform.position, 1, 2f);
                if (Scp106PlayerScript._blastDoor.isClosed)
                {
                    __instance.GetComponent <CharacterClassManager>().RpcPlaceBlood(ply.transform.position, 1, 2f);
                    __instance.GetComponent <PlayerStats>().HurtPlayer(
                        new PlayerStats.HitInfo(500f, __instance.GetComponent <NicknameSync>().MyNick + " (" + __instance.GetComponent <CharacterClassManager>().UserId + ")", DamageTypes.Scp106, __instance.GetComponent <QueryProcessor>().PlayerId), ply);
                }
                else
                {
                    CharacterClassManager component3 = ply.GetComponent <CharacterClassManager>();

                    foreach (Scp079PlayerScript scp079PlayerScript in Scp079PlayerScript.instances)
                    {
                        Scp079Interactable.ZoneAndRoom
                                                otherRoom            = ply.GetComponent <Scp079PlayerScript>().GetOtherRoom();
                        Scp079Interactable.InteractableType[] filter = new Scp079Interactable.InteractableType[]
                        {
                            Scp079Interactable.InteractableType.Door, Scp079Interactable.InteractableType.Light,
                            Scp079Interactable.InteractableType.Lockdown, Scp079Interactable.InteractableType.Tesla,
                            Scp079Interactable.InteractableType.ElevatorUse,
                        };
                        bool flag = false;
                        foreach (Scp079Interaction scp079Interaction in scp079PlayerScript.ReturnRecentHistory(12f, filter))
                        {
                            foreach (Scp079Interactable.ZoneAndRoom zoneAndRoom in scp079Interaction.interactable
                                     .currentZonesAndRooms)
                            {
                                if (zoneAndRoom.currentZone == otherRoom.currentZone &&
                                    zoneAndRoom.currentRoom == otherRoom.currentRoom)
                                {
                                    flag = true;
                                }
                            }
                        }

                        if (flag)
                        {
                            scp079PlayerScript.RpcGainExp(ExpGainType.PocketAssist, component3.CurClass);
                        }
                    }

                    var ev = new EnteringPocketDimensionEventArgs(API.Features.Player.Get(ply), Vector3.down * 1998.5f);

                    Player.OnEnteringPocketDimension(ev);

                    if (!ev.IsAllowed)
                    {
                        return(false);
                    }

                    ply.GetComponent <PlayerMovementSync>().OverridePosition(ev.Position, 0f, true);

                    __instance.GetComponent <PlayerStats>().HurtPlayer(
                        new PlayerStats.HitInfo(40f, __instance.GetComponent <NicknameSync>().MyNick + " (" + __instance.GetComponent <CharacterClassManager>().UserId + ")", DamageTypes.Scp106, __instance.GetComponent <QueryProcessor>().PlayerId), ply);
                }

                PlayerEffectsController effectsController = hub.playerEffectsController;
                effectsController.GetEffect <Corroding>().IsInPd = true;
                effectsController.EnableEffect <Corroding>(0.0f, false);

                return(false);
            }
            catch (Exception e)
            {
                Exiled.API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.EnteringPocketDimension: {e}\n{e.StackTrace}");

                return(true);
            }
        }
Exemplo n.º 7
0
        public static bool Prefix(Scp106PlayerScript __instance, GameObject ply, int t)
        {
            try
            {
                if (!__instance._iawRateLimit.CanExecute())
                {
                    return(false);
                }
                if (ply == null)
                {
                    return(false);
                }

                var player           = ply.GetPlayer();
                var charClassManager = player.ClassManager;

                if (charClassManager == null || charClassManager.GodMode || charClassManager.IsAnyScp())
                {
                    return(false);
                }

                if (!ServerTime.CheckSynchronization(t) || !__instance.iAm106 ||
                    Vector3.Distance(__instance.hub.playerMovementSync.RealModelPosition, ply.transform.position) >=
                    3f || !charClassManager.IsHuman())
                {
                    return(false);
                }

                if (Scp106PlayerScript._blastDoor.isClosed)
                {
                    __instance.hub.characterClassManager.RpcPlaceBlood(ply.transform.position, 1, 2f);
                    __instance.hub.playerStats.HurtPlayer(
                        new PlayerStats.HitInfo(500f,
                                                $"{__instance.GetComponent<NicknameSync>().MyNick} ({__instance.hub.characterClassManager.UserId})",
                                                DamageTypes.Scp106, __instance.GetComponent <RemoteAdmin.QueryProcessor>().PlayerId), ply);
                }
                else
                {
                    foreach (var scp079PlayerScript in Scp079PlayerScript.instances)
                    {
                        var otherRoom = ply.GetComponent <Scp079PlayerScript>().GetOtherRoom();
                        var filter    = new[]
                        {
                            Scp079Interactable.InteractableType.Door,
                            Scp079Interactable.InteractableType.Light,
                            Scp079Interactable.InteractableType.Lockdown,
                            Scp079Interactable.InteractableType.Tesla,
                            Scp079Interactable.InteractableType.ElevatorUse
                        };
                        var flag = false;
                        foreach (var zoneAndRoom in from scp079Interaction in scp079PlayerScript.ReturnRecentHistory(12f,
                                                                                                                     filter) from zoneAndRoom in scp079Interaction.interactable
                                 .currentZonesAndRooms where zoneAndRoom.currentZone == otherRoom.currentZone &&
                                 zoneAndRoom.currentRoom == otherRoom.currentRoom select zoneAndRoom)
                        {
                            flag = true;
                        }

                        if (flag)
                        {
                            scp079PlayerScript.RpcGainExp(ExpGainType.PocketAssist, player.ClassManager.CurClass);
                        }
                    }
                }

                var canEnter = true;
                Events.InvokePocketDimensionEnterEvent(player, ref canEnter);
                if (!canEnter)
                {
                    return(false);
                }

                __instance.hub.playerStats.HurtPlayer(
                    new PlayerStats.HitInfo(40f,
                                            $"{__instance.GetComponent<NicknameSync>().MyNick} ({__instance.hub.characterClassManager.UserId})",
                                            DamageTypes.Scp106, __instance.GetComponent <RemoteAdmin.QueryProcessor>().PlayerId), ply);

                player.Position = Vector3.down * 1998.5f;
                player.EffectsController.GetEffect <Corroding>().IsInPd = true;
                player.EffectsController.EnableEffect <Corroding>();

                return(false);
            }
            catch (Exception e)
            {
                Log.Error($"PocketDimEnter Err: {e}");
                return(true);
            }
        }
Exemplo n.º 8
0
		public static bool Prefix(Scp106PlayerScript __instance, GameObject ply, int t)
		{
			if (EventPlugin.Scp106PocketDimensionDamageEventPatchDisable)
				return true;

			try
			{
				if (!__instance._iawRateLimit.CanExecute(true))
					return false;
				if (ply == null)
					return false;

				CharacterClassManager component = ply.GetComponent<CharacterClassManager>();
				if (component == null)
					return false;
				if (!ServerTime.CheckSynchronization(t) || !__instance.iAm106 ||
					Vector3.Distance(__instance.GetComponent<PlyMovementSync>().RealModelPosition,
						ply.transform.position) >= 3f || !component.IsHuman())
					return false;

				CharacterClassManager component2 = ply.GetComponent<CharacterClassManager>();
				if (component2.GodMode)
					return false;
				if (component2.Classes.SafeGet(component2.CurClass).team == Team.SCP)
					return false;

				__instance.GetComponent<CharacterClassManager>().RpcPlaceBlood(ply.transform.position, 1, 2f);
				if (Scp106PlayerScript.blastDoor.isClosed)
				{
					__instance.GetComponent<CharacterClassManager>().RpcPlaceBlood(ply.transform.position, 1, 2f);
					__instance.GetComponent<PlayerStats>().HurtPlayer(
						new PlayerStats.HitInfo(500f,
							__instance.GetComponent<NicknameSync>().MyNick + " (" +
							__instance.GetComponent<CharacterClassManager>().UserId + ")", DamageTypes.Scp106,
							__instance.GetComponent<QueryProcessor>().PlayerId), ply);
				}
				else
				{
					CharacterClassManager component3 = ply.GetComponent<CharacterClassManager>();
					// 079 shit
					foreach (Scp079PlayerScript scp079PlayerScript in Scp079PlayerScript.instances)
					{
						Scp079Interactable.ZoneAndRoom
							otherRoom = ply.GetComponent<Scp079PlayerScript>().GetOtherRoom();
						Scp079Interactable.InteractableType[] filter = new Scp079Interactable.InteractableType[]
						{
							Scp079Interactable.InteractableType.Door, Scp079Interactable.InteractableType.Light,
							Scp079Interactable.InteractableType.Lockdown, Scp079Interactable.InteractableType.Tesla,
							Scp079Interactable.InteractableType.ElevatorUse
						};
						bool flag = false;
						foreach (Scp079Interaction scp079Interaction in scp079PlayerScript.ReturnRecentHistory(12f,
							filter))
						{
							foreach (Scp079Interactable.ZoneAndRoom zoneAndRoom in scp079Interaction.interactable
								.currentZonesAndRooms)
							{
								if (zoneAndRoom.currentZone == otherRoom.currentZone &&
									zoneAndRoom.currentRoom == otherRoom.currentRoom)
								{
									flag = true;
								}
							}
						}

						if (flag)
						{
							scp079PlayerScript.RpcGainExp(ExpGainType.PocketAssist, component3.CurClass);
						}
					}

					// Invoke enter

					bool allowEnter = true;

					Events.InvokePocketDimEnter(ply, ref allowEnter);

					if (!allowEnter)
						return false;

					ply.GetComponent<PlyMovementSync>().OverridePosition(Vector3.down * 1998.5f, 0f, true);

					// Invoke damage.

					bool allowDamage = true;


					Events.InvokePocketDimDamage(ply, ref allowDamage);

					if (allowDamage)
						__instance.GetComponent<PlayerStats>().HurtPlayer(
							new PlayerStats.HitInfo(40f,
								__instance.GetComponent<NicknameSync>().MyNick + " (" +
								__instance.GetComponent<CharacterClassManager>().UserId + ")", DamageTypes.Scp106,
								__instance.GetComponent<QueryProcessor>().PlayerId), ply);

				}

				PlayerEffectsController componentInParent = ply.GetComponentInParent<PlayerEffectsController>();
				componentInParent.GetEffect<Corroding>("Corroding").isInPd = true;
				componentInParent.EnableEffect("Corroding");

				return false;
			}
			catch (Exception exception)
			{
				Log.Error($"PocketDimDamageEvent error: {exception}");
				return true;
			}
		}