public static bool Prefix(Handcuffs __instance, GameObject target) { if (EventPlugin.HandcuffEventPatchDisable) { return(true); } try { if (!__instance._interactRateLimit.CanExecute(true) || target == null || (Vector3.Distance(target.transform.position, __instance.transform.position) > __instance.raycastDistance * 1.10000002384186 || __instance.MyReferenceHub.characterClassManager .Classes.SafeGet(__instance.MyReferenceHub.characterClassManager.CurClass).team == Team.SCP)) { return(false); } bool allow = true; Events.InvokePlayerHandcuffFree(__instance.gameObject, target, ref allow); if (!allow) { return(false); } ReferenceHub.GetHub(target).handcuffs.NetworkCufferId = -1; return(false); } catch (Exception e) { Log.Error($"HandcuffFreeTeammate Error: {e}"); return(true); } }
public static bool Prefix(Handcuffs __instance) { if (EventPlugin.HandcuffEventPatchDisable) { return(true); } try { foreach (GameObject player in PlayerManager.players) { Handcuffs handcuffs = ReferenceHub.GetHub(player).handcuffs; if (handcuffs.CufferId == __instance.MyReferenceHub.queryProcessor.PlayerId) { bool allow = true; Events.InvokePlayerHandcuffFree(__instance.gameObject, player, ref allow); if (allow) { handcuffs.NetworkCufferId = -1; } break; } } return(false); } catch (Exception e) { Log.Error($"HandcuffFree Error: {e}"); return(true); } }
public CJMajor() { health = 19; maxHP = 19; strength = 4; power = 0; charge = 0; defense = 0; guard = 0; baseAccuracy = 12; accuracy = 12; dexterity = 3; evasion = 0; type = "Criminal Justice Major"; passive = new Outgun(this); quirk = Quirk.GetQuirk(this); special = new Taze(); special2 = new Handcuffs(); player = false; champion = false; recruitable = true; CreateDrops(); attackEffect = "heal 2 HP"; }
private static bool Prefix(Handcuffs __instance, GameObject target) { try { if (!__instance._interactRateLimit.CanExecute(true) || target == null || (Vector3.Distance(target.transform.position, __instance.transform.position) > __instance.raycastDistance * 1.10000002384186 || __instance.MyReferenceHub.characterClassManager .Classes.SafeGet(__instance.MyReferenceHub.characterClassManager.CurClass).team == Team.SCP)) { return(false); } var targetPlayer = API.Features.Player.Get(target); var ev = new RemovingHandcuffsEventArgs(API.Features.Player.Get(__instance.gameObject), targetPlayer); Player.OnRemovingHandcuffs(ev); if (!ev.IsAllowed) { return(false); } targetPlayer.CufferId = -1; return(false); } catch (Exception e) { Exiled.API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.RemovingHandcuffsByTeammate: {e}\n{e.StackTrace}"); return(true); } }
private static bool Prefix(Handcuffs __instance) { foreach (API.Features.Player target in API.Features.Player.List) { if (target == null) { continue; } if (target.CufferId == __instance.MyReferenceHub.queryProcessor.PlayerId) { var ev = new RemovingHandcuffsEventArgs(API.Features.Player.Get(__instance.gameObject), target); Player.OnRemovingHandcuffs(ev); if (ev.IsAllowed) { target.CufferId = -1; } break; } } return(false); }
private static bool Prefix(Handcuffs __instance) { try { foreach (API.Features.Player target in API.Features.Player.List) { if (target == null) { continue; } if (target.CufferId == __instance.MyReferenceHub.queryProcessor.PlayerId) { var ev = new RemovingHandcuffsEventArgs(API.Features.Player.Get(__instance.gameObject), target); Player.OnRemovingHandcuffs(ev); if (ev.IsAllowed) { target.CufferId = -1; } break; } } return(false); } catch (Exception e) { Exiled.API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.RemovingHandcuffs: {e}\n{e.StackTrace}"); return(true); } }
/// <summary> /// Handcuff a player by another player. /// </summary> /// <param name="player"></param> /// <param name="target"></param> public static void HandcuffPlayer(this ReferenceHub player, ReferenceHub target) { Handcuffs handcuffs = target.handcuffs; if (handcuffs == null) { return; } if (handcuffs.CufferId < 0 && player.inventory.items.Any((Inventory.SyncItemInfo item) => item.id == ItemType.Disarmer) && Vector3.Distance(player.transform.position, target.transform.position) <= 130f) { handcuffs.NetworkCufferId = player.GetPlayerId(); } }
private static bool Prefix(CharacterClassManager __instance, bool lite = false, bool escape = false) { try { Role role = __instance.CurRole; if (!__instance._wasAnytimeAlive && __instance.CurClass != RoleType.Spectator && __instance.CurClass != RoleType.None) { __instance._wasAnytimeAlive = true; } __instance.InitSCPs(); __instance.AliveTime = 0f; switch (role.team) { case Team.RSC: case Team.CDP: __instance.EscapeStartTime = (int)Time.realtimeSinceStartup; break; } try { __instance._hub.footstepSync.SetLoudness(role.team, role.roleId.Is939()); } catch { } if (NetworkServer.active) { Handcuffs component = __instance._hub.handcuffs; component.ClearTarget(); component.NetworkCufferId = -1; component.NetworkForceCuff = false; if (role.roleId != RoleType.Spectator && RespawnManager.CurrentSequence() != RespawnManager.RespawnSequencePhase.SpawningSelectedTeam && UnitNamingManager.RolesWithEnforcedDefaultName.TryGetValue(role.roleId, out SpawnableTeamType value) && RespawnManager.Singleton.NamingManager.TryGetAllNamesFromGroup((byte)value, out string[] names) &&
private static bool Prefix(CharacterClassManager __instance, bool lite = false, bool escape = false) { Role role = __instance.Classes.SafeGet(__instance.CurClass); if (!__instance._wasAnytimeAlive && __instance.CurClass != RoleType.Spectator && __instance.CurClass != RoleType.None) { __instance._wasAnytimeAlive = true; } __instance.InitSCPs(); __instance.AliveTime = 0f; switch (role.team) { case Team.MTF: AchievementManager.Achieve("arescue"); break; case Team.CHI: AchievementManager.Achieve("chaos"); break; case Team.RSC: case Team.CDP: __instance.EscapeStartTime = (int)Time.realtimeSinceStartup; break; } __instance.GetComponent <Inventory>(); try { __instance.GetComponent <FootstepSync>().SetLoudness(role.team, role.roleId.Is939()); } catch { } if (NetworkServer.active) { Handcuffs component = __instance.GetComponent <Handcuffs>(); component.ClearTarget(); component.NetworkCufferId = -1; } if (role.team != Team.RIP) { if (NetworkServer.active && !lite) { Vector3 constantRespawnPoint = NonFacilityCompatibility.currentSceneSettings.constantRespawnPoint; if (constantRespawnPoint != Vector3.zero) { __instance._pms.OnPlayerClassChange(constantRespawnPoint, 0f); } else { GameObject randomPosition = CharacterClassManager._spawnpointManager.GetRandomPosition(__instance.CurClass); Vector3 spawnPoint; float rotY; if (randomPosition != null) { spawnPoint = randomPosition.transform.position; rotY = randomPosition.transform.rotation.eulerAngles.y; AmmoBox component1 = __instance.GetComponent <AmmoBox>(); if (escape && __instance.KeepItemsAfterEscaping) { Inventory component2 = PlayerManager.localPlayer.GetComponent <Inventory>(); for (ushort index = 0; index < 3; ++index) { if (component1[index] >= 15U) { component2.SetPickup(component1.types[index].inventoryID, component1[index], randomPosition.transform.position, randomPosition.transform.rotation, 0, 0, 0); } } } component1.ResetAmmo(); } else { spawnPoint = __instance.DeathPosition; rotY = 0f; } var ev = new SpawningEventArgs(API.Features.Player.Get(__instance.gameObject), __instance.CurClass, spawnPoint, rotY); Player.OnSpawning(ev); __instance._pms.OnPlayerClassChange(ev.Position, ev.RotationY); } if (!__instance.SpawnProtected && __instance.EnableSP && __instance.SProtectedTeam.Contains((int)role.team)) { __instance.GodMode = true; __instance.SpawnProtected = true; __instance.ProtectedTime = Time.time; } } if (!__instance.isLocalPlayer) { __instance.GetComponent <PlayerStats>().maxHP = role.maxHP; } } __instance.Scp0492.iAm049_2 = __instance.CurClass == RoleType.Scp0492; __instance.Scp106.iAm106 = __instance.CurClass == RoleType.Scp106; __instance.Scp173.iAm173 = __instance.CurClass == RoleType.Scp173; __instance.Scp939.iAm939 = __instance.CurClass.Is939(); __instance.RefreshPlyModel(); return(false); }
public static bool Prefix(Handcuffs __instance, GameObject target) { if (EventPlugin.HandcuffEventPatchDisable) { return(true); } try { if (!__instance._interactRateLimit.CanExecute() || target == null || Vector3.Distance(target.transform.position, __instance.transform.position) > __instance.raycastDistance * 1.10000002384186) { return(false); } Handcuffs handcuffs = ReferenceHub.GetHub(target).handcuffs; if (handcuffs == null || __instance.MyReferenceHub.inventory.curItem != ItemType.Disarmer || (__instance.MyReferenceHub.characterClassManager.CurClass < RoleType.Scp173 || handcuffs.CufferId >= 0) || handcuffs.MyReferenceHub.inventory.curItem != ItemType.None) { return(false); } Team team1 = __instance.MyReferenceHub.characterClassManager.Classes .SafeGet(__instance.MyReferenceHub.characterClassManager.CurClass).team; Team team2 = __instance.MyReferenceHub.characterClassManager.Classes .SafeGet(handcuffs.MyReferenceHub.characterClassManager.CurClass).team; bool flag = false; switch (team1) { case Team.MTF: if (team2 == Team.CHI || team2 == Team.CDP) { flag = true; } if (team2 == Team.RSC && ConfigFile.ServerConfig.GetBool("mtf_can_cuff_researchers")) { flag = true; } break; case Team.CHI: if (team2 == Team.MTF || team2 == Team.RSC) { flag = true; } if (team2 == Team.CDP && ConfigFile.ServerConfig.GetBool("ci_can_cuff_class_d")) { flag = true; } break; case Team.RSC: if (team2 == Team.CHI || team2 == Team.CDP) { flag = true; } break; case Team.CDP: if (team2 == Team.MTF || team2 == Team.RSC) { flag = true; } break; } if (!flag) { return(false); } __instance.ClearTarget(); bool allow = true; Events.InvokePlayerHandcuff(__instance.gameObject, target, ref allow); if (!allow) { return(false); } handcuffs.NetworkCufferId = __instance.MyReferenceHub.queryProcessor.PlayerId; return(false); } catch (Exception e) { Log.Error($"Handcuffed Error: {e}"); return(true); } }
public static bool Prefix(Handcuffs __instance, GameObject target) { try { if (!__instance._interactRateLimit.CanExecute()) { return(false); } if (target == null || Vector3.Distance(target.transform.position, __instance.transform.position) > __instance.raycastDistance * 1.1f) { return(false); } //Get The Handcuff of the Target var handcuffs = ReferenceHub.GetHub(target).handcuffs; if (handcuffs == null || __instance.MyReferenceHub.inventory.curItem != ItemType.Disarmer || __instance.MyReferenceHub.characterClassManager.CurClass < RoleType.Scp173) { return(false); } if (handcuffs.CufferId >= 0 || handcuffs.MyReferenceHub.inventory.curItem != ItemType.None) { return(false); } //Team of the person who cuffs someone var team = __instance.MyReferenceHub.characterClassManager.CurRole.team; //Team of the Person who will become cuffed var team2 = handcuffs.MyReferenceHub.characterClassManager.CurRole.team; var flag = false; switch (team) { //Check for When the Cuffer is a DBoy case Team.CDP: { if (team2 == Team.MTF || team2 == Team.RSC) { flag = true; } break; } //Check for when the Cuffer is a Nerd case Team.RSC: { if (team2 == Team.CHI || team2 == Team.CDP) { flag = true; } break; } //Check for when the Cuffer is a Chaos case Team.CHI: { switch (team2) { case Team.MTF: case Team.RSC: case Team.CDP when ConfigFile.ServerConfig.GetBool("ci_can_cuff_class_d"): flag = true; break; } break; } //Check for when the Cuffer is a Mtf case Team.MTF: { switch (team2) { case Team.CHI: case Team.CDP: case Team.RSC when ConfigFile.ServerConfig.GetBool("mtf_can_cuff_researchers"): flag = true; break; } break; } } //Event var cuffer = __instance.GetPlayer(); var target2 = handcuffs.GetPlayer(); Events.InvokePlayerCuffedEvent(cuffer, target2, ref flag); if (!flag) { return(false); } __instance.ClearTarget(); handcuffs.NetworkCufferId = __instance.MyReferenceHub.queryProcessor.PlayerId; return(false); } catch (Exception e) { Log.Error($"PlayerCuffedEvent Error: {e}"); return(true); } }
public void ToHandcuff() { Handcuffs.Lock(); }
private void CheckForInput() { if (this.cuffTarget != null) { bool flag = false; foreach (Inventory.SyncItemInfo syncItemInfo in this.inv.items) { if (syncItemInfo.id == 27) { flag = true; } } if (!flag) { this.CallCmdTarget(null); } } if (base.GetComponent <WeaponManager>().inventoryCooldown <= 0f) { if (this.inv.curItem == 27) { if (Input.GetButtonDown("Fire1") && this.cuffTarget == null) { this.CuffPlayer(); } else if (Input.GetButtonDown("Zoom") && this.cuffTarget != null) { this.CallCmdTarget(null); } } if (this.ccm.curClass >= 0 && this.ccm.klasy[this.ccm.curClass].team != Team.SCP && Input.GetButton("Interact")) { RaycastHit raycastHit; if (Physics.Raycast(this.plyCam.position, this.plyCam.forward, out raycastHit, this.maxDistance)) { Handcuffs componentInParent = raycastHit.collider.GetComponentInParent <Handcuffs>(); if (componentInParent != null && componentInParent.GetComponent <AnimationController>().handAnimator.GetBool("Cuffed")) { this.progress += Time.deltaTime; if (this.progress >= 5f) { this.progress = 0f; foreach (GameObject gameObject in PlayerManager.singleton.players) { if (gameObject.GetComponent <Handcuffs>().cuffTarget == componentInParent.gameObject) { this.CallCmdResetTarget(gameObject); } } } } else { this.progress = 0f; } } else { this.progress = 0f; } } else { this.progress = 0f; } if (this.ccm.curClass != 3) { this.uncuffProgress.fillAmount = Mathf.Clamp01(this.progress / 5f); } } }
private static bool Prefix(Handcuffs __instance, GameObject target) { try { if (!__instance._interactRateLimit.CanExecute() || target == null || Vector3.Distance(target.transform.position, __instance.transform.position) > __instance.raycastDistance * 1.10000002384186) { return(false); } Handcuffs handcuffs = ReferenceHub.GetHub(target).handcuffs; if (handcuffs == null || __instance.MyReferenceHub.inventory.curItem != ItemType.Disarmer || (__instance.MyReferenceHub.characterClassManager.CurClass < RoleType.Scp173 || handcuffs.CufferId >= 0) || handcuffs.MyReferenceHub.inventory.curItem != ItemType.None) { return(false); } Team team1 = __instance.MyReferenceHub.characterClassManager.Classes .SafeGet(__instance.MyReferenceHub.characterClassManager.CurClass).team; Team team2 = __instance.MyReferenceHub.characterClassManager.Classes .SafeGet(handcuffs.MyReferenceHub.characterClassManager.CurClass).team; bool flag = false; switch (team1) { case Team.MTF: if (team2 == Team.CHI || team2 == Team.CDP) { flag = true; } if (team2 == Team.RSC && ConfigFile.ServerConfig.GetBool("mtf_can_cuff_researchers")) { flag = true; } break; case Team.CHI: if (team2 == Team.MTF || team2 == Team.RSC) { flag = true; } if (team2 == Team.CDP && ConfigFile.ServerConfig.GetBool("ci_can_cuff_class_d")) { flag = true; } break; case Team.RSC: if (team2 == Team.CHI || team2 == Team.CDP) { flag = true; } break; case Team.CDP: if (team2 == Team.MTF || team2 == Team.RSC) { flag = true; } break; } if (!flag) { return(false); } __instance.ClearTarget(); var ev = new HandcuffingEventArgs(API.Features.Player.Get(__instance.gameObject), API.Features.Player.Get(target)); Player.OnHandcuffing(ev); if (!ev.IsAllowed) { return(false); } handcuffs.NetworkCufferId = __instance.MyReferenceHub.queryProcessor.PlayerId; return(false); } catch (Exception e) { Exiled.API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.Handcuffing: {e}\n{e.StackTrace}"); return(true); } }
public static void ApplyPropertiesCustom(this ReferenceHub rh, Vector3 pos, float rotY, bool lite = false) { Role role = rh.characterClassManager.Classes.SafeGet(rh.characterClassManager.CurClass); if (!rh.characterClassManager._wasAnytimeAlive && rh.characterClassManager.CurClass != RoleType.Spectator && rh.characterClassManager.CurClass != RoleType.None) { rh.characterClassManager._wasAnytimeAlive = true; } rh.characterClassManager.InitSCPs(); rh.characterClassManager.AliveTime = 0.0f; switch (role.team) { case Team.MTF: AchievementManager.Achieve("arescue", true); break; case Team.CHI: AchievementManager.Achieve("chaos", true); break; case Team.RSC: case Team.CDP: rh.characterClassManager.EscapeStartTime = (int)Time.realtimeSinceStartup; break; } rh.characterClassManager.GetComponent <Inventory>(); try { rh.characterClassManager.GetComponent <FootstepSync>().SetLoudness(role.team, role.roleId.Is939()); } catch { } if (NetworkServer.active) { Handcuffs component = rh.characterClassManager.GetComponent <Handcuffs>(); component.ClearTarget(); component.NetworkCufferId = -1; } if (role.team != Team.RIP) { if (NetworkServer.active && !lite) { rh.characterClassManager._pms.OnPlayerClassChange(pos, rotY); if (!rh.characterClassManager.SpawnProtected && rh.characterClassManager.EnableSP && rh.characterClassManager.SProtectedTeam.Contains((int)role.team)) { rh.characterClassManager.GodMode = true; rh.characterClassManager.SpawnProtected = true; rh.characterClassManager.ProtectedTime = Time.time; } } if (!rh.characterClassManager.isLocalPlayer) { rh.characterClassManager.GetComponent <PlayerStats>().maxHP = role.maxHP; } } rh.characterClassManager.Scp0492.iAm049_2 = rh.characterClassManager.CurClass == RoleType.Scp0492; rh.characterClassManager.Scp106.iAm106 = rh.characterClassManager.CurClass == RoleType.Scp106; rh.characterClassManager.Scp173.iAm173 = rh.characterClassManager.CurClass == RoleType.Scp173; rh.characterClassManager.Scp939.iAm939 = rh.characterClassManager.CurClass.Is939(); rh.characterClassManager.RefreshPlyModel(RoleType.None); }
public static bool Prefix(CharacterClassManager __instance) { if (!PluginConfig.Cfg.Enabled) { return(true); } if (!__instance._interactRateLimit.CanExecute(true)) { return(false); } if (Vector3.Distance(__instance.transform.position, __instance.GetComponent <Escape>().worldPosition) >= (float)(Escape.radius * 2)) { return(false); } bool flag = false; Handcuffs component = __instance.GetComponent <Handcuffs>(); if (component.CufferId >= 0 && ConfigFile.ServerConfig.GetBool("cuffed_escapee_change_team", true)) { CharacterClassManager component2 = component.GetCuffer(component.CufferId).GetComponent <CharacterClassManager>(); if (__instance.CurClass == RoleType.Scientist && (component2.CurClass == RoleType.ChaosInsurgency || component2.CurClass == RoleType.ClassD)) { flag = true; } if (__instance.CurClass == RoleType.ClassD && (component2.Classes.SafeGet(component2.CurClass).team == Team.MTF || component2.CurClass == RoleType.Scientist)) { flag = true; } } Team team = __instance.Classes.SafeGet(__instance.CurClass).team; if (team == Team.CDP) { if (flag) { __instance.SetPlayersClass(RoleType.NtfCadet, __instance.gameObject, false, true); RoundSummary.escaped_scientists++; __instance.GetComponent <PlayerStats>().health = __instance.Classes.SafeGet(RoleType.NtfCadet).maxHP *((__instance.GetComponent <HealthChangedComponent>()?.ActualHealthPercentage ?? 100) / 100); __instance.GetComponent <PlayerStats>().maxHP = Mathf.RoundToInt(__instance.Classes.SafeGet(RoleType.NtfCadet).maxHP *((__instance.GetComponent <HealthChangedComponent>()?.ActualHealthPercentage ?? 100) / 100)); return(false); } __instance.SetPlayersClass(RoleType.ChaosInsurgency, __instance.gameObject, false, true); RoundSummary.escaped_ds++; __instance.GetComponent <PlayerStats>().health = __instance.Classes.SafeGet(RoleType.ChaosInsurgency).maxHP *((__instance.GetComponent <HealthChangedComponent>()?.ActualHealthPercentage ?? 100) / 100); __instance.GetComponent <PlayerStats>().maxHP = Mathf.RoundToInt(__instance.Classes.SafeGet(RoleType.ChaosInsurgency).maxHP *((__instance.GetComponent <HealthChangedComponent>()?.ActualHealthPercentage ?? 100) / 100)); return(false); } else if (team == Team.RSC) { if (flag) { __instance.SetPlayersClass(RoleType.ChaosInsurgency, __instance.gameObject, false, true); RoundSummary.escaped_ds++; __instance.GetComponent <PlayerStats>().health = __instance.Classes.SafeGet(RoleType.ChaosInsurgency).maxHP *((__instance.GetComponent <HealthChangedComponent>()?.ActualHealthPercentage ?? 100) / 100); __instance.GetComponent <PlayerStats>().maxHP = Mathf.RoundToInt(__instance.Classes.SafeGet(RoleType.ChaosInsurgency).maxHP *((__instance.GetComponent <HealthChangedComponent>()?.ActualHealthPercentage ?? 100) / 100)); return(false); } __instance.SetPlayersClass(RoleType.NtfScientist, __instance.gameObject, false, true); RoundSummary.escaped_scientists++; __instance.GetComponent <PlayerStats>().health = __instance.Classes.SafeGet(RoleType.NtfScientist).maxHP *((__instance.GetComponent <HealthChangedComponent>()?.ActualHealthPercentage ?? 100) / 100); __instance.GetComponent <PlayerStats>().maxHP = Mathf.RoundToInt(__instance.Classes.SafeGet(RoleType.NtfScientist).maxHP *((__instance.GetComponent <HealthChangedComponent>()?.ActualHealthPercentage ?? 100) / 100)); return(false); } return(false); }
public static bool Prefix(CharacterClassManager __instance, bool lite = false, bool escape = false) { if (EventPlugin.PlayerSpawnEventPatchDisable) { return(true); } try { Role role = __instance.Classes.SafeGet(__instance.CurClass); if (!__instance._wasAnytimeAlive && __instance.CurClass != RoleType.Spectator && __instance.CurClass != RoleType.None) { __instance._wasAnytimeAlive = true; } __instance.InitSCPs(); __instance.AliveTime = 0f; switch (role.team) { case Team.MTF: AchievementManager.Achieve("arescue"); break; case Team.CHI: AchievementManager.Achieve("chaos"); break; case Team.RSC: case Team.CDP: __instance.EscapeStartTime = (int)Time.realtimeSinceStartup; break; } __instance.GetComponent <Inventory>(); try { __instance.GetComponent <FootstepSync>().SetLoudness(role.team, role.roleId.Is939()); } catch { } if (NetworkServer.active) { Handcuffs component = __instance.GetComponent <Handcuffs>(); component.ClearTarget(); component.NetworkCufferId = -1; } if (role.team != Team.RIP) { if (NetworkServer.active && !lite) { Vector3 constantRespawnPoint = NonFacilityCompatibility.currentSceneSettings.constantRespawnPoint; if (constantRespawnPoint != Vector3.zero) { __instance._pms.OnPlayerClassChange(constantRespawnPoint, 0f); } else { GameObject randomPosition = CharacterClassManager.SpawnpointManager.GetRandomPosition(__instance.CurClass); Vector3 spawnPoint = new Vector3(0f, 0f, 0f); float rotY = 0f; if (randomPosition != null) { spawnPoint = randomPosition.transform.position; rotY = randomPosition.transform.rotation.eulerAngles.y; AmmoBox component2 = __instance.GetComponent <AmmoBox>(); if (escape && __instance.KeepItemsAfterEscaping) { Inventory component3 = PlayerManager.localPlayer.GetComponent <Inventory>(); for (ushort num = 0; num < 3; num += 1) { if (component2.GetAmmo(num) >= 15) { component3.SetPickup(component2.types[num].inventoryID, component2.GetAmmo(num), randomPosition.transform.position, randomPosition.transform.rotation, 0, 0, 0); } } } component2.SetAmmoAmount(); } else { spawnPoint = __instance.DeathPosition; rotY = 0f; } Events.InvokePlayerSpawn(__instance, __instance.CurClass, ref spawnPoint, ref rotY); __instance._pms.OnPlayerClassChange(spawnPoint, rotY); } if (!__instance.SpawnProtected && __instance.EnableSP && __instance.SProtectedTeam.Contains((int)role.team)) { __instance.GodMode = true; __instance.SpawnProtected = true; __instance.ProtectedTime = Time.time; } } if (!__instance.isLocalPlayer) { __instance.GetComponent <PlayerStats>().maxHP = role.maxHP; } } __instance.Scp049.iAm049 = (__instance.CurClass == RoleType.Scp049); __instance.Scp0492.iAm049_2 = (__instance.CurClass == RoleType.Scp0492); __instance.Scp096.iAm096 = (__instance.CurClass == RoleType.Scp096); __instance.Scp106.iAm106 = (__instance.CurClass == RoleType.Scp106); __instance.Scp173.iAm173 = (__instance.CurClass == RoleType.Scp173); __instance.Scp939.iAm939 = __instance.CurClass.Is939(); __instance.RefreshPlyModel(); return(false); } catch (Exception exception) { Log.Error($"PlayerSpawnEvent error: {exception}"); return(true); } }
private static bool Prefix(Handcuffs __instance, GameObject target) { try { if (!__instance._interactRateLimit.CanExecute()) { return(false); } if (target == null || Vector3.Distance(target.transform.position, __instance.transform.position) > __instance.raycastDistance * 1.1f) { return(false); } var targetplayer = target.GetPlayer(); var player = __instance.GetPlayer(); var item = player.ItemInHand; var handcuffs = targetplayer.Handcuffs; if (item.ItemType != ItemType.Disarmer) { return(false); } if (handcuffs.CufferId >= 0 || __instance.ForceCuff || handcuffs.MyReferenceHub.inventory.curItem != ItemType.None) { return(false); } //Team of the person who cuffs someone var team = player.Team; //Team of the Person who will become cuffed var team2 = targetplayer.Team; var flag = false; switch (team) { //Check for When the Cuffer is a DBoy case Team.CDP: { if (team2 == Team.MTF || team2 == Team.RSC) { flag = true; } break; } //Check for when the Cuffer is a Nerd case Team.RSC: { if (team2 == Team.CHI || team2 == Team.CDP) { flag = true; } break; } //Check for when the Cuffer is a Chaos case Team.CHI: { switch (team2) { case Team.MTF: case Team.RSC: case Team.CDP when ConfigFile.ServerConfig.GetBool("ci_can_cuff_class_d"): flag = true; break; } break; } //Check for when the Cuffer is a Mtf case Team.MTF: { switch (team2) { case Team.CHI: case Team.CDP: case Team.RSC when ConfigFile.ServerConfig.GetBool("mtf_can_cuff_researchers"): flag = true; break; } break; } } //Event var cuffer = __instance.GetPlayer(); var target2 = handcuffs.GetPlayer(); SynapseController.Server.Events.Player.InvokePlayerCuffTargetEvent(target2, cuffer, item, ref flag); SynapseController.Server.Events.Player.InvokePlayerItemUseEvent(cuffer, item, Api.Events.SynapseEventArguments.ItemInteractState.Finalizing, ref flag); if (!flag) { return(false); } if (team2 == Team.MTF && team == global::Team.CDP) { __instance.MyReferenceHub.playerStats.TargetAchieve(__instance.MyReferenceHub.playerStats.connectionToClient, "tableshaveturned"); } __instance.ClearTarget(); handcuffs.NetworkCufferId = __instance.MyReferenceHub.queryProcessor.PlayerId; return(false); } catch (Exception e) { Synapse.Api.Logger.Get.Error($"Synapse-Event: PlayerAmmoDrop failed!!\n{e}\nStackTrace:\n{e.StackTrace}"); return(true); } }