コード例 #1
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);
            }
        }
コード例 #2
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;
			}
		}
コード例 #3
0
        public static bool Prefix(SinkholeEnvironmentalHazard __instance, GameObject player)
        {
            // Check if player has a connection to the server.
            if (!NetworkServer.active)
            {
                return(false);
            }

            PlayerEffectsController componentInParent = player.GetComponentInParent <PlayerEffectsController>();

            if (componentInParent == null)
            {
                return(false);
            }

            componentInParent.GetEffect <CustomPlayerEffects.SinkHole>();

            // Check if the player walking into a sinkhole is an SCP or not.
            if (__instance.SCPImmune)
            {
                CharacterClassManager component = player.GetComponent <CharacterClassManager>();
                if (component == null || component.IsAnyScp())
                {
                    return(false);
                }
            }

            // Check if player is in god mode.
            Player ply = Player.Get(player);

            if (ply.IsGodModeEnabled)
            {
                return(false);
            }

            // If a player is out of a sinkhole's range.
            if (Vector3.Distance(player.transform.position, __instance.transform.position) > (double)__instance.DistanceToBeAffected * BetterSinkholes.config.SlowDistance)
            {
                // If player doesn't have a sinkhole effect don't remove it.
                if (player.TryGetComponent(out PlayerEffectsController pec))
                {
                    CustomPlayerEffects.SinkHole SinkholeEffect = pec.GetEffect <CustomPlayerEffects.SinkHole>();

                    // // If the player has the sinkhole effect, remove it.
                    if (SinkholeEffect != null && SinkholeEffect.Enabled)
                    {
                        componentInParent.DisableEffect <CustomPlayerEffects.SinkHole>();
                    }

                    return(false);
                }

                return(false);
            }

            // Check distance from the sinkhole's center.
            if (Vector3.Distance(player.transform.position, __instance.transform.position) < (double)__instance.DistanceToBeAffected * BetterSinkholes.config.TeleportDistance)
            {
                // Remove Sinkhole effect once falling into a sinkhole.
                componentInParent.DisableEffect <CustomPlayerEffects.SinkHole>();

                // Teleport player once walking too close to the center of a sinkhole.
                ReferenceHub referenceHub = ReferenceHub.GetHub(player);
                referenceHub.playerMovementSync.OverridePosition(Vector3.down * 1998.5f, 0f, true);

                // Apply corrosion effect.
                PlayerEffectsController playerEffectsController = referenceHub.playerEffectsController;
                playerEffectsController.GetEffect <CustomPlayerEffects.Corroding>().IsInPd = true;
                playerEffectsController.EnableEffect <CustomPlayerEffects.Corroding>(0f, false);

                // Send player a broadcast specified in the configs. Default: "" for 0U duration.
                QueryProcessor.Localplayer.GetComponent <Broadcast>().TargetAddElement(player.gameObject.GetComponent <NetworkIdentity>().connectionToClient, BetterSinkholes.config.TeleportMessage, BetterSinkholes.config.TeleportMessageDuration, Broadcast.BroadcastFlags.Normal);
                return(false);
            }

            componentInParent.EnableEffect <CustomPlayerEffects.SinkHole>(0f, false);
            return(false);
        }
コード例 #4
0
        public void EnableEffects(PlayerEffectsController controller)
        {
            if (plugin.Config.amnesia)
            {
                controller.EnableEffect <Amnesia>(plugin.Config.amnesiaDuration);
            }

            if (plugin.Config.asphyxiated)
            {
                controller.EnableEffect <Asphyxiated>(plugin.Config.asphyxiatedDuration);
            }

            if (plugin.Config.blinded)
            {
                controller.EnableEffect <Blinded>(plugin.Config.blindedDuration);
            }

            if (plugin.Config.concussed)
            {
                controller.EnableEffect <Concussed>(plugin.Config.concussedDuration);
            }

            if (plugin.Config.deafened)
            {
                controller.EnableEffect <Deafened>(plugin.Config.deafenedDuration);
            }

            if (plugin.Config.disabled)
            {
                controller.EnableEffect <Disabled>(plugin.Config.disabledDuration);
            }

            if (plugin.Config.ensnared)
            {
                controller.EnableEffect <Ensnared>(plugin.Config.ensnaredDuration);
            }

            if (plugin.Config.exhausted)
            {
                controller.EnableEffect <Exhausted>(plugin.Config.exhaustedDuration);
            }

            if (plugin.Config.flash)
            {
                controller.EnableEffect <Flashed>(plugin.Config.flashDuration);
            }

            if (plugin.Config.poisoned)
            {
                controller.EnableEffect <Poisoned>(plugin.Config.poisonedDuration);
            }

            if (plugin.Config.bleeding)
            {
                controller.EnableEffect <Bleeding>(plugin.Config.bleedingDuration);
            }

            if (plugin.Config.sinkhole)
            {
                controller.EnableEffect <SinkHole>(plugin.Config.sinkholeDuration);
            }

            if (plugin.Config.speed)
            {
                controller.EnableEffect <Scp207>(plugin.Config.speedDuration);
            }

            if (plugin.Config.hemorrhage)
            {
                //hemrorrrogohgage
                controller.EnableEffect <Hemorrhage>(plugin.Config.hemorrhageDuration);
            }

            if (plugin.Config.decontaminating)
            {
                controller.EnableEffect <Decontaminating>(plugin.Config.decontaminatingDuration, true);
            }
        }
コード例 #5
0
        public void Sleep(Player player)
        {
            try {
                // Initialize variables & add player to list
                Vector3 oldPos = player.Position;
                PlayerEffectsController controller = player.ReferenceHub.playerEffectsController;
                tranquilized.Add(player.Nickname);
                float sleepDuration = UnityEngine.Random.Range(plugin.Config.sleepDurationMin, plugin.Config.sleepDurationMax), bdd = controller.GetEffect <Bleeding>().Duration;
                bool  pd = controller.GetEffect <Corroding>().Enabled, bd = controller.GetEffect <Bleeding>().Enabled;

                // Broadcast message (if enabled)
                if (plugin.Config.tranquilizedBroadcastDuration > 0)
                {
                    if (plugin.Config.UseHintsSystem)
                    {
                        player.ShowHint(plugin.Config.tranquilizedBroadcastDuration, plugin.Config.tranquilizedBroadcast.Replace("%seconds", ((int)sleepDuration).ToString()));
                    }
                    else
                    {
                        if (plugin.Config.clearBroadcasts)
                        {
                            player.ClearBroadcasts();
                        }
                        player.Broadcast(plugin.Config.tranquilizedBroadcastDuration, plugin.Config.tranquilizedBroadcast.Replace("%seconds", ((int)sleepDuration).ToString()));
                    }
                }

                if (plugin.Config.dropItems)
                {
                    player.Inventory.ServerDropAll();
                }

                if (plugin.Config.usingEffects)
                {
                    EnableEffects(controller);

                    if (plugin.Config.invisible)
                    {
                        Invisible(player, true);
                        Timing.CallDelayed(plugin.Config.invisibleDuration, () => Invisible(player, false));
                    }
                }

                if (plugin.Config.SummonRagdoll)
                {
                    // Spawn a Ragdoll
                    PlayerStats.HitInfo hitInfo = new PlayerStats.HitInfo(1000f, player.UserId, DamageTypes.Usp, player.Id);

                    player.GameObject.GetComponent <RagdollManager>().SpawnRagdoll(
                        oldPos, player.GameObject.transform.rotation, player.ReferenceHub.playerMovementSync.PlayerVelocity,
                        (int)player.Role, hitInfo, false, player.Nickname, player.Nickname, 0);
                }

                if (plugin.Config.teleportAway)
                {
                    // Apply effects
                    controller.EnableEffect <Amnesia>(sleepDuration);
                    controller.EnableEffect <Scp268>(sleepDuration);

                    player.Position = new Vector3(plugin.Config.newPos_x, plugin.Config.newPos_y, plugin.Config.newPos_z);
                    Timing.CallDelayed(1f, () => player.ReferenceHub.playerEffectsController.DisableEffect <Decontaminating>());
                }

                Timing.CallDelayed(sleepDuration, () => Wake(player, oldPos, pd, bd, bdd));
            } catch (Exception e) {
                e.Print($"Sleeping {player.Nickname} {e.StackTrace}");
            }
        }
コード例 #6
0
        // Token: 0x06000007 RID: 7 RVA: 0x00002144 File Offset: 0x00000344
        private void Update()
        {
            if (_stage == 0)
            {
                incStage();
                thisEffects.EnableEffect <CustomPlayerEffects.Panic>(180);
            }
            else if (infectionTime - Time.time > 30 && _stage == 1)
            {
                incStage();
                thisPlayer.Broadcast(5, "Вы чувсвтвуете слабость");
                thisEffects.EnableEffect <CustomPlayerEffects.Exhausted>(150);
            }
            else if (infectionTime - Time.time > 60 && _stage == 2)
            {
                incStage();
                thisPlayer.Broadcast(5, "У вас кружится голова");
                thisEffects.EnableEffect <CustomPlayerEffects.Concussed>(120);
            }

            else if (infectionTime - Time.time > 90 && _stage == 3)
            {
                incStage();
                thisPlayer.Broadcast(5, "Как же плохо...");
                thisEffects.EnableEffect <CustomPlayerEffects.Disabled>(90);
            }
            else if (infectionTime - Time.time > 120 && _stage == 4)
            {
                incStage();
                thisPlayer.Broadcast(5, "Мир вокруг вас затихает...");
                thisEffects.EnableEffect <CustomPlayerEffects.Deafened>(60);
            }
            else if (infectionTime - Time.time > 150 && _stage == 5)
            {
                incStage();
                thisPlayer.Broadcast(5, "Мир вокруг вас исчезает...");
                thisEffects.EnableEffect <CustomPlayerEffects.Blinded>(30);
            }
            else if (infectionTime - Time.time > 170 && _stage == 6)
            {
                incStage();
                thisEffects.EnableEffect <CustomPlayerEffects.Ensnared>(15);
                thisPlayer.Broadcast(5, "Вы не в силах сопротивляться вирусу");
            }
            else if ((_stage == 7 && zombie) || (infectionTime - Time.time > 180 && _stage == 7))
            {
                incStage();
                if (!zombie)
                {
                    thisPlayer.SetRole(RoleType.Scp0492, true);
                    setZombie();
                }
                thisPlayer.Broadcast(5, "Вы больше не человек");
                thisPlayer.MaxHealth = 300;
                thisPlayer.Health    = 300;
                zombieTime           = Time.time;
            }
            else if (Time.time - zombieTime > 60 && _stage == 8 && thisPlayer.Role == RoleType.Scp0492)
            {
                incStage();
                thisPlayer.Broadcast(5, "Вы становитесь сильнее");
                thisPlayer.MaxHealth += 300;
                thisPlayer.Health    += 300;
            }
            else if (Time.time - zombieTime > 120 && _stage == 9 && thisPlayer.Role == RoleType.Scp0492)
            {
                incStage();
                thisPlayer.Broadcast(5, "Вы становитесь сильнее");
                thisPlayer.MaxHealth += 300;
                thisPlayer.Health    += 300;
            }
            else if (Time.time - zombieTime > 180 && _stage == 10 && thisPlayer.Role == RoleType.Scp0492)
            {
                incStage();
                thisPlayer.Broadcast(5, "Вы становитесь сильнее");
                thisEffects.EnableEffect <CustomPlayerEffects.Scp207>(120);
                thisPlayer.MaxHealth += 300;
                thisPlayer.Health    += 300;
            }
            else if (Time.time - zombieTime > 240 && _stage == 11 && thisPlayer.Role == RoleType.Scp0492)
            {
                incStage();
                thisPlayer.Broadcast(5, "Вы становитесь сильнее");
                thisEffects.EnableEffect <CustomPlayerEffects.Visuals939>(60);
                thisPlayer.MaxHealth += 300;
                thisPlayer.Health    += 300;
            }
            else if (Time.time - zombieTime > 285 && _stage == 12 && thisPlayer.Role == RoleType.Scp0492)
            {
                incStage();
                thisPlayer.Broadcast(5, "Ваша плоть начала разлагаться");
                thisEffects.EnableEffect <CustomPlayerEffects.Bleeding>(45);
                thisPlayer.MaxHealth += 300;
                thisPlayer.Health    += 300;
            }
            else if (Time.time - zombieTime > 300 && _stage == 13 && thisPlayer.Role == RoleType.Scp0492)
            {
                incStage();
                thisPlayer.Broadcast(5, "Вы умираете от разложения");
                thisEffects.EnableEffect <CustomPlayerEffects.Disabled>(30);
                _nextCycle = Time.time;
            }
            else if (_stage == 14 && thisPlayer.Role == RoleType.Scp0492)
            {
                if (Time.time < _nextCycle)
                {
                    return;
                }
                _nextCycle += 0.5f;
                thisHub.playerStats.HurtPlayer(new PlayerStats.HitInfo(0.1f * thisPlayer.MaxHealth, "Rotting from Virus", VirusController.Virus, -1), thisHub.gameObject);
            }
        }
コード例 #7
0
        private static bool Prefix(Scp106PlayerScript __instance, GameObject ply, int t)
        {
            try
            {
                if (!__instance._iawRateLimit.CanExecute(true) || ply == null)
                {
                    return(false);
                }

                ReferenceHub          hub = ReferenceHub.GetHub(ply);
                CharacterClassManager ccm = hub != null ? hub.characterClassManager : null;

                if (ccm == null)
                {
                    return(false);
                }

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

                Vector3 position = ply.transform.position;
                float   num1     = Vector3.Distance(__instance._hub.playerMovementSync.RealModelPosition, position);
                float   num2     = Math.Abs(__instance._hub.playerMovementSync.RealModelPosition.y - position.y);
                if ((num1 >= 1.8179999589920044 && num2 < 1.0199999809265137) ||
                    (num1 >= 2.0999999046325684 && num2 < 1.9500000476837158) ||
                    ((num1 >= 2.6500000953674316 && num2 < 2.200000047683716) ||
                     (num1 >= 3.200000047683716 && num2 < 3.0)) || num1 >= 3.640000104904175)
                {
                    __instance._hub.characterClassManager.TargetConsolePrint(__instance.connectionToClient, $"106 MovePlayer command rejected - too big distance (code: T1). Distance: {num1}, Y Diff: {num2}.", "gray");
                }
                else if (Physics.Linecast(__instance._hub.playerMovementSync.RealModelPosition, ply.transform.position, __instance._hub.weaponManager.raycastServerMask))
                {
                    __instance._hub.characterClassManager.TargetConsolePrint(__instance.connectionToClient, $"106 MovePlayer command rejected - collider found between you and the target (code: T2). Distance: {num1}, Y Diff: {num2}.", "gray");
                }
                else
                {
                    var instanceHub = ReferenceHub.GetHub(__instance.gameObject);
                    instanceHub.characterClassManager.RpcPlaceBlood(ply.transform.position, 1, 2f);
                    __instance.TargetHitMarker(__instance.connectionToClient, __instance.captureCooldown);

                    if (Scp106PlayerScript._blastDoor.isClosed)
                    {
                        instanceHub.characterClassManager.RpcPlaceBlood(ply.transform.position, 1, 2f);
                        instanceHub.playerStats.HurtPlayer(new PlayerStats.HitInfo(500f, instanceHub.LoggedNameFromRefHub(), DamageTypes.Scp106, instanceHub.playerId), ply);
                    }
                    else
                    {
                        Scp079Interactable.ZoneAndRoom        otherRoom = hub.scp079PlayerScript.GetOtherRoom();
                        Scp079Interactable.InteractableType[] filter    = new Scp079Interactable.InteractableType[]
                        {
                            Scp079Interactable.InteractableType.Door, Scp079Interactable.InteractableType.Light,
                            Scp079Interactable.InteractableType.Lockdown, Scp079Interactable.InteractableType.Tesla,
                            Scp079Interactable.InteractableType.ElevatorUse,
                        };

                        foreach (Scp079PlayerScript scp079PlayerScript in Scp079PlayerScript.instances)
                        {
                            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, ccm.CurClass);
                            }
                        }

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

                        Exiled.Events.Handlers.Player.OnEnteringPocketDimension(ev);

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

                        hub.playerMovementSync.OverridePosition(ev.Position, 0f, true);

                        instanceHub.playerStats.HurtPlayer(new PlayerStats.HitInfo(40f, instanceHub.LoggedNameFromRefHub(), DamageTypes.Scp106, instanceHub.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($"{typeof(EnteringPocketDimension).FullName}:\n{e}");

                return(true);
            }
        }
コード例 #8
0
        private static bool Prefix(Scp106PlayerScript __instance, GameObject ply, int t)
        {
            try
            {
                if (!__instance._iawRateLimit.CanExecute(true) || ply == null)
                {
                    return(false);
                }

                ReferenceHub          hub = ReferenceHub.GetHub(ply);
                CharacterClassManager ccm = hub != null ? hub.characterClassManager : null;

                if (ccm == null)
                {
                    return(false);
                }

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

                var instanceHub = ReferenceHub.GetHub(__instance.gameObject);
                instanceHub.characterClassManager.RpcPlaceBlood(ply.transform.position, 1, 2f);
                __instance.TargetHitMarker(__instance.connectionToClient);

                if (Scp106PlayerScript._blastDoor.isClosed)
                {
                    instanceHub.characterClassManager.RpcPlaceBlood(ply.transform.position, 1, 2f);
                    instanceHub.playerStats.HurtPlayer(new PlayerStats.HitInfo(500f, instanceHub.LoggedNameFromRefHub(), DamageTypes.Scp106, instanceHub.playerId), ply);
                }
                else
                {
                    Scp079Interactable.ZoneAndRoom        otherRoom = hub.scp079PlayerScript.GetOtherRoom();
                    Scp079Interactable.InteractableType[] filter    = new Scp079Interactable.InteractableType[]
                    {
                        Scp079Interactable.InteractableType.Door, Scp079Interactable.InteractableType.Light,
                        Scp079Interactable.InteractableType.Lockdown, Scp079Interactable.InteractableType.Tesla,
                        Scp079Interactable.InteractableType.ElevatorUse,
                    };

                    foreach (Scp079PlayerScript scp079PlayerScript in Scp079PlayerScript.instances)
                    {
                        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, ccm.CurClass);
                        }
                    }

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

                    Player.OnEnteringPocketDimension(ev);

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

                    hub.playerMovementSync.OverridePosition(ev.Position, 0f, true);

                    instanceHub.playerStats.HurtPlayer(new PlayerStats.HitInfo(40f, instanceHub.LoggedNameFromRefHub(), DamageTypes.Scp106, instanceHub.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($"{typeof(EnteringPocketDimension).FullName}:\n{e}");

                return(true);
            }
        }