Beispiel #1
0
        static void Main(string[] args)
        {
            Log.Info("CharacterCacher", "Lancement");

            Assembly.Load("Common");

            if (!EasyServer.InitLog("CharacterCacher", "Configs/CharacterCacher.log"))
            {
                return;
            }

            if (!EasyServer.InitConfig("Configs/CharacterCacher.xml", "CharacterCacher"))
            {
                return;
            }

            if (!EasyServer.InitMysqlDB("Configs/CharacterCacher.db", "Characters"))
            {
                return;
            }

            if (!EasyServer.InitRpcServer("CharacterCacher",
                                          EasyServer.GetConfValue <string>("CharacterCacher", "CharacterCacher", "Key"),
                                          EasyServer.GetConfValue <int>("CharacterCacher", "CharacterCacher", "Port")))
            {
                return;
            }

            CharMgr = new CharacterMgr();
            CharacterMgr.Database = EasyServer.GetDatabase("Characters");

            CharMgr.LoadRealms();

            EasyServer.StartConsole();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Log.Info("LobbyServer", "Starting...");
            if (!EasyServer.InitLog("Lobby", "Configs/Logs.conf") || !EasyServer.InitConfig("Configs/Lobby.xml", "Lobby") || !EasyServer.InitConfig("Configs/Database.xml", "Database"))
            {
                return;
            }
            if (!EasyServer.Listen <TcpServer>(EasyServer.GetConfValue <int>("Lobby", "LoginServer", "Port"), "LoginServer"))
            {
                return;
            }
            worldListener = new World.Listener(EasyServer.GetConfValue <string>("Lobby", "WorldListener", "IP"), EasyServer.GetConfValue <int>("Lobby", "WorldListener", "Port"));
            Databases.InitDB();
            Databases.Load(true);

            try
            {
                HttpServer.MapHandlers();
                HttpServer server = new HttpServer();
                server.Start();
            }
            catch
            {
                Log.Error("HTTP", "If you want to use HTTP stuff, start this server with Admin rights");
            }

            Log.Succes("LobbyServer", "Server initialisation complete!");
            clients.Clear();
            worlds.Clear();
            Timer aTimer = new Timer(1000);

            aTimer.Elapsed  += OnTimedEvent;
            aTimer.AutoReset = true;
            aTimer.Enabled   = true;
            Log.Enter();
            Console.WriteLine("For available console commands, type /commands");
            Log.Enter();
            bool done = false;

            while (!done)
            {
                string command;
                command = Console.ReadLine();
                ProccessCommand(command);
            }
            EasyServer.StartConsole();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Log.Info("WorldServer", "Starting...");
            if (!EasyServer.InitLog("World", "Configs/Logs.conf") || !EasyServer.InitConfig("Configs/World.xml", "World") || !EasyServer.InitConfig("Configs/Database.xml", "Database"))
            {
                return;
            }
            Port = EasyServer.GetConfValue <int>("World", "WorldServer", "Port");
            IP1  = EasyServer.GetConfValue <byte>("World", "WorldServer", "IP1");
            IP2  = EasyServer.GetConfValue <byte>("World", "WorldServer", "IP2");
            IP3  = EasyServer.GetConfValue <byte>("World", "WorldServer", "IP3");
            IP4  = EasyServer.GetConfValue <byte>("World", "WorldServer", "IP4");
            if (!EasyServer.Listen <TcpServer>(Port, "WorldInfo"))
            {
                return;
            }
            Databases.InitDB();
            Databases.Load(false);
            FileMgr           = new FileManager();
            Password          = EasyServer.GetConfValue <string>("World", "LobbyCommunication", "Password");
            WorldName         = EasyServer.GetConfValue <string>("World", "WorldInfo", "Name");
            ID                = EasyServer.GetConfValue <byte>("World", "WorldInfo", "Id");
            Lobby             = new Client(EasyServer.GetConfValue <string>("World", "LobbyCommunication", "Ip"), EasyServer.GetConfValue <int>("World", "LobbyCommunication", "Port"));
            districtsListener = new Listener(EasyServer.GetConfValue <string>("World", "DistrictListener", "Ip"), EasyServer.GetConfValue <int>("World", "DistrictListener", "Port"));
            clients.Clear();
            Timer aTimer = new Timer(10000);

            aTimer.Elapsed  += OnTimedEvent;
            aTimer.AutoReset = true;
            aTimer.Enabled   = true;
            Log.Enter();
            Console.WriteLine("For available console commands, type /commands");
            Log.Enter();
            bool done = false;

            while (!done)
            {
                string command;
                command = Console.ReadLine();
                ProccessCommand(command);
            }
            EasyServer.StartConsole();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Log.Info("DistrictServer", "Starting...");

            #region District

            if (!EasyServer.InitLog("World", "Configs/Logs.conf") || !EasyServer.InitConfig("Configs/District.xml", "District"))
            {
                return;
            }
            switch (EasyServer.GetConfValue <string>("District", "District", "Type"))
            {
            case "social":
                Type = 1;
                break;

            case "financial":
                Type = 2;
                break;

            case "waterfront":
                Type = 21;
                break;

            case "tutorial":
                Type = 14;
                break;
            }

            switch (EasyServer.GetConfValue <string>("District", "District", "Language"))
            {
            case "en":
                Language = 0;
                break;

            case "fr":
                Language = 1;
                break;

            case "it":
                Language = 2;
                break;

            case "ge":
                Language = 3;
                break;

            case "es":
                Language = 4;
                break;

            case "ru":
                Language = 5;
                break;
            }

            if ((Type == 21 || Type == 2) && EasyServer.GetConfValue <bool>("District", "District", "Hardcore"))
            {
                Type += 6;
            }

            #endregion

            Log.Info("World.Client", "Connecting to world at 127.0.0.1:2108...");
            Password = "******";
            ID       = EasyServer.GetConfValue <byte>("District", "District", "Id");
            Port     = EasyServer.GetConfValue <string>("District", "District", "Port");
            IP       = GetPublicIP();
            try
            {
                string       line = null;
                StreamReader file = new StreamReader("Configs\\token.id");
                while ((line = file.ReadLine()) != null)
                {
                    Token = line;
                }
                file.Close();
            }
            catch (FileNotFoundException)
            {
                Log.Error("Token", "\"_rtoken.id\" file not found!");
                return;
            }
            if (IP == null)
            {
                return;
            }
            World    = new World.Client("127.0.0.1", 2108);
            listener = new Listener(Convert.ToInt32(Port));
            EasyServer.StartConsole();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Log.Info("LobbyServer", "Starting...");
            if (!EasyServer.InitLog("Lobby", "Configs/Logs.conf") || !EasyServer.InitConfig("Configs/Lobby.xml", "Lobby") || !EasyServer.InitConfig("Configs/Database.xml", "Database"))
            {
                return;
            }
            if (!EasyServer.Listen <TcpServer>(EasyServer.GetConfValue <int>("Lobby", "LoginServer", "Port"), "LoginServer"))
            {
                return;
            }
            worldListener = new World.Listener(EasyServer.GetConfValue <string>("Lobby", "WorldListener", "IP"), EasyServer.GetConfValue <int>("Lobby", "WorldListener", "Port"));
            Databases.InitDB();
            Databases.Load(true);
            FileMgr = new FileManager();
            string sVersion = EasyServer.GetConfValue <string>("Lobby", "LoginServer", "GameVersion");

            if (sVersion == "RTW_CB")
            {
                version = GameVersion.RTW_CB;
                Log.Info("Version", "Supported game version: 0.6.0.509927 (RTW closed beta)");
            }
            else if (sVersion == "RTW_DVD")
            {
                version = GameVersion.RTW_DVD;
                Log.Info("Version", "Supported game version: 1.1.0.534979 (RTW DVD release)");
            }
            else if (sVersion == "RTW_LAST")
            {
                version = GameVersion.RTW_LAST;
                Log.Info("Version", "Supported game version: 1.4.1.555239 (last RTW patch)");
            }
            else if (sVersion == "G1_LATEST")
            {
                version = GameVersion.G1_LATEST;
                Log.Info("Version", "Supported game version: 1.19.4.766569 (latest G1 patch)");
            }
            else if (sVersion == "G1_ENGUPD")
            {
                version = GameVersion.G1_ENGUPD;
                Log.Info("Version", "Supported game version: 2.0.0.750394 (G1 engine update)");
            }
            else
            {
                version = GameVersion.INVALID;
                Log.Error("Version", "Invalid game version");
            }

            try
            {
                HttpServer.MapHandlers();
                HttpServer server = new HttpServer();
                server.Start();
            }
            catch
            {
                Log.Error("HTTP", "If you want to use HTTP stuff, start this server with Admin rights");
            }

            Log.Succes("LobbyServer", "Server initialisation complete!");
            clients.Clear();
            worlds.Clear();
            Timer aTimer = new Timer(10000);

            aTimer.Elapsed  += OnTimedEvent;
            aTimer.AutoReset = true;
            aTimer.Enabled   = true;
            Log.Enter();
            Console.WriteLine("For available console commands, type /commands");
            Log.Enter();
            bool done = false;

            while (!done)
            {
                string command;
                command = Console.ReadLine();
                ProccessCommand(command);
            }
            EasyServer.StartConsole();
        }