Ejemplo n.º 1
0
        public void Handle(string logLine, IHsGameState gameState, IGame game)
        {
            if (!GoldProgressRegex.IsMatch(logLine) || (DateTime.Now - gameState.LastGameStart) <= TimeSpan.FromSeconds(10) ||
                game.CurrentGameMode == GameMode.Spectator)
            {
                return;
            }
            var rawWins = GoldProgressRegex.Match(logLine).Groups["wins"].Value;

            if (!int.TryParse(rawWins, out int wins))
            {
                return;
            }
            UpdateGoldProgress(wins, game);
        }
 public void Handle(string logLine, IHsGameState gameState, IGame game)
 {
     if (GoldProgressRegex.IsMatch(logLine) && (DateTime.Now - gameState.LastGameStart) > TimeSpan.FromSeconds(10) &&
         game.CurrentGameMode != GameMode.Spectator)
     {
         int wins;
         var rawWins = GoldProgressRegex.Match(logLine).Groups["wins"].Value;
         if (int.TryParse(rawWins, out wins))
         {
             var timeZone = GetTimeZoneInfo(game.CurrentRegion);
             if (timeZone != null)
             {
                 UpdateGoldProgress(wins, game, timeZone);
             }
         }
     }
 }
 public void Handle(string logLine, IHsGameState gameState, IGame game)
 {
     if (CardAlreadyInCacheRegex.IsMatch(logLine))
     {
         var id = CardAlreadyInCacheRegex.Match(logLine).Groups["id"].Value;
         if (game.CurrentGameMode == GameMode.Arena)
         {
             gameState.GameHandler.HandlePossibleArenaCard(id);
         }
         else
         {
             gameState.GameHandler.HandlePossibleConstructedCard(id, false);
         }
     }
     else if (GoldProgressRegex.IsMatch(logLine) && (DateTime.Now - gameState.LastGameStart) > TimeSpan.FromSeconds(10) &&
              game.CurrentGameMode != GameMode.Spectator)
     {
         int wins;
         var rawWins = GoldProgressRegex.Match(logLine).Groups["wins"].Value;
         if (int.TryParse(rawWins, out wins))
         {
             var timeZone = GetTimeZoneInfo(game.CurrentRegion);
             if (timeZone != null)
             {
                 UpdateGoldProgress(wins, game, timeZone);
             }
         }
     }
     else if (DustRewardRegex.IsMatch(logLine))
     {
         int amount;
         if (int.TryParse(DustRewardRegex.Match(logLine).Groups["amount"].Value, out amount))
         {
             gameState.GameHandler.HandleDustReward(amount);
         }
     }
     else if (GoldRewardRegex.IsMatch(logLine))
     {
         int amount;
         if (int.TryParse(GoldRewardRegex.Match(logLine).Groups["amount"].Value, out amount))
         {
             gameState.GameHandler.HandleGoldReward(amount);
         }
     }
 }