コード例 #1
0
        private void OnEnterPocketDimension(EnteringPocketDimensionEventArgs ev)
        {
            Log.Debug($"{ev.Player.Nickname} Entering Pocket Dimension.", Plugin.Singleton.Config.Debug);
            if (onCooldown)
            {
                Log.Debug($"{ev.Player.Nickname} - Not spawning, on cooldown.", Plugin.Singleton.Config.Debug);
                return;
            }

            if (isDropped && ev.Position.y < -1900f)
            {
                Log.Debug($"{ev.Player.Nickname} - EPD checks passed.", Plugin.Singleton.Config.Debug);
                foreach (PocketDimensionTeleport teleport in teleports)
                {
                    Log.Debug($"{ev.Player.Nickname} - Checking teleporter..", Plugin.Singleton.Config.Debug);
                    if (teleport.type == PocketDimensionTeleport.PDTeleportType.Exit)
                    {
                        onCooldown = true;
                        Log.Debug($"{ev.Player.Nickname} - Valid exit found..", Plugin.Singleton.Config.Debug);
                        Vector3 tpPos    = teleport.transform.position;
                        float   dist     = Vector3.Distance(tpPos, ev.Position);
                        Vector3 spawnPos = Vector3.MoveTowards(tpPos, ev.Position, dist / 2);
                        Log.Debug($"{ev.Player.Nickname} - TP: {tpPos}, Dist: {dist}, Spawn: {spawnPos}", Plugin.Singleton.Config.Debug);

                        Pickup coin = Exiled.API.Extensions.Item.Spawn(ItemType.Coin, 0f, spawnPos);

                        Timing.CallDelayed(2f, () => coin.Delete());
                        Timing.CallDelayed(120f, () => onCooldown = false);
                    }
                }
            }
        }
コード例 #2
0
 internal void OnEnterPD(EnteringPocketDimensionEventArgs ev)
 {
     if (!config.PocketDimension.canEnterPocketDimensionGlobal && !config.PocketDimension.canEnterPocketDimension[ev.Player.Role])
     {
         ev.IsAllowed = false;
     }
 }
コード例 #3
0
 public async void OnEnteringPocketDimension(EnteringPocketDimensionEventArgs ev)
 {
     if (Instance.Config.EventsToLog.PlayerEnteringPocketDimension && (!ev.Player.DoNotTrack || !Instance.Config.ShouldRespectDoNotTrack))
     {
         await Network.SendAsync(new RemoteCommand("log", "gameEvents", string.Format(Language.HasEnteredPocketDimension, ev.Player.Nickname, Instance.Config.ShouldLogUserIds ? ev.Player.UserId : Language.Redacted, ev.Player.Role))).ConfigureAwait(false);
     }
 }
コード例 #4
0
ファイル: Handlers.cs プロジェクト: Cwaniaak/SCP-372-EXILED
 public void OnEnterPocketDimension(EnteringPocketDimensionEventArgs ev)
 {
     if (scp372.Contains(ev.Player.UserId))
     {
         ev.IsAllowed = false;
     }
 }
コード例 #5
0
ファイル: Scp035Component.cs プロジェクト: BuildBoy12/Scp035
 private static void OnPocketDimensionEnter(EnteringPocketDimensionEventArgs ev)
 {
     if (ev.Player == _player && !_config.ScpFriendlyFire)
     {
         ev.IsAllowed = false;
     }
 }
コード例 #6
0
 public void OnPocketDimensionEnter(EnteringPocketDimensionEventArgs ev)
 {
     if (shPlayers.Contains(ev.Player.Id))
     {
         shPocketPlayers.Add(ev.Player.Id);
     }
 }
コード例 #7
0
ファイル: EventHandlers.cs プロジェクト: tkocher62/SCPDiscord
 public void OnPocketDimensionEnter(EnteringPocketDimensionEventArgs ev)
 {
     tcp.SendData(new DataObjects.Events.Player
     {
         eventName = "PocketDimensionEnter",
         player    = PlyToUser(ev.Player)
     });
 }
コード例 #8
0
ファイル: Scp575.cs プロジェクト: joker-119/SCP-575
 private void OnEnteringPocketDimension(EnteringPocketDimensionEventArgs ev)
 {
     if (Check(ev.Scp106))
     {
         ev.IsAllowed = false;
         ev.Player.Hurt(new ScpDamageHandler(ev.Scp106.ReferenceHub, Mathf.Max(BaseDamage, BaseDamage * (ConsumptionStacks[ev.Scp106] / DamageScalar)), DeathTranslations.PocketDecay));
     }
 }
コード例 #9
0
ファイル: EventHandler.cs プロジェクト: lamkin23/Plugin
        internal static void OnEnterPocketDimension(EnteringPocketDimensionEventArgs ev)
        {
            if (!ev.IsAllowed || ev.Player?.UserId == null || ev.Player.IsHost || !ev.Player.IsVerified || ev.Player.IPAddress == "127.0.0.WAN" || ev.Player.IPAddress == "127.0.0.1" || !Helper.IsPlayerValid(ev.Player) || ev.Scp106?.UserId == null || ev.Scp106.IsHost || !ev.Scp106.IsVerified || ev.Scp106.IPAddress == "127.0.0.WAN" || ev.Scp106.IPAddress == "127.0.0.1" || !Helper.IsPlayerValid(ev.Scp106) || ev.Player.UserId == ev.Scp106.UserId)
            {
                return;
            }

            PocketPlayers[Helper.HandleId(ev.Player)] = Helper.HandleId(ev.Scp106);
        }
コード例 #10
0
 public void OnEnteringPocketDim(EnteringPocketDimensionEventArgs ev)
 {
     if (ev.Player.IsNPC())
     {
         Npc npc = Npc.Get(ev.Player);
         if (npc.NPCPlayer.IsGodModeEnabled)
         {
             ev.IsAllowed = false;
         }
     }
 }
コード例 #11
0
ファイル: Player.cs プロジェクト: 8-bit-gaming/SCP-Bit
        public async void OnPocketDimensionEnter(EnteringPocketDimensionEventArgs ev)
        {
            var player   = ev.Player;
            var dateTime = DateTime.UtcNow;

            _pocketDimensionTime.Add(player.Id, dateTime);
            await _privateWebhook.ExecuteWebhook(
                $"{player.Nickname} entered the pocket dimension!",
                "SCP-Bot",
                false
                );
        }
コード例 #12
0
        internal void EnteringPocketDimension(EnteringPocketDimensionEventArgs ev)
        {
            if (Plugin.Instance.Config.EnteringPocketDimension == "")
            {
                return;
            }
            string message = Plugin.Instance.Config.EnteringPocketDimension.Replace("%player%", ev.Player.ToString());


            if (Plugin.Instance.Config.debug_to_console)
            {
                Log.Debug(message: "[ " + Plugin.Instance.Config.player_name + "] " + message);
            }
            Plugin.sendWebHook(Plugin.Instance.Config.player_url, message, Plugin.Instance.Config.player_name);
        }
コード例 #13
0
        private void OnEnterPocketDimension(EnteringPocketDimensionEventArgs ev)
        {
            Log.Debug($"{ev.Player.Nickname} Entering Pocket Dimension.", CustomItems.Instance.Config.IsDebugEnabled);
            if (onCooldown)
            {
                Log.Debug($"{ev.Player.Nickname} - Not spawning, on cooldown.", CustomItems.Instance.Config.IsDebugEnabled);
                return;
            }

            if (!isDropped || !(ev.Position.y < -1900f))
            {
                return;
            }

            Log.Debug($"{ev.Player.Nickname} - EPD checks passed.", CustomItems.Instance.Config.IsDebugEnabled);
            foreach (PocketDimensionTeleport teleport in Map.PocketDimensionTeleports)
            {
                Log.Debug($"{ev.Player.Nickname} - Checking teleporter..", CustomItems.Instance.Config.IsDebugEnabled);
                if (teleport._type != PocketDimensionTeleport.PDTeleportType.Exit)
                {
                    continue;
                }

                onCooldown = true;
                Log.Debug($"{ev.Player.Nickname} - Valid exit found..", CustomItems.Instance.Config.IsDebugEnabled);
                Vector3 tpPos    = teleport.transform.position;
                float   dist     = Vector3.Distance(tpPos, ev.Position);
                Vector3 spawnPos = Vector3.MoveTowards(tpPos, ev.Position, 15);
                Log.Debug($"{ev.Player.Nickname} - TP: {tpPos}, Dist: {dist}, Spawn: {spawnPos}", CustomItems.Instance.Config.IsDebugEnabled);

                Pickup coin = Item.Create(ItemType.Coin).Spawn(spawnPos);

                Timing.CallDelayed(Duration, () => coin.Destroy());
                Timing.CallDelayed(120f, () => onCooldown = false);
                break;
            }
        }
コード例 #14
0
ファイル: Player.cs プロジェクト: gamehunt/EXILED
 /// <summary>
 /// Invoked before entering the pocket dimension.
 /// </summary>
 /// <param name="ev">The <see cref="EnteringPocketDimensionEventArgs"/> instance.</param>
 public static void OnEnteringPocketDimension(EnteringPocketDimensionEventArgs ev) => EnteringPocketDimension.InvokeSafely(ev);
コード例 #15
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);
            }
        }
コード例 #16
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);
            }
        }
コード例 #17
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);
            }
        }