Exemplo n.º 1
0
        public static PondInfo GetPond(string strxml)
        {
            try
            {
                if (String.IsNullOrEmpty(strxml))
                    return null;

                XmlDocument objXmlDoc = new XmlDocument();
                objXmlDoc.LoadXml(strxml);
                if (objXmlDoc == null)
                    return null;

                PondInfo pond = new PondInfo();

                pond.Shakable = DataConvert.GetInt32(objXmlDoc.SelectSingleNode("conf/shake").InnerText) == 1 ? true : false;
                pond.Netable = DataConvert.GetInt32(objXmlDoc.SelectSingleNode("conf/netable").InnerText) == 1 ? true : false;
                pond.SickTips = DataConvert.GetString(objXmlDoc.SelectSingleNode("conf/sicktips").InnerText);
                pond.NnetFishTips = DataConvert.GetString(objXmlDoc.SelectSingleNode("conf/nnetfishtips").InnerText);

                //pond
                XmlNode objNode = objXmlDoc.SelectSingleNode("conf/account");
                if (objNode == null)
                    return null;

                pond.Title = DataConvert.GetString(objNode.SelectSingleNode("title").InnerText);
                pond.Rank = DataConvert.GetInt32(objNode.SelectSingleNode("rank").InnerText.Replace("级", ""));
                pond.RankTip = JsonHelper.FiltrateHtmlTags(DataConvert.GetString(objNode.SelectSingleNode("ranktips").InnerText));                
                pond.CashTips = JsonHelper.FiltrateHtmlTags(DataConvert.GetString(objNode.SelectSingleNode("cashtips").InnerText));
                pond.Cash = DataConvert.GetInt64(JsonHelper.GetMid(pond.CashTips, "现金:", "元"));
                pond.Fish = DataConvert.GetString(objNode.SelectSingleNode("fish").InnerText);
                pond.FishTips = DataConvert.GetString(objNode.SelectSingleNode("fishtips").InnerText);
                
                //fishs
                DataView dv = GetData(objXmlDoc, "conf/fish");

                Collection<FishInfo> fishs = new Collection<FishInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    try
                    {
                        FishInfo fish = new FishInfo();
                        fish.FishId = DataConvert.GetInt64(dv.Table.Rows[ix]["fishid"]);
                        fish.BProduct = DataConvert.GetInt32(dv.Table.Rows[ix]["bproduct"]);
                        fish.Tips = JsonHelper.FiltrateHtmlTags(DataConvert.GetString(dv.Table.Rows[ix]["tips"]));
                        fish.CurrentWeight = DataConvert.GetDecimal(JsonHelper.GetMid(fish.Tips, "当前重", "斤"));
                        fish.MaxWeight = DataConvert.GetDecimal(JsonHelper.GetMid(fish.Tips, "最大", "斤"));
                        fish.ProductUrl = DataConvert.GetString(dv.Table.Rows[ix]["producturl"]);
                        if (fish.Tips.Contains("千年蚌精") && !String.IsNullOrEmpty(fish.ProductUrl))
                        {
                            pond.BangKeJing = true;
                            pond.BangKeJingFishId = fish.FishId;
                        }
                        fishs.Add(fish);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Write("ConfigCtrl.GetPond(Get fish list)", strxml, ex, LogSeverity.Error);
                        continue;
                    }
                }
                pond.Fishs = fishs;

                //fishers
                dv = GetData(objXmlDoc, "conf/fisher");

                Collection<FisherInfo> fishers = new Collection<FisherInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    try
                    {
                        FisherInfo fisher = new FisherInfo();
                        fisher.UId = DataConvert.GetInt32(dv.Table.Rows[ix]["uid"]);
                        fisher.Name = DataConvert.GetString(dv.Table.Rows[ix]["real_name"]);
                        fisher.Pos = DataConvert.GetInt32(dv.Table.Rows[ix]["pos"]);
                        fisher.TackleId = DataConvert.GetInt64(dv.Table.Rows[ix]["tackleid"]);
                        fisher.FStat = DataConvert.GetInt32(dv.Table.Rows[ix]["fstat"]);
                        fisher.BFish = DataConvert.GetInt32(dv.Table.Rows[ix]["bfish"]);
                        fisher.TTitle = JsonHelper.FiltrateHtmlTags(DataConvert.GetString(dv.Table.Rows[ix]["ttitle"]));
                        fishers.Add(fisher);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Write("ConfigCtrl.GetPond(Get fishers)", strxml, ex, LogSeverity.Error);
                        continue;
                    }
                }
                pond.Fishers = fishers;

                return pond;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetPond", strxml, ex, LogSeverity.Error);
                return null;
            }
        }
Exemplo n.º 2
0
        private bool NetTheFish(FishInfo fish, int num)
        {
            SetMessageLn(string.Format("#{0} {1}", num, fish.Tips));
            if (fish.Tips.Contains("千年蚌精"))
            {
                SetMessage(", 跳过");
                return false;
            }
            double weightratio = DataConvert.GetDouble(Math.Round(fish.CurrentWeight / fish.MaxWeight, 3));
            double standardratio = DataConvert.GetDouble(Task.NetSelfFishMature) / 100;
            if (weightratio < standardratio)
            {
                weightratio = Math.Round(weightratio * 100, 0);
                SetMessage(string.Format("当前重量{0}/最大重量{1}={2}% < {3}%,跳过", fish.CurrentWeight, fish.MaxWeight, weightratio, Task.NetSelfFishMature));
                return false;
            }
            else
            {
                string content = HH.Post("http://www.kaixin001.com/!fish/!catchfish.php", string.Format("verify={0}&fishid={1}&fuid=0&r=0%2E4802739913575351", DataConvert.GetEncodeData(this._verifyCode), fish.FishId));
                if (GetNetSelfFishFeedback(content))
                    return true;
                else
                    return false;
            }

        }