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); } }
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); } }
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 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); } }