Exemple #1
0
    public void Prepare()
    {
        _server = new Server(8886);
        _server.StartListeningForPackets();

        Redis redis = new Redis();

        redis.Start();

        TestDb.Create();

        _client = new ConnectedClientTcpHandler(new TcpClient("localhost", 8886));
    }
Exemple #2
0
        public void Start()
        {
            Redis redis = new Redis();

            redis.Start();
            TestDb.Create();
            _server = new Server(new ServerStartConfig()
            {
                Port = 123
            });
            _server.StartGameThread();
            _player       = TestDb.TEST_PLAYER;
            _player.Login = "******";
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Log.Info("Connecting to Redis");
            Redis redis = new Redis();

            redis.Start();

            Log.Info("Creating Test Database");
            TestDb.Create();

            Log.Info("Starting Server");
            var server = new Server(new Server.ServerStartConfig()
            {
                Port = SERVER_PORT
            });

            server.StartListeningForPackets();
            server.StartGameThread();

            // Make the server thread join this thread so the code execution dont stop here
            //server.TcpHandler.connectionsThread.Join();
            while (server.IsRunning())
            {
                string consoleInput = Console.ReadLine();

                string[] split = consoleInput.Split(" ");

                string cmd = split[0];

                var cmdArgs = split.Skip(1).ToArray();
                if (cmd == "help")
                {
                    Log.Info("Registered Commands:", ConsoleColor.Green);
                    var allCommands = Server.CommandHandler.RegisteredCommands();
                    var output      = "help |";
                    foreach (var command in allCommands)
                    {
                        output += $" {command} |";
                    }
                    Log.Info(output, ConsoleColor.Green);
                }
                if (!Server.CommandHandler.RunCommand(cmd, cmdArgs))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine();
                    Log.Error("[Console] Command Not Found. Use 'help' for help");
                }
            }
        }
Exemple #4
0
        public void Start()
        {
            Redis redis = new Redis();

            redis.Start();
            TestDb.Create();
            _server = new Server(1234);
            _server.StartGameThread();

            _player = new StoredPlayer()
            {
                UserId   = "wololo",
                Login    = "******",
                Password = "******"
            };
        }
Exemple #5
0
    public void Prepare()
    {
        _server = new Server(8886);
        _server.StartListeningForPackets();

        Redis redis = new Redis();

        redis.Start();

        TestDb.Create();

        _client = new ConnectedClientTcpHandler()
        {
            TcpClient    = new TcpClient("localhost", 8886),
            ConnectionId = Guid.NewGuid().ToString()
        };
    }
Exemple #6
0
        public void Start()
        {
            Redis redis = new Redis();

            redis.Start();

            TestDb.Create();
            _player = new StoredPlayer()
            {
                UserId    = "wololo",
                Login     = "******",
                Password  = "******",
                MoveSpeed = 1,
                X         = 5,
                Y         = 5
            };
        }
Exemple #7
0
        public void Start()
        {
            Redis redis = new Redis();

            redis.Start();
            TestDb.Create();
            _server = new Server(new ServerStartConfig()
            {
                Port = 123
            });
            _server.StartGameThread();
            _player = new StoredPlayer()
            {
                UserId    = "wololo",
                Login     = "******",
                Password  = "******",
                MoveSpeed = 1,
                X         = 0,
                Y         = 0
            };
        }
Exemple #8
0
        public void Start()
        {
            Redis redis = new Redis();

            redis.Start();
            TestDb.Create();
            _server = new Server(new Server.ServerStartConfig()
            {
                Port = 123, DisableSpawners = true
            });
            // _server.StartGameThread();
            GameThread.TIME_MS_NOW = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
            _player = new StoredPlayer()
            {
                UserId    = "wololo",
                Login     = "******",
                Password  = "******",
                MoveSpeed = 1,
                X         = 0,
                Y         = 0
            };
            _client = ServerMocker.GetClient();
            _client.FullLoginSequence(_player);
            _monster = new Skeleton()
            {
                HP       = 10,
                Position = new Position(1, 0)
            };

            Server.Events.Call(new EntitySpawnEvent()
            {
                Entity   = _monster,
                Position = _monster.Position
            });

            // So we can send move events w/o worryng about cooldown check
            Server.GetPlayer(_player.UserId).MoveSpeed = int.MaxValue;
        }