Beispiel #1
0
        public void Enter(SyncSession session, GateEnterRequest request)
        {
            if (_gate.Id != request.Gate)
            {
                NetworkUtils.DropBadAction();
            }

            if (!_relay.Session.Contains(new RGSSessionContainsRequest {
                Account = request.Account, Key = request.SessionKey
            }).Result)
            {
                NetworkUtils.DropBadAction();
            }

            {
                using AccountContext context = _accountFactory.CreateDbContext();

                AccountModel model = context.Accounts.AsNoTracking().First(c => c.Id == request.Account);

                session.Account    = new(model);
                session.Characters = GetCharacters(model, request.Gate);
                session.Background = model.CharacterBackground;
                session.Permission = HandlerPermission.Authorized;
            }

            session.SendDeferred(new GateEnterResponse()
            {
                AccountId = request.Account, Result = GateEnterResult.Success
            });
            session.SendDeferred(new SWorldCurrentDataResponse());
        }
Beispiel #2
0
        public void Enter(Session session, GateEnterRequest request)
        {
            if (_gate.Id != request.Gate)
            {
                NetworkUtils.DropSession();
            }

            if (!_relayClient.Session.Validate(new() { Account = request.Account, Key = request.SessionKey }).Result)
            {
                NetworkUtils.DropSession();
            }

            {
                using AccountContext context = _accountFactory.CreateDbContext();

                AccountModel model = context.Accounts.AsNoTracking().First(c => c.Id == request.Account);

                session.Account    = new(model);
                session.Characters = GetCharacters(model, request.Gate);
                session.Background = model.CharacterBackground;
            }

            session.SendAsync(new GateEnterResponse()
            {
                AccountId = request.Account, Result = GateEnterResult.Success
            });
            session.SendAsync(new ServiceCurrentDataResponse());
        }