Example #1
0
        static void Main(string[] args)
        {
            Log.Texte("", "---------------------------------------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", " _______ _________ _______ _________ _______  _______          ", ConsoleColor.Cyan);
            Log.Texte("", "(  ____ )\\__   __/(  ____ \\__   __/(  ____ \\(       )|\\     /|", ConsoleColor.Cyan);
            Log.Texte("", "| (    )|   ) (   | (    \\/   ) (   | (    \\/| () () || )   ( |", ConsoleColor.Cyan);
            Log.Texte("", "| (____)|   | |   | (__       | |   | (__    | || || || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "|     __)   | |   |  __)      | |   |  __)   | |(_)| || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "| (\\ (      | |   | (         | |   | (      | |   | || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "| ) \\ \\_____) (___| )         | |   | (____/\\| )   ( || (___) |", ConsoleColor.Cyan);
            Log.Texte("", "|/   \\__/\\_______/|/          )_(   (_______/|/     \\|(_______)", ConsoleColor.Cyan);
            Log.Texte("", "www.Strawberry-Pr0jcts.com", ConsoleColor.DarkCyan);
            Log.Texte("", "---------------------------------------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<RealmConfig>();
            Config.RealmInfo.GenerateName();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel,"Realm"))
                ConsoleMgr.WaitAndExit(2000);

            CharactersMgr.CharactersDB = DBManager.Start(Config.CharactersDB.Total(), ConnectionType.DATABASE_MYSQL, "Characters");
            if (CharactersMgr.CharactersDB == null)
                ConsoleMgr.WaitAndExit(2000);

            WorldMgr.WorldDB = DBManager.Start(Config.WorldDB.Total(), ConnectionType.DATABASE_MYSQL, "World");
            if (WorldMgr.WorldDB == null)
                ConsoleMgr.WaitAndExit(2000);

            PacketProcessor.RegisterDefinitions();

            // Starting Remote Client
            Client = new RpcClient("Realm-" + Config.RealmInfo.RealmId, Config.RpcCharacter.RpcLocalIp, 1);
            if (!Client.Start(Config.RpcCharacter.RpcServerIp, Config.RpcCharacter.RpcServerPort))
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcMapServer.RpcClientStartingPort, 2);
            if (!Server.Start(Config.RpcMapServer.RpcIp, Config.RpcMapServer.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            World = Client.GetLocalObject<WorldMgr>();
            Accounts = Client.GetServerObject<AccountMgr>();
            Characters = Client.GetLocalObject<CharactersMgr>();

            // 1 : Loading WorldMgr
            World.Load();

            // 2 : Loading CharactersMgr
            CharactersMgr.Client = Client;
            CharactersMgr.MyRealm = Config.RealmInfo;
            CharactersMgr.MyRealm.RpcInfo = Client.Info;
            Characters.Load();

            // 3 : Loading AccountsMgr
            Accounts.RegisterRealm(Config.RealmInfo, Client.Info);

            ConsoleMgr.Start();
        }
Example #2
0
        static void ReadArguments(string[] args)
        {
            for (int i = 1; i < args.Length; i += 2)
            {
                switch (args[i - 1])
                {
                case "-config":
                    RealmConfig.Initialize(args[i]);
                    break;

                default:
                    Log.Message(LogType.Error, "'{0}' isn't a valid argument.", args[i - 1]);
                    break;
                }
            }

            if (!RealmConfig.IsInitialized)
            {
                RealmConfig.Initialize("./Configs/RealmServer.conf");
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ Rift", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <RealmConfig>();
            Config.RealmInfo.GenerateName();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "Realm"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            CharactersMgr.CharactersDB = DBManager.Start(Config.CharactersDB.Total(), ConnectionType.DATABASE_MYSQL, "Characters");
            if (CharactersMgr.CharactersDB == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            WorldMgr.WorldDB = DBManager.Start(Config.WorldDB.Total(), ConnectionType.DATABASE_MYSQL, "World");
            if (WorldMgr.WorldDB == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            PacketProcessor.RegisterDefinitions();

            // Starting Remote Client
            Client = new RpcClient("Realm-" + Config.RealmInfo.RealmId, Config.RpcCharacter.RpcLocalIp, 1);
            if (!Client.Start(Config.RpcCharacter.RpcServerIp, Config.RpcCharacter.RpcServerPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }


            Server = new RpcServer(Config.RpcMapServer.RpcClientStartingPort, 2);
            if (!Server.Start(Config.RpcMapServer.RpcIp, Config.RpcMapServer.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            World      = Client.GetLocalObject <WorldMgr>();
            Accounts   = Client.GetServerObject <AccountMgr>();
            Characters = Client.GetLocalObject <CharactersMgr>();

            // 1 : Loading WorldMgr
            World.Load();

            // 2 : Loading CharactersMgr
            CharactersMgr.Client          = Client;
            CharactersMgr.MyRealm         = Config.RealmInfo;
            CharactersMgr.MyRealm.RpcInfo = Client.Info;
            Characters.Load();

            // 3 : Loading AccountsMgr
            Accounts.RegisterRealm(Config.RealmInfo, Client.Info);

            ConsoleMgr.Start();
        }