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; } }
private void BuyFish(PondInfo pond) { //购买鱼苗 SetMessageLn("购买鱼苗..."); if (pond.BuyableCapacity <= 0) { SetMessage(string.Format("你的鱼塘已经养满鱼了:{0}", pond.Fish)); return; } if (pond.Fishs.Count >= Task.MaxFishes) { SetMessage(string.Format("你的鱼塘已经有{0}条鱼了,跳过", pond.Fishs.Count)); return; } _iscontainfish39 = false; int count = pond.Fishs.Count; if (Task.BuyFishByRank) { Collection<FishFryInfo> rankFishs = SortFishFrysListByRank(this._fishFrysList); _canbuyfish = true; for (int ix = 0; ix < pond.BuyableCapacity; ix++) { try { FishFryInfo fishfry = GetFishFryByRank(rankFishs, pond); if (fishfry != null) { SetMessageLn(string.Format("#{0}购买1条{1}:", ix + 1, fishfry.Name)); HH.DelayedTime = Constants.DELAY_2SECONDS; //http://www.kaixin001.com/!fish/!buyfish.php //id=4&verify=2588258%5F1106%5F2588258%5F1258863064%5F0c75cf807573b8a53eab8e77c8810a6a&fuid=0&r=0%2E18200292345136404 string content = HH.Post("http://www.kaixin001.com/!fish/!buyfish.php", string.Format("id={0}&verify={1}&fuid=0&r=0%2E18200292345136404", fishfry.FId, DataConvert.GetEncodeData(this._verifyCode))); if (GetBuyFishFeedback(content)) { if (fishfry.FId == 39) _iscontainfish39 = true; count++; if (count >= Task.MaxFishes) { SetMessageLn(string.Format("你的鱼塘已经有{0}条鱼了,跳过", count)); return; } } if (!_canbuyfish) break; } } catch (Exception ex) { LogHelper.Write("GameFish.BuyFish(BuyFishByRank)", ex, LogSeverity.Error); continue; } } } else { _canbuyfish = true; for (int ix = 0; ix < pond.BuyableCapacity; ix++) { try { SetMessageLn(string.Format("#{0}购买1条{1}:", ix + 1, GetFishNameById(Task.BuyFishFishId))); HH.DelayedTime = Constants.DELAY_2SECONDS; //http://www.kaixin001.com/!fish/!buyfish.php //id=4&verify=2588258%5F1106%5F2588258%5F1258863064%5F0c75cf807573b8a53eab8e77c8810a6a&fuid=0&r=0%2E18200292345136404 string content = HH.Post("http://www.kaixin001.com/!fish/!buyfish.php", string.Format("id={0}&verify={1}&fuid=0&r=0%2E18200292345136404", Task.BuyFishFishId, DataConvert.GetEncodeData(this._verifyCode))); if (GetBuyFishFeedback(content)) { count++; if (count >= Task.MaxFishes) { SetMessageLn(string.Format("你的鱼塘已经有{0}条鱼了,跳过", count)); return; } } if (!_canbuyfish) break; } catch (Exception ex) { LogHelper.Write("GameFish.BuyFish(BuyFishFishId)", ex, LogSeverity.Error); continue; } } } }
private void BuyFishTackles(PondInfo pond) { SetMessageLn("购买/升级鱼竿:"); //我的鱼竿 string content = RequestMyTacklesList(); Collection<FishTackleInfo> myTackcles = ConfigCtrl.GetMyTackles(content); Collection<FishTackleInfo> rankTackles = SortFishTacklesListByRank(this._fishTacklesList); _canbuyfish = true; _canupdatefish = true; int count = GetMyTackleCount(myTackcles); for (int ix = 0; ix < myTackcles.Count; ix++) { try { if (myTackcles[ix].Status == 1) { SetMessageLn(string.Format("#{0} {1}...", ix + 1, myTackcles[ix].Title)); // FishTackleInfo fishtackle = GetFishTackleByRank(rankTackles, pond.Rank); if (fishtackle != null) { if (fishtackle.TId != myTackcles[ix].TId) { SetMessage(string.Format(" 尝试升级为{0},", fishtackle.Name)); HH.DelayedTime = Constants.DELAY_5SECONDS; content = HH.Post("http://www.kaixin001.com/!fish/!chgtackle.php", string.Format("verify={0}&oldid={1}&tid={2}&r=0%2E16443684557452798", DataConvert.GetEncodeData(this._verifyCode), myTackcles[ix].TackleId, fishtackle.TId)); GetUpdateFishTackleFeedback(content); if (!_canupdatefish) break; } } } else if (myTackcles[ix].Status == 0) { FishTackleInfo fishtackle = GetFishTackleByRank(rankTackles, pond.Rank); if (fishtackle != null) { SetMessageLn(string.Format("#{0} 购买1根{1}", ix + 1, fishtackle.Name)); if (count >= Task.MaxTackles) { SetMessage(string.Format(" 已经有{0}根鱼竿了,跳过", count)); continue; } HH.DelayedTime = Constants.DELAY_2SECONDS; //http://www.kaixin001.com/!fish/!buyfish.php //id=4&verify=2588258%5F1106%5F2588258%5F1258863064%5F0c75cf807573b8a53eab8e77c8810a6a&fuid=0&r=0%2E18200292345136404 content = HH.Post("http://www.kaixin001.com/!fish/!buyfishtackle.php", string.Format("id={0}&verify={1}&fuid=0&r=0%2E9835843918845057", fishtackle.TId, DataConvert.GetEncodeData(this._verifyCode))); if (GetBuyFishTackleFeedback(content)) count++; if (!_canbuyfish) break; } } } catch (Exception ex) { LogHelper.Write("GameFish.BuyFishTackles", ex, LogSeverity.Error); continue; } } }
private void TreatFish(PondInfo pond) { try { SetMessageLn("开始治病..."); if (string.IsNullOrEmpty(pond.SickTips)) { SetMessage("鱼塘很健康,不需要治病"); return; } string content = HH.Post("http://www.kaixin001.com/!fish/!treatfish.php", string.Format("verify={0}&r=0%2E12005394231528044", DataConvert.GetEncodeData(this._verifyCode))); GetTreatFishFeedback(content); } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameFish.TreatFish", ex, LogSeverity.Error); SetMessage("治病失败!错误:" + ex.Message); } }
private void BangKeJing(PondInfo pond) { try { //千年蚌精 //<producturl>http://img.kaixin001.com.cn/swf/fish/fish/zhenzhubang_product-1.swf</producturl> //<producturl></producturl> //http://www.kaixin001.com/!fish/!pearlproduct.php //fishid=6856442152&r=0%2E646392990835011&verify=6209767%5F1106%5F6209767%5F1267622827%5Fbc341173c5d3323c5d99c8798a8901df //<data><msg>她感激地流下了泪水,千年蚌精,滴泪成珠。<br>你获得珍珠一颗已放入你的仓库。</msg></data> SetMessageLn("开始给千年蚌精输真气..."); if (!pond.BangKeJing) { SetMessage("不需要,跳过。"); return; } string content = HH.Post("http://www.kaixin001.com/!fish/!pearlproduct.php", string.Format("fishid={0}&r=0%2E646392990835011&verify={1}", pond.BangKeJingFishId, DataConvert.GetEncodeData(this._verifyCode))); SetMessage(JsonHelper.FiltrateHtmlTags(JsonHelper.GetMid(content, "<msg>", "</msg>"))); } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameFish.BangKeJing", ex, LogSeverity.Error); SetMessage("给千年蚌精输真气失败!错误:" + ex.Message); } }
private bool ContainsFish39(PondInfo pond) { //鱼塘只能养1个珍珠蚌 foreach (FishInfo fish in pond.Fishs) { if (fish.Tips.Contains("珍珠蚌")) { _iscontainfish39 = true; return true; } } return false; }
private void Shake(PondInfo pond) { //<data> // <shake> // <item> // <skey>tools-monster</skey> // <pic>http://img.kaixin001.com.cn/i3/fish/tools/dj_monster.swf</pic> // </item> // <item> // <skey>tools-fisherman</skey> // <pic>http://img.kaixin001.com.cn/i3/fish/tools/dj_fisherman.swf</pic> // </item> // <item> // <skey>tools-food</skey> // <pic>http://img.kaixin001.com.cn/i3/fish/tools/dj_food2.swf</pic> // </item> // <item> // <skey>fish-luopao</skey> // <pic>http://img.kaixin001.com.cn/i3/fish/fish2/dingziluopao.swf</pic> // </item> // <item> // <skey>wishs</skey> // <pic> // </pic> // </item> // <item> // <skey>again</skey> // <pic> // </pic> // </item> // </shake> //</data> try { SetMessageLn("开始转盘..."); if (!pond.Shakable) { SetMessage("今天已抽过奖,请明天再来。"); return; } string content = HH.Post("http://www.kaixin001.com/!fish/!shake.php", string.Format("verify={0}&r=0%2E1539040575735271", DataConvert.GetEncodeData(this._verifyCode))); content = HH.Post("http://www.kaixin001.com/!fish/!myshake.php", string.Format("verify={0}&r=0%2E6482421010732651", DataConvert.GetEncodeData(this._verifyCode))); GetShakeFeedback(content); } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameFish.Shake", ex, LogSeverity.Error); SetMessage("转盘失败!错误:" + ex.Message); } }
private FishFryInfo GetFishFryByRank(Collection<FishFryInfo> fishfrys, PondInfo pond) { for (int ix = fishfrys.Count - 1; ix >= 0; ix--) { if (fishfrys[ix].Rank <= pond.Rank) { if (fishfrys[ix].FId == 39 && (_iscontainfish39 || ContainsFish39(pond))) return fishfrys[ix - 1]; else return fishfrys[ix]; } } return null; }
private void SellFish(PondInfo pond) { try { SetMessageLn("开始出售鱼..."); if (Task.SellFishLowCash) { if (pond.Cash > Task.SellFishLowCashLimit * 10000) { SetMessageLn(string.Format("还有{0}元现金,无须出售。", pond.Cash)); return; } } if (Task.SellAllFish) { string content = HH.Post("http://www.kaixin001.com/!fish/!sellall.php", string.Format("fuid=0&r=0%2E575820348225534&verify={0}", DataConvert.GetEncodeData(this._verifyCode))); long fishvalue = 0; GetSellFishFeedback(content, ref fishvalue); } else { string content = RequestMyWarehouse(); Collection<FishMaturedInfo> fishes = ConfigCtrl.GetMyWarehouseFish(content); if (fishes == null || fishes.Count == 0) { SetMessage("仓库里没有任何鱼"); return; } //计算价值 long soldvalue = 0; long fishvalue = 0; StringBuilder sb; fishes = RebuildFishMaturedList(fishes); int num = 0; foreach (FishMaturedInfo fish in fishes) { if (fish.TNnum == 0) continue; fishvalue = 0; if (soldvalue >= Task.SellFishMaxLimit * 10000) { SetMessageLn(string.Format("已出售的鱼总价值已经超过{0}万,停止出售。", Task.SellFishMaxLimit)); break; } SetMessageLn(string.Format("#{0} {1} ", ++num, fish.Name)); if (Task.SellFishForbiddenList.Contains(fish.FId)) { SetMessage("在出售的禁止列表中,跳过"); continue; } if (fish.Price <= 0) { SetMessage(string.Format("未知鱼{0},跳过", fish.FId)); continue; } content = HH.Post("http://www.kaixin001.com/!fish/!granaryinfo.php", string.Format("verify={0}&fid={1}&r=0%2E3951922911219299", DataConvert.GetEncodeData(this._verifyCode), fish.FId)); Collection<FishMaturedInfo> detailFishes = ConfigCtrl.GetMyWarehouseDetailFish(content); sb = new StringBuilder(); foreach (FishMaturedInfo detailfish in detailFishes) { if (Task.SellFishCheckValue) { if (detailfish.Weight * fish.Price >= Task.SellFishValue) { SetMessage(string.Format("{0} 当前重量:{1} * 市场价:{2} = {3} >= {4},跳过", fish.Name, detailfish.Weight, fish.Price, detailfish.Weight * fish.Price, Task.SellFishValue)); continue; } } sb.Append(";"); sb.Append(detailfish.Weight * 10); sb.Append("-1"); } if (String.IsNullOrEmpty(sb.ToString())) continue; //SetMessageLn("参数:" + sb.ToString()); content = HH.Post("http://www.kaixin001.com/!fish/!sellfish.php", string.Format("id={0}&verify={1}&odata={2}&fuid=0&r=0%2E5109372432343662", fish.FId, DataConvert.GetEncodeData(this._verifyCode), DataConvert.GetEncodeData(sb.ToString()))); //;200-1;34-1 //id=66&verify=2588258%5F1106%5F2588258%5F1267708811%5Fa0faefb9bbe15b24da6c02058e2c8993&odata=%3B200%2D1%3B34%2D1&fuid=0&r=0%2E5109372432343662 if (GetSellFishFeedback(content, ref fishvalue)) { soldvalue += fishvalue; SetMessage(string.Format(" 已出售的鱼总价值:{0}元", soldvalue)); } } } } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameGarden.SellFruit", ex, LogSeverity.Error); SetMessage("出售果实失败!错误:" + ex.Message); } }
private void NetSelfFish(PondInfo pond) { try { SetMessageLn("开始自家收鱼..."); if (!pond.Netable) { SetMessage(pond.NnetFishTips); return; } int num = 0; int num2 = 0; if (Task.NetSelfFishCheap) { for (int ix = 0; ix < pond.Fishs.Count; ix++) { if (NetTheFish(pond.Fishs[ix], ++num2)) num++; if (num >= 2) break; } } else { for (int ix = pond.Fishs.Count - 1; ix >= 0; ix--) { if (NetTheFish(pond.Fishs[ix], ++num2)) num++; if (num >= 2) break; } } } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameFish.NetSelfFish", ex, LogSeverity.Error); SetMessage("自家收鱼失败!错误:" + ex.Message); } }
private Collection<int> GetValidPondPos(PondInfo pond) { if (pond.Fishers.Count == 4) return new Collection<int>(); Collection<int> poses = new Collection<int>(); poses.Add(1); poses.Add(2); poses.Add(3); poses.Add(4); foreach (FisherInfo fisher in pond.Fishers) { poses.Remove(fisher.Pos); } return poses; }
private void FishingPonds(PondInfo pond) { try { int num = 0; SetMessageLn("开始去好友的鱼塘钓鱼..."); bool canfish = false; string content = RequestMyTacklesList(); Collection<FishTackleInfo> myTackcles = ConfigCtrl.GetMyTackles(content); foreach (FishTackleInfo fishtackle in myTackcles) { if (fishtackle.Status == 1 && fishtackle.BUse == 0) { canfish = true; } } if (!canfish) return; //先去白名单中的鱼塘钓鱼 SetMessageLn("开始去白名单中好友的鱼塘钓鱼:"); foreach (int uid in Operation.FishingWhiteList) { try { SetMessageLn(string.Format("#{0}{1}", ++num, base.GetFriendNameById(uid)) + "=>"); FriendInfo friend = GetFishFriendById(uid); if (friend == null) { SetMessage("没什么可钓的,跳过"); continue; } if (Operation.FishingBlackList.Contains(uid)) { SetMessage(base.GetFriendNameById(uid) + "在钓鱼黑名单中,跳过"); continue; } FishingThePond(uid.ToString(), friend); if (!_canfish) break; } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameFish.FishingPonds", GetFriendNameById(uid), ex, LogSeverity.Error); continue; } } if (Task.Fishing && Operation.FishingAll) { //其他好友 num = 0; SetMessageLn("开始去其他好友的鱼塘钓鱼:"); foreach (FriendInfo friend in this._allFishFriendsList) { try { if (Operation.FishingWhiteList.Contains(friend.Id) || friend.Id.ToString() == CurrentAccount.UserId) continue; SetMessageLn(string.Format("#{0}{1}", ++num, friend.Name + "=>")); if (Operation.FishingBlackList.Contains(friend.Id)) { SetMessage(friend.Name + "在钓鱼黑名单中,跳过"); continue; } FishingThePond(friend.Id.ToString(), friend); if (!_canfish) break; } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameFish.FishingPonds", friend.Name, ex, LogSeverity.Error); continue; } } } } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameFish.FishingPonds", ex, LogSeverity.Error); } }