예제 #1
0
 private static bool Prefix(Scp106PlayerScript __instance)
 {
     try
     {
         Server.Get.Events.Scp.Scp106.InvokePortalCreateEvent(__instance.GetPlayer(), out var allow);
         return(allow);
     }
     catch (Exception e)
     {
         Logger.Get.Error($"Synapse-Event: Scp106PortalCreate failed!!\n{e}\nStackTrace:\n{e.StackTrace}");
         return(true);
     }
 }
        private static bool Prefix(Scp106PlayerScript __instance, GameObject ply, int t)
        {
            try
            {
                if (!__instance._iawRateLimit.CanExecute(true) || ply == null)
                {
                    return(false);
                }
                var scp    = __instance.GetPlayer();
                var player = ply.GetPlayer();
                if (player == null || player.GodMode || !ServerTime.CheckSynchronization(t) || !__instance.iAm106 || Vector3.Distance(scp.Position, player.Position) >= 3f)
                {
                    return(false);
                }

                if (!scp.WeaponManager.GetShootPermission(player.ClassManager))
                {
                    return(false);
                }

                EventHandler.Get.Scp.InvokeScpAttack(scp, player, Api.Enum.ScpAttackType.Scp106_Grab, out var allow);
                if (!allow)
                {
                    return(false);
                }

                scp.ClassManager.RpcPlaceBlood(player.Position, 1, 2f);
                __instance.TargetHitMarker(scp.Connection);
                if (Scp106PlayerScript._blastDoor.isClosed)
                {
                    player.Hurt(500, DamageTypes.Scp106, scp);
                }
                else
                {
                    player.Hurt(40, DamageTypes.Scp106, scp);
                    player.Position = Vector3.down * 1998.5f;
                    foreach (var scp079 in Scp079PlayerScript.instances)
                    {
                        var room   = player.ClassManager.Scp079.GetOtherRoom();
                        var filter = new Scp079Interactable.InteractableType[]
                        {
                            Scp079Interactable.InteractableType.Door,
                            Scp079Interactable.InteractableType.Light,
                            Scp079Interactable.InteractableType.Lockdown,
                            Scp079Interactable.InteractableType.Tesla,
                            Scp079Interactable.InteractableType.ElevatorUse,
                        };

                        var flag = true;
                        foreach (var interaction in scp079.ReturnRecentHistory(12f, filter))
                        {
                            foreach (var zoneRoom in interaction.interactable.currentZonesAndRooms)
                            {
                                if (zoneRoom.currentZone == room.currentZone && zoneRoom.currentRoom == room.currentRoom)
                                {
                                    flag = true;
                                }
                            }
                        }
                        if (flag)
                        {
                            scp079.RpcGainExp(ExpGainType.PocketAssist, player.RoleType);
                        }
                    }

                    if (player.RoleType == RoleType.Spectator)
                    {
                        return(false);
                    }

                    EventHandler.Get.Scp.Scp106.InvokePocketDimensionEnterEvent(player, scp, ref allow);
                    if (!allow)
                    {
                        return(false);
                    }
                    scp.Scp106Controller.PocketPlayers.Add(player);
                    player.PlayerEffectsController.GetEffect <CustomPlayerEffects.Corroding>().IsInPd = true;
                    player.GiveEffect(Api.Enum.Effect.Corroding);
                }

                return(false);
            }
            catch (Exception e)
            {
                Logger.Get.Error($"Synapse-Event: PocketDimEnter/ScpAttackEvent(106) failed!!\n{e}\nStackTrace:\n{e.StackTrace}");
                return(true);
            }
        }
예제 #3
0
        private static bool MovePlayer(Scp106PlayerScript __instance, GameObject ply, int t)
        {
            try
            {
                if (!__instance._iawRateLimit.CanExecute(true) || ply == null || !__instance.iAm106)
                {
                    return(false);
                }

                var scp    = __instance.GetPlayer();
                var player = ply.GetPlayer();

                if (player == null || player.GodMode || !ServerTime.CheckSynchronization(t) || !player.ClassManager.IsHuman())
                {
                    return(false);
                }

                if (!SynapseExtensions.GetHarmPermission(scp, player))
                {
                    return(false);
                }

                var pos  = player.Position;
                var num  = Vector3.Distance(scp.Position, pos);
                var num2 = Math.Abs(scp.Position.y - pos.y);
                if ((num >= 1.818f && num2 < 1.02f) || (num >= 3.4f && num2 < 1.95f) || (num >= 3.7f && num2 < 2.2f) || (num >= 3.9f && num2 < 3f) || num >= 4.2f)
                {
                    __instance._hub.characterClassManager.TargetConsolePrint(scp.Connection, string.Format("106 MovePlayer command rejected - too big distance (code: T1). Distance: {0}, Y Diff: {1}.", num, num2), "gray");
                    return(false);
                }
                if (Physics.Linecast(scp.Position, player.Position, MicroHIDItem.WallMask))
                {
                    __instance._hub.characterClassManager.TargetConsolePrint(scp.Connection, string.Format("106 MovePlayer command rejected - collider found between you and the target (code: T2). Distance: {0}, Y Diff: {1}.", num, num2), "gray");
                    return(false);
                }

                EventHandler.Get.Scp.InvokeScpAttack(scp, player, Api.Enum.ScpAttackType.Scp106_Grab, out var allow);
                if (!allow)
                {
                    return(false);
                }

                scp.ClassManager.RpcPlaceBlood(player.Position, 1, 2f);
                __instance.TargetHitMarker(scp.Connection, __instance.captureCooldown);
                __instance._currentServerCooldown = __instance.captureCooldown;
                if (Scp106PlayerScript._blastDoor.isClosed)
                {
                    __instance._hub.characterClassManager.RpcPlaceBlood(player.Position, 1, 2f);
                    player.PlayerStats.DealDamage(new ScpDamageHandler(__instance._hub, PlayerStatsSystem.DeathTranslations.PocketDecay));
                }
                else
                {
                    EventHandler.Get.Scp.Scp106.InvokePocketDimensionEnterEvent(player, scp, ref allow);
                    if (!allow)
                    {
                        return(false);
                    }

                    foreach (var script in Scp079PlayerScript.instances)
                    {
                        script.ServerProcessKillAssist(player.Hub, ExpGainType.PocketAssist);
                    }

                    player.Hub.scp106PlayerScript.GrabbedPosition = player.Hub.playerMovementSync.RealModelPosition;
                    player.PlayerStats.DealDamage(new ScpDamageHandler(__instance._hub, 40f, PlayerStatsSystem.DeathTranslations.PocketDecay));
                    player.Position = Vector3.down * 1998.5f;
                    scp.Scp106Controller.PocketPlayers.Add(player);
                }
                player.PlayerEffectsController.EnableEffect <CustomPlayerEffects.Corroding>(0f, false);

                return(false);
            }
            catch (Exception e)
            {
                Logger.Get.Error($"Synapse-Event: PocketDimEnter/ScpAttackEvent(106) failed!!\n{e}");
                return(true);
            }
        }