public SetLevelCommandPacketHandler(IChannelHttpClient channelHttpClient, IStatHttpClient statHttpClient,
                                     IConnectedAccountHttpClient connectedAccountHttpClient)
 {
     _channelHttpClient          = channelHttpClient;
     _statHttpClient             = statHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
 }
Esempio n. 2
0
 public FinsPacketHandler(IFriendHttpClient friendHttpClient, IChannelHttpClient channelHttpClient,
                          IConnectedAccountHttpClient connectedAccountHttpClient)
 {
     _friendHttpClient           = friendHttpClient;
     _channelHttpClient          = channelHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
 }
Esempio n. 3
0
 public BlacklistHttpClient(IHttpClientFactory httpClientFactory, Channel channel,
                            IChannelHttpClient channelHttpClient)
     : base(httpClientFactory, channel, channelHttpClient)
 {
     ApiUrl            = "api/blacklist";
     RequireConnection = true;
 }
Esempio n. 4
0
 public BazaarHttpClient(IHttpClientFactory httpClientFactory, Channel channel,
                         IChannelHttpClient channelHttpClient)
     : base(httpClientFactory, channel, channelHttpClient)
 {
     ApiUrl            = "api/bazaar";
     RequireConnection = true;
 }
Esempio n. 5
0
 public IncommingMailHttpClient(IHttpClientFactory httpClientFactory, Channel channel,
                                IChannelHttpClient channelHttpClient)
     : base(httpClientFactory, channel, channelHttpClient)
 {
     ApiUrl            = "api/incommingMail";
     RequireConnection = true;
 }
Esempio n. 6
0
 public FriendHttpClient(IHttpClientFactory httpClientFactory, Channel channel,
     IChannelHttpClient channelHttpClient)
     : base(httpClientFactory, channel, channelHttpClient)
 {
     ApiUrl = "api/friend";
     RequireConnection = true;
 }
 protected MasterServerHttpClient(IHttpClientFactory httpClientFactory, Channel channel,
                                  IChannelHttpClient channelHttpClient)
 {
     _httpClientFactory = httpClientFactory;
     _channel           = channel;
     _channelHttpClient = channelHttpClient;
 }
Esempio n. 8
0
 public LoginServer(LoginConfiguration loginConfiguration, NetworkManager networkManager, ILogger logger,
                    IChannelHttpClient channelHttpClient)
 {
     _loginConfiguration = loginConfiguration;
     _networkManager     = networkManager;
     _logger             = logger;
     _channelHttpClient  = channelHttpClient;
 }
Esempio n. 9
0
 public LoginServer(IOptions <LoginConfiguration> loginConfiguration, NetworkManager networkManager, ILogger logger, IChannelHttpClient channelHttpClient, NosCoreContext context)
 {
     _loginConfiguration = loginConfiguration;
     _networkManager     = networkManager;
     _logger             = logger;
     _channelHttpClient  = channelHttpClient;
     _context            = context;
 }
Esempio n. 10
0
 public ConnectedAccountHttpClient(IHttpClientFactory httpClientFactory, Channel channel,
                                   IChannelHttpClient channelHttpClient)
     : base(httpClientFactory, channel, channelHttpClient)
 {
     _channelHttpClient = channelHttpClient;
     ApiUrl             = "api/connectedAccount";
     RequireConnection  = true;
 }
Esempio n. 11
0
 public WorldServer(WorldConfiguration worldConfiguration, NetworkManager networkManager,
                    IEnumerable <IGlobalEvent> events, ILogger logger, IChannelHttpClient channelHttpClient)
 {
     _worldConfiguration = worldConfiguration;
     _networkManager     = networkManager;
     _events             = events.ToList();
     _logger             = logger;
     _channelHttpClient  = channelHttpClient;
 }
Esempio n. 12
0
 public WorldServer(IOptions <WorldConfiguration> worldConfiguration, NetworkManager networkManager, Clock clock, ILogger logger, IChannelHttpClient channelHttpClient, IMapInstanceGeneratorService mapInstanceGeneratorService)
 {
     _worldConfiguration          = worldConfiguration;
     _networkManager              = networkManager;
     _logger                      = logger;
     _channelHttpClient           = channelHttpClient;
     _mapInstanceGeneratorService = mapInstanceGeneratorService;
     _clock = clock;
 }
Esempio n. 13
0
 public WarehouseHttpClient(IHttpClientFactory httpClientFactory, Channel channel,
                            IChannelHttpClient channelHttpClient, IItemGenerationService itemProvider,
                            IDao <IItemInstanceDto?, Guid> itemInstanceDao)
     : base(httpClientFactory, channel, channelHttpClient)
 {
     ApiUrl            = "api/warehouse";
     RequireConnection = true;
     _itemProvider     = itemProvider;
     _itemInstanceDao  = itemInstanceDao;
 }
Esempio n. 14
0
 public WorldServer(IOptions <WorldConfiguration> worldConfiguration, NetworkManager networkManager,
                    IEnumerable <IGlobalEvent> events, ILogger logger, IChannelHttpClient channelHttpClient, IMapInstanceProvider mapInstanceProvider)
 {
     _worldConfiguration  = worldConfiguration;
     _networkManager      = networkManager;
     _events              = events.ToList();
     _logger              = logger;
     _channelHttpClient   = channelHttpClient;
     _mapInstanceProvider = mapInstanceProvider;
 }
Esempio n. 15
0
 public LoginService(LoginConfiguration loginConfiguration, IDao <AccountDto, long> accountDao,
                     IAuthHttpClient authHttpClient,
                     IChannelHttpClient channelHttpClient, IConnectedAccountHttpClient connectedAccountHttpClient)
 {
     _loginConfiguration         = loginConfiguration;
     _accountDao                 = accountDao;
     _authHttpClient             = authHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
     _channelHttpClient          = channelHttpClient;
 }
Esempio n. 16
0
 public DacPacketHandler(IDao <AccountDto, long> accountDao,
                         ILogger logger, IAuthHttpClient authHttpClient,
                         IConnectedAccountHttpClient connectedAccountHttpClient,
                         IChannelHttpClient channelHttpClient)
 {
     _accountDao                 = accountDao;
     _logger                     = logger;
     _authHttpClient             = authHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
     _channelHttpClient          = channelHttpClient;
 }
Esempio n. 17
0
 public LoginService(IOptions <LoginConfiguration> loginConfiguration, IDao <AccountDto, long> accountDao,
                     IAuthHttpClient authHttpClient,
                     IChannelHttpClient channelHttpClient, IConnectedAccountHttpClient connectedAccountHttpClient,
                     IDao <CharacterDto, long> characterDao)
 {
     _loginConfiguration         = loginConfiguration;
     _accountDao                 = accountDao;
     _authHttpClient             = authHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
     _channelHttpClient          = channelHttpClient;
     _characterDao               = characterDao;
 }
 public EntryPointPacketHandler(IDao <CharacterDto, long> characterDao,
                                IDao <AccountDto, long> accountDao,
                                IDao <MateDto, long> mateDao, ILogger logger, IAuthHttpClient authHttpClient,
                                IConnectedAccountHttpClient connectedAccountHttpClient,
                                IChannelHttpClient channelHttpClient, IHasher hasher)
 {
     _characterDao               = characterDao;
     _accountDao                 = accountDao;
     _mateDao                    = mateDao;
     _logger                     = logger;
     _authHttpClient             = authHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
     _channelHttpClient          = channelHttpClient;
 }
Esempio n. 19
0
 public EntryPointPacketHandler(IGenericDao <CharacterDto> characterDao,
                                IGenericDao <AccountDto> accountDao,
                                IGenericDao <MateDto> mateDao, ILogger logger, IAuthHttpClient authHttpClient,
                                IConnectedAccountHttpClient connectedAccountHttpClient,
                                IChannelHttpClient channelHttpClient)
 {
     _characterDao               = characterDao;
     _accountDao                 = accountDao;
     _mateDao                    = mateDao;
     _logger                     = logger;
     _authHttpClient             = authHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
     _channelHttpClient          = channelHttpClient;
 }
 public EntryPointPacketHandler(IDao <CharacterDto, long> characterDao,
                                IDao <AccountDto, long> accountDao,
                                IDao <MateDto, long> mateDao, ILogger logger, IAuthHttpClient authHttpClient,
                                IConnectedAccountHttpClient connectedAccountHttpClient,
                                IChannelHttpClient channelHttpClient, IOptions <WorldConfiguration> configuration)
 {
     _characterDao               = characterDao;
     _accountDao                 = accountDao;
     _mateDao                    = mateDao;
     _logger                     = logger;
     _authHttpClient             = authHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
     _channelHttpClient          = channelHttpClient;
     _configuration              = configuration;
 }
 public GameStartPacketHandler(WorldConfiguration worldConfiguration, IFriendHttpClient friendHttpClient,
                               IChannelHttpClient channelHttpClient,
                               IConnectedAccountHttpClient connectedAccountHttpClient, IBlacklistHttpClient blacklistHttpClient,
                               IPacketHttpClient packetHttpClient,
                               ISerializer packetSerializer, IMailHttpClient mailHttpClient)
 {
     _worldConfiguration         = worldConfiguration;
     _packetSerializer           = packetSerializer;
     _blacklistHttpClient        = blacklistHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
     _channelHttpClient          = channelHttpClient;
     _friendHttpClient           = friendHttpClient;
     _packetHttpClient           = packetHttpClient;
     _mailHttpClient             = mailHttpClient;
 }
Esempio n. 22
0
 public GameStartPacketHandler(IOptions <WorldConfiguration> worldConfiguration, IFriendHttpClient friendHttpClient,
                               IChannelHttpClient channelHttpClient,
                               IConnectedAccountHttpClient connectedAccountHttpClient, IBlacklistHttpClient blacklistHttpClient,
                               IPacketHttpClient packetHttpClient,
                               ISerializer packetSerializer, IMailHttpClient mailHttpClient, IQuestService questProvider)
 {
     _worldConfiguration         = worldConfiguration;
     _packetSerializer           = packetSerializer;
     _blacklistHttpClient        = blacklistHttpClient;
     _connectedAccountHttpClient = connectedAccountHttpClient;
     _channelHttpClient          = channelHttpClient;
     _friendHttpClient           = friendHttpClient;
     _packetHttpClient           = packetHttpClient;
     _mailHttpClient             = mailHttpClient;
     _questProvider = questProvider;
 }
        public static async Task <FinitPacket> GenerateFinitAsync(this ICharacterEntity visualEntity, IFriendHttpClient friendHttpClient,
                                                                  IChannelHttpClient channelHttpClient, IConnectedAccountHttpClient connectedAccountHttpClient)
        {
            //same canal
            var servers = (await channelHttpClient.GetChannelsAsync().ConfigureAwait(false))
                          ?.Where(c => c.Type == ServerType.WorldServer).ToList();
            var accounts = new List <ConnectedAccount>();

            foreach (var server in servers ?? new List <ChannelInfo>())
            {
                accounts.AddRange(
                    await connectedAccountHttpClient.GetConnectedAccountAsync(server).ConfigureAwait(false));
            }

            var subpackets = new List <FinitSubPacket?>();
            var friendlist = await friendHttpClient.GetListFriendsAsync(visualEntity.VisualId).ConfigureAwait(false);

            //TODO add spouselist
            //var spouseList = _webApiAccess.Get<List<CharacterRelationDto>>(WebApiRoute.Spouse, friendServer.WebApi, visualEntity.VisualId) ?? new List<CharacterRelationDto>();
            foreach (var relation in friendlist)
            {
                var account = accounts.Find(s =>
                                            (s.ConnectedCharacter != null) && (s.ConnectedCharacter.Id == relation.CharacterId));
                subpackets.Add(new FinitSubPacket
                {
                    CharacterId   = relation.CharacterId,
                    RelationType  = relation.RelationType,
                    IsOnline      = account != null,
                    CharacterName = relation.CharacterName
                });
            }

            return(new FinitPacket {
                SubPackets = subpackets
            });
        }
 public SetMaintenancePacketHandler(IChannelHttpClient channelHttpClient)
 {
     _channelHttpClient = channelHttpClient;
 }
        public static async Task VerifyConnectionAsync(ClientSession clientSession, ILogger _logger, IAuthHttpClient authHttpClient,
                                                       IConnectedAccountHttpClient connectedAccountHttpClient, IDao <AccountDto, long> accountDao, IChannelHttpClient channelHttpClient, bool passwordLessConnection, string accountName, string password, int sessionId)
        {
            var alreadyConnnected = false;
            var servers           = await channelHttpClient.GetChannelsAsync().ConfigureAwait(false) ?? new List <ChannelInfo>();

            foreach (var channel in servers.Where(c => c.Type == ServerType.WorldServer))
            {
                var accounts = await connectedAccountHttpClient.GetConnectedAccountAsync(channel).ConfigureAwait(false);

                var target = accounts.FirstOrDefault(s => s.Name == accountName);

                if (target == null)
                {
                    continue;
                }

                alreadyConnnected = true;
                break;
            }

            if (alreadyConnnected)
            {
                _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.ALREADY_CONNECTED), new
                {
                    accountName
                });
                await clientSession.DisconnectAsync().ConfigureAwait(false);

                return;
            }

            var account = await accountDao.FirstOrDefaultAsync(s => s.Name == accountName).ConfigureAwait(false);

            if (account == null)
            {
                _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.INVALID_ACCOUNT), new
                {
                    accountName
                });
                await clientSession.DisconnectAsync().ConfigureAwait(false);

                return;
            }

            var awaitingConnection =
                (passwordLessConnection
                    ? await authHttpClient
                 .GetAwaitingConnectionAsync(accountName, password, sessionId)
                 .ConfigureAwait(false) != null
                    : account.Password?.Equals(new Sha512Hasher().Hash(password), StringComparison.OrdinalIgnoreCase) ==
                 true);

            if (!awaitingConnection)
            {
                _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.INVALID_PASSWORD), new
                {
                    accountName
                });
                await clientSession.DisconnectAsync().ConfigureAwait(false);

                return;
            }

            var sessionMapping = SessionFactory.Instance.Sessions
                                 .FirstOrDefault(s => s.Value.SessionId == clientSession.SessionId);

            if (!sessionMapping.Equals(default(KeyValuePair <string, RegionTypeMapping>)))
            {
                sessionMapping.Value.RegionType = account.Language;
            }
            clientSession.InitializeAccount(account);
            //todo Send Account Connected
        }
Esempio n. 26
0
 public PacketHttpClient(IHttpClientFactory httpClientFactory, IChannelHttpClient channelHttpClient)
 {
     _channelHttpClient = channelHttpClient;
     _httpClientFactory = httpClientFactory;
 }
Esempio n. 27
0
 public SetMaintenancePacketHandler(IChannelHttpClient channelHttpClient, Channel channel)
 {
     _channelHttpClient = channelHttpClient;
     _channel           = channel;
 }