Exemplo n.º 1
0
        public NecServer(NecSetting setting)
        {
            _running = false;
            Setting  = new NecSetting(setting);

            NecromancyBot = new NecromancyBot(setting);
            NecromancyBot.AddSingleton(this);

            Instances         = new InstanceGenerator();
            Instances64       = new InstanceGenerator64();
            Clients           = new ClientLookup();
            Characters        = new CharacterLookup();
            Maps              = new MapLookup();
            Chat              = new ChatManager(this);
            Router            = new PacketRouter();
            Database          = new NecDatabaseBuilder().Build(Setting.DatabaseSettings);
            SettingRepository = new SettingRepository(Setting.RepositoryFolder).Initialize();
            _authConsumer     = new NecQueueConsumer(ServerType.Auth, Setting, Setting.AuthSocketSettings);
            _authConsumer.ClientDisconnected += AuthClientDisconnected;
            _msgConsumer = new NecQueueConsumer(ServerType.Msg, Setting, Setting.MsgSocketSettings);
            _msgConsumer.ClientDisconnected += MsgClientDisconnected;
            _areaConsumer = new NecQueueConsumer(ServerType.Area, Setting, Setting.AreaSocketSettings);
            _areaConsumer.ClientDisconnected += AreaClientDisconnected;

            _authServer = new AsyncEventServer(
                Setting.ListenIpAddress,
                Setting.AuthPort,
                _authConsumer,
                Setting.AuthSocketSettings
                );

            _msgServer = new AsyncEventServer(
                Setting.ListenIpAddress,
                Setting.MsgPort,
                _msgConsumer,
                Setting.MsgSocketSettings
                );

            _areaServer = new AsyncEventServer(
                Setting.ListenIpAddress,
                Setting.AreaPort,
                _areaConsumer,
                Setting.AreaSocketSettings
                );

            LoadChatCommands();
            LoadSettingRepository();
            LoadHandler();
            LoadCharacterRepository();
        }
Exemplo n.º 2
0
        public NecServer(NecSetting setting)
        {
            _running     = false;
            this.setting = new NecSetting(setting);

            necromancyBot = new NecromancyBot(this.setting);
            necromancyBot.AddSingleton(this);
            instances         = new InstanceGenerator(this);
            clients           = new ClientLookup();
            maps              = new MapLookup();
            chat              = new ChatManager(this);
            router            = new PacketRouter();
            settingRepository = new SettingRepository(this.setting.repositoryFolder).Initialize();
            database          = new NecDatabaseBuilder(this.setting, settingRepository).Build();
            _authConsumer     = new NecQueueConsumer(ServerType.Auth, this.setting, this.setting.authSocketSettings);
            _authConsumer.clientDisconnected += AuthClientDisconnected;
            _msgConsumer = new NecQueueConsumer(ServerType.Msg, this.setting, this.setting.msgSocketSettings);
            _msgConsumer.clientDisconnected += MsgClientDisconnected;
            _areaConsumer = new NecQueueConsumer(ServerType.Area, this.setting, this.setting.areaSocketSettings);
            _areaConsumer.clientDisconnected += AreaClientDisconnected;

            _authServer = new AsyncEventServer(
                this.setting.listenIpAddress,
                this.setting.authPort,
                _authConsumer,
                this.setting.authSocketSettings
                );

            _msgServer = new AsyncEventServer(
                this.setting.listenIpAddress,
                this.setting.msgPort,
                _msgConsumer,
                this.setting.msgSocketSettings
                );

            _areaServer = new AsyncEventServer(
                this.setting.listenIpAddress,
                this.setting.areaPort,
                _areaConsumer,
                this.setting.areaSocketSettings
                );

            LoadChatCommands();
            LoadDatabaseObjects();
            LoadHandler();
        }