コード例 #1
0
ファイル: GameHouse.cs プロジェクト: jojozhuang/Projects
 public GameHouse()
 {
     this._sameVillageFriendsList = new Collection<FriendInfo>();
     this._allHouseFriendsList = new Collection<FriendInfo>();
     this._freeFriendsList = new Collection<FriendInfo>();
     this._staystatus = StayStatus.UnKnown;
     this._myHouses = new Collection<HouseInfo>();
     this._robbedFriendsList = new Collection<int>();
 }        
コード例 #2
0
ファイル: GameHouse.cs プロジェクト: jojozhuang/Projects
        private bool GetStayHouseFeedback(string content, string uid)
        {
            try
            {
                //if ($("flag1_1"))
                //{
                //    $("flag1_1").style.display = "block";
                //}
                string strmsg = "";
                bool ret = false;
                string strdivid = JsonHelper.GetMid(content, "if ($(\"", "\"))");
                if (strdivid != null)
                {
                    //<div id="flag1_1" style="display:none;">
                    //    <div class="h100">&nbsp;</div><div class="h50">&nbsp;</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小时,不能换房居住") > -1 || strmsg.IndexOf("你在好友的房子里还没住满1小时,不能换房住") > -1)
                        {
                            this._staystatus = StayStatus.WithinOneHour;
                        }
                        if (strmsg.IndexOf("房子已经住满了,你不能入住") > -1 || strmsg.IndexOf("的房间已住满了人") > -1)
                            this._houseFullList.Add(DataConvert.GetInt32(uid));
                    }
                    else
                    {
                        //<div id="flag0_2" style="display:none;">
                        //    <div class="f14 tac" style="margin-top:100px;"><strong>你搬进<span class="sl">武小浪</span>的房子里住了!<br />
                        //    </strong>
                        //</div>
                        strmsg = JsonHelper.GetMid(content, "<div id=\"" + strdivid + "\" style=\"display:none;\">", "</div>");
                        if (strmsg != null)
                        {
                            SetMessage(" " + JsonHelper.FiltrateHtmlTags(strmsg));
                            if (strmsg.IndexOf("你搬进") > -1)
                            {
                                ret = true;
                                SetMessage(" 系统随机给你一笔住房津贴,数额为:" + JsonHelper.GetMid(content, "var staycash = \"", "\";") + "。 ");
                                SetMessage("住入成功!");
                            }
                            if (strmsg.IndexOf("你上次入住还没满1小时,不能换房居住") > -1 || strmsg.IndexOf("你在好友的房子里还没住满1小时,不能换房住") > -1)
                            {
                                this._staystatus = StayStatus.WithinOneHour; ;
                            }
                            if (strmsg.IndexOf("房子已经住满了,你不能入住") > -1 || strmsg.IndexOf("的房间已住满了人") > -1)
                                this._houseFullList.Add(DataConvert.GetInt32(uid));
                        }
                    }
                }

                return ret;
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (ThreadInterruptedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                LogHelper.Write("GameHouse.GetStayHouseFeedback", content, ex, LogSeverity.Error);
                return false;
            }
        }
コード例 #3
0
ファイル: GameHouse.cs プロジェクト: jojozhuang/Projects
        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;
            }
        }
コード例 #4
0
ファイル: GameHouse.cs プロジェクト: jojozhuang/Projects
        public string RequestHouseHomePage(bool IsInitial)
        {
            string content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1062");
            //if (content.IndexOf("<title>添加组件 - 开心网</title>") != -1)
            if (content.IndexOf("游戏:买房子") == -1)
            {
                SetMessageLn("还未安装买房子组件");
                //SetMessageLn("还未安装买房子组件,尝试安装中...");
                //HH.Post("http://www.kaixin001.com/app/install.php", "aid=1062&isinstall=1");
                //content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1062");
                //this._verifyCode = JsonHelper.GetMid(content, "g_verify = \"", "\"");
                ////init city
                //HH.Get("http://www.kaixin001.com/house/inithouse_dialog.php?verify=" + this._verifyCode);
                //HH.Get("http://www.kaixin001.com/house/gethouseconfig.php?verify=" + this._verifyCode + "&roomid=8646&fuid=&r=0.8915753769688308");
                //HH.Post("http://www.kaixin001.com/house/inithouse_dialog.php", "http://www.kaixin001.com/house/inithouse_dialog.php?verify=" + this._verifyCode, "verify=" + this._verifyCode + "&step=2");
                //HH.Post("http://www.kaixin001.com/house/inithouse.php", "http://www.kaixin001.com/house/inithouse_dialog.php", "city=%E4%B8%8A%E6%B5%B7&verify=" + this._verifyCode);
                //content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1062");
                //SetMessage("你要闯荡的城市:上海!");
            }
            this._verifyCode = JsonHelper.GetMid(content, "g_verify = \"", "\"");
            if (content.IndexOf("我目前露宿街头") > -1)
                this._staystatus = StayStatus.InTheStreet;
            else if (content.IndexOf("我目前住在自己家") > -1)
                this._staystatus = StayStatus.StayInOwn;
            else if (content.IndexOf("我目前住在<a href=/~house/index.php?_lgmode=pri&fuid=") > -1)
            {
                this._staystatus = StayStatus.StayInOthers;
                this._otherhousemaster = JsonHelper.GetMid(content, "我目前住在<a href=/~house/index.php?_lgmode=pri&fuid=", " class='sl noline'>");
            }
            if (!IsInitial)
            {
                SetMessageLn("我的状态:" + JsonHelper.FiltrateHtmlTags(JsonHelper.GetMid(content, "<span  class=\"c_sl \">", "</span>")));                
               //<div class="tar">
               //             <a href="/!house/index.php?roomid=31647"><img src="http://img.kaixin001.com.cn/i2/house/1h-2.gif"/></a>
               //             <a href="/!house/index.php?roomid=9717"><img src="http://img.kaixin001.com.cn/i2/house/2h-1.gif"/></a>
               //             <a href="/!house/index.php?roomid=15552"><img src="http://img.kaixin001.com.cn/i2/house/3h-1.gif"/></a>
 
               //         </div>
                string myhouses = JsonHelper.GetMid(content, "<div class=\"tar\">", "</div>");
                if (!String.IsNullOrEmpty(myhouses) && myhouses.Trim() != string.Empty)
                {
                    int num = 0;
                    int count = 0;
                    for (string pos = JsonHelper.GetMid(myhouses, "<a href=\"/!house/index.php?roomid=", "\"><img src=\"http://img.kaixin001.com.cn/i2/house/", out num); pos != null; pos = JsonHelper.GetMid(myhouses, "<a href=\"/!house/index.php?roomid=", "\"><img src=\"http://img.kaixin001.com.cn/i2/house/", out num))
                    {
                        myhouses = myhouses.Substring(num);
                        if (!String.IsNullOrEmpty(pos))
                        {
                            string content2 = HH.Get("http://www.kaixin001.com/~house/index.php?roomid=" + pos);
                            HouseInfo house = GetPreviouHouse(content2);
                            SetMessageLn(string.Format("#{0}", ++count));
                            house = ReadHouse(content2, house, true);
                            this._myHouses.Add(house);
                        }
                    }
                }
                else
                {
                    HouseInfo house = GetPreviouHouse(content);
                    SetMessageLn("#1");
                    house = ReadHouse(content, house, true);
                    this._myHouses.Add(house);
                }
            }
            return content;
        }