private bool SowPlot(GardenInfo garden, SeedInfo seed, PlotInfo plot) { SetMessage(" 尝试播种" + seed.Name + "..."); HH.DelayedTime = Constants.DELAY_2SECONDS; string content = HH.Post("http://www.kaixin001.com/house/garden/farmseed.php", string.Format("fuid=0&farmnum={0}&verify={1}&seedid={2}&r=0%2E012194405309855938", plot.FarmNum, this._verifyCode, seed.SeedId)); if (GetFarmFeedback(content)) { //人参 if (seed.SeedId == 21) garden.PanaxCount++; //人参(有人参娃娃) if (seed.SeedId == 25) garden.PanaxBabyCount++; seed.Num--; return true; } else { if (content.Contains("该种子最多同时可种")) seed.Valid = false; return false; } }
public static GardenInfo GetGarden(string strxml) { try { if (String.IsNullOrEmpty(strxml)) return null; XmlDocument objXmlDoc = new XmlDocument(); objXmlDoc.LoadXml(strxml); if (objXmlDoc == null) return null; GardenInfo garden = new GardenInfo(); //garden XmlNode objNode = objXmlDoc.SelectSingleNode(Constants.GARDEN_ROOT + Constants.CHAR_SLASH + Constants.GARDEN_ACCOUNT); if (objNode == null) return null; garden.Rank = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.GARDEN_RANK).InnerText); garden.RankTip = objNode.SelectSingleNode(Constants.GARDEN_RANKTIP).InnerText; garden.Name = objNode.SelectSingleNode(Constants.GARDEN_NAME).InnerText; garden.CashTip = objNode.SelectSingleNode(Constants.GARDEN_CASHTIP).InnerText; garden.Cash = GetCash(garden.CashTip); garden.TCharms = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.GARDEN_TCHARMS).InnerText); if (objNode.SelectSingleNode(Constants.GARDEN_CAREURL) == null) garden.HasMonitor = false; else if (!String.IsNullOrEmpty(objNode.SelectSingleNode(Constants.GARDEN_CAREURL).InnerText)) garden.HasMonitor = true; else garden.HasMonitor = false; //plots DataView dv = GetData(objXmlDoc, Constants.GARDEN_ROOT + Constants.CHAR_SLASH + Constants.GARDEN_GARDEN); Collection<PlotInfo> plots = new Collection<PlotInfo>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { PlotInfo plot = new PlotInfo(); plot.Water = DataConvert.GetInt32(dv.Table.Rows[ix]["water"]); plot.FarmNum = DataConvert.GetInt32(dv.Table.Rows[ix]["farmnum"]); plot.Vermin = DataConvert.GetInt32(dv.Table.Rows[ix]["vermin"]); plot.CropsId = DataConvert.GetInt64(dv.Table.Rows[ix]["cropsid"]); plot.Fuid = DataConvert.GetInt32(dv.Table.Rows[ix]["fuid"]); plot.Status = DataConvert.GetInt32(dv.Table.Rows[ix]["status"]); plot.Grass = DataConvert.GetInt32(dv.Table.Rows[ix]["grass"]); plot.Shared = DataConvert.GetInt32(dv.Table.Rows[ix]["shared"]); if (dv.Table.Columns.Contains("cropsstatus")) plot.CropsStatus = DataConvert.GetInt32(dv.Table.Rows[ix]["cropsstatus"]); else plot.CropsStatus = -2; if (dv.Table.Columns.Contains("seedid")) plot.SeedId = DataConvert.GetInt32(dv.Table.Rows[ix]["seedid"]); else plot.SeedId = 0; if (dv.Table.Columns.Contains("crops")) plot.Crops = JsonHelper.FiltrateHtmlTags(dv.Table.Rows[ix]["crops"].ToString()); else plot.Crops = ""; if (dv.Table.Columns.Contains("farm")) plot.Farm = JsonHelper.FiltrateHtmlTags(dv.Table.Rows[ix]["farm"].ToString()); else plot.Farm = ""; plots.Add(plot); } garden.Plots = plots; return garden; } catch (Exception ex) { LogHelper.Write("ConfigCtrl.GetGarden", strxml, ex, LogSeverity.Error); return null; } }
private bool SowSharedPlot(string fuid, SeedInfo seed, PlotInfo plot, ref string content) { SetMessage(" 尝试播种" + seed.Name + "..."); HH.DelayedTime = Constants.DELAY_2SECONDS; content = HH.Get(string.Format("http://www.kaixin001.com/house/garden/farmseed.php?verify={0}&seedid={1}&r=0%2E1429477329365909&fuid={2}&farmnum={3}", this._verifyCode, seed.SeedId, fuid, plot.FarmNum)); if (GetFarmFeedback(content)) { seed.Num--; return true; } else { if (content.Contains("该种子最多同时可种")) seed.Valid = false; return false; } }