Пример #1
0
 public bool Action()
 {
     GetCardsService getCardsService = new GetCardsService(this.user, this.logger);
     GetCardsResponse getCardsResponse = getCardsService.ExecuteSerialize<GetCardsResponse>();
     List<Card> cardsToSell = (from x in getCardsResponse.cards
     where x.star < 4 && x.level == 1 && !x.name.Contains("Mule") && !x.name.Contains("Donkey")
     select x).ToList<Card>();
     Console.Write("Enter desired amount of gold (please do not enter more then 1 million): ");
     int desiredGold = int.Parse(Console.ReadLine());
     int earnedGold = 0;
     foreach (Card card in cardsToSell)
     {
         if (earnedGold >= desiredGold)
         {
             this.logger.Add(string.Format("Earned {0} gold", earnedGold), LogType.Information);
             break;
         }
         this.cards = string.Join<int>(",", Enumerable.Repeat<int>(card.gid, 2000).ToList<int>());
         SellCardsResponse result = this.ExecuteSerialize<SellCardsResponse>();
         if (result.success)
         {
             earnedGold += result.addGold;
             this.logger.Add(string.Format("Earned {0} gold", earnedGold), LogType.Information);
         }
     }
     this.logger.Add("Exit from earn gold.", LogType.Information);
     return false;
 }
Пример #2
0
 public bool SellAllPoorCards()
 {
     List<int> excludeIds = new List<int>
     {
         1001,
         1002,
         1003
     };
     GetCardsService getCardsService = new GetCardsService(this.user, this.logger);
     GetCardsResponse getCardsResponse = getCardsService.ExecuteSerialize<GetCardsResponse>();
     List<Card> cardsToSell = (from x in getCardsResponse.cards
     where x.star < 4 && x.level == 1 && x.cost < 20 && !excludeIds.Contains(x.id)
     orderby x.id
     select x).ToList<Card>();
     this.cards = string.Join<int>(",", from x in cardsToSell
     select x.gid);
     SellCardsResponse result = this.ExecuteSerialize<SellCardsResponse>();
     if (result.success)
     {
         this.logger.Add(string.Format("Sold all poor cards and earned {0} gold", result.addGold), LogType.Information);
     }
     this.logger.Add("Exit from sell all poor cards", LogType.Information);
     return false;
 }