public void TakeEffect(Effect effect) { if (isInvulnerable) { return; } effectsController.GetEffect(effect); }
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); } }
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); }
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; } }
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}"); } }
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); } }
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); } }