示例#1
0
    public static void FindGame(BnetGameType gameType, int missionId, long deckId, long aiDeckId)
    {
        Guid guid = Guid.NewGuid();
        bool setScenarioIdAttr = RequiresScenarioIdAttribute(gameType);

        s_impl.FindGame(guid.ToByteArray(), gameType, missionId, deckId, aiDeckId, setScenarioIdAttr);
    }
示例#2
0
 internal GameStartEventArgs(BnetGameType mode, string gameHandle, ulong accHi, ulong accLo)
 {
     Mode       = mode;
     GameHandle = gameHandle;
     AccountHi  = accHi;
     AccountLo  = accLo;
 }
 public static void OnGameEnd(BnetGameType gameType)
 {
     if (!Config.Instance.GoogleAnalytics)
     {
         return;
     }
     WritePoint(new InfluxPointBuilder("hdt_played_game_counter").Tag("game_type", gameType).Build());
 }
 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);
     }
 }
示例#5
0
 public static bool RequiresScenarioIdAttribute(BnetGameType bnetGameType)
 {
     switch (bnetGameType)
     {
     case BnetGameType.BGT_TAVERNBRAWL_PVP:
     case BnetGameType.BGT_TAVERNBRAWL_2P_COOP:
     case BnetGameType.BGT_FRIENDS:
         return(true);
     }
     return(false);
 }
 private bool IsNoAccountTutorialGame(BnetGameType gameType)
 {
     if (Network.ShouldBeConnectedToAurora())
     {
         return(false);
     }
     if (gameType != BnetGameType.BGT_TUTORIAL)
     {
         return(false);
     }
     return(true);
 }
    private void CancelFindGame(ulong gameRequestId)
    {
        BnetGameType findingBnetGameType = Network.Get().GetFindingBnetGameType();

        if (!this.IsNoAccountTutorialGame(findingBnetGameType))
        {
            CancelGameEntryRequest message = new CancelGameEntryRequest {
                RequestId = gameRequestId
            };
            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);
            message.AddPlayer(val);
            CancelGameContext context = new CancelGameContext(gameRequestId);
            base.m_rpcConnection.QueueRequest(this.m_gameMasterService.Id, 4, message, new RPCContextDelegate(context.CancelGameCallback), 0);
        }
    }
		public static void OnGameEnd(BnetGameType gameType)
		{
			if(!Config.Instance.GoogleAnalytics)
				return;
			WritePoint(new InfluxPointBuilder("hdt_played_game_counter").Tag("game_type", gameType).Build());
		}