Beispiel #1
0
        static void Main(string[] args)
        {
            ReadArguments(args);

            var authConnString = DB.CreateConnectionString(NodeConfig.AuthDBHost, NodeConfig.AuthDBUser, NodeConfig.AuthDBPassword,
                                                           NodeConfig.AuthDBDataBase, NodeConfig.AuthDBPort, NodeConfig.AuthDBMinPoolSize, 
                                                           NodeConfig.AuthDBMaxPoolSize, NodeConfig.AuthDBType);
            var charConnString = DB.CreateConnectionString(NodeConfig.CharacterDBHost, NodeConfig.CharacterDBUser, NodeConfig.CharacterDBPassword,
                                                           NodeConfig.CharacterDBDataBase, NodeConfig.CharacterDBPort, NodeConfig.CharacterDBMinPoolSize, 
                                                           NodeConfig.CharacterDBMaxPoolSize, NodeConfig.CharacterDBType);
            var dataConnString = DB.CreateConnectionString(NodeConfig.DataDBHost, NodeConfig.DataDBUser, NodeConfig.DataDBPassword,
                                                           NodeConfig.DataDBDataBase, NodeConfig.DataDBPort, NodeConfig.DataDBMinPoolSize, 
                                                           NodeConfig.DataDBMaxPoolSize, NodeConfig.DataDBType);

            if (DB.Auth.Initialize(authConnString, NodeConfig.AuthDBType) &&
                DB.Character.Initialize(charConnString, NodeConfig.CharacterDBType) &&
                DB.Data.Initialize(dataConnString, NodeConfig.DataDBType))
            {
                Helper.PrintHeader(serverName);

                using (var server = new Server(NodeConfig.BindIP, NodeConfig.BindPort))
                {
                    PacketManager.DefineMessageHandler();

                    Manager.Initialize();

                    Log.Normal($"{serverName} successfully started");
                    Log.Normal("Total Memory: {0} Kilobytes", GC.GetTotalMemory(false) / 1024);

                    // No need of console commands.
                    while (true)
                        Thread.Sleep(1);
                }
            }
            else
                Log.Error("Not all database connections successfully opened.");
        }
        static void Main(string[] args)
        {
            ReadArguments(args);

            Info = Helper.GetServerDefinition(NodeConfig.ServerId, "nId");

            if (Info == null)
            {
                Log.Error($"Can't find any server definition for nId '{NodeConfig.ServerId}'.");
                Log.Wait();

                return;
            }

            var authConnString = DB.CreateConnectionString(NodeConfig.AuthDBHost, NodeConfig.AuthDBUser, NodeConfig.AuthDBPassword,
                                                           NodeConfig.AuthDBDataBase, NodeConfig.AuthDBPort, NodeConfig.AuthDBMinPoolSize, 
                                                           NodeConfig.AuthDBMaxPoolSize, NodeConfig.AuthDBType);
            var charConnString = DB.CreateConnectionString(NodeConfig.CharacterDBHost, NodeConfig.CharacterDBUser, NodeConfig.CharacterDBPassword,
                                                           NodeConfig.CharacterDBDataBase, NodeConfig.CharacterDBPort, NodeConfig.CharacterDBMinPoolSize, 
                                                           NodeConfig.CharacterDBMaxPoolSize, NodeConfig.CharacterDBType);
            var dataConnString = DB.CreateConnectionString(NodeConfig.DataDBHost, NodeConfig.DataDBUser, NodeConfig.DataDBPassword,
                                                           NodeConfig.DataDBDataBase, NodeConfig.DataDBPort, NodeConfig.DataDBMinPoolSize, 
                                                           NodeConfig.DataDBMaxPoolSize, NodeConfig.DataDBType);

            if (DB.Auth.Initialize(authConnString, NodeConfig.AuthDBType) &&
                DB.Character.Initialize(charConnString, NodeConfig.CharacterDBType) &&
                DB.Data.Initialize(dataConnString, NodeConfig.DataDBType))
            {
                Helper.PrintHeader(serverName);

                Log.Normal($"Loading server with nId '{NodeConfig.ServerId}'.");

                using (var server = new Server(NodeConfig.BindIP, Info.Port))
                {
                    Server.NodeService.Register(null);
                    Server.WorldService.Register(null);

                    Server.ServerInfo = new WorldNodeInfo
                    {
                        RealmId   = Info.Realm,
                        Maps      = Info.Maps,
                        IPAddress = Info.Address,
                        Port      = Info.Port,
                    };

                    Server.NodeService.Register(Server.ServerInfo);

                    PacketManager.DefineMessageHandler();

                    Manager.Initialize();

                    Log.Normal($"{serverName} successfully started");
                    Log.Normal("Total Memory: {0} Kilobytes", GC.GetTotalMemory(false) / 1024);

                    // No need of console commands.
                    while (true)
                        Thread.Sleep(1);
                }
            }
            else
                Log.Error("Not all database connections successfully opened.");
        }