Esempio n. 1
0
        private void _lt_OnConnectionAccepted(object sender, SocketArg e)
        {
            Connection client = new Connection(e.Socket);

            client.OnLoginRequest          += Client_OnLoginRequest;
            client.OnCharacterListRequest  += Client_OnCharacterListRequest;
            client.OnCreateCharacter       += Client_OnCharacterCreate;
            client.OnDeleteCharacter       += Client_OnDeleteCharacter;
            client.OnSelectCharacter       += Client_OnSelectCharacter;
            client.OnLoadSelectedCharacter += Client_OnLoadSelectedCharacter;
            client.OnPlayerEnterMap        += Client_OnPlayerEnterMap;
            client.OnMoveTo              += Client_OnMoveTo;
            client.OnUpdatePosition      += Client_OnUpdatePosition;
            client.OnNPCDialogNextButton += Client_OnNPCDialogNextButton;
            client.OnGMCommand           += Client_OnGMCommand;
            client.OnMoveItem            += Client_OnMoveItem;
            client.OnToolbarItemSet      += Client_OnToolbar;
            client.OnToolbarItemClear    += Client_OnToolbarItemClear;
            client.OnUseItem             += Client_OnUseItem;
            client.OnEquipItem           += Client_OnEquipItem;
            client.OnUnEquipItem         += Client_OnUnEquipItem;
            client.OnAttack              += Client_OnAttack;

            InputThread.AddConnection(client);
        }
Esempio n. 2
0
        public ServerBase(int listenPort, string dbConnectString)
        {
            _rand = new Random();
            _playServers = new List<PlayServerInfo>();
            _expectedConnections = new Dictionary<string, int>();

            IPAddress[] IPS = Dns.GetHostAddresses(Dns.GetHostName());
            foreach (IPAddress ip in IPS)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                    _playServers.Add(new PlayServerInfo("Main Server", ip.ToString(), (ushort)listenPort));
            }

            // Start log thread
            LogThread log = new LogThread();

            // Start database thread
            if( dbConnectString != null )
                _db = new DatabaseThread(dbConnectString);

            // Start AI Thread
            _aiThread = new AIThread();

            _listenPort = listenPort;

            // Start input thread
            _inputThread = new InputThread();
        }
Esempio n. 3
0
        public ServerBase(int listenPort, string dbConnectString)
        {
            _rand                = new Random();
            _playServers         = new List <PlayServerInfo>();
            _expectedConnections = new Dictionary <string, int>();

            IPAddress[] IPS = Dns.GetHostAddresses(Dns.GetHostName());
            foreach (IPAddress ip in IPS)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                {
                    _playServers.Add(new PlayServerInfo("Main Server", ip.ToString(), (ushort)listenPort));
                }
            }


            // Start log thread
            LogThread log = new LogThread();

            // Start database thread
            if (dbConnectString != null)
            {
                _db = new DatabaseThread(dbConnectString);
            }

            // Start AI Thread
            _aiThread = new AIThread();

            _listenPort = listenPort;

            // Start input thread
            _inputThread = new InputThread();
        }