Beispiel #1
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            CommandWindow.Log(Translations["Debug_Title"]);
            CommandWindow.Log(string.Format(Translations["Debug_SteamID"], SteamGameServer.GetSteamID()));
            CommandWindow.Log(string.Format(Translations["Debug_IP"], Parser.getIPFromUInt32(SteamGameServer.GetPublicIP())));
            CommandWindow.Log(string.Format(Translations["Debug_Port"], Provider.port));

            CommandWindow.Log(string.Format(Translations["Debug_BytesSent"], Provider.bytesSent));
            CommandWindow.Log(string.Format(Translations["Debug_BytesReceived"], Provider.bytesReceived));

            CommandWindow.Log(string.Format(Translations["Debug_ABytesSent"], (uint)(Provider.bytesSent / Time.realtimeSinceStartup)));
            CommandWindow.Log(string.Format(Translations["Debug_ABytesReceived"], (uint)(Provider.bytesReceived / Time.realtimeSinceStartup)));

            CommandWindow.Log(string.Format(Translations["Debug_PacketsSent"], Provider.packetsSent));
            CommandWindow.Log(string.Format(Translations["Debug_PacketsReceived"], Provider.packetsReceived));

            CommandWindow.Log(string.Format(Translations["Debug_APacketsSent"], (uint)(Provider.packetsSent / Time.realtimeSinceStartup)));
            CommandWindow.Log(string.Format(Translations["Debug_APacketsReceived"], (uint)(Provider.packetsReceived / Time.realtimeSinceStartup)));

            CommandWindow.Log(string.Format(Translations["Debug_UPS"], Mathf.CeilToInt(Provider.debugUPS / 50f * 100f)));
            CommandWindow.Log(string.Format(Translations["Debug_TPS"], Mathf.CeilToInt((Provider.debugTPS / 50f * 100f))));

            CommandWindow.Log(string.Format(Translations["Debug_Zombies"], ZombieManager.tickingZombies.Count));
            CommandWindow.Log(string.Format(Translations["Debug_Animals"], AnimalManager.tickingAnimals.Count));
        }
Beispiel #2
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            UnturnedPlayer[] players = new UnturnedPlayer[1];
            players[0] = (UnturnedPlayer)executor;

            if (args.Length > 0)
            {
                if (!UnturnedPlayer.TryGetPlayers(args[0], out players))
                {
                    UnturnedChat.SendMessage(executor, Translate("PlayerNotFound"), ConsoleColor.Red);
                    return;
                }
            }
            players.ForEach((player) =>
            {
                if (UnturnedPlayer.IsServer(player))
                {
                    UnturnedChat.SendMessage(executor, Translate("FailServer"), ConsoleColor.Red);
                    return;
                }

                player.Life.sendRevive();
                UnturnedChat.SendMessage(executor, Translate("Heal_Success", player.PlayerName), ConsoleColor.Green);
            });
        }
Beispiel #3
0
        public override void Execute(PointBlankPlayer Executor, string[] Arguments)
        {
            if (!Executor.Metadata.ContainsKey("LastPM"))
            {
                UnturnedChat.SendMessage(Executor, Translate("Reply_NoPlayer"));
                return;
            }
            UnturnedPlayer Player = (UnturnedPlayer)Executor.Metadata["LastPM"];

            if (UnturnedPlayer.IsServer(Player) || !UnturnedPlayer.IsInServer(Player))
            {
                Executor.Metadata.Remove("LastPM");
                UnturnedChat.SendMessage(Executor, Translate("Reply_Left"));
                return;
            }

            UnturnedChat.SendMessage(Player, Executor.Get <UnturnedPlayer>() + ": " + Arguments[0]);
            UnturnedChat.SendMessage(Executor, Translate("Reply_Sent", Player));
            if (Player.Metadata.ContainsKey("LastPM"))
            {
                Player.Metadata["LastPM"] = Executor.Get <UnturnedPlayer>();
            }
            else
            {
                Player.Metadata.Add("LastPM", Executor.Get <UnturnedPlayer>());
            }
        }
Beispiel #4
0
 public override void Execute(PointBlankPlayer executor, string[] args)
 {
     if (StringComparer.InvariantCultureIgnoreCase.Compare("reloadsteam", args[0]) == 0)
     {
         SteamGroupManager.Reload();
         UnturnedChat.SendMessage(executor, Translations["PointBlank_ReloadSteam"], ConsoleColor.Green);
     }
     else if (StringComparer.InvariantCultureIgnoreCase.Compare("reloadall", args[0]) == 0)
     {
         SteamGroupManager.Reload();
         UnturnedServer.ReloadPlayers();
         GroupManager.Reload();
         UnturnedChat.SendMessage(executor, Translations["PointBlank_ReloadAll"], ConsoleColor.Green);
     }
     else if (StringComparer.InvariantCultureIgnoreCase.Compare("version", args[0]) == 0)
     {
         UnturnedChat.SendMessage(executor, string.Format(Translations["PointBlank_Version"], PointBlankInfo.Version), ConsoleColor.Green);
     }
     else if (StringComparer.InvariantCultureIgnoreCase.Compare("restartplugins", args[0]) == 0)
     {
         PluginManager.Reload();
         UnturnedChat.SendMessage(executor, Translations["PointBlank_RestartPlugins"], ConsoleColor.Green);
     }
     else
     {
         UnturnedChat.SendMessage(executor, Translations["PointBlank_Invalid"], ConsoleColor.Red);
     }
 }
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            UnturnedPlayer[] players = new UnturnedPlayer[1];
            players[0] = (UnturnedPlayer)executor;

            if (args.Length > 0)
            {
                if (!UnturnedPlayer.TryGetPlayers(args[0], out players))
                {
                    UnturnedChat.SendMessage(executor, Translate("PlayerNotFound"), ConsoleColor.Red);
                    return;
                }
            }
            players.ForEach((player) =>
            {
                if (UnturnedPlayer.IsServer(player))
                {
                    UnturnedChat.SendMessage(executor, Translate("FailServer"), ConsoleColor.Red);
                    return;
                }

                if (player.Metadata.ContainsKey("GodMode"))
                {
                    player.Metadata.Remove("GodMode");
                    UnturnedChat.SendMessage(player, Translate("GodMode_Ungod"), ConsoleColor.Green);
                }
                else
                {
                    player.Metadata.Add("GodMode", true);
                    UnturnedChat.SendMessage(player, Translate("GodMode_God"), ConsoleColor.Green);
                }
            });
        }
Beispiel #6
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            float          distance = Mathf.Infinity;
            UnturnedPlayer player   = (UnturnedPlayer)executor;

            if (args.Length > 0)
            {
                if (!float.TryParse(args[0], out distance))
                {
                    UnturnedChat.SendMessage(executor, Translate("Jump_Distance"), ConsoleColor.Red);
                    return;
                }
            }
            Vector3?position = player.GetEyePosition(distance);

            if (!position.HasValue)
            {
                UnturnedChat.SendMessage(executor, Translate("InvalidPosition"), ConsoleColor.Red);
                return;
            }
            Vector3 pos = position.Value;

            pos.y += 6f;

            if (player.Metadata.ContainsKey("pPosition"))
            {
                player.Metadata["pPosition"] = player.Position.Duplicate();
            }
            else
            {
                player.Metadata.Add("pPosition", player.Position.Duplicate());
            }
            player.Teleport(pos);
            UnturnedChat.SendMessage(executor, Translate("Jump_Jump"), ConsoleColor.Green);
        }
Beispiel #7
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (args.Length < 2 || !UnturnedPlayer.TryGetPlayer(args[1], out UnturnedPlayer ply))
            {
                if (executor == null)
                {
                    UnturnedChat.SendMessage(executor, Translations["Base_InvalidPlayer"], ConsoleColor.Red);
                    return;
                }

                ply = (UnturnedPlayer)executor;
            }

            if (UnturnedPlayer.TryGetPlayer(args[0], out UnturnedPlayer pTarget))
            {
                ply.Teleport(pTarget.Player.transform.position);
                UnturnedChat.SendMessage(executor, string.Format(Translations["Teleport_Teleport"], ply.PlayerName, pTarget.PlayerName), ConsoleColor.Green);
            }
            else
            {
                Node nTarget = LevelNodes.nodes.FirstOrDefault(a => a.type == ENodeType.LOCATION && NameTool.checkNames(args[0], ((LocationNode)a).name));

                if (nTarget == null)
                {
                    UnturnedChat.SendMessage(executor, Translations["Teleport_Invalid"], ConsoleColor.Red);
                    return;
                }

                ply.Teleport(nTarget.point);
                UnturnedChat.SendMessage(executor, string.Format(Translations["Teleport_Teleport"], ply.PlayerName, ((LocationNode)nTarget).name), ConsoleColor.Green);
            }
        }
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            UnturnedPlayer[] players = new UnturnedPlayer[1];
            players[0] = (UnturnedPlayer)executor;

            if (args.Length > 0)
            {
                if (!UnturnedPlayer.TryGetPlayers(args[0], out players))
                {
                    UnturnedChat.SendMessage(executor, Translate("PlayerNotFound"), ConsoleColor.Red);
                    return;
                }
            }
            players.ForEach((player) =>
            {
                if (UnturnedPlayer.IsServer(player))
                {
                    UnturnedChat.SendMessage(executor, Translate("TargetServer"), ConsoleColor.Red);
                    return;
                }

                while (player.Items.Length > 0)
                {
                    player.RemoveItem(player.Items[0]);
                }
                UnturnedChat.SendMessage(executor, Translate("ClearInventory_Success", player.PlayerName), ConsoleColor.Green);
            });
        }
        public ECommandRunError ExecuteCommand(string text, PointBlankPlayer executor)
        {
            string[]       info       = ParseCommand(text);
            List <string>  args       = new List <string>();
            CommandWrapper wrapper    = Commands.FirstOrDefault(a => a.Commands.FirstOrDefault(b => b.ToLower() == info[0].ToLower()) != null && a.Enabled);
            string         permission = "";

            if (wrapper == null)
            {
                PointBlankPlayer.SendMessage(executor, Environment.ServiceTranslations[typeof(ServiceTranslations)].Translations["CommandManager_Invalid"], ConsoleColor.Red);
                return(ECommandRunError.COMMAND_NOT_EXIST);
            }
            permission = wrapper.Permission;
            if (info.Length > 1)
            {
                for (int i = 1; i < info.Length; i++)
                {
                    args.Add(info[i]);
                }
            }
            if (args.Count > 0)
            {
                permission += "." + string.Join(".", args.ToArray());
            }
            if (!PointBlankPlayer.IsServer(executor) && !executor.HasPermission(permission))
            {
                PointBlankPlayer.SendMessage(executor, Environment.ServiceTranslations[typeof(ServiceTranslations)].Translations["CommandManager_NotEnoughPermissions"], ConsoleColor.Red);
                return(ECommandRunError.NO_PERMISSION);
            }

            return(wrapper.Execute(executor, args.ToArray()));
        }
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            string      pos = args[0].ToUpperInvariant();
            ECameraMode mode;

            switch (pos)
            {
            case "FIRST":
                mode = ECameraMode.FIRST;
                break;

            case "THIRD":
                mode = ECameraMode.THIRD;
                break;

            case "VEHICLE":
                mode = ECameraMode.VEHICLE;
                break;

            case "BOTH":
                mode = ECameraMode.BOTH;
                break;

            default:
                mode = ECameraMode.BOTH;
                break;
            }
            Provider.cameraMode = mode;
            UnturnedChat.SendMessage(executor, string.Format(Translations["Camera_SetTo"], mode.ToString()), ConsoleColor.Green);
        }
Beispiel #11
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (!ushort.TryParse(args[0], out ushort flag))
            {
                UnturnedChat.SendMessage(executor, Translations["Flag_InvalidFlag"], ConsoleColor.Red);
                return;
            }
            if (!short.TryParse(args[1], out short value))
            {
                UnturnedChat.SendMessage(executor, Translations["Flag_InvalidValue"], ConsoleColor.Red);
                return;
            }
            if (args.Length < 3 || !UnturnedPlayer.TryGetPlayer(args[2], out UnturnedPlayer player))
            {
                if (executor == null)
                {
                    UnturnedChat.SendMessage(executor, Translations["Base_InvalidPlayer"], ConsoleColor.Red);
                    return;
                }
                player = (UnturnedPlayer)executor;
            }

            player.Player.quests.sendSetFlag(flag, value);
            UnturnedChat.SendMessage(executor, string.Format(Translations["Flag_Set"], player.PlayerName), ConsoleColor.Green);
        }
 public override void Execute(PointBlankPlayer executor, string[] args)
 {
     ZombieManager.tickingZombies.ForEach((zombie) =>
     {
         ZombieManager.sendZombieDead(zombie, Vector3.zero);
     });
     UnturnedChat.SendMessage(executor, Translate("KillZombies_Success"), ConsoleColor.Green);
 }
Beispiel #13
0
 public override void Execute(PointBlankPlayer executor, string[] args)
 {
     AnimalManager.animals.ForEach((animal) =>
     {
         AnimalManager.sendAnimalDead(animal, Vector3.zero);
     });
     UnturnedChat.SendMessage(executor, Translate("KillAnimals_Success"), ConsoleColor.Green);
 }
Beispiel #14
0
 public override void Execute(PointBlankPlayer executor, string[] args)
 {
     CommandWindow.shouldLogChat      = (args[0].ToLower() == "y");
     CommandWindow.shouldLogJoinLeave = (args[1].ToLower() == "y");
     CommandWindow.shouldLogDeaths    = (args[2].ToLower() == "y");
     CommandWindow.shouldLogAnticheat = (args[3].ToLower() == "y");
     CommandWindow.Log(Translations["Log_Set"], ConsoleColor.Green);
 }
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (args.Length < 4 || !byte.TryParse(args[1], out byte r) || !byte.TryParse(args[2], out byte g) || !byte.TryParse(args[3], out byte b))
            {
                ChatManager.say(args[0], Palette.SERVER);
                return;
            }

            ChatManager.say(args[0], new Color((r / 255f), (g / 255f), (b / 255f)));
        }
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (LevelManager.hasAirdrop)
            {
                return;
            }

            LevelManager.airdropFrequency = 0u;
            UnturnedChat.SendMessage(executor, Translations["Airdrop_Success"], ConsoleColor.Green);
        }
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (!Parser.checkIP(args[0]))
            {
                CommandWindow.Log(Translations["Bind_InvalidIP"], ConsoleColor.Red);
                return;
            }

            Provider.ip = Parser.getUInt32FromIP(args[0]);
        }
Beispiel #18
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (!Level.exists(args[0]))
            {
                UnturnedChat.SendMessage(executor, Translations["Map_Invalid"], ConsoleColor.Red);
                return;
            }

            Provider.map = args[0];
            UnturnedChat.SendMessage(executor, string.Format(Translations["Map_Set"], args[0]), ConsoleColor.Green);
        }
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (!PlayerTool.tryGetSteamID(args[0], out CSteamID id))
            {
                UnturnedChat.SendMessage(executor, Translations["Base_InvalidPlayer"], ConsoleColor.Red);
                return;
            }

            SteamAdminlist.ownerID = id;
            UnturnedChat.SendMessage(executor, string.Format(Translations["Owner_Set"], id), ConsoleColor.Green);
        }
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (!ushort.TryParse(args[0], out ushort port))
            {
                UnturnedChat.SendMessage(executor, Translations["Port_Invalid"], ConsoleColor.Red);
                return;
            }

            Provider.port = port;
            UnturnedChat.SendMessage(executor, string.Format(Translations["Port_Set"], port), ConsoleColor.Green);
        }
Beispiel #21
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (!UnturnedPlayer.TryGetPlayer(args[0], out UnturnedPlayer ply))
            {
                UnturnedChat.SendMessage(executor, Translations["Base_InvalidPlayer"], ConsoleColor.Red);
                return;
            }

            ply.Player.sendScreenshot(((UnturnedPlayer)executor)?.SteamID ?? CSteamID.Nil, null);
            UnturnedChat.SendMessage(executor, string.Format(Translations["Spy_Spy"], ply.PlayerName), ConsoleColor.Red);
        }
Beispiel #22
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (!PlayerTool.tryGetSteamID(args[0], out CSteamID id))
            {
                UnturnedChat.SendMessage(executor, Translations["Base_InvalidPlayer"], ConsoleColor.Red);
                return;
            }

            SteamWhitelist.whitelist(id, args[1], ((UnturnedPlayer)executor)?.SteamID ?? CSteamID.Nil);
            UnturnedChat.SendMessage(executor, string.Format(Translations["Permit_Added"], id), ConsoleColor.Green);
        }
Beispiel #23
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            PointBlankCommand cmd = CommandManager.Commands.FirstOrDefault(a => a.Commands.FirstOrDefault(b => b.ToLower() == args[0].ToLower()) != null && a.Enabled);

            if (cmd == null)
            {
                UnturnedChat.SendMessage(executor, Translations["Base_CommandInvalid"], ConsoleColor.Red);
                return;
            }
            UnturnedChat.SendMessage(executor, (executor == null ? "" : "/") + cmd.Usage, ConsoleColor.Green);
        }
Beispiel #24
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            if (args.Length < 1 || args[0].Length < 1)
            {
                Provider.serverPassword = string.Empty;
                UnturnedChat.SendMessage(executor, Translations["Password_Removed"], ConsoleColor.Green);
                return;
            }

            Provider.serverPassword = args[0];
            UnturnedChat.SendMessage(executor, string.Format(Translations["Password_Set"], args[0]), ConsoleColor.Green);
        }
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            UnturnedPlayer player = (UnturnedPlayer)executor;

            if (!player.IsInVehicle)
            {
                UnturnedChat.SendMessage(executor, Translate("OutVehicle"), ConsoleColor.Red);
                return;
            }
            player.Vehicle.Health = player.Vehicle.MaxHealth;
            UnturnedChat.SendMessage(executor, Translate("RepairVehicle_Success"), ConsoleColor.Green);
        }
        private void PointBlankCommandEvents_OnCommandExecuted(PointBlankCommand command, string[] args, PointBlankPlayer executor, ref bool allowExecute)
        {
            if (!typeof(FireworksCommand).IsAssignableFrom(command.GetType()))
            {
                return;
            }
            bool          cancel       = false;
            IRocketPlayer rocketPlayer = (PointBlankPlayer.IsServer(executor) ? new ConsolePlayer() : (IRocketPlayer) new UnturnedPlayer((PBPlayer)executor));

            RocketCommandManager.Instance.RunExecuteCommand(rocketPlayer, ((FireworksCommand)command)._RocketCommand, ref cancel);
            allowExecute = !cancel;
        }
Beispiel #27
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            string reason = Translate("NotSpecified");

            if (args.Length > 0)
            {
                reason = args[0];
            }
            while (UnturnedServer.Players.Length > 0)
            {
                UnturnedServer.Players[0].Kick(reason);
            }
        }
        public ECommandRunError Execute(PointBlankPlayer executor, string[] args)
        {
            try
            {
                if (CommandClass.AllowedServerState == EAllowedServerState.LOADING && PointBlankServer.IsRunning)
                {
                    PointBlankPlayer.SendMessage(executor, Translations["CommandWrapper_Running"], ConsoleColor.Red);
                    return(ECommandRunError.SERVER_RUNNING);
                }
                if (CommandClass.AllowedServerState == EAllowedServerState.RUNNING && !PointBlankServer.IsRunning)
                {
                    PointBlankPlayer.SendMessage(executor, Translations["CommandWrapper_NotRunning"], ConsoleColor.Red);
                    return(ECommandRunError.SERVER_LOADING);
                }
                if (CommandClass.AllowedCaller == EAllowedCaller.SERVER && executor != null)
                {
                    executor.SendMessage(Translations["CommandWrapper_NotConsole"], Color.red);
                    return(ECommandRunError.NOT_CONSOLE);
                }
                if (CommandClass.AllowedCaller == EAllowedCaller.PLAYER && executor == null)
                {
                    executor.SendMessage(Translations["CommandWrapper_NotPlayer"], Color.red);
                    return(ECommandRunError.NOT_PLAYER);
                }
                if (CommandClass.MinimumParams > args.Length)
                {
                    PointBlankPlayer.SendMessage(executor, Translations["CommandWrapper_Arguments"], ConsoleColor.Red);
                    return(ECommandRunError.ARGUMENT_COUNT);
                }
                if (executor != null && executor.HasCooldown(CommandClass))
                {
                    executor.SendMessage(Translations["CommandWrapper_Cooldown"], Color.red);
                    return(ECommandRunError.COOLDOWN);
                }
                bool shouldExecute = true;

                PointBlankCommandEvents.RunCommandExecute(CommandClass, args, executor, ref shouldExecute);
                if (!shouldExecute)
                {
                    return(ECommandRunError.NO_EXECUTE);
                }
                executor?.SetCooldown(CommandClass, DateTime.Now);
                CommandClass.Execute(executor, args);
                return(ECommandRunError.NONE);
            }
            catch (Exception ex)
            {
                PointBlankLogging.LogError("Error when running command: " + Class.Name, ex);
                return(ECommandRunError.EXCEPTION);
            }
        }
Beispiel #29
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            string reason;

            if (!UnturnedPlayer.TryGetPlayer(args[0], out UnturnedPlayer ply))
            {
                UnturnedChat.SendMessage(executor, Translations["Base_InvalidPlayer"], ConsoleColor.Red);
                return;
            }
            reason = args.Length < 2 ? Translations["Kick_Reason"] : args[1];

            Provider.kick(ply.SteamID, reason);
            UnturnedChat.SendMessage(executor, string.Format(Translations["Kick_Kicked"], ply.PlayerName), ConsoleColor.Green);
        }
Beispiel #30
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            switch (LevelLighting.rainyness)
            {
            case ELightingRain.NONE:
                LightingManager.rainFrequency = 0u;
                break;

            case ELightingRain.DRIZZLE:
                LightingManager.rainDuration = 0u;
                break;
            }
            UnturnedChat.SendMessage(executor, Translations["Storm_Change"], ConsoleColor.Green);
        }