Example #1
0
        private void PrintFindGameRequest(FindGameRequest request)
        {
            string str;
            string str1        = "FindGameRequest: { ";
            int    playerCount = request.PlayerCount;

            for (int i = 0; i < playerCount; i++)
            {
                Player item = request.Player[i];
                str1 = string.Concat(str1, this.PrintPlayer(item));
            }
            if (request.HasFactoryId)
            {
                str  = str1;
                str1 = string.Concat(new object[] { str, "Factory Id: ", request.FactoryId, " " });
            }
            if (request.HasProperties)
            {
                str1 = string.Concat(str1, this.PrintGameProperties(request.Properties));
            }
            if (request.HasObjectId)
            {
                str  = str1;
                str1 = string.Concat(new object[] { str, "Obj Id: ", request.ObjectId, " " });
            }
            if (request.HasRequestId)
            {
                str  = str1;
                str1 = string.Concat(new object[] { str, "Request Id: ", request.RequestId, " " });
            }
            str1 = string.Concat(str1, "}");
            base.ApiLog.LogDebug(str1);
        }
 public void FindGame(byte[] requestGuid, BnetGameType gameType, int scenario, long deckId, long aiDeckId, bool setScenarioIdAttr)
 {
     if (this.s_gameRequest != 0)
     {
         Debug.LogWarning("WARNING: FindGame called with an active game");
         this.CancelFindGame(this.s_gameRequest);
         this.s_gameRequest = 0L;
     }
     if (this.IsNoAccountTutorialGame(gameType))
     {
         this.GoToNoAccountTutorialServer(scenario);
     }
     else
     {
         object[] args = new object[] { gameType, scenario, deckId, aiDeckId, !setScenarioIdAttr ? 0 : 1, (requestGuid != null) ? requestGuid.ToHexString() : "null" };
         base.ApiLog.LogInfo("FindGame type={0} scenario={1} deck={2} aideck={3} setScenId={4} request_guid={5}", args);
         bnet.protocol.game_master.Player val = new bnet.protocol.game_master.Player();
         Identity identity = new Identity();
         identity.SetGameAccountId(base.m_battleNet.GameAccountId);
         val.SetIdentity(identity);
         val.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)gameType));
         val.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
         val.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)deckId)));
         val.AddAttribute(ProtocolHelper.CreateAttribute("aideck", (long)((int)aiDeckId)));
         val.AddAttribute(ProtocolHelper.CreateAttribute("request_guid", requestGuid));
         GameProperties  properties = new GameProperties();
         AttributeFilter filter     = new AttributeFilter();
         filter.SetOp(AttributeFilter.Types.Operation.MATCH_ALL);
         if (!BattleNet.IsVersionInt() && (BattleNet.GetVersionString() == "PAX"))
         {
             filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString() + BattleNet.GetVersionInt().ToString()));
         }
         else if (BattleNet.IsVersionInt())
         {
             filter.AddAttribute(ProtocolHelper.CreateAttribute("version", (long)BattleNet.GetVersionInt()));
         }
         else
         {
             filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString()));
         }
         filter.AddAttribute(ProtocolHelper.CreateAttribute("GameType", (long)gameType));
         if (setScenarioIdAttr)
         {
             filter.AddAttribute(ProtocolHelper.CreateAttribute("ScenarioId", (long)scenario));
         }
         properties.SetFilter(filter);
         properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("type", (long)gameType));
         properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
         FindGameRequest request = new FindGameRequest();
         request.AddPlayer(val);
         request.SetProperties(properties);
         request.SetAdvancedNotification(true);
         FindGameRequest request2 = request;
         this.PrintFindGameRequest(request2);
         this.IsFindGamePending = true;
         base.m_rpcConnection.QueueRequest(this.m_gameMasterService.Id, 3, request2, new RPCContextDelegate(this.FindGameCallback), 0);
     }
 }
Example #3
0
        public void FindGame(byte[] requestGuid, int gameType, int scenario, long deckId, long aiDeckId, bool setScenarioIdAttr)
        {
            if (this.s_gameRequest != 0UL)
            {
                LogAdapter.Log(LogLevel.Warning, "WARNING: FindGame called with an active game");
                this.CancelFindGame(this.s_gameRequest);
                this.s_gameRequest = 0UL;
            }
            Player   player   = new Player();
            Identity identity = new Identity();

            identity.SetGameAccountId(this.m_battleNet.GameAccountId);
            player.SetIdentity(identity);
            player.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)gameType));
            player.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
            player.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)deckId)));
            player.AddAttribute(ProtocolHelper.CreateAttribute("aideck", (long)((int)aiDeckId)));
            player.AddAttribute(ProtocolHelper.CreateAttribute("request_guid", requestGuid));
            GameProperties  gameProperties  = new GameProperties();
            AttributeFilter attributeFilter = new AttributeFilter();

            attributeFilter.SetOp(AttributeFilter.Types.Operation.MATCH_ALL);
            if (!BattleNet.IsVersionInt())
            {
                attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersion()));
            }
            else
            {
                int num = 0;
                if (!int.TryParse(BattleNet.GetVersion(), out num))
                {
                    LogAdapter.Log(LogLevel.Error, "Could not convert BattleNetVersion to int: " + BattleNet.GetVersion());
                }
                attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("version", (long)num));
            }
            attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("GameType", (long)gameType));
            if (setScenarioIdAttr)
            {
                attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("ScenarioId", (long)scenario));
            }
            gameProperties.SetFilter(attributeFilter);
            gameProperties.AddCreationAttributes(ProtocolHelper.CreateAttribute("type", (long)gameType));
            gameProperties.AddCreationAttributes(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
            FindGameRequest findGameRequest = new FindGameRequest();

            findGameRequest.AddPlayer(player);
            findGameRequest.SetProperties(gameProperties);
            findGameRequest.SetAdvancedNotification(true);
            FindGameRequest findGameRequest2 = findGameRequest;

            this.PrintFindGameRequest(findGameRequest2);
            this.IsFindGamePending = true;
            this.m_rpcConnection.QueueRequest(this.m_gameMasterService.Id, 3u, findGameRequest2, new RPCContextDelegate(this.FindGameCallback), 0u);
        }
Example #4
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 #5
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 #6
0
        public override void FindGame(IRpcController controller, FindGameRequest request, Action<FindGameResponse> done)
        {            
            Logger.Trace("FindGame()");
    
            var game = GameManager.CreateGame(request.FactoryId);
            // Map the remote ID
            this.Client.MapLocalObjectID(game.DynamicId, request.ObjectId);
            var builder = FindGameResponse.CreateBuilder().SetRequestId(game.RequestID);
            done(builder.Build());

            // TODO: We should actually match the games that matches the filter
            game.ListenForGame((BNetClient)this.Client);
        }
Example #7
0
        public void CreateFriendlyChallengeGame(long myDeck, long hisDeck, bnet.protocol.EntityId hisGameAccount, int scenario)
        {
            FindGameRequest findGameRequest = new FindGameRequest();
            Player          player          = new Player();
            Identity        identity        = new Identity();

            identity.SetGameAccountId(this.m_battleNet.GameAccountId);
            GameProperties  gameProperties  = new GameProperties();
            AttributeFilter attributeFilter = new AttributeFilter();

            attributeFilter.SetOp(AttributeFilter.Types.Operation.MATCH_ALL);
            if (!BattleNet.IsVersionInt())
            {
                attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersion()));
            }
            else
            {
                int num = 0;
                if (!int.TryParse(BattleNet.GetVersion(), out num))
                {
                    LogAdapter.Log(LogLevel.Error, "Could not convert BattleNetVersion to int: " + BattleNet.GetVersion());
                }
                attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("version", (long)num));
            }
            attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("GameType", 1L));
            attributeFilter.AddAttribute(ProtocolHelper.CreateAttribute("ScenarioId", (long)scenario));
            gameProperties.SetFilter(attributeFilter);
            gameProperties.AddCreationAttributes(ProtocolHelper.CreateAttribute("type", 1L));
            gameProperties.AddCreationAttributes(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
            player.SetIdentity(identity);
            player.AddAttribute(ProtocolHelper.CreateAttribute("type", 1L));
            player.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
            player.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)myDeck)));
            findGameRequest.AddPlayer(player);
            identity = new Identity();
            player   = new Player();
            identity.SetGameAccountId(hisGameAccount);
            player.SetIdentity(identity);
            player.AddAttribute(ProtocolHelper.CreateAttribute("type", 1L));
            player.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
            player.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)hisDeck)));
            findGameRequest.AddPlayer(player);
            findGameRequest.SetProperties(gameProperties);
            findGameRequest.SetAdvancedNotification(true);
            FindGameRequest findGameRequest2 = findGameRequest;

            this.PrintFindGameRequest(findGameRequest2);
            this.IsFindGamePending = true;
            this.m_rpcConnection.QueueRequest(this.m_gameMasterService.Id, 3u, findGameRequest2, new RPCContextDelegate(this.FindGameCallback), 0u);
        }
    public void CreateFriendlyChallengeGame(long myDeck, long hisDeck, EntityId hisGameAccount, int scenario)
    {
        FindGameRequest request = new FindGameRequest();

        bnet.protocol.game_master.Player val = new bnet.protocol.game_master.Player();
        Identity identity = new Identity();

        identity.SetGameAccountId(base.m_battleNet.GameAccountId);
        GameProperties  properties = new GameProperties();
        AttributeFilter filter     = new AttributeFilter();

        filter.SetOp(AttributeFilter.Types.Operation.MATCH_ALL);
        if (!BattleNet.IsVersionInt() && (BattleNet.GetVersionString() == "PAX"))
        {
            filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString() + BattleNet.GetVersionInt().ToString()));
        }
        else if (BattleNet.IsVersionInt())
        {
            filter.AddAttribute(ProtocolHelper.CreateAttribute("version", (long)BattleNet.GetVersionInt()));
        }
        else
        {
            filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString()));
        }
        filter.AddAttribute(ProtocolHelper.CreateAttribute("GameType", (long)1L));
        filter.AddAttribute(ProtocolHelper.CreateAttribute("ScenarioId", (long)scenario));
        properties.SetFilter(filter);
        properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("type", (long)1L));
        properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
        val.SetIdentity(identity);
        val.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)1L));
        val.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
        val.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)myDeck)));
        request.AddPlayer(val);
        identity = new Identity();
        val      = new bnet.protocol.game_master.Player();
        identity.SetGameAccountId(hisGameAccount);
        val.SetIdentity(identity);
        val.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)1L));
        val.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
        val.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)hisDeck)));
        request.AddPlayer(val);
        request.SetProperties(properties);
        request.SetAdvancedNotification(true);
        FindGameRequest request2 = request;

        this.PrintFindGameRequest(request2);
        this.IsFindGamePending = true;
        base.m_rpcConnection.QueueRequest(this.m_gameMasterService.Id, 3, request2, new RPCContextDelegate(this.FindGameCallback), 0);
    }
Example #9
0
        private void PrintFindGameRequest(FindGameRequest request)
        {
            string text        = "FindGameRequest: { ";
            int    playerCount = request.PlayerCount;

            for (int i = 0; i < playerCount; i++)
            {
                Player player = request.Player[i];
                text += this.PrintPlayer(player);
            }
            if (request.HasFactoryId)
            {
                string text2 = text;
                text = string.Concat(new object[]
                {
                    text2,
                    "Factory Id: ",
                    request.FactoryId,
                    " "
                });
            }
            if (request.HasProperties)
            {
                text += this.PrintGameProperties(request.Properties);
            }
            if (request.HasObjectId)
            {
                string text2 = text;
                text = string.Concat(new object[]
                {
                    text2,
                    "Obj Id: ",
                    request.ObjectId,
                    " "
                });
            }
            if (request.HasRequestId)
            {
                string text2 = text;
                text = string.Concat(new object[]
                {
                    text2,
                    "Request Id: ",
                    request.RequestId,
                    " "
                });
            }
            text += "}";
            base.ApiLog.LogDebug(text);
        }
Example #10
0
        public override void FindGame(IRpcController controller, FindGameRequest request, Action <FindGameResponse> done)
        {
            Logger.Trace("FindGame()");

            var game = GameManager.CreateGame(request.FactoryId);

            // Map the remote ID
            this.Client.MapLocalObjectID(game.DynamicId, request.ObjectId);
            var builder = FindGameResponse.CreateBuilder().SetRequestId(game.RequestID);

            done(builder.Build());

            // TODO: We should actually match the games that matches the filter
            game.ListenForGame((BNetClient)this.Client);
        }
Example #11
0
        public static void FindGame(MooNetClient client, ulong requestId, FindGameRequest request)
        {
            // We actually need to check request here and see if client wants to join a public game or create his own.

            var clients = new List<MooNetClient>();
            foreach(var player in request.PlayerList)
            {
                var toon = ToonManager.GetToonByLowID(player.ToonId.Low);
                if(toon.Owner.LoggedInClient==null) continue;
                clients.Add(toon.Owner.LoggedInClient);
            }

            client.CurrentChannel.Game.RequestId = requestId;
            client.CurrentChannel.Game.StartGame(clients, request.ObjectId);            
        }
Example #12
0
        public override void FindGame(IRpcController controller, FindGameRequest request, Action<FindGameResponse> done)
        {
            FindGameResponse.Builder findGameResponse = FindGameResponse.CreateBuilder();
            findGameResponse.SetRequestId(12526585062881647236);

            done(findGameResponse.Build());

            client.ListenerId = request.ObjectId;

            GameFoundNotification.Builder gameFoundNotification = GameFoundNotification.CreateBuilder();

            GameHandle.Builder gameHandle = GameHandle.CreateBuilder();
            gameHandle.SetFactoryId(request.FactoryId);
            gameHandle.SetGameId(EntityId.CreateBuilder().SetHigh(433661094641971304).SetLow(11017467167309309688).Build());

            ConnectInfo.Builder connectInfo = ConnectInfo.CreateBuilder();
            connectInfo.SetToonId(new EntityId.Builder
                                      {
                                          High = HighId.Toon,
                                          Low = 2
                                      }.Build());
            connectInfo.SetHost("127.0.0.1");
            connectInfo.SetPort(6665);
            connectInfo.SetToken(ByteString.CopyFrom(new byte[] { 0x07, 0x34, 0x02, 0x60, 0x91, 0x93, 0x76, 0x46, 0x28, 0x84 }));
            connectInfo.AddAttribute(Attribute
                                         .CreateBuilder()
                                         .SetName("SGameId")
                                         .SetValue(Variant
                                                       .CreateBuilder()
                                                       .SetIntValue(2014314530)
                                                       .Build())
                                         .Build());

            gameFoundNotification.SetRequestId(12526585062881647236);
            gameFoundNotification.SetGameHandle(gameHandle.Build());
            gameFoundNotification.AddConnectInfo(connectInfo.Build());

            GameFactorySubscriber.CreateStub(client).NotifyGameFound(controller, gameFoundNotification.Build(), r => { });
        }
Example #13
0
        public override void FindGame(IRpcController controller, FindGameRequest request, Action <FindGameResponse> done)
        {
            FindGameResponse.Builder findGameResponse = FindGameResponse.CreateBuilder();
            findGameResponse.SetRequestId(12526585062881647236);

            done(findGameResponse.Build());

            client.ListenerId = request.ObjectId;

            GameFoundNotification.Builder gameFoundNotification = GameFoundNotification.CreateBuilder();

            GameHandle.Builder gameHandle = GameHandle.CreateBuilder();
            gameHandle.SetFactoryId(request.FactoryId);
            gameHandle.SetGameId(EntityId.CreateBuilder().SetHigh(433661094641971304).SetLow(11017467167309309688).Build());

            ConnectInfo.Builder connectInfo = ConnectInfo.CreateBuilder();
            connectInfo.SetToonId(new EntityId.Builder
            {
                High = HighId.Toon,
                Low  = 2
            }.Build());
            connectInfo.SetHost("127.0.0.1");
            connectInfo.SetPort(6665);
            connectInfo.SetToken(ByteString.CopyFrom(new byte[] { 0x07, 0x34, 0x02, 0x60, 0x91, 0x93, 0x76, 0x46, 0x28, 0x84 }));
            connectInfo.AddAttribute(Attribute
                                     .CreateBuilder()
                                     .SetName("SGameId")
                                     .SetValue(Variant
                                               .CreateBuilder()
                                               .SetIntValue(2014314530)
                                               .Build())
                                     .Build());

            gameFoundNotification.SetRequestId(12526585062881647236);
            gameFoundNotification.SetGameHandle(gameHandle.Build());
            gameFoundNotification.AddConnectInfo(connectInfo.Build());

            GameFactorySubscriber.CreateStub(client).NotifyGameFound(controller, gameFoundNotification.Build(), r => { });
        }
Example #14
0
        public static void FindGame(MooNetClient client, ulong requestId, FindGameRequest request)
        {
            var clients = new List<MooNetClient>();
            foreach(var player in request.PlayerList)
            {
                var toon = ToonManager.GetToonByLowID(player.ToonId.Low);
                if(toon.Owner.LoggedInClient==null) continue;
                clients.Add(toon.Owner.LoggedInClient);
            }

            string version = null;
            D3.OnlineService.GameCreateParams gameCreateParams = null;
            foreach(bnet.protocol.attribute.Attribute attribute in request.Properties.Filter.AttributeList)
            {
                if(attribute.Name == "GameCreateParams")
                {
                    gameCreateParams = D3.OnlineService.GameCreateParams.ParseFrom(attribute.Value.MessageValue);
                }
                else if(attribute.Name == "version")
                {
                    version = attribute.Value.StringValue;
                }
            }

            List<GameCreator> matchingGames;
            if (!request.Properties.Create && (matchingGames = FindMatchingGames(request)).Count > 0)
            {
                Random rand = new Random();
                var game = matchingGames[rand.Next(matchingGames.Count)];
                game.JoinGame(clients, request.ObjectId);
            }
            else
            {
                client.CurrentChannel.Game.RequestId = requestId;
                client.CurrentChannel.Game.StartGame(clients, request.ObjectId, gameCreateParams, version);
            }
        }
    private void PrintFindGameRequest(FindGameRequest request)
    {
        string str2;
        string message     = "FindGameRequest: { ";
        int    playerCount = request.PlayerCount;

        for (int i = 0; i < playerCount; i++)
        {
            bnet.protocol.game_master.Player player = request.Player[i];
            message = message + this.PrintPlayer(player);
        }
        if (request.HasFactoryId)
        {
            str2 = message;
            object[] objArray1 = new object[] { str2, "Factory Id: ", request.FactoryId, " " };
            message = string.Concat(objArray1);
        }
        if (request.HasProperties)
        {
            message = message + this.PrintGameProperties(request.Properties);
        }
        if (request.HasObjectId)
        {
            str2 = message;
            object[] objArray2 = new object[] { str2, "Obj Id: ", request.ObjectId, " " };
            message = string.Concat(objArray2);
        }
        if (request.HasRequestId)
        {
            str2 = message;
            object[] objArray3 = new object[] { str2, "Request Id: ", request.RequestId, " " };
            message = string.Concat(objArray3);
        }
        message = message + "}";
        base.ApiLog.LogDebug(message);
    }
Example #16
0
        public override void FindGame(IRpcController controller, FindGameRequest request, Action<FindGameResponse> done)
        {
            Logger.Trace("FindGame()");

            ////>>> FindGameResponse
            ////request_id: 12526585062881647236

            var findGameResponse = bnet.protocol.game_master.FindGameResponse.CreateBuilder();
            findGameResponse.SetRequestId(12526585062881647236);

            done(findGameResponse.Build());

            var gameFoundNotification = bnet.protocol.game_master.GameFoundNotification.CreateBuilder();

            var gameHandle = bnet.protocol.game_master.GameHandle.CreateBuilder();
            gameHandle.SetFactoryId(request.FactoryId);
            gameHandle.SetGameId(bnet.protocol.EntityId.CreateBuilder().SetHigh(433661094641971304).SetLow(11017467167309309688).Build());

            var connectInfo = bnet.protocol.game_master.ConnectInfo.CreateBuilder();
            connectInfo.SetToonId(Client.Account.Toons.First().Value.BnetEntityID);
            connectInfo.SetHost("127.0.0.1");
            connectInfo.SetPort(1345);
            connectInfo.SetToken(ByteString.CopyFrom(new byte[] { 0x07, 0x34, 0x02, 0x60, 0x91, 0x93, 0x76, 0x46, 0x28, 0x84 }));
            connectInfo.AddAttribute(bnet.protocol.attribute.Attribute
                .CreateBuilder()
                .SetName("SGameId")
                .SetValue(bnet.protocol.attribute.Variant
                        .CreateBuilder()
                        .SetIntValue(2014314530)
                        .Build())
                .Build());

            gameFoundNotification.SetRequestId(12526585062881647236);
            gameFoundNotification.SetGameHandle(gameHandle.Build());
            gameFoundNotification.AddConnectInfo(connectInfo.Build());

            var c = this.Client as Client;
            c.CallMethod(bnet.protocol.game_master.GameFactorySubscriber.Descriptor.FindMethodByName("NotifyGameFound"), null, gameFoundNotification.Build(), null, r => { }, 1);


            ////            >>> GameFoundNotification
            ////request_id: 12526585062881647236
            ////game_handle {
            ////  factory_id: 14249086168335147635
            ////  game_id {
            ////    high: 433661094641971304
            ////    low: 11017467167309309688
            ////  }
            ////}
            ////connect_info {
            ////  toon_id {
            ////    high: 216174302532224051
            ////    low: 2345959482769161802
            ////  }
            ////  host: "12.129.237.197"
            ////  port: 1119
            ////  token: "7340260919376462884"
            ////  attribute {
            ////    name: "SGameId"
            ////    value {
            ////      int_value: 2014314530
            ////    }
            ////  }
            ////}
        }
Example #17
0
 public override void FindGame(IRpcController controller, FindGameRequest request, Action<FindGameResponse> done)
 {
     throw new NotImplementedException();
 }
Example #18
0
 public override void FindGame(IRpcController controller, FindGameRequest request, Action<FindGameResponse> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Example #19
0
        private static List<GameCreator> FindMatchingGames(FindGameRequest request)
        {
            String version = String.Empty;
            int difficulty = 0;
            int currentQuest = 0;
            foreach (bnet.protocol.attribute.Attribute attribute in request.Properties.Filter.AttributeList)
            {
                switch (attribute.Name)
                {
                    case "version":
                        version = attribute.Value.StringValue;
                        break;
                    case "Game.Difficulty":
                        difficulty = (int)attribute.Value.IntValue;
                        break;
                    case "Game.CurrentQuest":
                        currentQuest = (int)attribute.Value.IntValue;
                        break;
                }
            }

            Func<bool, bool, bool, bool> matchOp;
            switch (request.Properties.Filter.Op)
            {
                case bnet.protocol.attribute.AttributeFilter.Types.Operation.MATCH_ANY:
                    matchOp = (bool b1, bool b2, bool b3) => b1 || b2 || b3;
                    break;
                case bnet.protocol.attribute.AttributeFilter.Types.Operation.MATCH_NONE:
                    matchOp = (bool b1, bool b2, bool b3) => !b1 && !b2 && !b3;
                    break;
                case bnet.protocol.attribute.AttributeFilter.Types.Operation.MATCH_ALL:
                default://default to match all, fall through is on purpose
                    matchOp = (bool b1, bool b2, bool b3) => b1 && b2 && b3;
                    break;
            }

            List<GameCreator> matches = new List<GameCreator>();
            foreach (GameCreator game in GameCreators.Values)
            {   //FIXME: don't currently track max players allowed in a game, hardcoded 4 /dustinconrad
                if (game.InGame != null && !game.GameCreateParams.IsPrivate && game.InGame.Players.Count < 4)
                {
                    if (matchOp(version == game.Version, difficulty == game.GameCreateParams.Coop.DifficultyLevel, currentQuest == game.GameCreateParams.Coop.SnoQuest))
                    {
                        matches.Add(game);
                    }
                }
            }
            return matches;
        }
Example #20
0
 public override void FindGame(IRpcController controller, FindGameRequest request, Action <FindGameResponse> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }