Exemplo n.º 1
0
        private bool BuyTheSlave(int slaveuid)
        {
            if (Operation.BuyBlackList.Contains(slaveuid))
            {
                SetMessage("#" + GetFriendNameById(slaveuid) + ",不购买黑名单里的奴隶 ");
                return(false);
            }
            string slaveNick = Task.NickName;

            if (slaveNick == null)
            {
                slaveNick = string.Empty;
            }
            else
            {
                slaveNick = DataConvert.GetEncodeData(slaveNick);
            }

            //get slave info
            HH.DelayedTime = Constants.DELAY_2SECONDS;
            string content = HH.Get(string.Format("http://www.kaixin001.com/slave/buy_dialog.php?slaveuid={0}&verify={1}", slaveuid, this._verifyCode));

            if (!GetBuySlaveFeedback(content))
            {
                return(false);
            }

            //current price
            int slaveprice = JsonHelper.GetInteger(JsonHelper.GetMid(content, "你想花 <strong class=\"dgreen\">&yen;", "</strong> 的价格购买"));

            //request for buying
            string param = "verify=" + this._verifyCode + "&slaveuid=" + slaveuid + "&nick=" + slaveNick + "&acc=" + GetAccCode(content);

            HH.DelayedTime = Constants.DELAY_2SECONDS;
            content        = HH.Post("http://www.kaixin001.com/slave/buy.php", param);
            if (!GetBuySlaveFeedback(content))
            {
                return(false);
            }

            if (this.GetFeedback(content))
            {
                FriendInfo slave = new FriendInfo();
                slave.Id   = Convert.ToInt32(slaveuid);
                slave.Name = JsonHelper.GetMid(content, "<span class=\"sl\">", "<");
                if (slave.Name == null)
                {
                    slave.Name = string.Empty;
                }
                slave.Gender = JsonHelper.GetMid(content, "<br />同时,", "的") == "他" ? true : false;
                slave.Price  = JsonHelper.GetInteger(JsonHelper.GetMid(content, "&yen;", "<"));
                this._mySlaveList.Add(slave);
                this._slavecash -= slaveprice;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        private string GetFawnType()
        {
            string fawnType = "1"; //给他请安
            string content  = "";

            int num = 0;

            try
            {
                HH.DelayedTime = Constants.DELAY_1SECONDS;
                content        = HH.Get(string.Format("http://www.kaixin001.com/slave/fawn_dialog.php?hostuid={0}&verify={1}", this._hostuid, this._verifyCode));
                for (string pos = JsonHelper.GetMid(content, "<input type=\"radio\" name=\"fawntype\" value=\"", "\">", out num); pos != null; pos = JsonHelper.GetMid(content, "<input type=\"radio\" name=\"fawntype\" value=\"", "\">", out num))
                {
                    content = content.Substring(num);
                    int type = JsonHelper.GetInteger(pos);
                    if (type > 0)
                    {
                        return(type.ToString());
                    }
                }
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (ThreadInterruptedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                LogHelper.Write("GameSlave.GetComfortType", content, ex, LogSeverity.Error);
            }
            return(fawnType);
        }
Exemplo n.º 3
0
        public string RequestBiteHomePage()
        {
            string content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1048");

            if (content.IndexOf("<title>添加组件 - 开心网</title>") != -1)
            {
                SetMessageLn("还未安装咬人组件,尝试安装中...");
                HH.Post("http://www.kaixin001.com/app/install.php", "aid=1048&isinstall=1");
                content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1048");
            }
            this._verifyCode = JsonHelper.GetMid(content, "g_verify = \"", "\"");
            return(content);
        }
Exemplo n.º 4
0
        public string RequestRichHomePage(bool IsInitial)
        {
            string content = HH.Get("http://www.kaixin001.com/!rich/index.php");

            if (content.IndexOf("<title>添加组件 - 开心网</title>") != -1)
            {
                SetMessageLn("还未安装超级大亨组件,尝试安装中...");
                HH.Post("http://www.kaixin001.com/app/install.php", "aid=1092&isinstall=1");
                content = HH.Get("http://www.kaixin001.com/!rich/index.php");
            }
            this._verifyCode = JsonHelper.GetMid(content, "g_verify = \"", "\"");
            return(content);
        }
Exemplo n.º 5
0
        private void ConfirmFriend()
        {
            int page = 0;

            do
            {
                //防止死循环
                if (page > 20)
                {
                    return;
                }

                HH.DelayedTime = Constants.DELAY_1SECONDS;
                string content = HH.Get("http://www.kaixin001.com/msg/sys.php?type=1&start=" + (page * 10).ToString());

                if (string.IsNullOrEmpty(content))
                {
                    SetMessageLn("没有加好友请求消息");
                    return;
                }
                if (content.IndexOf("消息中心") > -1)
                {
                    SetMessageLn("没有加好友请求消息");
                    return;
                }
                string temp = JsonHelper.GetMid(content, "javascript:agreefriend(", ");\" class=\"sl\">同意");
                if (string.IsNullOrEmpty(temp))
                {
                    SetMessageLn("没有加好友请求消息");
                    return;
                }

                page++;

                SetMessageLn("第" + page.ToString() + "页");

                int num;
                for (string info = JsonHelper.GetMid(content, "javascript:agreefriend(", ");\" class=\"sl\">同意", out num); info != null; info = JsonHelper.GetMid(content, "javascript:agreefriend(", ");\" class=\"sl\">同意", out num))
                {
                    content = content.Substring(num);
                    string[] arrayAgree = new string[2];
                    arrayAgree = info.Split(',');
                    if (arrayAgree != null)
                    {
                        AgreeFriend(arrayAgree[0], arrayAgree[1]);
                    }
                }
            }while (true);
        }
Exemplo n.º 6
0
        public string RequestSlaveHomePage()
        {
            string content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1028");

            if (content.IndexOf("<title>添加组件 - 开心网</title>") != -1)
            {
                SetMessageLn("还未安装朋友买卖组件,尝试安装中...");
                HH.Post("http://www.kaixin001.com/app/install.php", "aid=1028&isinstall=1");
                content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1028");
            }
            this._verifyCode = JsonHelper.GetMid(content, "g_verify = \"", "\"");
            this._slavecash  = JsonHelper.GetInteger(JsonHelper.GetMid(content, "<p>现 金:<strong class=\"dgreen\">&yen;", "</strong></p>"));
            this._hostuid    = JsonHelper.GetInteger(JsonHelper.GetMid(content, "javascript:fawnHost(", ");"));
            return(content);
        }
Exemplo n.º 7
0
        private void BuyAssetAccordingCount(int assetid, string name, long purchaseprice, long count)
        {
            SetMessageLn(string.Format("购买{0}个{1}", count, name));
            HH.DelayedTime = Constants.DELAY_1SECONDS;
            HH.Get(string.Format("http://www.kaixin001.com/!rich/!purchase.php?iid={0}&purchase_price={1}&t=0.9090718055919508", assetid, purchaseprice));

            HH.DelayedTime = Constants.DELAY_2SECONDS;
            string content = HH.Post(string.Format("http://www.kaixin001.com/!rich/!purchase.php?iid={0}&purchase_price={1}&t=0.13999783978033764", assetid, purchaseprice), string.Format("iid={0}&purchase_price={1}&num={2}", assetid, purchaseprice, count));

            if (GetBuyAssetFeedback(content))
            {
                _isfirsttimebuy  = false;
                _transactedasset = true;
                _cash           -= count * purchaseprice;
            }
        }
Exemplo n.º 8
0
 private void ReleaseSlaves()
 {
     try
     {
         SetMessageLn("释放奴隶:");
         int  num  = 0;
         bool flag = false;
         foreach (FriendInfo slave in this._mySlaveList)
         {
             SetMessageLn(string.Format("奴隶#{0}:{1}(身价:¥{2}) ", ++num, slave.Name, slave.Price));
             HH.DelayedTime = Constants.DELAY_1SECONDS;
             string content = HH.Get(string.Format("http://www.kaixin001.com/slave/free_dialog.php?slaveuid={0}&verify={1}", slave.Id.ToString(), this._verifyCode));
             if (content.IndexOf("$(\"flag2\").style.display") != -1)
             {
                 string param = "verify=" + this._verifyCode + "&slaveuid=" + slave.Id.ToString();
                 HH.DelayedTime = Constants.DELAY_2SECONDS;
                 HH.Post("http://www.kaixin001.com/slave/free.php", param);
                 SetMessage("释放成功!");
                 flag = true;
             }
             else
             {
                 SetMessage("未满两天,不能释放!");
             }
         }
         if (flag)
         {
             string content = RequestSlaveHomePage();
             ReadSlaves(content, false);
         }
     }
     catch (ThreadAbortException)
     {
         throw;
     }
     catch (ThreadInterruptedException)
     {
         throw;
     }
     catch (Exception ex)
     {
         LogHelper.Write("GameSlave.ReleaseSlaves", ex, LogSeverity.Error);
         SetMessage(" 释放奴隶失败!错误:" + ex.Message);
     }
 }
Exemplo n.º 9
0
 private void AgreeFriend(string fuid, string smid)
 {
     try
     {
         HH.DelayedTime = Constants.DELAY_2SECONDS;
         string content = HH.Get(string.Format("http://www.kaixin001.com/friend/editfriend_dialog.php?smid={0}&fuid={1}", smid, fuid));
         string param   = string.Format("fuid={0}&byname=&memo=&groups=&allgroups=%E7%8E%B0%E5%9C%A8%E5%90%8C%E4%BA%8B%2C%E4%BB%A5%E5%89%8D%E5%90%8C%E4%BA%8B%2C%E5%A4%A7%E5%AD%A6%E5%90%8C%E5%AD%A6%2C%E9%AB%98%E4%B8%AD%E5%90%8C%E5%AD%A6%2C%E5%AE%B6%E4%BA%BA%E4%BA%B2%E6%88%9A%2C%E6%8C%9A%E4%BA%A4%E5%A5%BD%E5%8F%8B%2C%E6%99%AE%E9%80%9A%E6%9C%8B%E5%8F%8B%2C%E6%9C%8B%E5%8F%8B%E7%9A%84%E6%9C%8B%E5%8F%8B%2C%E5%85%B6%E4%BB%96&start=0&sysmsgtype=1&from=sysmsg&smid={1}", fuid, smid);
         HH.DelayedTime = Constants.DELAY_2SECONDS;
         HH.Post("http://www.kaixin001.com/friend/editfriend.php", param);
         SetMessageLn(string.Format("已同意{0}的好友请求!", this.GetFriendNameById(fuid)));
     }
     catch (OverflowException)
     {
     }
     catch (FormatException)
     {
     }
 }
Exemplo n.º 10
0
        private bool SendFriendRequest(string userid)
        {
            string content = HH.Get("http://www.kaixin001.com/home/?uid=" + userid);

            HH.DelayedTime = Constants.DELAY_2SECONDS;
            content        = HH.Get("http://www.kaixin001.com/friend/new.php?touid=" + userid, "http://www.kaixin001.com/home/?uid=" + userid);
            string param = string.Format("from=&touid={0}&content=hi&rcode=&code=&usercode=&email=&bidirection=", userid);

            HH.DelayedTime = Constants.DELAY_2SECONDS;
            content        = HH.Post("http://www.kaixin001.com/friend/addverify.php", "http://www.kaixin001.com/friend/new.php?touid=" + userid, param);

            if (content.IndexOf("var type = \"4\"") != -1)
            {
                return(true);
            }
            else
            {
                LogHelper.Write("ToolAddFriends.SendFriendRequest()", content, LogSeverity.Warn);
                return(false);
            }
        }
Exemplo n.º 11
0
        private string GetComfortType(string userid, bool female)
        {
            string comfortType = "";

            //6 给她穿漂亮的新衣服
            //7 给他穿漂亮的新衣服
            comfortType = (female) ? "6" : "7";

            string content = "";
            int    num     = 0;

            try
            {
                HH.DelayedTime = Constants.DELAY_1SECONDS;
                content        = HH.Get(string.Format("http://www.kaixin001.com/slave/comfort_dialog.php?slaveuid={0}&verify={1}", userid, this._verifyCode));
                for (string pos = JsonHelper.GetMid(content, "name=\"comforttype\" value=\"", "\">", out num); pos != null; pos = JsonHelper.GetMid(content, "name=\"comforttype\" value=\"", "\">", out num))
                {
                    content = content.Substring(num);
                    int type = JsonHelper.GetInteger(pos);
                    if (type > 0)
                    {
                        return(type.ToString());
                    }
                }
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (ThreadInterruptedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                LogHelper.Write("GameSlave.GetComfortType", content, ex, LogSeverity.Error);
            }
            return(comfortType);
        }
Exemplo n.º 12
0
 public string RequestBuyableSlaves()
 {
     HH.DelayedTime = Constants.DELAY_1SECONDS;
     return(HH.Get("http://www.kaixin001.com/slave/selslave_dialog.php?verify=" + this._verifyCode));
 }
Exemplo n.º 13
0
 public string RequestTheAsset(int iid, double currentprice)
 {
     HH.DelayedTime = Constants.DELAY_1SECONDS;
     return(HH.Get(string.Format("http://www.kaixin001.com/!rich/!purchase.php?iid={0}&purchase_price={1}&t=0.9960790519692878", iid, currentprice)));
 }
Exemplo n.º 14
0
        private void GetMyAssets(bool printMessage)
        {
            if (printMessage)
            {
                SetMessageLn("读取我的资产信息...");
            }

            this._myAssetsList.Clear();

            int page       = 0;
            int maxrequest = 0;

            do
            {
                //防止死循环
                if (maxrequest > 20)
                {
                    return;
                }
                maxrequest++;

                int num;
                HH.DelayedTime = Constants.DELAY_1SECONDS;
                string content = HH.Get("http://www.kaixin001.com/!rich/myitem.php&start=" + page);

                content = JsonHelper.GetMid(content, "<div class=\"list_zc\">", "<div class=\"tac mt30\">");
                if (content != null)
                {
                    if (content == "\r\n\r\n\t\t\t<div class=\"c\"></div>\r\n\t\t</div>\r\n\t\t")
                    {
                        return;
                    }

                    if (printMessage)
                    {
                        SetMessageLn("第" + (page / 20 + 1).ToString() + "页");
                    }

                    for (string info = JsonHelper.GetMid(content, "<ul>", "</ul>", out num); info != null; info = JsonHelper.GetMid(content, "<ul>", "</ul>", out num))
                    {
                        content = content.Substring(num);
                        string   detail   = JsonHelper.GetMid(info, "<a href=\"javascript:sell(", ");\"");
                        string[] details  = detail.Split(',');
                        string   assetnum = JsonHelper.GetMid(info, "</b> ", " <img src="); //<li class="tac mt5" ><b>石油天然气公司</b> 100家 <img src="http://img.kaixin001.com.cn/i3/dh/icon_u.gif" /></li>
                        if (assetnum == null)
                        {
                            assetnum = JsonHelper.GetMid(info, "</b> ", " </li>"); //<li class="tac mt5" style="margin-top:14px"><b>诺亚方舟船票</b> 2张 </li>
                        }
                        if (details != null && details.Length == 3)
                        {
                            MyAssetInfo myasset = new MyAssetInfo();
                            myasset.IId          = DataConvert.GetInt32(details[0]);
                            myasset.BuyPrice     = DataConvert.GetDouble(details[1]);
                            myasset.CurrentPrice = DataConvert.GetDouble(JsonHelper.GetMid(details[2], "'", "'"));
                            myasset.AssetNum     = DataConvert.GetInt32(assetnum.Substring(0, assetnum.Length - 1));
                            this._myAssetsList.Add(myasset);
                            if (printMessage)
                            {
                                SetMessageLn(myasset.ToString());
                            }
                        }
                    }
                    page += 20;
                }
                else
                {
                    return;
                }
            }while (true);
        }
Exemplo n.º 15
0
 public string RequestRestableFriends()
 {
     HH.DelayedTime = Constants.DELAY_1SECONDS;
     return(HH.Get("http://www.kaixin001.com/bite/restable.php?verify=" + this._verifyCode));
 }
Exemplo n.º 16
0
 private string RequestBiteStyle(string touid)
 {
     HH.DelayedTime = Constants.DELAY_1SECONDS;
     return(HH.Get(string.Format("http://www.kaixin001.com/bite/style.php?verify={0}&touid={1}", this._verifyCode, touid)));
 }
Exemplo n.º 17
0
        private void RequestBiteAcc()
        {
            string content = HH.Get("http://www.kaixin001.com/app/app.php?aid=1048&url=index.php&touid=6747992");

            this._biteAcc = GetAccCode(content);
        }
Exemplo n.º 18
0
 public string RequestMyAssets()
 {
     HH.DelayedTime = Constants.DELAY_1SECONDS;
     return(HH.Get("http://www.kaixin001.com/!rich/myitem.php"));
 }
Exemplo n.º 19
0
        private void GetAssetsMarket(bool printMessage)
        {
            if (printMessage)
            {
                SetMessageLn("读取市场上的资产信息...");
            }

            this._assetsMarketList.Clear();

            if (Task.BuyAssetsList.Count <= 10)
            {
                string content = "";
                for (int ix = 0; ix < Task.BuyAssetsList.Count; ix++)
                {
                    AssetInfo asset = CreateAssetById(Task.BuyAssetsList[ix]);
                    if (asset != null)
                    {
                        content            = HH.Get(string.Format("http://www.kaixin001.com/!rich/!api_item_price.php?rt=xml&iid={0}", asset.IId));
                        asset.CurrentPrice = DataConvert.GetInt64(JsonHelper.GetMidLast(content, "<price>", "</price>"));
                        this._assetsMarketList.Add(asset);
                    }
                }
            }
            else
            {
                int   page       = 0;
                int   maxrequest = 0;
                int[] cateids    = null;
                if (_myFortuneRank != FortuneRank.Worker)
                {
                    cateids = new int[] { 2, 4, 6, 7, 8, 9, 10, 11 }
                }
                ;
                else
                {
                    cateids = new int[] { 1, 11 }
                };

                for (int ix = 0; ix < cateids.Length; ix++)
                {
                    page       = 0;
                    maxrequest = 0;
                    do
                    {
                        //防止死循环
                        if (maxrequest > 20)
                        {
                            break;
                        }
                        maxrequest++;

                        HH.DelayedTime = Constants.DELAY_1SECONDS;
                        string content = HH.Get(string.Format("http://www.kaixin001.com/!rich/market.php?cateid={0}&start={1}", cateids[ix], page));

                        content = JsonHelper.GetMid(content, "<div class=\"list_zc\">", "<div class=\"tac mt30\">");
                        if (!ReadAssetsMarket(content, printMessage, ref page))
                        {
                            break;
                        }
                    }while (true);
                }
            }
        }