public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { response = ""; Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.Punch) || player.IsCuffed) { Log.Debug($"Player {player.Nickname} could not use the punch command", Subclass.Instance.Config.Debug); response = ""; return(true); } SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (!subClass.Abilities.Contains(AbilityType.InfiniteSprint)) { if ((player.Stamina.RemainingStamina * 100) - (subClass.FloatOptions.ContainsKey("PunchStaminaUse") ? subClass.FloatOptions["PunchStaminaUse"] : 10) <= 0) { Log.Debug($"Player {player.Nickname} failed to use the punch command", Subclass.Instance.Config.Debug); player.Broadcast(5, Subclass.Instance.Config.OutOfStaminaMessage); return(true); } player.Stamina.RemainingStamina = Mathf.Clamp( player.Stamina.RemainingStamina - (subClass.FloatOptions.ContainsKey("PunchStaminaUse") ? subClass.FloatOptions["PunchStaminaUse"] / 100 : .1f), 0, 1); player.Stamina._regenerationTimer = 0; } if (!TrackingAndMethods.CanUseAbility(player, AbilityType.Punch, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.Punch, subClass, "punch"); response = ""; return(true); } if (TrackingAndMethods.OnCooldown(player, AbilityType.Punch, subClass)) { Log.Debug($"Player {player.Nickname} failed to use punch", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.Punch, subClass, "punch", Time.time); response = ""; return(true); } if (Physics.Raycast(player.CameraTransform.position, player.CameraTransform.forward, out RaycastHit hit, (subClass.FloatOptions.ContainsKey("PunchRange") ? subClass.FloatOptions["PunchRange"] : 1.3f))) { Player target = Player.Get(hit.collider.gameObject) ?? Player.Get(hit.collider.GetComponentInParent <ReferenceHub>()); if (target == null || target.Id == player.Id) { return(true); } TrackingAndMethods.AddCooldown(player, AbilityType.Punch); TrackingAndMethods.UseAbility(player, AbilityType.Punch, subClass); target.Hurt(subClass.FloatOptions["PunchDamage"], null, player.Nickname, player.Id); } return(true); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) && TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.FlashOnCommand)) { SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (!TrackingAndMethods.CanUseAbility(player, AbilityType.FlashOnCommand, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.FlashOnCommand, subClass, "flash on command"); response = ""; return(true); } if (TrackingAndMethods.OnCooldown(player, AbilityType.FlashOnCommand, subClass)) { Log.Debug($"Player {player.Nickname} failed to flash on command", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.FlashOnCommand, subClass, "flash", Time.time); response = ""; return(true); } Utils.SpawnGrenade(ItemType.GrenadeFlash, player, subClass); TrackingAndMethods.AddCooldown(player, AbilityType.FlashOnCommand); TrackingAndMethods.UseAbility(player, AbilityType.FlashOnCommand, subClass); Log.Debug($"Player {player.Nickname} successfully used flash on commad", Subclass.Instance.Config.Debug); } else { Log.Debug($"Player {player.Nickname} could not flash on command", Subclass.Instance.Config.Debug); } response = ""; return(true); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { response = ""; Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.Fake)) { Log.Debug($"Player {player.Nickname} could not use the fake command", Subclass.Instance.Config.Debug); response = ""; return(true); } SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (TrackingAndMethods.OnCooldown(player, AbilityType.Fake, subClass)) { Log.Debug($"Player {player.Nickname} failed to use the fake command", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.Fake, subClass, "fake", Time.time); response = ""; return(true); } if (!TrackingAndMethods.CanUseAbility(player, AbilityType.Fake, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.Fake, subClass, "fake"); response = ""; return(true); } Role role = player.ReferenceHub.characterClassManager.Classes.SafeGet((int)player.Role); if (role.model_ragdoll == null) { return(false); } player.EnableEffect <Ensnared>(subClass.FloatOptions.ContainsKey("FakeDuration") ? subClass.FloatOptions["FakeDuration"] : 3); player.EnableEffect <Scp268>(subClass.FloatOptions.ContainsKey("FakeDuration") ? subClass.FloatOptions["FakeDuration"] : 3); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(role.model_ragdoll, player.Position + role.ragdoll_offset.position, Quaternion.Euler(player.GameObject.transform.rotation.eulerAngles + role.ragdoll_offset.rotation)); NetworkServer.Spawn(gameObject); Ragdoll component = gameObject.GetComponent <Ragdoll>(); component.Networkowner = new Ragdoll.Info(player.UserId, player.Nickname, new PlayerStats.HitInfo(0, player.Nickname, DamageTypes.Falldown, player.Id), role, player.Id); component.NetworkallowRecall = false; component.NetworkPlayerVelo = (player.ReferenceHub.playerMovementSync == null) ? Vector3.zero : player.ReferenceHub.playerMovementSync.PlayerVelocity; TrackingAndMethods.UseAbility(player, AbilityType.Fake, subClass); TrackingAndMethods.AddCooldown(player, AbilityType.Fake); Timing.CallDelayed(subClass.FloatOptions.ContainsKey("FakeDuration") ? subClass.FloatOptions["FakeDuration"] : 3, () => { UnityEngine.Object.DestroyImmediate(gameObject); }); return(true); }
public static bool AbilityOnCooldown(Player p, AbilityType ability) { if (!PlayerHasSubclass(p)) { return(false); } return(TrackingAndMethods.OnCooldown(p, ability, TrackingAndMethods.PlayersWithSubclasses[p])); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { response = ""; Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.Corrupt)) { Log.Debug($"Player {player.Nickname} could not use the corrupt command", Subclass.Instance.Config.Debug); response = ""; return(true); } SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (TrackingAndMethods.OnCooldown(player, AbilityType.Corrupt, subClass)) { Log.Debug($"Player {player.Nickname} failed to use the corrupt command", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.Corrupt, subClass, "corrupt", Time.time); response = ""; return(true); } if (!TrackingAndMethods.CanUseAbility(player, AbilityType.Corrupt, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.Corrupt, subClass, "corrupt"); response = ""; return(true); } Collider[] colliders = Physics.OverlapSphere(player.Position, (subClass.FloatOptions.ContainsKey("CorruptRange") ? subClass.FloatOptions["CorruptRange"] : 10f)); IEnumerable <Player> players = colliders.Select(c => Player.Get(c.gameObject)).Distinct(); if (players.Count() > 0) { TrackingAndMethods.UseAbility(player, AbilityType.Corrupt, subClass); TrackingAndMethods.AddCooldown(player, AbilityType.Corrupt); foreach (Player target in players) { if (target == null || target.Id == player.Id || player.Side == target.Side || (player.Team == Team.SCP && target.Team == Team.TUT)) { continue; } target.EnableEffect <SinkHole>((subClass.FloatOptions.ContainsKey("CorruptDuration") ? subClass.FloatOptions["CorruptDuration"] : 3)); } } return(true); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { response = ""; Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.Stun) || player.IsCuffed) { Log.Debug($"Player {player.Nickname} could not use the punch command", Subclass.Instance.Config.Debug); response = ""; return(true); } SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (TrackingAndMethods.OnCooldown(player, AbilityType.Stun, subClass)) { Log.Debug($"Player {player.Nickname} failed to use the stun command", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.Stun, subClass, "stun", Time.time); response = ""; return(true); } if (!TrackingAndMethods.CanUseAbility(player, AbilityType.Stun, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.Stun, subClass, "stun"); response = ""; return(true); } if (Physics.Raycast(player.CameraTransform.position, player.CameraTransform.forward, out RaycastHit hit, (subClass.FloatOptions.ContainsKey("StunRange") ? subClass.FloatOptions["StunRange"] : 1.3f))) { Player target = Player.Get(hit.collider.gameObject) ?? Player.Get(hit.collider.GetComponentInParent <ReferenceHub>()); if (target == null || target.Id == player.Id || player.Side == target.Side || (player.Team == Team.SCP && target.Team == Team.TUT)) { return(true); } TrackingAndMethods.UseAbility(player, AbilityType.Stun, subClass); TrackingAndMethods.AddCooldown(player, AbilityType.Stun); target.Hurt(subClass.FloatOptions["StunDamage"], null, player.Nickname, player.Id); target.EnableEffect <Ensnared>(subClass.FloatOptions.ContainsKey("StunDuration") ? subClass.FloatOptions["StunDuration"] : 3); target.EnableEffect <Blinded>(subClass.FloatOptions.ContainsKey("StunDuration") ? subClass.FloatOptions["StunDuration"] : 3); } return(true); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (player.Role != RoleType.Scp93953 && player.Role != RoleType.Scp93989 && (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.Scp939Vision))) { Log.Debug($"Player {player.Nickname} failed to echolocate", Subclass.Instance.Config.Debug); response = ""; return(true); } if (TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) && TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.Echolocate)) { SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (!TrackingAndMethods.CanUseAbility(player, AbilityType.Echolocate, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.Echolocate, subClass, "echolocate"); response = ""; return(true); } if (TrackingAndMethods.OnCooldown(player, AbilityType.Echolocate, subClass)) { Log.Debug($"Player {player.Nickname} failed to echolocate", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.Echolocate, subClass, "echolocation", Time.time); response = ""; return(true); } Collider[] lcolliders = Physics.OverlapSphere(player.Position, subClass.FloatOptions.ContainsKey("EcholocateRadius") ? subClass.FloatOptions["EcholocateRadius"] : 10f); foreach (Collider PlayerCollider in lcolliders.Where(c => Player.Get(c.gameObject) != null)) { Player.Get(PlayerCollider.gameObject).ReferenceHub.footstepSync?.CmdScp939Noise(100f); } TrackingAndMethods.AddCooldown(player, AbilityType.Echolocate); TrackingAndMethods.UseAbility(player, AbilityType.Echolocate, subClass); Log.Debug($"Player {player.Nickname} successfully used echolocate", Subclass.Instance.Config.Debug); } response = ""; return(true); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.PowerSurge)) { Log.Debug($"Player {player.Nickname} could not use power surge", Subclass.Instance.Config.Debug); response = ""; return(true); } SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (TrackingAndMethods.OnCooldown(player, AbilityType.PowerSurge, subClass)) { Log.Debug($"Player {player.Nickname} failed to power surge", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.PowerSurge, subClass, "power surge", Time.time); response = ""; return(true); } if (!TrackingAndMethods.CanUseAbility(player, AbilityType.PowerSurge, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.PowerSurge, subClass, "power surge"); response = ""; return(true); } float radius = subClass.FloatOptions.ContainsKey("PowerSurgeRadius") ? subClass.FloatOptions["PowerSurgeRadius"] : 30f; foreach (Room room in Exiled.API.Features.Map.Rooms) { if (Vector3.Distance(room.Position, player.Position) <= radius) { room.TurnOffLights(subClass.FloatOptions.ContainsKey("PowerSurgeDuration") ? subClass.FloatOptions["PowerSurgeDuration"] : 15f); } } TrackingAndMethods.AddCooldown(player, AbilityType.PowerSurge); TrackingAndMethods.UseAbility(player, AbilityType.PowerSurge, subClass); response = ""; return(true); }
public void OnInteractingDoor(InteractingDoorEventArgs ev) { if (TrackingAndMethods.PlayersVenting.Contains(ev.Player)) { ev.IsAllowed = false; Vector3 newPos = ev.Player.Position + (ev.Player.GameObject.transform.forward * 3.5f); newPos.y = ev.Player.Position.y; ev.Player.Position = newPos; return; } if (ev.Door is PryableDoor pryableDoor && (ev.Door.RequiredPermissions.RequiredPermissions != KeycardPermissions.None || ev.Door.ActiveLocks != 0) && !ev.Door.IsConsideredOpen() && ev.Player.CurrentItemIndex == -1) { if (TrackingAndMethods.PlayersWithSubclasses.ContainsKey(ev.Player)) { SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[ev.Player]; if (subClass.Abilities.Contains(AbilityType.PryGates)) { if (!TrackingAndMethods.CanUseAbility(ev.Player, AbilityType.PryGates, subClass)) { TrackingAndMethods.DisplayCantUseAbility(ev.Player, AbilityType.PryGates, subClass, "pry gates"); return; } if (TrackingAndMethods.OnCooldown(ev.Player, AbilityType.PryGates, subClass)) { TrackingAndMethods.DisplayCooldown(ev.Player, AbilityType.PryGates, subClass, "pry gates", Time.time); } else { TrackingAndMethods.AddCooldown(ev.Player, AbilityType.PryGates); TrackingAndMethods.UseAbility(ev.Player, AbilityType.PryGates, subClass); pryableDoor.TryPryGate(); } } } }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.Disguise)) { Log.Debug($"Player {player.Nickname} could not disguise", Subclass.Instance.Config.Debug); response = ""; return(true); } SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (TrackingAndMethods.OnCooldown(player, AbilityType.Disguise, subClass)) { Log.Debug($"Player {player.Nickname} failed to disguise", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.Disguise, subClass, "disguise", Time.time); response = ""; return(true); } if (!TrackingAndMethods.CanUseAbility(player, AbilityType.Disguise, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.Disguise, subClass, "disguise"); response = ""; return(true); } Team mostTeam = Team.RIP; Dictionary <Team, int> occurrences = new Dictionary <Team, int>(); Collider[] dcolliders = Physics.OverlapSphere(player.Position, 50); foreach (Collider c in dcolliders.Where(c => c.enabled && Player.Get(c.gameObject) != null)) { Team t = Player.Get(c.gameObject).Team; if (t == Team.CDP) { t = Team.CHI; } if (t == Team.RSC) { t = Team.MTF; } if (!occurrences.ContainsKey(t)) { occurrences.Add(t, 0); } occurrences[t]++; } var copy = occurrences.ToList(); copy.Sort((x, y) => y.Value.CompareTo(x.Value)); mostTeam = copy[0].Key; if (mostTeam == player.Team || mostTeam == Team.RIP || mostTeam == Team.SCP) { Log.Debug($"Player {player.Nickname} failed to disguise", Subclass.Instance.Config.Debug); player.Broadcast(3, Subclass.Instance.Config.DisguiseFailedMessage); response = ""; return(true); } RoleType role = RoleType.None; switch (mostTeam) { case Team.CDP: role = RoleType.ClassD; break; case Team.CHI: role = RoleType.ChaosInsurgency; break; case Team.MTF: role = RoleType.NtfCadet; break; case Team.RSC: role = RoleType.Scientist; break; case Team.TUT: role = RoleType.Tutorial; break; } bool wasLockedBefore = Round.IsLocked; Round.IsLocked = true; TrackingAndMethods.AddCooldown(player, AbilityType.Disguise); TrackingAndMethods.UseAbility(player, AbilityType.Disguise, subClass); TrackingAndMethods.PlayersThatJustGotAClass[player] = Time.time + 5f; TrackingAndMethods.RemoveAndAddRoles(player, true, false, false, true); float health = player.Health; float armor = player.ArtificialHealth; int maxHealth = player.MaxHealth; int maxArmor = player.MaxArtificialHealth; RoleType trueRole = player.Role; SubClass cloneClass = new SubClass(subClass); cloneClass.BoolOptions["TakesFriendlyFire"] = true; player.SetRole(role, true); Timing.CallDelayed(0.1f, () => { player.Health = health; player.ArtificialHealth = armor; player.IsFriendlyFireEnabled = true; Player scp035 = null; if (Subclass.Instance.Scp035Enabled) { scp035 = (Player)Loader.Plugins.FirstOrDefault(pl => pl.Name == "scp035")?.Assembly?.GetType("scp035.API.Scp035Data") ?.GetMethod("GetScp035", BindingFlags.Public | BindingFlags.Static)?.Invoke(null, null); } TrackingAndMethods.AddClass(player, cloneClass, scp035?.Id == player.Id, true, false, true); }); if (subClass.StringOptions.ContainsKey("Badge") && player.RankName == subClass.StringOptions["Badge"]) { player.RankName = null; } if (subClass.StringOptions.ContainsKey("BadgeColor") && player.RankColor == subClass.StringOptions["BadgeColor"]) { player.RankColor = null; } Timing.CallDelayed(subClass.FloatOptions["DisguiseDuration"], () => { if (!player.IsAlive) { return; } TrackingAndMethods.PlayersThatJustGotAClass[player] = Time.time + 5f; TrackingAndMethods.RemoveAndAddRoles(player, true, false, false, true); float curHealth = player.Health; float curArmor = player.ArtificialHealth; player.SetRole(trueRole, true); Timing.CallDelayed(Subclass.Instance.CommonUtilsEnabled ? 2f : 0.1f, () => { Player scp035 = null; if (Subclass.Instance.Scp035Enabled) { scp035 = (Player)Loader.Plugins.FirstOrDefault(pl => pl.Name == "scp035")?.Assembly?.GetType("scp035.API.Scp035Data") ?.GetMethod("GetScp035", BindingFlags.Public | BindingFlags.Static)?.Invoke(null, null); } TrackingAndMethods.AddClass(player, subClass, scp035?.Id == player.Id, true, false, true); player.MaxHealth = maxHealth; player.MaxArtificialHealth = maxArmor; player.Health = curHealth; player.ArtificialHealth = curArmor; player.IsFriendlyFireEnabled = !subClass.BoolOptions["DisregardHasFF"] && subClass.BoolOptions["HasFriendlyFire"]; }); if (subClass.StringOptions.ContainsKey("Badge") && player.RankName == null) { player.RankName = subClass.StringOptions["Badge"]; } if (subClass.StringOptions.ContainsKey("BadgeColor") && player.RankColor == null) { player.RankColor = subClass.StringOptions["BadgeColor"]; } Round.IsLocked = wasLockedBefore; }); response = ""; return(true); }
public static void AttemptRevive(Player player, SubClass subClass, bool necro = false) { Log.Debug($"Player {player.Nickname} {(necro ? "necromancy" : "revive")} attempt", Subclass.Instance.Config.Debug); AbilityType ability = necro ? AbilityType.Necromancy : AbilityType.Revive; if (TrackingAndMethods.OnCooldown(player, ability, subClass)) { Log.Debug($"Player {player.Nickname} {(necro ? "necromancy" : "revive")} on cooldown", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, necro ? AbilityType.Necromancy : AbilityType.Revive, subClass, necro ? "necromancy" : "revive", Time.time); return; } List <Collider> colliders = Physics.OverlapSphere(player.Position, 3f).Where(e => e.gameObject.GetComponentInParent <Ragdoll>() != null).ToList(); colliders.Sort((Collider x, Collider y) => { return(Vector3.Distance(x.gameObject.transform.position, player.Position).CompareTo(Vector3.Distance(y.gameObject.transform.position, player.Position))); }); if (colliders.Count == 0) { player.Broadcast(2, Subclass.Instance.Config.ReviveFailedNoBodyMessage); Log.Debug($"Player {player.Nickname} {(necro ? "necromancy" : "revive")} overlap did not hit a ragdoll", Subclass.Instance.Config.Debug); return; } Ragdoll doll = colliders[0].gameObject.GetComponentInParent <Ragdoll>(); if (doll.owner == null) { Log.Debug($"Player {player.Nickname} {(necro ? "necromancy" : "revive")} failed", Subclass.Instance.Config.Debug); player.Broadcast(2, Subclass.Instance.Config.CantReviveMessage); return; } if (doll.owner.DeathCause.GetDamageType() == DamageTypes.Lure) { Log.Debug($"Player {player.Nickname} {(necro ? "necromancy" : "revive")} failed", Subclass.Instance.Config.Debug); player.Broadcast(2, Subclass.Instance.Config.CantReviveMessage); return; } Player owner = Player.Get(doll.owner.PlayerId); if (owner != null && !owner.IsAlive) { bool revived = false; if (!necro && TrackingAndMethods.GetPreviousTeam(owner) != null && TrackingAndMethods.GetPreviousTeam(owner) == player.Team && TrackingAndMethods.RagdollRole(doll) != null && TrackingAndMethods.RagdollRole(doll) == TrackingAndMethods.GetPreviousRole(owner)) { if (TrackingAndMethods.PlayersThatJustGotAClass.ContainsKey(owner)) { TrackingAndMethods.PlayersThatJustGotAClass[owner] = Time.time + 3f; } else { TrackingAndMethods.PlayersThatJustGotAClass.Add(owner, Time.time + 3f); } owner.SetRole((RoleType)TrackingAndMethods.GetPreviousRole(owner), true); if (TrackingAndMethods.PreviousSubclasses.ContainsKey(owner) && TrackingAndMethods.PreviousSubclasses[owner].AffectsRoles.Contains((RoleType)TrackingAndMethods.GetPreviousRole(owner))) { TrackingAndMethods.AddClass(owner, TrackingAndMethods.PreviousSubclasses[owner], false, true); } owner.Inventory.Clear(); revived = true; } else if (necro) { owner.Role = RoleType.Scp0492; TrackingAndMethods.AddZombie(player, owner); owner.IsFriendlyFireEnabled = true; revived = true; } if (revived) { Timing.CallDelayed(0.2f, () => { owner.ReferenceHub.playerMovementSync.OverridePosition(player.Position + new Vector3(0.3f, 1f, 0), 0, true); if (subClass.FloatOptions.ContainsKey("PercentHealthOnRevive") && !necro) { owner.Health *= (subClass.FloatOptions["PercentHealthOnRevive"] / 100f); } else if (subClass.FloatOptions.ContainsKey("PercentHealthOnNecro") && necro) { owner.Health *= (subClass.FloatOptions["PercentHealthOnNecro"] / 100f); } }); NetworkServer.Destroy(doll.gameObject); TrackingAndMethods.AddCooldown(player, ability); TrackingAndMethods.UseAbility(player, ability, subClass); Log.Debug($"Player {player.Nickname} {(necro ? "necromancy" : "revive")} succeeded", Subclass.Instance.Config.Debug); } else { Log.Debug($"Player {player.Nickname} {(necro ? "necromancy" : "revive")} failed", Subclass.Instance.Config.Debug); player.Broadcast(2, Subclass.Instance.Config.CantReviveMessage); } } else { Log.Debug($"Player {player.Nickname} {(necro ? "necromancy" : "revive")} failed", Subclass.Instance.Config.Debug); player.Broadcast(2, Subclass.Instance.Config.CantReviveMessage); } }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.InvisibleOnCommand)) { Log.Debug($"Player {player.Nickname} could not go invisible on command", Subclass.Instance.Config.Debug); response = ""; return(true); } Scp268 scp268 = player.ReferenceHub.playerEffectsController.GetEffect <Scp268>(); if (scp268 != null) { SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (!TrackingAndMethods.CanUseAbility(player, AbilityType.InvisibleOnCommand, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.InvisibleOnCommand, subClass, "invisible on command"); response = ""; return(true); } if (scp268.Enabled) { Log.Debug($"Player {player.Nickname} failed to go invisible on command", Subclass.Instance.Config.Debug); player.Broadcast(3, Subclass.Instance.Config.AlreadyInvisibleMessage); response = ""; return(true); } if (TrackingAndMethods.OnCooldown(player, AbilityType.InvisibleOnCommand, subClass)) { Log.Debug($"Player {player.Nickname} failed to go invisible on command", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.InvisibleOnCommand, subClass, "invisible", Time.time); response = ""; return(true); } //scp268.Duration = subClass.FloatOptions.ContainsKey("InvisibleOnCommandDuration") ? // subClass.FloatOptions["InvisibleOnCommandDuration"]*2f : 30f*2f; //player.ReferenceHub.playerEffectsController.EnableEffect(scp268); player.ReferenceHub.playerEffectsController.EnableEffect <Scp268>(); TrackingAndMethods.PlayersInvisibleByCommand.Add(player); Timing.CallDelayed(subClass.FloatOptions.ContainsKey("InvisibleOnCommandDuration") ? subClass.FloatOptions["InvisibleOnCommandDuration"] : 30f, () => { if (TrackingAndMethods.PlayersInvisibleByCommand.Contains(player)) { TrackingAndMethods.PlayersInvisibleByCommand.Remove(player); } if (scp268.Enabled) { player.ReferenceHub.playerEffectsController.DisableEffect <Scp268>(); } }); TrackingAndMethods.AddCooldown(player, AbilityType.InvisibleOnCommand); TrackingAndMethods.UseAbility(player, AbilityType.InvisibleOnCommand, subClass); } response = ""; return(true); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { response = ""; Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.Disarm) || player.IsCuffed) { Log.Debug($"Player {player.Nickname} could not use the disarm command", Subclass.Instance.Config.Debug); response = ""; return(true); } SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (TrackingAndMethods.OnCooldown(player, AbilityType.Disarm, subClass)) { Log.Debug($"Player {player.Nickname} failed to use the disarm command", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.Disarm, subClass, "disarm", Time.time); response = ""; return(true); } if (!TrackingAndMethods.CanUseAbility(player, AbilityType.Disarm, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.Disarm, subClass, "disarm"); response = ""; return(true); } if (!subClass.BoolOptions.ContainsKey("DisarmSphere") || !subClass.BoolOptions["DisarmSphere"]) { if (Physics.Raycast(player.CameraTransform.position, player.CameraTransform.forward, out RaycastHit hit, (subClass.FloatOptions.ContainsKey("DisarmRange") ? subClass.FloatOptions["DisarmRange"] : 1.3f))) { Player target = Player.Get(hit.collider.gameObject) ?? Player.Get(hit.collider.GetComponentInParent <ReferenceHub>()); if (target == null || target.Id == player.Id || player.Side == target.Side || (player.Team == Team.SCP && target.Team == Team.TUT)) { return(true); } TrackingAndMethods.UseAbility(player, AbilityType.Disarm, subClass); TrackingAndMethods.AddCooldown(player, AbilityType.Disarm); if (target.CurrentItemIndex != -1) { target.DropItem(target.CurrentItem); } } } else { Collider[] colliders = Physics.OverlapSphere(player.Position, (subClass.FloatOptions.ContainsKey("DisarmRange") ? subClass.FloatOptions["DisarmRange"] : 3f)); IEnumerable <Player> players = colliders.Select(c => Player.Get(c.gameObject)).Distinct(); if (players.Count() > 0) { TrackingAndMethods.UseAbility(player, AbilityType.Disarm, subClass); TrackingAndMethods.AddCooldown(player, AbilityType.Disarm); foreach (Player target in players) { if (target == null || target.Id == player.Id || player.Side == target.Side || (player.Team == Team.SCP && target.Team == Team.TUT)) { continue; } if (target.CurrentItemIndex != -1) { target.DropItem(target.CurrentItem); } } } } return(true); }
public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { Player player = Player.Get(((PlayerCommandSender)sender).SenderId); if ((player.Team != Team.MTF && player.Team != Team.CHI) || !TrackingAndMethods.PlayersWithSubclasses.ContainsKey(player) || !TrackingAndMethods.PlayersWithSubclasses[player].Abilities.Contains(AbilityType.BackupCommand)) { Log.Debug($"Player {player.Nickname} could not use the backup command", Subclass.Instance.Config.Debug); response = ""; return(true); } SubClass subClass = TrackingAndMethods.PlayersWithSubclasses[player]; if (TrackingAndMethods.OnCooldown(player, AbilityType.BackupCommand, subClass)) { Log.Debug($"Player {player.Nickname} failed to use the backup command", Subclass.Instance.Config.Debug); TrackingAndMethods.DisplayCooldown(player, AbilityType.BackupCommand, subClass, "backup", Time.time); response = ""; return(true); } if (!TrackingAndMethods.CanUseAbility(player, AbilityType.BackupCommand, subClass)) { TrackingAndMethods.DisplayCantUseAbility(player, AbilityType.BackupCommand, subClass, "backup"); response = ""; return(true); } int min = subClass.IntOptions.ContainsKey("BackupMinSpawn") ? subClass.IntOptions["BackupMinSpawn"] : 3; int max = subClass.IntOptions.ContainsKey("BackupMaxSpawn") ? subClass.IntOptions["BackupMaxSpawn"] : 7; List <Player> spectators = Player.List.Where(p => p.Role == RoleType.Spectator).ToList(); if (spectators.Count == 0) { player.Broadcast(2, Subclass.Instance.Config.NoAvailableSpectators); response = ""; return(true); } TrackingAndMethods.UseAbility(player, AbilityType.BackupCommand, subClass); TrackingAndMethods.AddCooldown(player, AbilityType.BackupCommand); int spawns = Mathf.Clamp((int)(rnd.NextDouble() * ((max - min) + 1)) + min, 0, spectators.Count); bool isMTF = player.Team == Team.MTF; int commanders = 1; int lieutenants = 0; int cadets = 0; if (isMTF) { lieutenants = Mathf.Clamp(spawns - commanders, 0, 3); cadets = spawns - lieutenants - commanders; } for (int i = 0; i < spawns; i++) { int index = rnd.Next(spectators.Count); Player p = spectators[index]; spectators.RemoveAt(index); if (!isMTF) { p.SetRole(RoleType.ChaosInsurgency); } else { if (commanders > 0) { p.SetRole(RoleType.NtfCommander); commanders--; } else if (lieutenants > 0) { p.SetRole(RoleType.NtfLieutenant); lieutenants--; } else { p.SetRole(RoleType.NtfCadet); } } } response = ""; return(true); }