예제 #1
0
 private static void Main(string[] args)
 {
     #region Initiate Servers
     Program.Servers    = new GameServer[3];
     Program.Servers[0] = new GameServer
     {
         IPBytes    = IPAddress.Parse(GameIP).GetAddressBytes(),
         IP         = "192.168.1.2",
         serverType = Enums.ServerType.Normal,
         Port       = 13009,
         MaxPlayers = 800u,
         NoLimit    = 1,
         Name       = "Alchemist",
         MinRank    = 0,
         MaxRank    = 100
     };
     Program.Servers[1] = new GameServer
     {
         IPBytes    = IPAddress.Parse(GameIP).GetAddressBytes(),
         IP         = GameIP,
         serverType = Enums.ServerType.Normal,
         Port       = 13010,
         MaxPlayers = 800u,
         NoLimit    = 1,
         Name       = "LordsRoad",
         MinRank    = 0,
         MaxRank    = 100
     };
     Program.Servers[2] = new GameServer
     {
         IPBytes    = IPAddress.Parse(GameIP).GetAddressBytes(),
         IP         = GameIP,
         serverType = Enums.ServerType.Normal,
         Port       = 13011,
         MaxPlayers = 800u,
         NoLimit    = 1,
         Name       = "Satanic",
         MinRank    = 0,
         MaxRank    = 100
     };
     #endregion
     Thread = new Thread();
     Thread.Init();
     AuthServer = new Network.Sockets.ServerSocket();
     AuthServer.OnClientConnect    += AuthServer_OnClientConnect;
     AuthServer.OnClientReceive    += AuthServer_OnClientReceive;
     AuthServer.OnClientDisconnect += AuthServer_OnClientDisconnect;
     AuthServer.Enable(AuthPort, AuthIP);
     Console.Title = "[CF_Server] - Online Players: 0 - MaxOnline: 0";
     Console.WriteLine(string.Concat(new object[]
     {
         "[",
         DateTime.Now.ToString("dd/mm/yyyy hh:mm:ss"),
         "] Auth Server started on " + AuthIP + ":",
         AuthPort
     }));
     for (int i = 0; i < Servers.Length; i++)
     {
         Program.Servers[i].Open();
         Console.WriteLine(string.Concat(new object[]
         {
             "[",
             DateTime.Now.ToString("dd/mm/yyyy hh:mm:ss"),
             "] " + Program.Servers[i].Name + " Server started on " + Program.Servers[i].IP + ":",
             Program.Servers[i].Port
         }));
     }
     Kernel.Rooms.Add(new Room()
     {
         Channel            = 1,
         Server             = Program.Servers[0],
         VIP                = true,
         Status             = Enums.RoomStatus.inGame,
         gameMode           = Enums.GameMode.Team_Death_Match,
         MapID              = 20,//Egypt
         maxNumberOfPlayers = 10,
         objectiveType      = Enums.RoomObjType.Kills,
         NoFlash_Smoke      = true,
         Weapons            = Enums.RoomWeapons.Sniper,
         Name               = "my Testing Room1",
         Password           = "",
         Number             = 1,
         maxObjectiveCount  = 100,
         Players            = new System.Collections.Generic.Dictionary <uint, Client.GameClient>()
         {
             { 0, new Client.GameClient(null)
               {
                   Entity = new Entity()
                   {
                       Name = "2ndTest", Clan = "Yuzumaki"
                   }
               } }
         },
         objectiveCount = 70,
         Host           = new Client.GameClient(null)
         {
             Entity = new Entity()
             {
                 Name = "2ndTest", Clan = "Yuzumaki"
             }
         }
     });
     #region ReadCommands
     while (true)
     {
         string Command = Console.ReadLine();
         HandleCommand(Command);
     }
     #endregion
 }