Beispiel #1
0
        public void addClient(TcpClient client)
        {
            bool flag = this._banned == null;

            if (flag)
            {
                this._banned = NetworkBlock.getInstance();
            }
            string text = client.Client.RemoteEndPoint.ToString().Split(new char[]
            {
                ':'
            })[0];
            bool flag2 = !this._banned.allowed(text);

            if (flag2)
            {
                client.Close();
                CLogger.getInstance().error("NetworkBlock: connection attemp failed. " + text + " banned.");
            }
            else
            {
                GameClient item  = new GameClient(client);
                bool       flag3 = this._loggedClients.Contains(item);
                if (flag3)
                {
                    CLogger.getInstance().info("Client is Have");
                }
                else
                {
                    this._loggedClients.Add(item);
                }
            }
        }
        public void addClient(TcpClient client)
        {
            if (this._banned == null)
            {
                this._banned = NetworkBlock.getInstance();
            }
            string ip = client.Client.RemoteEndPoint.ToString().Split(new char[1]
            {
                ':'
            })[0];

            if (!this._banned.allowed(ip))
            {
                client.Close();
                CLogger.getInstance().error("NetworkBlock: connection attemp failed. " + ip + " banned.");
            }
            else
            {
                GameClient gameClient = new GameClient(client);
                if (this._loggedClients.Contains(gameClient))
                {
                    CLogger.getInstance().info("Client is Have");
                }
                else
                {
                    this._loggedClients.Add(gameClient);
                }
            }
        }
Beispiel #3
0
        public void addClient(TcpClient client)
        {
            if (banned == null)
            {
                banned = NetworkBlock.getInstance();
            }

            string ip = client.Client.RemoteEndPoint.ToString().Split(':')[0];

            Console.WriteLine("connected " + ip);
            if (flood.ContainsKey(ip))
            {
                if (flood[ip].CompareTo(DateTime.Now) == 1)
                {
                    CLogger.warning("active flooder " + ip);
                    client.Close();
                    return;
                }
                else
                {
                    lock (flood)
                    {
                        flood.Remove(ip);
                    }
                }
            }

            flood.Add(ip, DateTime.Now.AddMilliseconds(3000));

            if (!banned.Allowed(ip))
            {
                client.Close();
                CLogger.error("NetworkBlock: connection attemp failed. " + ip + " banned.");
                return;
            }

            LoginClient lc = new LoginClient(client);

            if (_loggedClients.Contains(lc))
            {
                return;
            }

            _loggedClients.Add(lc);
        }
        public void addClient(TcpClient client)
        {
            if (_banned == null)
            {
                _banned = NetworkBlock.getInstance();
            }

            string ip = client.Client.RemoteEndPoint.ToString().Split(':')[0];

            if (_flood.ContainsKey(ip))
            {
                if (_flood[ip].CompareTo(DateTime.Now) == 1)
                {
                    CLogger.warning("active flooder " + ip);
                    client.Close();
                    return;
                }
                else
                {
                    lock (_flood)
                        _flood.Remove(ip);
                }
            }

            _flood.Add(ip, DateTime.Now.AddMilliseconds(3000));

            if (!_banned.allowed(ip))
            {
                client.Close();
                CLogger.error("NetworkBlock: connection attemp failed. " + ip + " banned.");
                return;
            }

            GameClient gc = new GameClient(client);

            clients.Add(gc._address.ToString(), gc);
            CLogger.extra_info("NetController: " + clients.Count + " active connections");
        }
Beispiel #5
0
        public void Start()
        {
            Console.Title = "L2dotNET Gameserver";

            CLogger.form();
            Cfg.init("all");

            CharTemplateTable.Instance.Initialize();

            NetworkBlock.getInstance();
            GameTime.getInstance();

            IdFactory.Instance.Initialize();

            L2World.Instance.Initialize();

            // MapRegionTable.getInstance();
            ZoneTable.getInstance();

            NpcTable.getInstance();
            NpcData.getInstance();
            //  SpawnTable.getInstance();
            StaticObjTable.getInstance().read();
            StructureTable.getInstance().read();
            //  TSkillTable.getInstance();
            ItemTable.getInstance();
            ItemHandler.getInstance();
            MultiSell.getInstance();
            Capsule.getInstance();
            RecipeTable.getInstance();

            MonsterRace.getInstance();

            AIManager.getInstance();


            BlowFishKeygen.genKey();
            CLogger.info("generated 20 blowfish keys");

            AdminAccess.Instance.Initialize();;

            QuestManager.getInstance();

            AnnouncementManager.Instance.Initialize();

            AllianceTable.getInstance();
            ClanTable.getInstance();

            CLogger.info("NpcServer: ");
            StaticObjTable.getInstance().Spawn();
            MonsterRace.getInstance().Spawn();
            //  SpawnTable.getInstance().Spawn();
            StructureTable.getInstance().init();

            HtmCache.getInstance();

            AuthThread.getInstance();

            //   GeoData.getInstance();

            CLogger.extra_info("listening game clients on port " + Cfg.SERVER_PORT);
            _listener = new TcpListener(Cfg.SERVER_PORT);
            _listener.Start();

            TcpClient clientSocket = default(TcpClient);

            while (true)
            {
                clientSocket = _listener.AcceptTcpClient();
                accept(clientSocket);
            }
        }