Exemplo n.º 1
0
 public bool Action()
 {
     bool move = true;
     int errorCount = 0;
     while (move)
     {
         try
         {
             UpdateSeedResponse updateSeedResponse = new UpdateSeedService(this.user, this.logger).ExecuteSerialize<UpdateSeedResponse>();
             if (updateSeedResponse == null || updateSeedResponse.playerInfo.curBP < updateSeedResponse.playerInfo.totalCost)
             {
                 this.logger.Add("Exit from boss.", LogType.Information);
                 break;
             }
             this.logger.Add("Initial energy: " + updateSeedResponse.playerInfo.curBP, LogType.Information);
             new EnterToCityService(this.user, this.logger).Execute();
             PveGetVsInfoResponse info = new PveGetVsInfoService(this.user, this.logger).ExecuteSerialize<PveGetVsInfoResponse>();
             if (info != null && info.success)
             {
                 errorCount = 0;
                 if (info.playerInfo.curBP > info.playerInfo.totalCost)
                 {
                     List<PveBattleResponse> battleResults = this.ExecuteSerialize<PveBattleResponse>(3);
                     if (battleResults.All((PveBattleResponse x) => !x.success))
                     {
                         this.logger.Add("All battles failed.", LogType.Information);
                     }
                     this.logger.Add(string.Format("Success {0}, failed {1}. Current mana {2}.", battleResults.Count((PveBattleResponse x) => x.success), battleResults.Count((PveBattleResponse x) => !x.success), (from x in battleResults
                     where x.success
                     select x).Min((PveBattleResponse x) => x.playerInfo.curBP)), LogType.Information);
                 }
                 else
                 {
                     move = false;
                     this.logger.Add("Not enough mana: " + info.playerInfo.curBP, LogType.Information);
                 }
             }
             else
             {
                 errorCount++;
                 this.logger.Add("Boss info was not received", LogType.Information);
             }
         }
         catch (Exception e)
         {
             errorCount++;
             this.logger.Add(e.Message, LogType.Information);
         }
         if (errorCount > 3)
         {
             break;
         }
     }
     return false;
 }
Exemplo n.º 2
0
 public bool Action()
 {
     int errorCount = 0;
     bool reuslt = false;
     do
     {
         try
         {
             UpdateSeedResponse updateSeedResponse = new UpdateSeedService(this.user, this.logger).ExecuteSerialize<UpdateSeedResponse>();
             if (updateSeedResponse == null || updateSeedResponse.playerInfo.curAP < 4)
             {
                 this.logger.Add("Exit from quest.", LogType.Information);
                 break;
             }
             this.logger.Add("Initial energy: " + updateSeedResponse.playerInfo.curAP, LogType.Information);
             List<QuestMoveResponse> questResults = this.ExecuteSerialize<QuestMoveResponse>(10);
             this.logger.Add(string.Format("Success {0}, failed {1} requests, min energy {2}.", questResults.Count((QuestMoveResponse x) => x.success), questResults.Count((QuestMoveResponse x) => !x.success), (from x in questResults
             where x.success
             select x).Min((QuestMoveResponse x) => x.playerInfo.curAP)), LogType.Information);
             if (questResults.All((QuestMoveResponse x) => !x.success))
             {
                 this.logger.Add("All requests filed.", LogType.Information);
                 break;
             }
             QuestMoveResponse minCurBpResponse = (from x in questResults
             where x.success
             orderby x.playerInfo.curBP
             select x).FirstOrDefault<QuestMoveResponse>();
             if (minCurBpResponse != null && minCurBpResponse.playerInfo.curBP >= minCurBpResponse.playerInfo.maxBP - 30)
             {
                 reuslt = true;
                 break;
             }
             if (questResults.All((QuestMoveResponse x) => x.success))
             {
                 continue;
             }
         }
         catch (Exception e)
         {
             errorCount++;
             this.logger.Add(e.Message, LogType.Information);
         }
     }
     while (errorCount <= 3);
     return reuslt;
 }
Exemplo n.º 3
0
 public bool Action()
 {
     GetGuildBossResponse getGuildBossResponse = this.ExecuteSerialize<GetGuildBossResponse>();
     GuildBoss boss = getGuildBossResponse.bosses.FirstOrDefault((GuildBoss x) => x.status > 0);
     bool result;
     if (boss == null)
     {
         this.logger.Add("Can't find active battle with boss", LogType.Information);
         result = false;
     }
     else
     {
         int battleId = boss.bossId;
         int errorCount = 0;
         int count = 0;
         ViewGuildBossResponse viewGuildBossResponse = new ViewGuildBossService(this.user, this.logger, (long)battleId).ExecuteSerialize<ViewGuildBossResponse>();
         int childId = 1;
         do
         {
             try
             {
                 UpdateSeedResponse updateSeed = new UpdateSeedService(this.user, this.logger).ExecuteSerialize<UpdateSeedResponse>();
                 if (updateSeed != null && updateSeed.success)
                 {
                     this.logger.Add("Current count of mana: " + updateSeed.playerInfo.curBP, LogType.Information);
                 }
                 if (updateSeed.playerInfo.totalCost > updateSeed.playerInfo.curBP)
                 {
                     UseItemResponse useItemResponse = new UseItemService(this.user, this.logger, ItemEnum.ManaPotion, "module_guild_boss").ExecuteSerialize<UseItemResponse>();
                     if (!useItemResponse.success)
                     {
                     }
                 }
                 List<BattleGuildBossResponse> battleGuildBossResponses = new BattleGuildBossService(this.user, this.logger, (long)battleId, (long)childId).ExecuteSerialize<BattleGuildBossResponse>(10);
                 if (childId < 4)
                 {
                     childId++;
                 }
                 errorCount = 0;
                 count += battleGuildBossResponses.Count((BattleGuildBossResponse x) => x.success);
                 if (battleGuildBossResponses.Any((BattleGuildBossResponse x) => x.success && x.HP <= 0L))
                 {
                     this.logger.Add("Boss defeated.", LogType.Information);
                     break;
                 }
                 ILogger arg_2B7_0 = this.logger;
                 string arg_2B1_0 = "Current HP: {0}, success: {1}, failed: {2}. Count of battle: {3}.";
                 object[] array = new object[4];
                 array[0] = (from x in battleGuildBossResponses
                 where x.success
                 select x).Min((BattleGuildBossResponse x) => x.HP);
                 array[1] = battleGuildBossResponses.Count((BattleGuildBossResponse x) => x.success);
                 array[2] = battleGuildBossResponses.Count((BattleGuildBossResponse x) => !x.success);
                 array[3] = count;
                 arg_2B7_0.Add(string.Format(arg_2B1_0, array), LogType.Information);
             }
             catch (Exception e)
             {
                 errorCount++;
                 this.logger.Add(e.Message, LogType.Information);
             }
         }
         while (errorCount <= 10);
         result = false;
     }
     return result;
 }