public override void SelectToon(IRpcController controller, SelectToonRequest request, Action<SelectToonResponse> done)
        {
            done(new SelectToonResponse.Builder
                     {

                     }.Build());
        }
        public override void ModuleMessage(IRpcController controller, ModuleMessageRequest request, Action<NoData> done)
        {
            var moduleId = request.ModuleId;

            var message = request.Message.ToByteArray();
            var command = message[0];

            done(new NoData.Builder().Build());

            if (moduleId == 0 && command == 2)
            {
                byte[] A = message.Skip(1).Take(128).ToArray();
                byte[] M1 = message.Skip(1 + 128).Take(32).ToArray();
                byte[] seed = message.Skip(1 + 32 + 128).Take(128).ToArray();

                if (srp.Verify(A, M1, seed) == false)
                {
                    client.ListenerId = 0;
                    client.ErrorCode = AuthError.InvalidCredentials;
                }
                else
                {
                    var moduleMessagedRequest = ModuleMessageRequest.CreateBuilder()
                        .SetModuleId(moduleId)
                        .SetMessage(ByteString.CopyFrom(srp.Response2))
                        .Build();

                    AuthenticationClient.CreateStub(client).ModuleMessage(controller, moduleMessagedRequest, ClientServiceCallback);
                }

                wait.Set();
            }
        }
Example #3
0
        public override void SubscribeToUserManager(IRpcController controller, SubscribeToUserManagerRequest request, Action<SubscribeToUserManagerResponse> done)
        {
            done(new SubscribeToUserManagerResponse.Builder
                     {

                     }.Build());
        }
Example #4
0
        public override void SubscribeToFriends(IRpcController controller, SubscribeToFriendsRequest request, Action<SubscribeToFriendsResponse> done)
        {
            done(new SubscribeToFriendsResponse.Builder
                     {

                     }.Build());
        }
Example #5
0
        public override void SendInvitation(IRpcController controller, bnet.protocol.invitation.SendInvitationRequest request, Action<SendInvitationResponse> done)
        {
            Logger.Trace("SendInvitation() Stub");

            //TODO: Set these to the corect values.
            const ulong accountHandle = 0x0000000000000000;
            const ulong gameAccountHandle = 0x0000000000000000;

            var invitation = bnet.protocol.invitation.Invitation.CreateBuilder()
                .SetCreationTime(DateTime.Now.ToUnixTime())
                .SetExpirationTime(request.ExpirationTime)
                .SetId(0)
                .SetInvitationMessage(request.InvitationMessage)
                .SetInviteeIdentity(bnet.protocol.Identity.CreateBuilder()
                                        .SetAccountId(bnet.protocol.EntityId.CreateBuilder().SetHigh(accountHandle).SetLow(0x1).Build()) //TODO: Change SetLow to an actual index in the database.
                                        .SetGameAccountId(bnet.protocol.EntityId.CreateBuilder().SetHigh(gameAccountHandle).SetLow(0x1).Build()) //TODO: Change SetLow to an actual index in the database.
                                        .Build())
                .SetInviteeName("FriendName") //TODO: Set this to the name retrieved from the database.
                .SetInviterIdentity(bnet.protocol.Identity.CreateBuilder()
                                        .SetAccountId(bnet.protocol.EntityId.CreateBuilder().SetHigh(accountHandle).SetLow(0x0).Build()) //TODO: Change SetLow to an actual index in the database.
                                        .SetGameAccountId(bnet.protocol.EntityId.CreateBuilder().SetHigh(gameAccountHandle).SetLow(0x0).Build()) //TODO: Change SetLow to an actual index in the database.
                                        .Build())
                .SetInviterName("YourName") //TODO: Set this to the name retrieved from the database.
                .Build();

            var builder = bnet.protocol.invitation.SendInvitationResponse.CreateBuilder().SetInvitation(invitation);
            done(builder.Build());
        }
Example #6
0
        public override void SendInvitation(IRpcController controller, bnet.protocol.invitation.SendInvitationRequest request, Action<bnet.protocol.NoData> done)
        {
            // somehow protobuf lib doesnt handle this extension, so we're using a workaround to get that channelinfo.
            var extensionBytes = request.UnknownFields.FieldDictionary[103].LengthDelimitedList[0].ToByteArray();
            var friendRequest = bnet.protocol.friends.SendInvitationRequest.ParseFrom(extensionBytes);

            if (friendRequest.TargetEmail.ToLower() == this.Client.Account.Email.ToLower()) return; // don't allow him to invite himself - and we should actually return an error!
                                                                                                    // also he shouldn't be allowed to invite his current friends - put that check too!. /raist
            var inviteee = AccountManager.GetAccountByEmail(friendRequest.TargetEmail);
            if (inviteee == null) return; // we need send an error response here /raist.

            Logger.Trace("{0} sent {1} friend invitation.", this.Client.Account, inviteee);

            var invitation = bnet.protocol.invitation.Invitation.CreateBuilder()
                .SetId(FriendManager.InvitationIdCounter++) // we may actually need to store invitation ids in database with the actual invitation there. /raist.                
                .SetInviterIdentity(this.Client.GetIdentity(true, false, false))
                .SetInviterName(this.Client.Account.Email) // we shoulde be instead using account owner's name here.
                .SetInviteeIdentity(bnet.protocol.Identity.CreateBuilder().SetAccountId(inviteee.BnetAccountID))
                .SetInviteeName(inviteee.Email) // again we should be instead using invitee's name.
                .SetInvitationMessage(request.InvitationMessage)
                .SetCreationTime(DateTime.Now.ToUnixTime())
                .SetExpirationTime(86400);

            // Response is bnet.protocol.NoData as of 7728. /raist.
            //var response = bnet.protocol.invitation.SendInvitationResponse.CreateBuilder()
            //    .SetInvitation(invitation.Clone());

            var response = bnet.protocol.NoData.CreateBuilder();
            done(response.Build());

            // notify the invitee on invitation.
            FriendManager.HandleInvitation(this.Client, invitation.Build());
        }
Example #7
0
        public override void SubscribeToFriends(IRpcController controller, bnet.protocol.friends.SubscribeToFriendsRequest request, Action<bnet.protocol.friends.SubscribeToFriendsResponse> done)
        {
            Logger.Trace("Subscribe() {0}", this.Client);

            FriendManager.Instance.AddSubscriber(this.Client, request.ObjectId);

            var builder = bnet.protocol.friends.SubscribeToFriendsResponse.CreateBuilder()
                .SetMaxFriends(127)
                .SetMaxReceivedInvitations(127)
                .SetMaxSentInvitations(127)
                .AddRole(bnet.protocol.Role.CreateBuilder().SetId(1).SetName("battle_tag_friend").Build())
                .AddRole(bnet.protocol.Role.CreateBuilder().SetId(2).SetName("real_id_friend").Build());

            foreach (var friend in FriendManager.Friends[this.Client.Account.BnetEntityId.Low]) // send friends list.
            {
                builder.AddFriends(friend);
            }

            var invitations = new List<bnet.protocol.invitation.Invitation>();

            foreach (var invitation in FriendManager.OnGoingInvitations.Values)
            {
                if (invitation.InviteeIdentity.AccountId == this.Client.Account.BnetEntityId)
                {
                    invitations.Add(invitation);
                }
            }

            if (invitations.Count > 0)
                builder.AddRangeReceivedInvitations(invitations);

            done(builder.Build());
        }
Example #8
0
        public override void AcceptInvitation(IRpcController controller, bnet.protocol.invitation.GenericRequest request, Action<bnet.protocol.NoData> done)
        {
            var response = bnet.protocol.NoData.CreateBuilder();
            done(response.Build());

            FriendManager.HandleAccept(this.Client, request);
        }
Example #9
0
        public override void ListFactories(IRpcController controller, ListFactoriesRequest request, Action<ListFactoriesResponse> done)
        {
            GameFactoryDescription.Builder description = GameFactoryDescription.CreateBuilder().SetId(0xc5beec600d8c6273);

            var atributes = new[]
                                {
                                    Attribute.CreateBuilder().SetName("min_players").SetValue(Variant.CreateBuilder().SetIntValue(2)).Build(),
                                    Attribute.CreateBuilder().SetName("max_players").SetValue(Variant.CreateBuilder().SetIntValue(4)).Build(),
                                    Attribute.CreateBuilder().SetName("num_teams").SetValue(Variant.CreateBuilder().SetIntValue(1)).Build(),
                                    Attribute.CreateBuilder().SetName("version").SetValue(Variant.CreateBuilder().SetStringValue("0.3.0")).Build()
                                };

            description.AddRangeAttribute(atributes);
            description.AddStatsBucket(GameStatsBucket.CreateBuilder()
                                           .SetBucketMin(0)
                                           .SetBucketMax(4294967296F)
                                           .SetWaitMilliseconds(1354)
                                           .SetGamesPerHour(0)
                                           .SetActiveGames(1)
                                           .SetActivePlayers(1)
                                           .SetFormingGames(0)
                                           .SetWaitingPlayers(0)
                                           .Build());

            ListFactoriesResponse response = ListFactoriesResponse.CreateBuilder().AddDescription(description).SetTotalResults(1).Build();
            done(response);
        }
Example #10
0
        public override void ListFactories(IRpcController controller, ListFactoriesRequest request, Action<ListFactoriesResponse> done)
        {
            Logger.Trace("ListFactories() {0}", this.Client);

            var description = GameFactoryDescription.CreateBuilder().SetId(14249086168335147635);
            var attributes = new bnet.protocol.attribute.Attribute[4]
                {
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("min_players").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(2)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("max_players").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(4)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("num_teams").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(1)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("version").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetStringValue("0.3.0")).Build()
                };

            description.AddRangeAttribute(attributes);
            description.AddStatsBucket(GameStatsBucket.CreateBuilder()
               .SetBucketMin(0)
               .SetBucketMax(4267296)
               .SetWaitMilliseconds(1354)
               .SetGamesPerHour(0)
               .SetActiveGames(69)
               .SetActivePlayers(75)
               .SetFormingGames(5)
               .SetWaitingPlayers(0).Build());

            var builder = ListFactoriesResponse.CreateBuilder().AddDescription(description).SetTotalResults(1);
            done(builder.Build());
        }
Example #11
0
 public override void GetConfiguration(IRpcController controller, GetConfigurationRequest request, Action<GetConfigurationResponse> done)
 {
     Logger.Trace("GetConfiguration()");
     //TODO: Figure out what the buyout rules/specialist values are, and if they are related /dustinconrad
     var builder = GetConfigurationResponse.CreateBuilder()
         .AddConfigs(SpecialistConfig.CreateBuilder()
             .SetSpecialist(1)
             .AddAuctionDurations(720)
             .AddAuctionDurations(1440)
             .AddAuctionDurations(2880)
             .AddAuctionStartDelays(5)
             .SetAntiSnipingExtensionDelay(1)
             .AddCurrencyConfig(CurrencyConfig.CreateBuilder()
                 .SetCurrency("D3_GOLD")
                 .SetTickSize(1)
                 .SetFlatOutbidIncr(1)
                 .SetScaleOutbidIncr(10)
                 .SetMinStartingUnitPrice(5)
                 .SetMaxStartingUnitPrice(4294967295)
                 .SetMaxUnitPrice(4294967295)
                 .SetMaxTotalAmount(281474976710655)
                 .SetBuyoutRule(1))
             .AddCurrencyConfig(CurrencyConfig.CreateBuilder()
                 .SetCurrency("USD")
                 .SetTickSize(2)
                 .SetFlatOutbidIncr(2)
                 .SetScaleOutbidIncr(10)
                 .SetMinStartingUnitPrice(30)
                 .SetMaxStartingUnitPrice(4294967295)
                 .SetMaxUnitPrice(4294967295)
                 .SetMaxTotalAmount(281474976710655)
                 .SetBuyoutRule(1)))
         .AddConfigs(SpecialistConfig.CreateBuilder()
             .SetSpecialist(2)
             .AddAuctionDurations(2880)
             .AddAuctionDurations(10080)
             .AddAuctionStartDelays(0)
             .SetAntiSnipingExtensionDelay(0)
             .AddCurrencyConfig(CurrencyConfig.CreateBuilder()
                 .SetCurrency("D3_GOLD")
                 .SetTickSize(1)
                 .SetFlatOutbidIncr(1)
                 .SetScaleOutbidIncr(10)
                 .SetMinStartingUnitPrice(5)
                 .SetMaxStartingUnitPrice(4294967295)
                 .SetMaxUnitPrice(4294967295)
                 .SetMaxTotalAmount(281474976710655)
                 .SetBuyoutRule(2))
             .AddCurrencyConfig(CurrencyConfig.CreateBuilder()
                 .SetCurrency("USD")
                 .SetTickSize(2)
                 .SetFlatOutbidIncr(2)
                 .SetScaleOutbidIncr(10)
                 .SetMinStartingUnitPrice(30)
                 .SetMaxStartingUnitPrice(4294967295)
                 .SetMaxUnitPrice(4294967295)
                 .SetMaxTotalAmount(281474976710655)
                 .SetBuyoutRule(2)));
     done(builder.Build());
 }
Example #12
0
        public override void SendReport(IRpcController controller, bnet.protocol.report.SendReportRequest request, Action<bnet.protocol.NoData> done)
        {
            Logger.Trace("SendReport()");

            var report = request.Report;
            //TODO: Store reports against accounts
            foreach (var attribute in report.AttributeList)
            {
                switch (attribute.Name)
                {
                    case "target_toon_id": //uint GameAccount.Low
                        var reportee = GameAccountManager.GetAccountByPersistentID(attribute.Value.UintValue);
                        Logger.Trace("{0} reported {1} for \"{2}\".", this.Client.Account.CurrentGameAccount.CurrentToon, reportee, report.ReportType);
                        break;
                    //case "target_account_id": //uint Account.Low
                    //case "target_toon_name": //string
                    //case "target_toon_program": //fourcc
                    //case "target_toon_region": //string
                    //case "note": //string - not currently used in client
                }
            }

            var builder = bnet.protocol.NoData.CreateBuilder();

            done(builder.Build());
        }
Example #13
0
        public override void FindGame(IRpcController controller, bnet.protocol.game_master.FindGameRequest request, Action<bnet.protocol.game_master.FindGameResponse> done)
        {            
            Logger.Trace("FindGame() {0}", this.Client);

            // find the game.
            var gameFound = GameFactoryManager.FindGame(this.Client, request, ++GameFactoryManager.RequestIdCounter);
            //TODO: Find out why on rejoin game this is null
            if (Client.CurrentChannel != null)
            {
                //TODO: All these ChannelState updates can be moved to functions someplace else after packet flow is discovered and working -Egris
                //Send current JoinPermission to client before locking it
                var channelStatePermission = bnet.protocol.channel.ChannelState.CreateBuilder()
                    .AddAttribute(bnet.protocol.attribute.Attribute.CreateBuilder()
                    .SetName("D3.Party.JoinPermissionPreviousToLock")
                    .SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(1).Build())
                    .Build()).Build();

                var notificationPermission = bnet.protocol.channel.UpdateChannelStateNotification.CreateBuilder()
                    .SetAgentId(this.Client.Account.CurrentGameAccount.BnetEntityId)
                    .SetStateChange(channelStatePermission)
                    .Build();

                this.Client.MakeTargetedRPC(Client.CurrentChannel, () =>
                    bnet.protocol.channel.ChannelSubscriber.CreateStub(this.Client).NotifyUpdateChannelState(null, notificationPermission, callback => { }));
            }
            var builder = bnet.protocol.game_master.FindGameResponse.CreateBuilder().SetRequestId(gameFound.RequestId);
            done(builder.Build());

            var clients = new List<MooNetClient>();
            foreach (var player in request.PlayerList)
            {
                foreach (var gameAccount in GameAccountManager.GameAccountsList)
                {
                    if (player.Identity.GameAccountId.Low == gameAccount.BnetEntityId.Low)
                    {
                        clients.Add(gameAccount.LoggedInClient);
                    }
                }
            }

            // send game found notification.
            var notificationBuilder = bnet.protocol.game_master.GameFoundNotification.CreateBuilder()
                .SetRequestId(gameFound.RequestId)
                .SetGameHandle(gameFound.GameHandle);

            this.Client.MakeRPCWithListenerId(request.ObjectId, () =>
                bnet.protocol.game_master.GameFactorySubscriber.CreateStub(this.Client).NotifyGameFound(null, notificationBuilder.Build(), callback => { }));
            
            if(gameFound.Started)
            {
                Logger.Warn("Client {0} joining game with FactoryID:{1}", this.Client.Account.CurrentGameAccount.CurrentToon.HeroNameField.Value, gameFound.FactoryID);
                gameFound.JoinGame(clients, request.ObjectId);
            }
            else
            {
                Logger.Warn("Client {0} creating new game", this.Client.Account.CurrentGameAccount.CurrentToon.HeroNameField.Value);
                gameFound.StartGame(clients, request.ObjectId);
            }
        }
Example #14
0
        public override void GetContentHandle(IRpcController controller, ContentHandleRequest request, Action<ContentHandle> done)
        {
            Logger.Trace("GetContentHandle()");
            //Beta this returns status 4, no payload

            throw new NotImplementedException();

        }
Example #15
0
        public override void ProcessClientRequest(IRpcController controller, ClientRequest request, Action<ClientResponse> done)
        {
            var response = new ClientResponse.Builder
                              {

                              };
            done(response.Build());
        }
Example #16
0
        public override void UnregisterFromService(IRpcController controller, bnet.protocol.achievements.UnregisterFromServiceRequest request, Action<bnet.protocol.NoData> done)
        {
            Logger.Trace("Unregister()");

            var builder = bnet.protocol.NoData.CreateBuilder();

            done(builder.Build());
        }
Example #17
0
        public override void ProcessClientRequest(IRpcController controller, ClientRequest request, Action<ClientResponse> done)
        {
            Logger.Trace("ProcessClientRequest()");

            // TODO: handle the request. this is where banner changing happens (CustomMessageId 4)
            // CustomMessage for banner change is a D3.GameMessages.SaveBannerConfiguration
            var builder = ClientResponse.CreateBuilder();
            done(builder.Build());
        }
Example #18
0
 public override void SubscribeToFriends(IRpcController controller, SubscribeToFriendsRequest request, Action<SubscribeToFriendsResponse> done)
 {
     Logger.Trace("SubscribeToFriends()");
     var builder = SubscribeToFriendsResponse.CreateBuilder()
         .SetMaxFriends(127)
         .SetMaxReceivedInvitations(127)
         .SetMaxSentInvitations(127);
     done(builder.Build());
 }
Example #19
0
        public override void ToonList(IRpcController controller, ToonListRequest request, Action<ToonListResponse> done)
        {
            var builder = new ToonListResponse.Builder
                              {

                              };
            //builder.AddToons(EntityId.CreateBuilder().SetHigh(216174302532224051).SetLow(1).Build());
            done(builder.Build());
        }
Example #20
0
        public override void Connect(IRpcController controller, ConnectRequest request, Action<ConnectResponse> done)
        {
            var response = ConnectResponse.CreateBuilder()
                .SetServerId(ProcessId.CreateBuilder().SetLabel(0xDEADBABE).SetEpoch(DateTime.Now.ToUnixTime()))
                .SetClientId(ProcessId.CreateBuilder().SetLabel(0xDEADBEEF).SetEpoch(DateTime.Now.ToUnixTime()))
                .Build();

            done(response);
        }
Example #21
0
        public override void Initialize(IRpcController controller, bnet.protocol.achievements.InitializeRequest request, Action<bnet.protocol.achievements.InitializeResponse> done)
        {
            var contentHandle = bnet.protocol.ContentHandle.CreateBuilder()
                .SetRegion(0x00005553) //US
                .SetUsage(0x61636876) //achv
                .SetHash(ByteString.CopyFrom(VersionInfo.MooNet.Achievements.AchievementFileHash.ToByteArray()));
            var reponse = bnet.protocol.achievements.InitializeResponse.CreateBuilder().SetContentHandle(contentHandle);

            done(reponse.Build());
        }
Example #22
0
		public override void Connect(IRpcController controller, ConnectRequest request, Action<ConnectResponse> done) {
			var response = ConnectResponse.CreateBuilder();
			var server_id = ProcessId.CreateBuilder();
			var client_id = ProcessId.CreateBuilder();

			var epoch = (uint)(DateTime.Now - new DateTime(1970,1,1,0,0,0)).TotalSeconds;
			server_id.SetLabel(0).SetEpoch(epoch);
			response.SetServerId(server_id);
			done(response.Build());
		}
Example #23
0
 public override void CreateToon(IRpcController controller, CreateToonRequest request, Action<CreateToonResponse> done)
 {
     done(new CreateToonResponse.Builder
              {
                  Toon = new EntityId.Builder
                             {
                                 High = HighId.Toon,
                                 Low = 2
                             }.Build()
              }.Build());
 }
Example #24
0
 public override void RegisterWithService(IRpcController controller, bnet.protocol.achievements.RegisterWithServiceRequest request, Action<bnet.protocol.achievements.RegisterWithServiceResponse> done)
 {
     // This should register client with achievement notifier service. -Egris
     var response = bnet.protocol.achievements.RegisterWithServiceResponse.CreateBuilder()
         .SetMaxRecordsPerUpdate(1)
         .SetMaxCriteriaPerRecord(2)
         .SetMaxAchievementsPerRecord(1)
         .SetMaxRegistrations(16)
         .SetFlushFrequency(180);
     done(response.Build());
 }
Example #25
0
        public void CallMethod(MethodDescriptor method, IRpcController controller, IMessage request, IMessage responsePrototype, Action<IMessage> done)
        {
            uint hash = method.Service.GetHash();
            ExternalService externalService = exportedServicesIds[hash];

            var requestId = externalService.GetNextRequestId();
            callbacks.Enqueue(new Callback { Action = done, Builder = responsePrototype.WeakToBuilder(), RequestId = requestId });

            ServerPacket data = new ServerPacket(externalService.Id, (int)GetMethodId(method), requestId, ListenerId).WriteMessage(request);
            Send(data);
        }
Example #26
0
        public override void GetPoolState(IRpcController controller, bnet.protocol.server_pool.PoolStateRequest request, Action<bnet.protocol.server_pool.PoolStateResponse> done)
        {
            Logger.Trace("GetPoolState()");
            var pid = bnet.protocol.ProcessId.CreateBuilder().SetEpoch(26990464).SetLabel(17459).Build();
            var si = bnet.protocol.server_pool.ServerInfo.CreateBuilder().SetProgramId(17459).SetHost(pid).Build();
            var builder = bnet.protocol.server_pool.PoolStateResponse.CreateBuilder().AddInfo(si);

            throw new NotImplementedException();

            //done(builder.Build());
        }
Example #27
0
        public override void FindGame(IRpcController controller, FindGameRequest request, Action<FindGameResponse> done)
        {            
            Logger.Trace("FindGame() {0}", this.Client);

            var requestId = ++GameCreatorManager.RequestIdCounter;

            var builder = FindGameResponse.CreateBuilder().SetRequestId(requestId);
            done(builder.Build());

            GameCreatorManager.FindGame(this.Client, requestId, request);
        }
Example #28
0
        public override void ProcessClientRequest(IRpcController controller, bnet.protocol.game_utilities.ClientRequest request, Action<bnet.protocol.game_utilities.ClientResponse> done)
        {
            Logger.Trace("ProcessClientRequest()");

            // TODO: handle the request. this is where banner changing happens (CustomMessageId 4)
            // CustomMessage for banner change is a D3.GameMessages.SaveBannerConfiguration
            //Logger.Debug("request:\n{0}", request.ToString());

            var builder = bnet.protocol.game_utilities.ClientResponse.CreateBuilder();
            done(builder.Build());
        }
Example #29
0
        public override void JoinGame(IRpcController controller, bnet.protocol.game_master.JoinGameRequest request, Action<bnet.protocol.game_master.JoinGameResponse> done)
        {
            Logger.Trace("Client {0} attempted to join game {1}.", this.Client, request.GameHandle.GameId.Low);
            //var game = GameFactoryManager.FindGameByEntityId(request.GameHandle.GameId);

            var builder = bnet.protocol.game_master.JoinGameResponse.CreateBuilder();
                //.AddConnectInfo(game.GetConnectionInfoForClient(this.Client));

            done(builder.Build());
            //throw new NotImplementedException();
        }
Example #30
0
        public override void FindGame(IRpcController controller, FindGameRequest request, Action<FindGameResponse> done)
        {            
            Logger.Trace("FindGame()");
                        
            var game = GameManager.CreateGame(request.FactoryId);
            var builder = FindGameResponse.CreateBuilder().SetRequestId(game.RequestID);
            done(builder.Build());

            // TODO: should actually match the games that matches the filter.
            game.ListenForGame((Client) this.Client);    
        }
Example #31
0
 public override void RegisterUtilities(IRpcController controller, bnet.protocol.game_master.RegisterUtilitiesRequest request, Action <bnet.protocol.NoData> done)
 {
     throw new NotImplementedException();
 }
Example #32
0
 public override void CreateCSTradeMoney(IRpcController controller, bnet.protocol.exchange.CreateCSTradeMoneyRequest request, Action <bnet.protocol.exchange.CreateCSTradeResponse> done)
 {
     throw new NotImplementedException();
 }
Example #33
0
        public override void GetConfiguration(IRpcController controller, bnet.protocol.exchange.GetConfigurationRequest request, Action <bnet.protocol.exchange.GetConfigurationResponse> done)
        {
            Logger.Trace("GetConfiguration()");
            //TODO: Figure out what the buyout rules/specialist values are, and if they are related /dustinconrad
            var builder = bnet.protocol.exchange.GetConfigurationResponse.CreateBuilder()
                          .AddConfigs(bnet.protocol.exchange.SpecialistConfig.CreateBuilder()
                                      .SetSpecialist(1)
                                      .AddAuctionDurations(2880)
                                      .AddAuctionStartDelays(5)
                                      .SetAntiSnipingExtensionDelay(1)
                                      .SetMaxItemsAmount(1)
                                      .SetStartingUnitPriceRule(2)
                                      .SetReservedUnitPriceRule(1)
                                      .SetTradeNowUnitPriceRule(1)
                                      .SetCurrentUnitPriceRule(2)
                                      .SetMaximumUnitPriceRule(2)
                                      .SetFillOrKillRule(0)
                                      .AddCurrencyConfig(bnet.protocol.exchange.CurrencyConfig.CreateBuilder()
                                                         .SetCurrency("D3_GOLD")
                                                         .SetTickSize(1)
                                                         .SetMinTotalPrice(100)
                                                         .SetMinUnitPrice(100)
                                                         .SetMaxUnitPrice(100000000000)
                                                         .SetMaxTotalPrice(100000000000).Build())
                                      .AddCurrencyConfig(bnet.protocol.exchange.CurrencyConfig.CreateBuilder()
                                                         .SetCurrency("D3_GOLD_HC")
                                                         .SetTickSize(1)
                                                         .SetMinTotalPrice(100)
                                                         .SetMinUnitPrice(100)
                                                         .SetMaxUnitPrice(100000000000)
                                                         .SetMaxTotalPrice(100000000000).Build()))
                          .AddConfigs(bnet.protocol.exchange.SpecialistConfig.CreateBuilder()
                                      .SetSpecialist(2)
                                      .AddAuctionDurations(2880)
                                      .AddAuctionStartDelays(0)
                                      .SetAntiSnipingExtensionDelay(0)
                                      .SetMaxItemsAmount(4294967295)
                                      .SetStartingUnitPriceRule(1)
                                      .SetReservedUnitPriceRule(2)
                                      .SetTradeNowUnitPriceRule(0)
                                      .SetCurrentUnitPriceRule(0)
                                      .SetMaximumUnitPriceRule(2)
                                      .SetFillOrKillRule(1)
                                      .AddCurrencyConfig(bnet.protocol.exchange.CurrencyConfig.CreateBuilder()
                                                         .SetCurrency("D3_GOLD")
                                                         .SetTickSize(1)
                                                         .SetMinTotalPrice(100)
                                                         .SetMinUnitPrice(100)
                                                         .SetMaxUnitPrice(100000000000)
                                                         .SetMaxTotalPrice(100000000000).Build())
                                      .AddCurrencyConfig(bnet.protocol.exchange.CurrencyConfig.CreateBuilder()
                                                         .SetCurrency("D3_GOLD_HC")
                                                         .SetTickSize(1)
                                                         .SetMinTotalPrice(100)
                                                         .SetMinUnitPrice(100)
                                                         .SetMaxUnitPrice(100000000000)
                                                         .SetMaxTotalPrice(100000000000).Build()))
                          .SetRecommendedDefaultRmtCurrency("USD")
                          .SetRmtRestrictedByLicense(bnet.protocol.account.AccountLicense.CreateBuilder().SetId(222).SetExpires(1337724000000000));

            done(builder.Build());
        }
Example #34
0
 public override void ListFactories(IRpcController controller, ListFactoriesRequest request, Action <ListFactoriesResponse> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Example #35
0
 public override void ClearRecentPlayers(IRpcController controller, bnet.protocol.NoData request, Action <bnet.protocol.user_manager.ClearRecentPlayersResponse> done)
 {
     throw new NotImplementedException();
 }
Example #36
0
 public override void ViewFriends(IRpcController controller, ViewFriendsRequest request, Action <ViewFriendsResponse> done)
 {
     throw new NotImplementedException();
 }
Example #37
0
 public override void RegisterServer(IRpcController controller, RegisterServerRequest request, Action <NoData> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Example #38
0
 public override void ValidateStaticData(IRpcController controller, bnet.protocol.achievements.ValidateStaticDataRequest request, Action <bnet.protocol.NoData> done)
 {
     throw new NotImplementedException();
 }
Example #39
0
 public override void PostUpdate(IRpcController controller, bnet.protocol.achievements.PostUpdateRequest request, Action <bnet.protocol.achievements.PostUpdateResponse> done)
 {
     throw new NotImplementedException();
 }
Example #40
0
        public override void ListFactories(IRpcController controller, bnet.protocol.game_master.ListFactoriesRequest request, Action <bnet.protocol.game_master.ListFactoriesResponse> done)
        {
            Logger.Trace("ListFactories() {0}", this.Client);

            var statsBucket = bnet.protocol.game_master.GameStatsBucket.CreateBuilder()
                              .SetBucketMin(0)
                              .SetBucketMax(4267296)
                              .SetWaitMilliseconds(1354)
                              .SetGamesPerHour(0)
                              .SetActiveGames(69)
                              .SetActivePlayers(75)
                              .SetFormingGames(5)
                              .SetWaitingPlayers(0).Build();

            var factoryDescriptions = new bnet.protocol.game_master.GameFactoryDescription[9];

            for (var i = 0; i < 4; i++)
            {
                var factoryAttributes = GetFactoryAttributes(
                    min_players: 2,
                    max_players: 4,
                    num_teams: 1,
                    version: Mooege.Common.Versions.VersionInfo.Ingame.MajorVersion,
                    playergroup: 0,
                    currentquest: "",
                    difficultylevel: i
                    );
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                                         .AddRangeAttribute(factoryAttributes)
                                         .SetId(14249086168335147635 + (ulong)i)
                                         .AddStatsBucket(statsBucket)
                                         .Build();
            }
            for (var i = 4; i < 8; i++)
            {
                var factoryAttributes = GetFactoryAttributes(
                    min_players: 2,
                    max_players: 4,
                    num_teams: 1,
                    version: Mooege.Common.Versions.VersionInfo.Ingame.MajorVersion,
                    playergroup: 1,
                    currentquest: "",
                    difficultylevel: i - 4
                    );
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                                         .AddRangeAttribute(factoryAttributes)
                                         .SetId(14249086168335147635 + (ulong)i)
                                         .AddStatsBucket(statsBucket)
                                         .Build();
            }
            for (int i = 8; i < 9; i++)
            {
                var factoryAttributes = GetFactoryAttributes(
                    min_players: 2,
                    max_players: 4,
                    num_teams: 1,
                    version: Mooege.Common.Versions.VersionInfo.Ingame.MajorVersion,
                    playergroup: 2,
                    currentquest: "",
                    difficultylevel: 0
                    );
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                                         .AddRangeAttribute(factoryAttributes)
                                         .SetId(14249086168335147635 + (ulong)i)
                                         .AddStatsBucket(statsBucket)
                                         .Build();
            }

            var builder = bnet.protocol.game_master.ListFactoriesResponse.CreateBuilder().AddRangeDescription(factoryDescriptions).SetTotalResults((uint)factoryDescriptions.Length);

            done(builder.Build());
        }
Example #41
0
 public override void GetFactoryInfo(IRpcController controller, bnet.protocol.game_master.GetFactoryInfoRequest request, Action <bnet.protocol.game_master.GetFactoryInfoResponse> done)
 {
     throw new NotImplementedException();
 }
Example #42
0
 public override void ChangeGame(IRpcController controller, bnet.protocol.game_master.ChangeGameRequest request, Action <bnet.protocol.NoData> done)
 {
     throw new NotImplementedException();
 }
Example #43
0
 public override void Subscribe(IRpcController controller, SubscribeRequest request, Action <SubscribeResponse> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Example #44
0
 public override void UpdateFriendState(IRpcController controller, UpdateFriendStateRequest request, Action <UpdateFriendStateResponse> done)
 {
     throw new NotImplementedException();
 }
Example #45
0
 public override void UnregisterUtilities(IRpcController controller, UnregisterUtilitiesRequest request, Action <NO_RESPONSE> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Example #46
0
 public override void UnsubscribeToFriends(IRpcController controller, UnsubscribeToFriendsRequest request, Action <NoData> done)
 {
     throw new NotImplementedException();
 }
Example #47
0
 public override void PlayerLeft(IRpcController controller, PlayerLeftNotification request, Action <NO_RESPONSE> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Example #48
0
 public override void DeclineInvitation(IRpcController controller, GenericRequest request, Action <NoData> done)
 {
     throw new NotImplementedException();
 }
Example #49
0
 public override void BlockEntityForSession(IRpcController controller, bnet.protocol.user_manager.BlockEntityRequest request, Action <bnet.protocol.NoData> done)
 {
     throw new NotImplementedException();
 }
Example #50
0
 public override void LeaveExchange(IRpcController controller, LeaveRequest request, Action <NoData> done)
 {
     throw new NotImplementedException();
 }
Example #51
0
 public override void LoadBlockList(IRpcController controller, bnet.protocol.EntityId request, Action <bnet.protocol.NoData> done)
 {
     throw new NotImplementedException();
 }
Example #52
0
 public override void EnterExchange(IRpcController controller, EnterRequest request, Action <EnterResponse> done)
 {
     throw new NotImplementedException();
 }
Example #53
0
 public override void UnregisterFromService(IRpcController controller, bnet.protocol.achievements.UnregisterFromServiceRequest request, Action <bnet.protocol.NoData> done)
 {
     throw new NotImplementedException();
 }
Example #54
0
 public override void Subscribe(IRpcController controller, bnet.protocol.game_master.SubscribeRequest request, Action <bnet.protocol.game_master.SubscribeResponse> done)
 {
     throw new NotImplementedException();
 }
Example #55
0
 public override void GetGameStats(IRpcController controller, GetGameStatsRequest request, Action <GetGameStatsResponse> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Example #56
0
 public override void ChangeGame(IRpcController controller, ChangeGameRequest request, Action <NoData> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Example #57
0
 public override void GetAuthProgress(IRpcController controller, GetAuthProgressRequest request, Action <GetAuthProgressResponse> done)
 {
     throw new NotImplementedException();
 }
Example #58
0
 public override void Unsubscribe(IRpcController controller, UnsubscribeRequest request, Action <NO_RESPONSE> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Example #59
0
 public override void Unsubscribe(IRpcController controller, bnet.protocol.game_master.UnsubscribeRequest request, Action <bnet.protocol.NO_RESPONSE> done)
 {
     throw new NotImplementedException();
 }
Example #60
0
 public override void PlayerLeft(IRpcController controller, bnet.protocol.game_master.PlayerLeftNotification request, Action <bnet.protocol.NO_RESPONSE> done)
 {
     throw new NotImplementedException();
 }