Ejemplo n.º 1
0
        private static void RunServer()
        {
            Stopwatch sw = Stopwatch.StartNew();

            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            Console.WriteLine("----===== Revolution WorldServer =====----\n\n"
                              + "Copyright (C) 2013 Revolution Team\n\n"
                              + "This program is CLOSE SOURCE project.\n"
                              + "You DON'T have any right's, if you are NOT autor\n"
                              + "or authorized representative of him.\n"
                              + "Using that program without any right's is ILLEGAL\n\n"
                              + "Authors: Jenose, IMaster\n"
                              + "Authorized representative: netgame.in.th\n\n"
                              + "-------------------------------------------");

            Log.Info("Init Services...");
            AccountService = new AccountService();
            AiService = new AiService();
            ChatService = new ChatService();
            ControllerService = new ControllerService();
            FeedbackService = new FeedbackService();
            MapService = new MapService();
            ObserverService = new ObserverService();
            PlayerService = new PlayerService();
            TeamService = new TeamService();
            SkillsLearnService = new SkillsLearnService();
            StatsService = new StatsService();
            ShopService = new ShopService();
            StorageService = new StorageService();
            TeleportService = new TeleportService();
            VisibleService = new VisibleService();

            Log.Info("Init Engines...");
            ScriptEngine = new ScriptEngine.ScriptEngine();
            AdminEngine = new AdminEngine.AdminEngine();
            SkillEngine = new SkillEngine.SkillEngine();
            QuestEngine = new QuestEngine.QuestEngine();
            Console.WriteLine("\n-------------------------------------------\n");

            GlobalLogic.ServerStart();
            Console.WriteLine("\n-------------------------------------------\n");

            CountryCode = (CountryCode)Enum.Parse(typeof(CountryCode), Settings.Default.COUNTRY_CODE);

            InnerNetworkOpcode.Init();
            OuterNetworkOpcode.Init();

            InnerClient = new InnerNetworkClient("127.0.0.1", 22323);
            InnerClient.BeginConnect();

            foreach (var channel in DataBaseServer.GetServerChannel(Settings.Default.SERVER_ID))
            {
                var OuterNetwork = new OuterNetworkListener("*", channel.port, channel.max_user);
                OuterNetwork.BeginListening();
                OuterNetworks.Add(OuterNetwork);
            }

            InnerNetworkClient.SendAllThread.Start();
            OuterNetworkConnection.SendAllThread.Start();

            sw.Stop();
            Console.WriteLine("-------------------------------------------");
            Console.WriteLine("           Server start in {0}", (sw.ElapsedMilliseconds / 1000.0).ToString("0.00s"));
            Console.WriteLine("-------------------------------------------");
        }
Ejemplo n.º 2
0
        private static void RunServer()
        {
            Stopwatch sw = Stopwatch.StartNew();

            AppDomain.CurrentDomain.UnhandledException += UnhandledException;

            Console.WriteLine("----===== Revolution WorldServer =====----\n\n"
                              + "Copyright (C) 2013 Revolution Team\n\n"
                              + "This program is CLOSE SOURCE project.\n"
                              + "You DON'T have any right's, if you are NOT autor\n"
                              + "or authorized representative of him.\n"
                              + "Using that program without any right's is ILLEGAL\n\n"
                              + "Authors: Jenose, IMaster\n"
                              + "Authorized representative: netgame.in.th\n\n"
                              + "-------------------------------------------");

            Log.Info("Init Services...");
            AccountService     = new AccountService();
            AiService          = new AiService();
            ChatService        = new ChatService();
            ControllerService  = new ControllerService();
            FeedbackService    = new FeedbackService();
            MapService         = new MapService();
            ObserverService    = new ObserverService();
            PlayerService      = new PlayerService();
            TeamService        = new TeamService();
            SkillsLearnService = new SkillsLearnService();
            StatsService       = new StatsService();
            ShopService        = new ShopService();
            StorageService     = new StorageService();
            TeleportService    = new TeleportService();
            VisibleService     = new VisibleService();

            Log.Info("Init Engines...");
            ScriptEngine = new ScriptEngine.ScriptEngine();
            AdminEngine  = new AdminEngine.AdminEngine();
            SkillEngine  = new SkillEngine.SkillEngine();
            QuestEngine  = new QuestEngine.QuestEngine();
            Console.WriteLine("\n-------------------------------------------\n");

            GlobalLogic.ServerStart();
            Console.WriteLine("\n-------------------------------------------\n");

            CountryCode = (CountryCode)Enum.Parse(typeof(CountryCode), Settings.Default.COUNTRY_CODE);

            InnerNetworkOpcode.Init();
            OuterNetworkOpcode.Init();

            InnerClient = new InnerNetworkClient("127.0.0.1", 22323);
            InnerClient.BeginConnect();

            foreach (var channel in DataBaseServer.GetServerChannel(Settings.Default.SERVER_ID))
            {
                var OuterNetwork = new OuterNetworkListener("*", channel.port, channel.max_user);
                OuterNetwork.BeginListening();
                OuterNetworks.Add(OuterNetwork);
            }

            InnerNetworkClient.SendAllThread.Start();
            OuterNetworkConnection.SendAllThread.Start();

            sw.Stop();
            Console.WriteLine("-------------------------------------------");
            Console.WriteLine("           Server start in {0}", (sw.ElapsedMilliseconds / 1000.0).ToString("0.00s"));
            Console.WriteLine("-------------------------------------------");
        }