示例#1
0
 public void Execute(RocketPlayer caller, string[] command)
 {
     if (command.Length > 0)
     {
         if (command[0] == "listclients")
         {
             RocketChat.Say(caller, "ID\t||\tIP:PORT\t||\tCONNECTION TIME");
             foreach(var client in kRCON.dis.rcon.Clients)
             {
                 RocketChat.Say(caller, "#" + client.uniqueID + "\t||\t" + client.IPPort + "\t||\t" +client.OnlineFor);
             }
         }
         else if(command[0] == "kick")
         {
             if(command.Length == 2)
             {
                 int id;
                 int.TryParse(command[1], out id);
                 var client = kRCON.dis.rcon.GetClientFromuID(id);
                 if(client != null)
                 {
                     client.Send("Notice: Your connection was force closed.");
                     client.GracefulClose();
                     RocketChat.Say(caller, "Connection closed.");
                 }
                 else
                 {
                     RocketChat.Say(caller, "Error: client not found.");
                 }
             }
         }
     }
 }
示例#2
0
        private void ReportPermittedKits(RocketPlayer p) {
            string kitsList = ""; //Config.DefaultKit.Name;
            foreach (Kit k in Config.UserKits) {
                if (p.HasPermission("gearup.kits." + k.PermissionGroup))
                    kitsList += k.Name + ", ";
                }
            //if (kitsList.Length < 3)
            //    return;

            //kitsList.Remove(kitsList.Length - 3, 2);
            kitsList = kitsList.TrimEnd(", ".ToCharArray());
            Say(p, $"Kits: {kitsList}", Config.InfoColor);
            return;
            }
示例#3
0
        public void Execute(RocketPlayer caller, string[] command)
        {
            byte damage;
            RocketPlayer target;
            bool callerIsConsole;

            try {
                caller = caller;
                callerIsConsole = false;
            } catch (NullReferenceException nre) {
                callerIsConsole = true;
            }

            if (command.Length != 2) {
                string errorMsg = "Invalid syntax. Usage: /slap <target>/<damage>";
                sendErrorToCaller(caller, errorMsg);
                return;
            }
            if (!byte.TryParse(command[1], out damage) || damage > 100) {
                sendErrorToCaller(caller, "Please enter a valid damage value less than 100");
                return;
            }

            target = RocketPlayer.FromName(command[0]);
            try {
                caller = caller;
            } catch (NullReferenceException nre) {
                string errorMsg = "Target not found";
                if (callerIsConsole) {
                    Logger.LogError(errorMsg);
                } else {
                    RocketChat.Say(caller, errorMsg, Color.red);
                }
                return;
            }
            if (PluginSlay.Instance.Configuration.TellSlayer) {
                target.Damage(damage, Vector3.zero, EDeathCause.MELEE, ELimb.SPINE, caller.CSteamID);
            } else {
                target.Damage(damage, Vector3.zero, EDeathCause.MELEE, ELimb.SPINE, new CSteamID());
            }
        }
示例#4
0
        //public void Execute(RocketPlayer caller, string command) // Changes in the API, cri D:
        public void Execute(RocketPlayer caller, string[] command)
        {
            if (!kIRC.dis.myirc.isConnected) return;

            //if (String.IsNullOrEmpty(command) || command.Split(' ').Length < 2)
            if (command.Length < 2)
            {
                RocketChat.Say(caller, "Syntax: /ircpm [user name] [message]", Color.yellow);
                return;
            }
            else
            {
                //string username = command.Split(' ')[0];
                //string message = command.Remove(0, username.Length + 1);
                string username = command[0];
                string message = String.Join(" ", command, 1, command.Length - 1);
                bool useronline = false;

                for (int i = 0; i < kIRC.dis.myirc.userlist.Count; i++)
                {
                    if (kIRC.dis.myirc.userlist[i][0] == username)
                    {
                        useronline = true;
                        break;
                    }
                    useronline = false;
                }

                if (!useronline)
                {
                    RocketChat.Say(caller, "Error: Username \"" + username + "\" is not online.", Color.red);
                    return;
                }
                else
                {
                    kIRC.dis.myirc.Notice(username, "[Unturned PM] " + caller.CharacterName + ": " + message);
                }
            }
        }
示例#5
0
        private PERM GetPermLevel(RocketPlayer p) {
            PERM perm = PERM.None;

            if (p.HasPermission(@"gearup.info"))
                perm = PERM.Info;

            if (p.HasPermission(@"gearup.self"))
                perm = PERM.Self;

            if (p.HasPermission(@"gearup.other"))
                perm = PERM.Other;

            if (p.HasPermission(@"gearup.admin"))
                perm = PERM.Admin;

            return perm;
            }
示例#6
0
 private void ShowHelp(RocketPlayer p) {
     foreach (string s in Config.HelpText) {
         Say(p, $"{s}", Config.InfoColor);
         }
     }
示例#7
0
        public void Execute(RocketPlayer player, string[] cmd) {
            if (!Initialized)
                Initialize();

            if (player == null)
                return;

            if (!Config.AllowCmd) {
                Say(player, GearUp.TDict["command_disabled"]?.ToString(), Config.ErrorColor);
                Log("GU: Commands are disabled.");
                return;
                }

            PERM perms = GetPermLevel(player);

            try {

                if (perms <= PERM.None && string.Join("", cmd) != "-info") {
                    Say(player, GearUp.TDict["access_denied"]?.ToString(), Color.red);
                    return;
                    }

                if (cmd.Length == 0 && perms >= PERM.Self) {
                    player.GetComponent<GearUpComp>()?.AskGearUp();
                    return;
                    }

                if (cmd.Length >= 1) {

                    if (!cmd[0].StartsWith("-")) {

                        RocketPlayer pFromCmd = RocketPlayer.FromName(cmd[0]);
                        Kit kFromCmd = GetKitByName(cmd[0]);

                        // kit
                        if (kFromCmd != null && perms >= PERM.Self) {
                            player.GetComponent<GearUpComp>()?.AskGearUp(null, kFromCmd);
                            return;
                            }

                        // player
                        if (pFromCmd != null && perms >= PERM.Other) {
                            if (cmd.Length >= 2) {
                                kFromCmd = GetKitByName(cmd[1]);
                                if (kFromCmd != null) {
                                    pFromCmd.GetComponent<GearUpComp>()?.AskGearUp(player, kFromCmd);
                                    //Say(player, $"{GearUp.TDict["gear_gift_success"]?.Replace("%P", pFromCmd.CharacterName)}", Config.SuccessColor);
                                    return;
                                    } else {
                                    Say(player, $"{GearUp.TDict["access_denied_gift"]?.ToString()}", Config.ErrorColor);
                                    return;
                                    }
                                } else {
                                Say(player, $"{GearUp.TDict["error_user_nokit"]?.ToString()}", Config.ErrorColor);
                                return;
                                }
                            }

                        // neither; bad user, no biscuit! D:<
                        Say(player, $"No matching kits or players, kits: ", Config.ErrorColor);
                        ReportPermittedKits(player);
                        return;

                        } else if (cmd[0].StartsWith("-")) {

                        switch (cmd[0]) {
                            case "-on":
                                if ((int)perms < (int)PERM.Admin)
                                    return;
                                GearUp.Instance.enabled = true;
                                Say(player, "GU: Enabled", Config.SuccessColor);
                                break;

                            case "-off":
                                if ((int)perms < (int)PERM.Admin)
                                    return;
                                GearUp.Instance.enabled = false;
                                Say(player, "GU: Disabled", Config.SuccessColor);
                                break;

                            case "-kits":
                            case "-list":
                            case "-l":
                                ReportPermittedKits(player);
                                break;

                            case "-?":
                                if ((int)perms < (int)PERM.Info)
                                    return;
                                ShowHelp(player);
                                break;

                            case "--":
                                if ((int)perms < (int)PERM.Info)
                                    return;
                                Say(player, $"GU: Plugin {(GearUp.Instance.enabled == true ? "enabled" : "disabled")}.", Color.gray);
                                break;

                            case "-reset":
                                if ((int)perms < (int)PERM.Admin)
                                    return;
                                if (cmd.Length >= 2) {
                                    if (!string.IsNullOrEmpty(cmd[1])) {
                                        RocketPlayer p = RocketPlayer.FromName(cmd[1]);
                                        if (p == null) {
                                            Say(player, $"GU: Failed to find player name matching '{cmd[1]}'!", Config.ErrorColor);
                                            } else {
                                            p.GetComponent<GearUpComp>()?.ResetCooldown(player);
                                            }
                                        }
                                    } else {
                                    player.GetComponent<GearUpComp>()?.ResetCooldown();
                                    }
                                break;

                            case "-info":
                                Say(player, $"GearUp {GearUp.Version} by Mash - Auria.pw [{(GearUp.Instance.enabled == true ? "enabled" : "disabled")}]", Config.InfoColor);
                                break;

                            default:
                                Say(player, "GU: Unknown operand", Config.ErrorColor);
                                break;

                            }
                        return;
                        }
                    }
                } catch (Exception ex) {

                GearUp.STOP(ex.Message);

                }
            }
示例#8
0
 private void sendErrorToCaller(RocketPlayer caller, string errorMsg)
 {
     try {
         RocketChat.Say(caller, errorMsg, Color.red);
     } catch (NullReferenceException nre) {
         Logger.LogError(errorMsg);
     }
 }
示例#9
0
 private void sendToCaller(RocketPlayer caller, string msg)
 {
     if (caller == null) {
         Logger.Log(msg);
     } else {
         RocketChat.Say(caller, msg);
     }
 }
示例#10
0
        public void Execute(RocketPlayer caller, string[] command)
        {
            if (command.Length != 1) {
                if (caller == null) {
                    Logger.LogError("Incorrect syntax. Usage: /slay " + Syntax);
                } else {
                    RocketChat.Say(caller, "Incorrect syntax. Usage: /slay " + Syntax, UnityEngine.Color.red);
                }
                return;
            }

            string targetStr = command[0];

            if (RocketPlayer.FromName(targetStr) == null) {
                if (caller == null) {
                    Logger.LogError("Player " + targetStr + " not found");
                } else {
                    RocketChat.Say(caller, "Player " + targetStr + " not found", UnityEngine.Color.red);
                }
                return;
            }
            RocketPlayer target = RocketPlayer.FromName(targetStr);

            if (PluginSlay.Instance.Configuration.TellSlayer) {
                if (caller == null || !PluginSlay.Instance.Configuration.TellSlayer) {
                    target.Damage(255, UnityEngine.Vector3.zero, SDG.Unturned.EDeathCause.KILL, SDG.Unturned.ELimb.SPINE, new Steamworks.CSteamID());
                } else {
                    target.Damage(255, UnityEngine.Vector3.zero, SDG.Unturned.EDeathCause.KILL, SDG.Unturned.ELimb.SPINE, caller.CSteamID);
                }
            }
            sendToCaller(caller, target.CharacterName + " [" + target.SteamName + "] " + "slain.");
        }