public static Collection<FishMaturedInfo> GetMyWarehouseDetailFish(string strxml) { try { XmlDocument objXmlDoc = new XmlDocument(); objXmlDoc.LoadXml(strxml); if (objXmlDoc == null) return null; DataView dv = GetData(objXmlDoc, "data/fish"); Collection<FishMaturedInfo> fishes = new Collection<FishMaturedInfo>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { FishMaturedInfo fish = new FishMaturedInfo(); fish.UId = DataConvert.GetInt32(dv.Table.Rows[ix]["uid"]); fish.FId = DataConvert.GetInt32(dv.Table.Rows[ix]["fid"]); fish.Weight = DataConvert.GetDecimal(dv.Table.Rows[ix]["weight"]) / 10; fishes.Add(fish); } return fishes; } catch (Exception ex) { LogHelper.Write("ConfigCtrl.GetMyWarehouseDetailFish", strxml, ex, LogSeverity.Error); return null; } }
public static Collection<FishMaturedInfo> GetFishMaturedInMarket() { try { XmlDocument objXmlDoc = GetMasterDataFile(Constants.FILE_FISHMATUREDMASTERDATA); if (objXmlDoc == null) return null; DataView dv = GetData(objXmlDoc, "data/fishmatured"); Collection<FishMaturedInfo> fishmatureds = new Collection<FishMaturedInfo>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { FishMaturedInfo fishmatured = new FishMaturedInfo(); fishmatured.FId = DataConvert.GetInt32(dv.Table.Rows[ix]["fid"]); fishmatured.Name = DataConvert.GetString(dv.Table.Rows[ix]["name"]); fishmatured.Price = DataConvert.GetDecimal(dv.Table.Rows[ix]["price"]); fishmatured.Weight = DataConvert.GetDecimal(dv.Table.Rows[ix]["weight"]); fishmatured.MaxWeight = DataConvert.GetDecimal(dv.Table.Rows[ix]["maxweight"]); fishmatureds.Add(fishmatured); } return fishmatureds; } catch (Exception ex) { LogHelper.Write("ConfigCtrl.GetFishFrysInShop", ex); return null; } }
private bool PresentTheFish(FishMaturedInfo fish, ref int num) { if (fish.TNnum == 0) return false; SetMessageLn(string.Format("#{0} ", ++num)); if (fish.Price == 0) { SetMessage(string.Format(" 未知鱼:{0}({1},{2},{3}),跳过", fish, fish.FId, fish.Weight, fish.MaxWeight)); LogHelper.Write(CurrentAccount.UserName, string.Format(" 未知鱼:{0}({1},{2},{3})", fish.Name, fish.FId, fish.Weight, fish.MaxWeight), LogSeverity.Warn); return false; } if (Task.PresentFishForbiddenList.Contains(fish.FId)) { SetMessage(" 在禁止赠送列表中,跳过"); return false; } decimal currentvalue = fish.MaxWeight * fish.Price; SetMessage(string.Format("{0} 当前重量:{1} * 市场价:{2} = {3}元", fish.Name, fish.MaxWeight, fish.Price, currentvalue)); if (Task.PresentFishCheckValue) { if (currentvalue < DataConvert.GetDecimal(Task.PresentFishValue)) { SetMessage(string.Format(" < {0}元,跳过", Task.PresentFishValue)); return false; } } //确认重量是否正确 string 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); FishMaturedInfo detailFish = detailFishes[detailFishes.Count - 1]; if (Task.PresentFishCheckValue) { if (currentvalue < DataConvert.GetDecimal(Task.PresentFishValue)) { currentvalue = detailFish.Weight * fish.Price; SetMessage(string.Format("{0} 当前重量:{1} * 市场价:{2} = {3}元", fish.Name, detailFish.Weight, fish.Price, currentvalue)); SetMessage(string.Format(" < {0}元,跳过", Task.PresentFishValue)); return false; } } //HH.DelayedTime = Constants.DELAY_1SECONDS; //string content = HH.Post("http://www.kaixin001.com/!fish/!granaryinfo.php", string.Format("verify={0}&fid={1}&r=0%2E3697885484434664", this._verifyCode, fishfry.FId)); //string name = JsonHelper.GetMid(content, "<name>", "</name>"); SetMessage(string.Format(" 尝试向{0}赠送1条{1}...", base.GetFriendNameById(Operation.PresentFishId), fish.Name)); HH.DelayedTime = Constants.DELAY_1SECONDS; content = HH.Post("http://www.kaixin001.com/!fish/!present.php", string.Format("verify={0}&anony=0&fid={1}&fuid={2}&pmsg={3}&r=0%2E15355860581621528", this._verifyCode, fish.FId, Operation.PresentFishId, DataConvert.GetEncodeData("送你鱼啦!"))); GetPresentFishFeedback(content); return true; }