private bool RobTheFriend(int fuid, HouseInfo house) { try { bool ret = false; string feedback = ""; HH.DelayedTime = Constants.DELAY_2SECONDS; string content = HH.Post("http://www.kaixin001.com/house/stayhouse.php", string.Format("verify={0}&roomid={1}&tuid={2}&fuid={3}&status=1", this._verifyCode, house.RoomId, house.Fuid, fuid)); //<script language=javascript>new parent.dialog().reset();parent.stayhouse2_newret(10755333,10754113,0,'0','0');</script>" //function stayhouse2_newret(fuid,tuid,flag,cash,staycash) //{ // url = '/house/stayhouseret_dialog.php?verify=10752309_1062_10752309_1233234231_6ea15aac2840c10fae1b94b210a004d0&tuid='+tuid+'&flag='+flag+'&fuid='+fuid+'&cash='+cash+'&staycash='+staycash; // openWindow(url, 460, 500, '抢人'); //} feedback = JsonHelper.GetMid(content, "parent.stayhouse2_newret(", ");"); if (feedback != null) { string[] feedparam = feedback.Split(','); if (feedparam.Length == 5) { content = HH.Get(string.Format("http://www.kaixin001.com/house/stayhouseret_dialog.php?verify={0}&tuid={1}&flag={2}&fuid={3}cash={4}&staycash={5}", this._verifyCode, feedparam[1], feedparam[2], feedparam[0], feedparam[3], feedparam[4])); ret = GetRobFriendsFeedback(content, house); } } else { //<script language=javascript>new parent.dialog().reset();parent.stayhouse2_ret(10754420,10752309,5,0);</script> //function stayhouse2_ret(fuid,tuid,flag,cash) //{ // url = '/house/stayhouseret_dialog.php?verify=10752657_1062_10752657_1233279955_19e8767fa5e10fb7a88940408db7422c&tuid='+tuid+'&flag='+flag+'&fuid='+fuid+'&cash='+cash; // openWindow(url, 460, 500, '抢人'); //} feedback = JsonHelper.GetMid(content, "parent.stayhouse2_ret(", ");"); if (feedback != null) { string[] feedparam = feedback.Split(','); if (feedparam.Length == 4) { content = HH.Get(string.Format("http://www.kaixin001.com/house/stayhouseret_dialog.php?verify={0}&tuid={1}&flag={2}&fuid={3}cash={4}", this._verifyCode, feedparam[1], feedparam[2], feedparam[0], feedparam[3])); ret = GetRobFriendsFeedback(content, house); } } } _robbedFriendsList.Add(fuid); return ret; } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameHouse.RobTheFriend", GetFriendNameById(fuid), ex, LogSeverity.Error); SetMessage("抢" + GetFriendNameById(fuid) + "失败!错误:" + ex.Message); return false; } }
private void RobFriends(HouseInfo house, bool IsFirstRoom) { try { SetMessage(house.HouseName + ":"); if (house.Status == HouseStatus.Full) { SetMessage("已住满,无法抢人!"); return; } //if (this._staystatus != StayStatus.StayInOwn && IsFirstRoom) //{ // SetMessage("我目前不住在自己家里,暂不抢人!"); // return; //} int num = 0; if (Task.RobFriends) { SetMessageLn("抢白名单中的好友:"); foreach (int uid in Operation.RobWhiteList) { if (!Operation.RobBlackList.Contains(uid)) { if (_robbedFriendsList.Contains(uid)) continue; SetMessage(string.Format("=>好友#{0}:{1} ", new object[] { ++num, GetFriendNameById(uid) })); if (!DifferentGender(uid) && IsFirstRoom) { SetMessage("性别相同,跳过 "); continue; } RobTheFriend(uid, house); if (house.Status == HouseStatus.Full) return; } else { SetMessage(string.Format("=>好友#{0}:{1} ", new object[] { ++num, GetFriendNameById(uid) })); SetMessage("在黑名单中,跳过 "); } } } if (Task.RobFreeFriends) { SetMessageLn("抢露宿街头的好友:"); foreach (FriendInfo friend in this._freeFriendsList) { if (!Operation.RobBlackList.Contains(friend.Id)) { if (_robbedFriendsList.Contains(friend.Id)) continue; SetMessage(string.Format("=>好友#{0}:{1} ", new object[] { ++num, friend.Name })); if (!DifferentGender(friend.Id) && IsFirstRoom) { SetMessage("性别相同,跳过 "); continue; } RobTheFriend(friend.Id, house); if (house.Status == HouseStatus.Full) return; } else { SetMessage(string.Format("=>好友#{0}:{1} ", new object[] { ++num, friend.Name })); SetMessage("在黑名单中,跳过 "); } } if (this._freeFriendsList.Count == 0) SetMessage("没有露宿街头的好友!"); } SetMessage("抢人失败!"); } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameHouse.RobFriends", ex, LogSeverity.Error); SetMessage("抢人失败!错误:" + ex.Message); } }
private bool StayTheHouse(string master, string uid, HouseInfo room) { try { //SetMessageLn("尝试住进" + master + "的房子:"); bool ret = false; if (room != null && uid != string.Empty && room.Fuid != string.Empty && room.RoomId != string.Empty) { string feedback = ""; HH.DelayedTime = Constants.DELAY_2SECONDS; string content = HH.Post("http://www.kaixin001.com/house/stayhouse.php", string.Format("verify={0}&roomid={1}&tuid={2}&fuid={3}&status=0", this._verifyCode, room.RoomId, uid, room.Fuid)); //<script language=javascript>new parent.dialog().reset();parent.stayhouse_newret(10752309,10752309,0,'0','0');</script> //<script language="JavaScript" type="text/javascript">document.domain="kaixin001.com"; //new parent.dialog().reset();parent.stayhouse_ret(6195212,6209068,5,0); //</script> //function stayhouse_newret(fuid,tuid,flag,cash,staycash) //{ // url = '/house/stayhouseret_dialog.php?verify=2588258_1062_2588258_1233119730_593462a6f2bbfedcabc156dacef4be1f&tuid='+tuid+'&flag='+flag+'&fuid='+fuid+'&cash='+cash+'&staycash='+staycash; // openWindow(url, 460, 500, '入住房子'); //} feedback = JsonHelper.GetMid(content, "parent.stayhouse_newret(", ");"); if (feedback != null) { string[] feedparam = feedback.Split(','); if (feedparam.Length == 5) { content = HH.Get(string.Format("http://www.kaixin001.com/house/stayhouseret_dialog.php?verify={0}&tuid={1}&flag={2}&fuid={3}cash={4}&staycash={5}", this._verifyCode, feedparam[1], feedparam[2], feedparam[0], feedparam[3], feedparam[4])); ret = GetStayHouseFeedback(content, uid); } } //<script language=javascript>new parent.dialog().reset();parent.stayhouse_ret(10752309,10752309,7,0);</script> //function stayhouse_ret(fuid,tuid,flag,cash) //{ // url = '/house/stayhouseret_dialog.php?verify=10752309_1062_10752309_1233216189_dbbb110718a7618a0214e04fcf6c3ad8&tuid='+tuid+'&flag='+flag+'&fuid='+fuid+'&cash='+cash; // openWindow(url, 460, 500, '入住房子'); //} feedback = JsonHelper.GetMid(content, "parent.stayhouse_ret(", ");"); if (feedback != null) { string[] feedparam = feedback.Split(','); if (feedparam.Length == 4) { content = HH.Get(string.Format("http://www.kaixin001.com/house/stayhouseret_dialog.php?verify={0}&tuid={1}&flag={2}&fuid={3}&cash={4}", this._verifyCode, feedparam[1], feedparam[2], feedparam[0], feedparam[3])); ret = GetStayHouseFeedback(content, uid); } } } else { SetMessage(master + "的房间已住满了人!"); } if (ret) { if (master == "我") { this._staystatus = StayStatus.StayInOwn; room.LodgerCount++; } else this._staystatus = StayStatus.StayInOthers; } return ret; } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameHouse.StayTheHouse", master, ex, LogSeverity.Error); SetMessage(" 住进" + GetFriendNameById(uid) + "的房子失败!错误:" + ex.Message); return false; } }
private HouseInfo ReadHouse(string content, HouseInfo house, bool printMessage) { //housename string strName = JsonHelper.GetMid(content, "<div class=\"f14 tac\" style=\"margin:0;*margin:10px 0 0 0;padding:10px 0 0 0;*padding:0;\">", "</div>"); if (!String.IsNullOrEmpty(strName)) house.HouseName = strName; else house.HouseName = ""; if (printMessage) SetMessage(house.HouseName + ":"); if (JsonHelper.GetMid(content, "<span class=\"c_sl \">", "</span>").IndexOf("自己家") > -1) house.IsMasterInHouse = true; else house.IsMasterInHouse = false; int num = 0; int lodgercount = 0; int roomcount = 0; for (int ix = 0; ix < 6; ix++) { string client = JsonHelper.GetMid(content, "<div style=\"margin-top:-10px;\" class=\"tac\">", "<div class='butt_box", out num); if (client != null) { lodgercount++; roomcount++; if (printMessage) SetMessage(string.Format(" {0}:{1}", lodgercount, JsonHelper.FiltrateHtmlTags(client))); } else { string empty = JsonHelper.GetMid(content, "<img src=\"http://img.kaixin001.com.cn/i2/house/icon_w.jpg\"", "<div class=\"butt_box1\"><a href=\"javascript:stayhouse(", out num); if (empty != null) roomcount++; else break; } content = content.Substring(num); } house.LodgerCount = lodgercount; house.RoomCount = roomcount; if (house.LodgerCount == 0 && printMessage) SetMessage("没人居住!"); return house; }
private HouseInfo GetPreviouHouse(string content) { HouseInfo house = new HouseInfo(); if (String.IsNullOrEmpty(content)) return house; //<a href="/!house/index_room.php?roomid=9719" class="sl noline" style="margin-left:0;">进入我的房间</a></li> //<a href="/!house/index_room.php?fuid=6195212&roomid=15553" class="sl noline" style="margin-left:0;"> 进入他的房间</a></li> string houseinfo = JsonHelper.GetMid(content, "<a href=\"/!house/index_room.php?", " class=\"sl noline\" style=\"margin-left:0;\">"); if (houseinfo != null) { house.RoomId = JsonHelper.GetMid(houseinfo, "roomid=", "\""); house.Fuid = CurrentAccount.UserId; } return house; }
private bool GetRobFriendsFeedback(string content, HouseInfo house) { try { //if ($("flag2_0")) //{ // $("flag2_0").style.display = "block"; //} string strmsg = ""; bool ret = false; string strdivid = JsonHelper.GetMid(content, "if ($(\"", "\"))"); if (strdivid != null) { //<div id="flag2_0" style="display:none;"> // <div class="h100"> </div><div class="h50"> </div> // <div class="f14 tac"> // <div class="l" style="padding-left:80px;"><img src="http://img.kaixin001.com.cn/i2/notice.gif" alt="警告" /></div> // <div class="l" style="padding-left:10px;width:20em;"><strong><span class="sl">庄子</span>已经在你的房子里住了!</strong></div> // <div class="c"></div> // </div> // <div style="padding:30px 167px;"> // <div class="rbs1"><input type="button" id="btn_sc" value="确定" class="rb1-12" onmouseover="this.className='rb2-12';" onmouseout="this.className='rb1-12';" onclick="new parent.dialog().reset();" style="padding:5px 20px;" /></div> // </div> //</div> strmsg = JsonHelper.GetMid(content, "<div id=\"" + strdivid + "\" style=\"display:none;\">", "<div style=\"padding:30px 167px;\">"); if (strmsg != null) { SetMessage(" " + JsonHelper.FiltrateHtmlTags(strmsg)); if (strmsg.IndexOf("已经在你的房子里住了") > -1 || strmsg.IndexOf("记得要好好招待你的客人哦") > -1) { ret = true; SetMessage("抢人成功!"); } if (strmsg.IndexOf("我的房间已住满了人") > -1 || strmsg.IndexOf("你的这套房子住满人了") > -1) { house.LodgerCount = house.RoomCount; } } } if (ret) house.LodgerCount++; return ret; } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("GameHouse.GetRobFriendsFeedback", content, ex, LogSeverity.Error); return false; } }