예제 #1
0
 private void MatureListPick()
 {
     long sec = TimeFormat.FormatTime(DateTime.Now);
     if (_matureList.Count == 0)
     {
         MessageBox.Show("请先获取成熟列表");
     }
     else
     {
         Mature temp = new Mature();
         string result = "";
         for (int i = 0; i < _matureList.Count; i++)
         {
             temp = _matureList[i];
             if (temp.cTime <= sec)
             {
                 //判断是否已经摘完
                 //判断是否为空
                 //判断是否已经摘取过
                 if (!_autoSteal || temp.cStatus.Equals("无") || temp.cStatus.Equals("已枯萎") || temp.cStatus.Equals("已摘完") || regexMature.IsMatch(temp.cStatus) || temp.cStatus.Equals("已摘取"))
                 {
                     continue;
                 }//_autoSteal 自动偷
                 else
                 {
                     result = Steal(temp.userId, temp.place.ToString());
                     DoResult doResultItem = new DoResult(result);
                     if (result.Contains("\"farmlandIndex\":" + temp.place.ToString() + ",\"harvest\":"))
                     {
                         toLog("摘取" + temp.userName + "的农场的第" + temp.place.ToString() + "号地" + temp.cName + "共" + doResultItem.harvest + "个");
                         saveAch(0, 0, 0, temp.cId, doResultItem.harvest);
                     }
                     else
                     {
                         toLog("摘取" + temp.userName + "的农场的第" + temp.place.ToString() + "号地" + temp.cName + "失败");
                     }
                     _matureList.RemoveAt(i);
                     i--;
                 }
             }
             else
             {
                 break;
             }
         }
     }
 }
예제 #2
0
        private void LandHarvest(string userId, JsonObject theFarmStatus)
        {
            string cropStatus = "";
            string result = "";
            User friendInfo = new User(GetUserModel(userId));
            string dogId = "";
            string isHungry = "";
            dogId = dogJson.GetValue("dogId");
            isHungry = dogJson.GetValue("isHungry");
            if (!userId.Equals(""))
            {
                if (userId.Equals(uIdx))
                {
                    for (int i = 0; i < theFarmStatus.GetCollection().Count; i++)
                    {
                        Land newLand = new Land(theFarmStatus.GetCollection()[i]);
                        bool landDogFlag = true; //true表示可偷,false表示不可偷
                        //自己的地尽管偷
                        //无狗 无狗粮
                       /*
                        if (_autoDog)
                        {
                            landDogFlag = (dogId.Equals("0") || isHungry.Equals("1"));
                            toLog(friendInfo.userName + "的农场有狗,不偷");
                        }*/
                        if (landDogFlag)
                        {
                            GetCropStatus(out cropStatus, newLand);
                            if (cropStatus.Equals("无") || cropStatus.Equals("已枯萎") || regexMature.IsMatch(cropStatus) || cropStatus.Equals("已摘取"))
                            {
                            }
                            else
                            {
                                result = Harvest(userId, i.ToString());
                                DoResult doResultItem = new DoResult(result);
                                if (result.Contains("\"farmlandIndex\":" + i.ToString() + ",\"harvest\":"))
                                {
                                    toLog("收获" + friendInfo.userName + "的农场的第" + i.ToString() + "号地的"
                                        + new CropItem(GetCropModel(newLand.a)).cName + "一共" + doResultItem.harvest + "个");

                                    saveAch(0, 0, 0, newLand.a, doResultItem.harvest);
                                }
                                else
                                {
                                    toLog("收获" + friendInfo.userName + "的农场的第" + i.ToString() + "号地失败");
                                }

                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < theFarmStatus.GetCollection().Count; i++)
                    {
                        Land newLand = new Land(theFarmStatus.GetCollection()[i]);
                        bool landDogFlag = true; //true表示可偷,false表示不可偷
                        //无狗 无狗粮
                        if (_autoDog)
                        {
                            landDogFlag = (dogId.Equals("0") || isHungry.Equals("1"));
                            toLog(friendInfo.userName + "的农场有狗,不偷");
                        }
                        if (landDogFlag)
                        {
                            GetCropStatus(out cropStatus, newLand);
                            if (cropStatus.Equals("无") || cropStatus.Equals("已枯萎") || regexMature.IsMatch(cropStatus) || cropStatus.Equals("已摘取"))
                            {
                            }
                            else
                            {
                                result = Steal(userId, i.ToString());
                                DoResult doResultItem = new DoResult(result);
                                if (result.Contains("\"farmlandIndex\":" + i.ToString() + ",\"harvest\":"))
                                {
                                    toLog("摘取" + friendInfo.userName + "的农场的第" + i.ToString() + "号地的"
                                        + new CropItem(GetCropModel(newLand.a)).cName + "一共" + doResultItem.harvest + "个");

                                    saveAch(0, 0, 0, newLand.a, doResultItem.harvest);
                                }
                                else
                                {
                                    toLog("摘取" + friendInfo.userName + "的农场的第" + i.ToString() + "号地失败");
                                }
                            }
                        }
                    }
                }
            }
        }