コード例 #1
0
        public void cmd_nodamage(CommandInfo info)
        {
            string[]      arg    = info.commandArgs;
            CommandSender sender = info.commandSender;

            if (!CustomInternalCommands.CheckPermissions(sender, arg[0], PlayerPermissions.PlayersManagement))
            {
                return;
            }

            List <GameObject> playerList = CustomInternalCommands.GetPlayersFromString(arg[1]);

            foreach (GameObject player in playerList)
            {
                int id = player.GetComponent <RemoteAdmin.QueryProcessor>().PlayerId;

                if (!nodamageplayers.ContainsKey(id))
                {
                    nodamageplayers.Add(id, player);
                }
                else
                {
                    nodamageplayers.Remove(id);
                }
            }
        }
コード例 #2
0
        public void cmd_Drop(CommandInfo info)
        {
            try
            {
                string[] arg = info.commandArgs;

                if (!CustomInternalCommands.CheckPermissions(info.commandSender, arg[0], PlayerPermissions.PlayersManagement))
                {
                    return;
                }

                List <GameObject> playerList = CustomInternalCommands.GetPlayersFromString(arg[1]);

                foreach (GameObject p in playerList)
                {
                    p.GetComponent <Inventory>().ServerDropAll();
                }

                info.commandSender.RaReply(info.commandName.ToUpper() + $"#Player {(playerList.Count > 1 ? "inventories" : "inventory")} dropped", true, true, "");
            }
            catch (Exception e)
            {
                Base.Error(e.ToString());
            }
        }
コード例 #3
0
        public void cmd_PBC(CommandInfo info)
        {
            string[]      arg    = info.commandArgs;
            CommandSender sender = info.commandSender;

            if (!CustomInternalCommands.CheckPermissions(sender, arg[0], PlayerPermissions.Broadcasting))
            {
                return;
            }

            bool success = ushort.TryParse(arg[2], out ushort duration);

            if (arg.Count() < 4)
            {
                sender.RaReply(arg[0].ToUpper() + "#Command expects 3 or more arguments ([Players], [Seconds], [Message])", false, true, "");
                return;
            }
            else if (!success || duration < 1 || duration > 255)
            {
                sender.RaReply(arg[0].ToUpper() + "#Invalid duration given", false, true, "");
                return;
            }

            List <GameObject> playerList = CustomInternalCommands.GetPlayersFromString(arg[1]);

            string message = string.Join(" ", arg.Skip(3));

            foreach (GameObject player in playerList)
            {
                player.GetComponent <Broadcast>().TargetAddElement(player.GetComponent <NetworkConnection>(), message, duration, Broadcast.BroadcastFlags.Normal);
            }

            sender.RaReply(arg[0].ToUpper() + "Broadcast sent!", true, true, "");
        }
コード例 #4
0
        public void cmd_pocket(CommandInfo info)
        {
            List <GameObject> playerList = CustomInternalCommands.GetPlayersFromString(info.commandArgs[1]);

            foreach (GameObject plr in playerList)
            {
                plr.GetComponent <PlayerMovementSync>().OverridePosition(Vector3.down * 1998.5f, 0f, true);
            }

            info.commandSender.RaReply(info.commandName.ToUpper() + $"#Teleported {playerList.Count} {(playerList.Count == 1 ? "player" : "players")} to the pocket dimension", true, true, "");
        }
コード例 #5
0
        public void cmd_tower2(CommandInfo info)
        {
            List <GameObject> playerList = CustomInternalCommands.GetPlayersFromString(info.commandArgs[1]);

            foreach (GameObject plr in playerList)
            {
                plr.GetComponent <PlayerMovementSync>().OverridePosition(new Vector3(223, 1026, -18), 0);
            }

            info.commandSender.RaReply(info.commandName.ToUpper() + $"#Teleported {playerList.Count} {(playerList.Count == 1 ? "player" : "players")} to tower 2", true, true, "");
        }
コード例 #6
0
        public void cmd_oban(CommandInfo info)
        {
            CommandSender sender = info.commandSender;

            string[] arg = info.commandArgs;

            if (arg.Count() < 4)
            {
                sender.RaReply(arg[0].ToUpper() + "#Command expects 3 or more arguments ([UserID], [Minutes], [Reason])", false, true, "");
                return;
            }
            else if (!arg[1].Contains('@'))
            {
                sender.RaReply(arg[0].ToUpper() + "#Invalid UserID given", false, true, "");
                return;
            }

            char unit = arg[2].ToString().Where(Char.IsLetter).ToArray()[0];

            if (!int.TryParse(new string(arg[2].Where(Char.IsDigit).ToArray()), out int amount) || !CustomInternalCommands.validUnits.Contains(unit) || amount < 1)
            {
                sender.RaReply(arg[0].ToUpper() + "#Invalid duration", false, true, "");
                return;
            }

            TimeSpan duration = CustomInternalCommands.GetBanDuration(unit, amount);
            string   reason   = string.Join(" ", arg.Skip(3));

            if (duration.Minutes > 60 && !CustomInternalCommands.CheckPermissions(sender, arg[0], PlayerPermissions.KickingAndShortTermBanning))
            {
                return;
            }
            else if (duration.Minutes > 1440 && !CustomInternalCommands.CheckPermissions(sender, arg[0], PlayerPermissions.BanningUpToDay))
            {
                return;
            }

            BanHandler.IssueBan(new BanDetails
            {
                OriginalName = "Offline player",
                Id           = arg[1],
                Issuer       = sender.Nickname,
                IssuanceTime = DateTime.UtcNow.Ticks,
                Expires      = DateTime.UtcNow.Add(duration).Ticks,
                Reason       = reason.Replace(Environment.NewLine, "")
            }, BanHandler.BanType.UserId);

            sender.RaReply(arg[0].ToUpper() + $"#{arg[1]} was offline banned for {arg[2]}", true, true, "");
        }
コード例 #7
0
        public void cmd_Kill(CommandInfo info)
        {
            string[]      arg    = info.commandArgs;
            CommandSender sender = info.commandSender;

            if (!CustomInternalCommands.CheckPermissions(sender, arg[0], PlayerPermissions.PlayersManagement))
            {
                return;
            }

            List <GameObject> playerList = CustomInternalCommands.GetPlayersFromString(arg[1]);

            foreach (GameObject player in playerList)
            {
                player.GetComponent <PlayerStats>().HurtPlayer(new PlayerStats.HitInfo(9999f, sender.Nickname, DamageTypes.None, info.gameObject.GetComponent <RemoteAdmin.QueryProcessor>().PlayerId), player);
            }

            info.commandSender.RaReply(info.commandName.ToUpper() + $"#Killed {playerList.Count} {(playerList.Count > 1 ? "players" : "player")}", true, true, "");
        }