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); } }
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); }
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); }
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); }