private int GuildBattle(int iG, int iS, string SK = "dummy") { int num = -1; Dictionary<string, string> dictionary = new Dictionary<string, string>(); dictionary.Add("", ""); IDictionary<string, string> parameters = dictionary; parameters.Clear(); parameters.Add("guild_id", this.Encrypt(iG.ToString(), this.key12)); parameters.Add("serial_id", this.Encrypt(iS.ToString(), this.key12)); parameters.Add("spp_skill_serial", this.Encrypt(SK, this.key12)); string url = "http://" + this.szhostport + "/connect/app/fairy/guild_fairy_battle?cyt=1"; CookieCollection cookies = new CookieCollection(); Cookie cookie2 = new Cookie("S", this.szCookie) { Domain = this.szhost }; Cookie cookie = cookie2; cookies.Add(cookie); XmlDocument document = null; try { document = this.CreatePostHttpResponse(url, parameters, 0xc350, string.Empty, Encoding.Default, cookies); } catch (Exception) { return num; } this.bWinner = false; if (document != null) { string text; document.Save("guildbattle.xml"); string message = "战斗:"; try { if (((this.iJobID == 0) && (this.itestjob < 9)) && (-2 != this.changejob(this.itestjob))) { this.itestjob++; } this.szCookie = document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("session_id").InnerText; if (int.Parse(document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("error").SelectSingleNode("code").InnerText) != 0) { message = message + document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("error").SelectSingleNode("message").InnerText + "\r\n"; text = this.actionlog.Text; this.actionlog.Text = text + "[" + DateTime.Now.ToString() + "]" + message; this.actionlog.WriteInfo(message); return 0x3e9; } this.dtOld = DateTime.Now; this.bBonus = false; XmlNode node = document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("your_data"); if (node == null) { node = document.SelectSingleNode("response").SelectSingleNode("body"); string name = node.ChildNodes[0].Name; if ((name == "guild_top") || (name == "guild_defeat_event")) { XmlNode node2 = node.SelectSingleNode(name).SelectSingleNode("guild_top_update"); XmlNode node3 = node2.SelectSingleNode("guild_reward_list"); if ((node3 != null) && (name == "guild_top")) { this.bBonus = true; string str5 = ""; switch (int.Parse(node3.SelectSingleNode("reward_box_list").SelectSingleNode("box_type").InnerText)) { case 0x2775: str5 = "白金箱"; break; case 0x2776: str5 = "金箱"; break; case 0x2777: str5 = "银箱"; break; case 0x2778: str5 = "铜箱"; break; case 0x2779: str5 = "木箱"; break; } int num2 = int.Parse(node3.SelectSingleNode("reward_box_list").SelectSingleNode("box_num").InnerText); string str6 = this.actionlog.Text; this.actionlog.Text = str6 + "[" + DateTime.Now.ToString() + "]发现强敌:获得" + str5 + "*" + num2.ToString() + "\r\n"; this.actionlog.WriteInfo("发现强敌:获得" + str5 + "*" + num2.ToString() + "\r\n"); } else if (name == "guild_defeat_event") { node3 = node.SelectSingleNode(name).SelectSingleNode("guild_reward_list"); if (node3.SelectSingleNode("reward_box_list") != null) { string str7 = ""; switch (int.Parse(node3.SelectSingleNode("reward_box_list").SelectSingleNode("box_type").InnerText)) { case 0x2775: str7 = "白金箱"; break; case 0x2776: str7 = "金箱"; break; case 0x2777: str7 = "银箱"; break; case 0x2778: str7 = "铜箱"; break; case 0x2779: str7 = "木箱"; break; } int num3 = int.Parse(node3.SelectSingleNode("reward_box_list").SelectSingleNode("box_num").InnerText); this.actionlog.Text = this.actionlog.Text + ((string.Concat(new object[] { "[", DateTime.Now.ToString(), "]", node3 }) != null) ? ("强敌扑街,获得" + str7 + "*" + num3.ToString() + "\r\n") : "强敌扑街\r\n"); this.actionlog.WriteInfo((node3 != null) ? ("强敌扑街,获得" + str7 + "*" + num3.ToString() + "\r\n") : "强敌扑街\r\n"); this.serial_id = 0; } else { this.actionlog.Text = this.actionlog.Text + "[" + DateTime.Now.ToString() + "]强敌扑街\r\n"; this.actionlog.WriteInfo("强敌扑街\r\n"); } } else { message = message + "新怪\r\n"; this.bBonus = false; } XmlNode node4 = node2.SelectSingleNode("fairy"); XmlNode node5 = node2.SelectSingleNode("guild_fairy_weak"); if ((node5 != null) && this.bAutojob) { int i = int.Parse(node5.SelectSingleNode("id").InnerText); if ((i != this.iJobID) && (-2 != this.changejob(i))) { this.iJobID = i; } } node2.SelectNodes("guild_log"); this.serial_id = int.Parse(node4.SelectSingleNode("serial_id").InnerText); this.lv = int.Parse(node4.SelectSingleNode("lv").InnerText); this.hp = int.Parse(node4.SelectSingleNode("hp").InnerText); this.hp_max = int.Parse(node4.SelectSingleNode("hp_max").InnerText); this.bname = node4.SelectSingleNode("name").InnerText; XmlNode node6 = node2.SelectSingleNode("force_gauge"); if (node6 != null) { int num5 = int.Parse(node6.SelectSingleNode("own").InnerText); int num6 = int.Parse(node6.SelectSingleNode("rival").InnerText); int num7 = int.Parse(node6.SelectSingleNode("total").InnerText); this.dWin = (((double) (num5 - num6)) / ((double) num7)) / 2.0; } this.iGuildID = int.Parse(node4.SelectSingleNode("discoverer_id").InnerText); int num8 = int.Parse(node4.SelectSingleNode("time_limit").InnerText); if (node4.SelectSingleNode("master_boss_id") != null) { num = 0; if ((int.Parse(node4.SelectSingleNode("master_boss_id").InnerText) == this.iSubBossID) && (num8 > 0x1ba8)) { num = 3; } } else if (num8 > 0x1ba8) { num = 3; } if (name == "guild_defeat_event") { this.serial_id = 0; num = 2; } return num; } string str8 = name; switch (str8) { case null: return num; case "guild_fairy_event": return 1; default: if (str8 == "guild_top_no_fairy") { num = 2; this.iSubBossID = int.Parse(node.SelectSingleNode("guild_top_no_fairy").SelectSingleNode("guild_boss").SelectSingleNode("sub_boss_id").InnerText); this.hp = 0; this.serial_id = 0; } return num; } } XmlNode node7 = node.SelectSingleNode("bc"); XmlNodeList list = node.SelectNodes("itemlist"); if (list != null) { foreach (XmlNode node8 in list) { if (int.Parse(node8.SelectSingleNode("item_id").InnerText) == 0xca) { this.iGuildItemCount = int.Parse(node8.SelectSingleNode("num").InnerText); } } } int bC = this.BC; this.BC = int.Parse(node7.SelectSingleNode("current").InnerText); this.MaxBc = int.Parse(node7.SelectSingleNode("max").InnerText); XmlNode node9 = node.SelectSingleNode("ap"); this.AP = int.Parse(node9.SelectSingleNode("current").InnerText); this.MaxAP = int.Parse(node9.SelectSingleNode("max").InnerText); string str9 = message; message = str9 + " BC:" + bC.ToString() + "-" + this.BC.ToString() + " "; this.iContribution = int.Parse(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("own_fairy_battle_result").SelectSingleNode("contribution_info").SelectSingleNode("hp_contribution").InnerText); this.iContribution2 = int.Parse(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("own_fairy_battle_result").SelectSingleNode("contribution_info").SelectSingleNode("battle_contribution").InnerText); this.bWinner = int.Parse(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("own_fairy_battle_result").SelectSingleNode("winner").InnerText) == 1; num = 0; BattleLog item = new BattleLog(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_battle"), this.lv, this.iContribution, this.iContribution2); this.Battles.Add(item); this.listBox1.Items.Add(item); this.listBox1.DisplayMember = "Text"; this.listBox1.ValueMember = "Value"; if (this.bWinner) { message = message + "-战斗胜利-"; } string str10 = message; message = str10 + "贡献:残血" + this.iContribution.ToString() + "战斗" + this.iContribution2.ToString(); XmlNodeList list2 = null; try { list2 = document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("own_fairy_battle_result").SelectNodes("guild_reward_list"); } catch (Exception) { } if (list2 != null) { try { int num10 = int.Parse(list2[0].SelectSingleNode("special_item").SelectSingleNode("before_count").InnerText); int num11 = int.Parse(list2[0].SelectSingleNode("special_item").SelectSingleNode("after_count").InnerText); text = message; string[] strArray = new string[] { text, "收集道具:", (num11 - num10).ToString(), "/", num11.ToString(), "\r\n" }; message = string.Concat(strArray); } catch (Exception) { message = message + "\r\n"; } if (list2.Count > 1) { string str11 = ""; switch (int.Parse(list2[1].SelectSingleNode("reward_box_list").SelectSingleNode("box_type").InnerText)) { case 0x2775: str11 = "白金箱"; break; case 0x2776: str11 = "金箱"; break; case 0x2777: str11 = "银箱"; break; case 0x2778: str11 = "铜箱"; break; case 0x2779: str11 = "木箱"; break; } int num12 = int.Parse(list2[1].SelectSingleNode("reward_box_list").SelectSingleNode("box_num").InnerText); text = message; message = text + "杀死强敌:获得" + str11 + "*" + num12.ToString() + "\r\n"; this.serial_id = 0; } } text = this.actionlog.Text; this.actionlog.Text = text + "[" + DateTime.Now.ToString() + "]" + message; this.actionlog.WriteInfo(message); } catch (Exception exception) { message = message + exception.Message + "\r\n"; text = this.actionlog.Text; this.actionlog.Text = text + "[" + DateTime.Now.ToString() + "]" + message; this.actionlog.WriteInfo(message); } } return num; }
private int guildfairybattle(int iU, int iS) { int num = -1; Dictionary<string, string> dictionary = new Dictionary<string, string>(); dictionary.Add("", ""); IDictionary<string, string> parameters = dictionary; parameters.Clear(); parameters.Add("no", this.Encrypt("0", this.key12)); parameters.Add("serial_id", this.Encrypt(iS.ToString(), this.key12)); parameters.Add("user_id", this.Encrypt(iU.ToString(), this.key12)); string url = "http://" + this.szhostport + "/connect/app/private_fairy/private_fairy_battle?cyt=1"; CookieCollection cookies = new CookieCollection(); Cookie cookie2 = new Cookie("S", this.szCookie) { Domain = this.szhost }; Cookie cookie = cookie2; cookies.Add(cookie); XmlDocument document = null; try { document = this.CreatePostHttpResponse(url, parameters, 0xc350, string.Empty, Encoding.Default, cookies); } catch (Exception) { return num; } this.guildfairytime = DateTime.Now; this.bWinner = false; if (document != null) { document.Save("fairybattle.xml"); string message = "战斗:"; try { this.szCookie = document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("session_id").InnerText; if (int.Parse(document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("error").SelectSingleNode("code").InnerText) != 0) { message = message + document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("error").SelectSingleNode("message").InnerText + "\r\n"; string szActionLog = this.szActionLog; szActionLog = szActionLog + "[" + DateTime.Now.ToString() + "]" + message; this.actionlog.WriteInfo(message); return 0x3e9; } XmlNode node = document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("your_data"); XmlNode node2 = node.SelectSingleNode("bc"); int bC = this.BC; this.BC = int.Parse(node2.SelectSingleNode("current").InnerText); this.MaxBc = int.Parse(node2.SelectSingleNode("max").InnerText); XmlNode node3 = node.SelectSingleNode("ap"); this.AP = int.Parse(node3.SelectSingleNode("current").InnerText); this.MaxAP = int.Parse(node3.SelectSingleNode("max").InnerText); string str4 = message; message = str4 + " BC:" + bC.ToString() + "->" + this.BC.ToString() + " "; try { int num3 = int.Parse(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_result").SelectSingleNode("before_exp").InnerText); int num4 = int.Parse(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_result").SelectSingleNode("after_exp").InnerText); this.bWinner = int.Parse(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_result").SelectSingleNode("winner").InnerText) == 1; string str5 = message; message = str5 + "经验" + num3.ToString() + "->" + num4.ToString(); num = 0; XmlNodeList list = node.SelectNodes("itemlist"); if (list != null) { foreach (XmlNode node4 in list) { if (int.Parse(node4.SelectSingleNode("item_id").InnerText) == 0xca) { this.iGuildItemCount = int.Parse(node4.SelectSingleNode("num").InnerText); } } } } catch (Exception) { } try { BattleLog item = new BattleLog(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_battle"), this.lv, 0, 0); this.Battles.Add(item); this.listBox1.Items.Add(item); this.listBox1.DisplayMember = "Text"; this.listBox1.ValueMember = "Value"; } catch (Exception) { } if (this.bWinner) { message = message + "-战斗胜利-"; } XmlNode node5 = null; XmlNodeList list2 = node.SelectSingleNode("owner_card_list").SelectNodes("user_card"); int num5 = 0; string str = ""; if ((list2 != null) && (list2.Count > 200)) { this.cardlist = list2; object obj2 = this.actionlog.Text; this.actionlog.Text = string.Concat(new object[] { obj2, "得到卡数:", list2.Count, "\r\n" }); try { this.iSellPrice = int.Parse(this.textBox4.Text); } catch (Exception) { } string str7 = "卖:\r\n"; foreach (XmlNode node6 in list2) { int num6 = int.Parse(node6.SelectSingleNode("lv").InnerText); int num7 = int.Parse(node6.SelectSingleNode("lv_max").InnerText); int num8 = int.Parse(node6.SelectSingleNode("sale_price").InnerText); int num9 = int.Parse(node6.SelectSingleNode("hp").InnerText); int num10 = int.Parse(node6.SelectSingleNode("power").InnerText); int num11 = int.Parse(node6.SelectSingleNode("holography").InnerText); if (num6 == 1) { if (((num9 > 1) || (num10 > 1)) && (((num11 == 0) && (num7 < 50)) && (num8 < this.iSellPrice))) { if (num5 == 0) { str = str + node6.SelectSingleNode("serial_id").InnerText; } else { str = str + "," + node6.SelectSingleNode("serial_id").InnerText; } object obj3 = str7; str7 = string.Concat(new object[] { obj3, "ID:", node6.ChildNodes[1].InnerText, " lv:", num6, "/", num7, " atk/hp:", num10, "/", num9, "\r\n" }); num5++; } } else if ((num7 < 50) && (num6 < 30)) { if (num5 == 0) { str = str + node6.SelectSingleNode("serial_id").InnerText; } else { str = str + "," + node6.SelectSingleNode("serial_id").InnerText; } object obj4 = str7; str7 = string.Concat(new object[] { obj4, "ID:", node6.ChildNodes[1].InnerText, " lv:", num6, "//", num7, " atk/hp:", num10, "//", num9, "\r\n" }); num5++; } if (num5 == 30) { this.actionlog.Text = this.actionlog.Text + str7 + "\r\n"; this.sellcard(str); num5 = 0; str = ""; str7 = "卖:\r\n"; } } if (str != "") { this.actionlog.Text = this.actionlog.Text + str7; this.sellcard(str); } } try { node5 = document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_result").SelectSingleNode("special_item"); } catch (Exception) { message = message + "\r\n"; } if (node5 != null) { try { int num12 = int.Parse(node5.SelectSingleNode("before_count").InnerText); int num13 = int.Parse(node5.SelectSingleNode("after_count").InnerText); string str8 = message; string[] strArray = new string[] { str8, "收集道具:", (num13 - num12).ToString(), "->", num13.ToString(), "\r\n" }; message = string.Concat(strArray); } catch (Exception) { message = message + "\r\n"; } } string text = this.actionlog.Text; this.actionlog.Text = text + "[" + DateTime.Now.ToString() + "]" + message; this.actionlog.WriteInfo(message); } catch (Exception exception) { message = message + exception.Message + "\r\n"; string str10 = this.szActionLog; this.szActionLog = str10 + "[" + DateTime.Now.ToString() + "]" + message; this.actionlog.WriteInfo(message); } } return num; }
private int fairybattle(int iU, int iS) { int num = -1; Dictionary<string, string> dictionary = new Dictionary<string, string>(); dictionary.Add("", ""); IDictionary<string, string> parameters = dictionary; parameters.Clear(); parameters.Add("serial_id", this.Encrypt(iS.ToString(), this.key12)); parameters.Add("user_id", this.Encrypt(iU.ToString(), this.key12)); string url = "http://" + this.szhostport + "/connect/app/exploration/fairybattle?cyt=1"; CookieCollection cookies = new CookieCollection(); Cookie cookie2 = new Cookie("S", this.szCookie) { Domain = this.szhost }; Cookie cookie = cookie2; cookies.Add(cookie); XmlDocument document = null; try { document = this.CreatePostHttpResponse(url, parameters, 0xc350, string.Empty, Encoding.Default, cookies); } catch (Exception) { return num; } this.bWinner = false; if (document != null) { string message = "战斗:"; try { this.szCookie = document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("session_id").InnerText; if (int.Parse(document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("error").SelectSingleNode("code").InnerText) != 0) { message = message + document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("error").SelectSingleNode("message").InnerText + "\r\n"; string szActionLog = this.szActionLog; szActionLog = szActionLog + "[" + DateTime.Now.ToString() + "]" + message; this.actionlog.WriteInfo(message); return 0x3e9; } XmlNode node = document.SelectSingleNode("response").SelectSingleNode("header").SelectSingleNode("your_data"); XmlNode node2 = node.SelectSingleNode("bc"); int bC = this.BC; this.BC = int.Parse(node2.SelectSingleNode("current").InnerText); this.MaxBc = int.Parse(node2.SelectSingleNode("max").InnerText); XmlNode node3 = node.SelectSingleNode("ap"); this.AP = int.Parse(node3.SelectSingleNode("current").InnerText); this.MaxAP = int.Parse(node3.SelectSingleNode("max").InnerText); string str4 = message; message = str4 + " BC:" + bC.ToString() + "->" + this.BC.ToString() + " "; int num3 = int.Parse(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_result").SelectSingleNode("before_exp").InnerText); int num4 = int.Parse(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_result").SelectSingleNode("after_exp").InnerText); this.bWinner = int.Parse(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_result").SelectSingleNode("winner").InnerText) == 1; num = 0; BattleLog item = new BattleLog(document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_battle"), this.lv, 0, 0); this.Battles.Add(item); this.listBox1.Items.Add(item); this.listBox1.DisplayMember = "Text"; this.listBox1.ValueMember = "Value"; if (this.bWinner) { message = message + "-战斗胜利-"; } string str5 = message; message = str5 + "经验" + num3.ToString() + "->" + num4.ToString(); XmlNode node4 = null; try { node4 = document.SelectSingleNode("response").SelectSingleNode("body").SelectSingleNode("battle_result").SelectSingleNode("special_item"); } catch (Exception) { message = message + "\r\n"; } if (node4 != null) { try { int num5 = int.Parse(node4.SelectSingleNode("before_count").InnerText); int num6 = int.Parse(node4.SelectSingleNode("after_count").InnerText); string str6 = message; string[] strArray = new string[] { str6, "收集道具:", (num6 - num5).ToString(), "->", num6.ToString(), "\r\n" }; message = string.Concat(strArray); } catch (Exception) { message = message + "\r\n"; } } string text = this.actionlog.Text; this.actionlog.Text = text + "[" + DateTime.Now.ToString() + "]" + message; this.actionlog.WriteInfo(message); } catch (Exception exception) { message = message + exception.Message + "\r\n"; string str8 = this.szActionLog; this.szActionLog = str8 + "[" + DateTime.Now.ToString() + "]" + message; this.actionlog.WriteInfo(message); } } return num; }