|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using CommandSystem; |
| 4 | +using CommandSystem.Commands.Console; |
| 5 | +using Exiled.API.Features; |
| 6 | +using Exiled.API.Features.Items; |
| 7 | +using PluginAPI.Enums; |
| 8 | +using UnityEngine; |
| 9 | +using Item = Exiled.API.Features.Items; |
| 10 | + |
| 11 | +namespace SCP_600V.Command |
| 12 | +{ |
| 13 | + [CommandHandler(typeof(CommandHandler))] |
| 14 | + internal class ChengeClass : ICommand |
| 15 | + { |
| 16 | + public string Command { get; set; } = "ChangeClass"; |
| 17 | + |
| 18 | + public string[] Aliases { get; set; } = { "ChCls", "newclass" }; |
| 19 | + |
| 20 | + public string Description { get; set; } = "changes class 1 attemp per game to classd, security, mtf, scientist"; |
| 21 | + |
| 22 | + public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) |
| 23 | + { |
| 24 | + Player ply = Player.Get(sender); |
| 25 | + if (ply.SessionVariables.ContainsKey("IsSCP600") == false) |
| 26 | + { |
| 27 | + response = $"<color=\"red\">{Sai.Instance.Config.NotScp600}</color>"; |
| 28 | + return false; |
| 29 | + } |
| 30 | + if (ply.SessionVariables.ContainsKey("FullAt")) |
| 31 | + { |
| 32 | + response = $"{Sai.Instance.Config.AtempLimitMessage}"; |
| 33 | + return false; |
| 34 | + } |
| 35 | + if (ply.SessionVariables.ContainsKey("IsSCP600")) |
| 36 | + { |
| 37 | + float healt = ply.Health; |
| 38 | + float max = ply.MaxHealth; |
| 39 | + if (arguments.Count == 0) |
| 40 | + { |
| 41 | + response = $"{Sai.Instance.Config.ClassType.Replace("{name}", "classd, security, mtf, scientist")}"; |
| 42 | + return false; |
| 43 | + } |
| 44 | + if (arguments.At(0) == "classd") |
| 45 | + { |
| 46 | + List<Item.Item> items = new List<Item.Item>(); |
| 47 | + Vector3 pos = ply.Position; |
| 48 | + foreach (Item.Item a in ply.Items) { items.Add(a); } |
| 49 | + ply.Role.Set(PlayerRoles.RoleTypeId.ClassD); |
| 50 | + ply.ClearInventory(); |
| 51 | + ply.AddItem(items); |
| 52 | + ply.Teleport(pos); |
| 53 | + ply.SessionVariables.Add("FullAt", null); |
| 54 | + ply.MaxHealth = max; |
| 55 | + ply.Health = healt; |
| 56 | + response = $"{Sai.Instance.Config.CompleteTransform}"; |
| 57 | + return true; |
| 58 | + } |
| 59 | + if (arguments.At(0) == "security") |
| 60 | + { |
| 61 | + List<Item.Item> items = new List<Item.Item>(); |
| 62 | + Vector3 pos = ply.Position; |
| 63 | + foreach (Item.Item a in ply.Items) { items.Add(a); } |
| 64 | + ply.Role.Set(PlayerRoles.RoleTypeId.FacilityGuard); |
| 65 | + ply.ClearInventory(); |
| 66 | + ply.AddItem(items); |
| 67 | + ply.Teleport(pos); |
| 68 | + ply.SessionVariables.Add("FullAt", null); |
| 69 | + ply.MaxHealth = max; |
| 70 | + ply.Health = healt; |
| 71 | + response = $"{Sai.Instance.Config.CompleteTransform}"; |
| 72 | + return true; |
| 73 | + } |
| 74 | + if (arguments.At(0) == "mtf") |
| 75 | + { |
| 76 | + List<Item.Item> items = new List<Item.Item>(); |
| 77 | + Vector3 pos = ply.Position; |
| 78 | + foreach (Item.Item a in ply.Items) { items.Add(a); } |
| 79 | + ply.Role.Set(PlayerRoles.RoleTypeId.NtfSergeant); |
| 80 | + ply.ClearInventory(); |
| 81 | + ply.AddItem(items); |
| 82 | + ply.Teleport(pos); |
| 83 | + ply.SessionVariables.Add("FullAt", null); |
| 84 | + ply.MaxHealth = max; |
| 85 | + ply.Health = healt; |
| 86 | + response = $"{Sai.Instance.Config.CompleteTransform}"; |
| 87 | + return true; |
| 88 | + } |
| 89 | + if (arguments.At(0) == "scientist") |
| 90 | + { |
| 91 | + List<Item.Item> items = new List<Item.Item>(); |
| 92 | + Vector3 pos = ply.Position; |
| 93 | + foreach (Item.Item a in ply.Items) { items.Add(a); } |
| 94 | + ply.Role.Set(PlayerRoles.RoleTypeId.Scientist); |
| 95 | + ply.ClearInventory(); |
| 96 | + ply.AddItem(items); |
| 97 | + ply.Teleport(pos); |
| 98 | + ply.SessionVariables.Add("FullAt", null); |
| 99 | + ply.MaxHealth = max; |
| 100 | + ply.Health = healt; |
| 101 | + response = $"{Sai.Instance.Config.CompleteTransform}"; |
| 102 | + return true; |
| 103 | + } |
| 104 | + } |
| 105 | + response = "?"; |
| 106 | + return false; |
| 107 | + } |
| 108 | + } |
| 109 | +} |
0 commit comments