public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
        {
            if (player.Status != SessionStatus.InGame || player.AttachedEntity == null)
            {
                return;
            }

            if (args.Length < 2 || !float.TryParse(args[0], out var posX) || !float.TryParse(args[1], out var posY))
            {
                return;
            }

            var mapMgr = IoCManager.Resolve <IMapManager>();

            var position  = new Vector2(posX, posY);
            var entity    = player.AttachedEntity;
            var transform = entity.GetComponent <IServerTransformComponent>();

            transform.DetachParent();

            IMapGrid grid;

            if (args.Length == 3 && int.TryParse(args[2], out var mapId) && mapMgr.TryGetMap(new MapId(mapId), out var map))
            {
                grid = map.FindGridAt(position);
            }
            else
            {
                grid = transform.LocalPosition.Map.FindGridAt(position);
            }

            transform.LocalPosition = new GridLocalCoordinates(position, grid);

            host.SendConsoleReply(player.ConnectedClient, $"Teleported {player} to {grid.MapID}:{posX},{posY}.");
        }
Esempio n. 2
0
        public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
        {
            var sb = new StringBuilder();

            var players = IoCManager.Resolve <IPlayerManager>().GetAllPlayers();

            sb.AppendLine("Current Players:");
            sb.AppendLine($"{"Index",1}{"Player Name",20}{"IP Address",16}{"Status",12}{"Playing Time",14}{"Ping",9}");

            foreach (IPlayerSession p in players)
            {
                if (p == null)
                {
                    continue;
                }

                sb.Append($"  {p.Index,3}");
                sb.Append($"  {p.Name,20}");
                sb.AppendLine(string.Format("  {0,16}{1,12}{2,14}{3,9}",
                                            p.ConnectedClient.RemoteAddress,
                                            p.Status.ToString(),
                                            (DateTime.Now - p.ConnectedTime).ToString(@"hh\:mm\:ss"),
                                            p.ConnectedClient.Ping + "ms"));
            }

            host.SendConsoleReply(player.ConnectedClient, sb.ToString());
        }
Esempio n. 3
0
 public void Execute(IClientConsoleHost host, IClient client, params string[] args)
 {
     foreach (IPlayerSession playerfordrugs in IoCManager.Resolve <IPlayerManager>().GetAllPlayers())
     {
         playerfordrugs.AddPostProcessingEffect(PostProcessingEffectType.Acid, 60);
         host.SendConsoleReply("Okay then.", client.NetConnection);
     }
 }
 public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
 {
     foreach (var targetPlayer in IoCManager.Resolve <IPlayerManager>().GetAllPlayers())
     {
         targetPlayer.AddPostProcessingEffect(PostProcessingEffectType.Acid, 60);
         host.SendConsoleReply(player.ConnectedClient, "Okay then.");
     }
 }
Esempio n. 5
0
        public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
        {
            if (player.AttachedEntity == null)
            {
                return;
            }

            var pos = player.AttachedEntity.GetComponent <ITransformComponent>().LocalPosition;

            host.SendConsoleReply(player.ConnectedClient, $"MapID:{pos.MapID} GridID:{pos.GridID} X:{pos.X:N2} Y:{pos.Y:N2}");
        }
Esempio n. 6
0
        public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
        {
            if (args.Length < 1)
            {
                return;
            }

            var mapId = new MapId(int.Parse(args[0]));

            var mapMgr = IoCManager.Resolve <IMapManager>();

            if (!mapMgr.MapExists(mapId))
            {
                mapMgr.CreateMap(mapId);
                host.SendConsoleReply(player.ConnectedClient, $"Map with ID {mapId} created.");
                return;
            }

            host.SendConsoleReply(player.ConnectedClient, $"Map with ID {mapId} already exists!");
        }
        public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
        {
            var builder = new StringBuilder("Available commands:\n");

            foreach (var command in host.AvailableCommands.Values)
            {
                builder.AppendFormat("{0}: {1}\n", command.Command, command.Description);
            }
            var message = builder.ToString().Trim(' ', '\n');

            host.SendConsoleReply(player.ConnectedClient, message);
        }
Esempio n. 8
0
        public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
        {
            var network = (NetManager)IoCManager.Resolve <INetManager>();

            var callbacks = network.CallbackAudit;

            foreach (var kvCallback in callbacks)
            {
                var msgType = kvCallback.Key;
                var call    = kvCallback.Value;

                var str = $"Type: {msgType.Name} Call:{call.Target}";

                host.SendConsoleReply(player.ConnectedClient, str);
            }
        }