时间:10-04-17
大致功能有:
1。我的资料,查看我的等级,经验,金钱等信息
2。我的农场:可以查看我的农场信息,种了哪些作物,什么时候成熟
3。我的仓库,可以浏览仓库里的物品,并可以卖掉
4。我的背包:可以浏览背包里的东西,并可以自动播铲(没用的种子种了马上铲掉又种获取经验)
5。我的装饰:查看我购买的所有装饰
6。商店:可以购买全部值得购买的装饰用品(没2点经验需要120块以内的装饰)
7。日志:偷窃日志,刷新日志,被狗咬日志等等
8。设置:可以按自己需要设置一些自动除草之类的东西
9。手机控制:可以利用手机短信警报你出入验证码,然后手机通过wap网站浏览验证码图片,输入验证码。(这样即使人不在电脑前,也可以用手机输入验证码了)
c#代码片段:
view plaincopy to clipboardprint?
//得到所有好友列表的c#代码:
public static int getFriendList()
{
string url = "http://happyfarm.qzone.qq.com/api.php?mod=friend";
Program.allFriend.Clear();
Program.mainFrm.myFriendList.Items.Clear();
try
{
int curTime = com.sourceware.util.DateUtil.getCurTime();//得到当前时间;
String s = "sdoit78sdopig7w34057";
int yushu = curTime % 10;
s = s.Substring(yushu, 20 - yushu);
String farmKey = com.sourceware.util.MD5Util.MD5(curTime + s);
//以上是生成farmKey
System.Net.WebClient wc = new System.Net.WebClient();
string uin = com.sourceware.util.IniProperties.getValue("login", "uin");
string skey = com.sourceware.util.IniProperties.getValue("login", "skey");
string login_time = com.sourceware.util.IniProperties.getValue("login", "login_time");
wc.Headers.Add(System.Net.HttpRequestHeader.Cookie, "uin=" + uin + ";skey=" + skey + ";login_time=" + login_time);
//以上是session值,每次提交必须把这3个参数放到cookie当中提交。
System.Collections.Specialized.NameValueCollection coll = new System.Collections.Specialized.NameValueCollection();
coll.Add("user", "true");
coll.Add("farmTime", "" + curTime);
coll.Add("farmKey", farmKey.ToLower());
coll.Add("refresh", "true");
//以上是得到好友列表必须post的参数
byte[] b = wc.UploadValues(url, coll);
ServerUtil.trickConnect2server();
String result = System.Text.Encoding.UTF8.GetString(b);
//得到服务器返回的内容,为 json格式,可以用json4net分析它;
return 0;
}catch (Exception ex)
{
log.Error(ex.Message + ex.StackTrace);
return -2;
}
}
//得到所有好友列表的c#代码:
public static int getFriendList()
{
string url = "http://happyfarm.qzone.qq.com/api.php?mod=friend";
Program.allFriend.Clear();
Program.mainFrm.myFriendList.Items.Clear();
try
{
int curTime = com.sourceware.util.DateUtil.getCurTime();//得到当前时间;
String s = "sdoit78sdopig7w34057";
int yushu = curTime % 10;
s = s.Substring(yushu, 20 - yushu);
String farmKey = com.sourceware.util.MD5Util.MD5(curTime + s);
//以上是生成farmKey
System.Net.WebClient wc = new System.Net.WebClient();
string uin = com.sourceware.util.IniProperties.getValue("login", "uin");
string skey = com.sourceware.util.IniProperties.getValue("login", "skey");
string login_time = com.sourceware.util.IniProperties.getValue("login", "login_time");
wc.Headers.Add(System.Net.HttpRequestHeader.Cookie, "uin=" + uin + ";skey=" + skey + ";login_time=" + login_time);
//以上是session值,每次提交必须把这3个参数放到cookie当中提交。
System.Collections.Specialized.NameValueCollection coll = new System.Collections.Specialized.NameValueCollection();
coll.Add("user", "true");
coll.Add("farmTime", "" + curTime);
coll.Add("farmKey", farmKey.ToLower());
coll.Add("refresh", "true");
//以上是得到好友列表必须post的参数
byte[] b = wc.UploadValues(url, coll);
ServerUtil.trickConnect2server();
String result = System.Text.Encoding.UTF8.GetString(b);
//得到服务器返回的内容,为 json格式,可以用json4net分析它;
return 0;
}catch (Exception ex)
{
log.Error(ex.Message + ex.StackTrace);
return -2;
}
}
java代码片段:
view plaincopy to clipboardprint?
// 得到好友列表;
public List getFriendList() {
String url = "http://happyfarm.qzone.qq.com/api.php?mod=friend";
try {
String login_time = ConfigProperties.getProperty("login_time");
String skey = ConfigProperties.getProperty("skey");
String _s_ = ConfigProperties.getProperty("_s_");
String uin = ConfigProperties.getProperty("uin");
HttpClient hc = new HttpClient();
// 创建GET方法的实例
GetMethod getMethod = new GetMethod(url);
//
getMethod.addRequestHeader("Accept", "*/*");
getMethod
.addRequestHeader(
"User-Agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; 360SE)");
getMethod.addRequestHeader("Accept-Encoding", "gzip, deflate");
getMethod.addRequestHeader("Accept-Language", "zh-CN");
getMethod.addRequestHeader("Connection", "Keep-Alive");
getMethod.addRequestHeader("Pragma", "no-cache");
hc.getState().clearCookies();
//
String cookies = "1" + "; _s_=" + _s_ + "; uin=" + uin + "; skey="
+ skey + "; login_time=" + login_time;
hc.getState().addCookie(
new Cookie("happyfarm.qzone.qq.com", "jump", cookies, "/",
new Date(2011, 12, 8), false));
// 执行getMethod
int statusCode = hc.executeMethod(getMethod);
String result = getMethod.getResponseBodyAsString();
if (result.startsWith("{/"errorType/":/"session/",")) {
logger.error(result);
return null;
}
List list = new ArrayList();
JSONArray jj = JSONArray.fromObject(result);
Iterator it = jj.iterator();
while (it.hasNext()) {
Object o = it.next();
JSONObject ja = JSONObject.fromObject(o);
int userID = ja.getInt("userId");
String userName = ja.getString("userName");
logger
.debug("userid[" + userID + "]username[" + userName
+ "]");
FriendInfo fi = new FriendInfo();
fi.setId(userID);
fi.setName(userName);
list.add(fi);
if (RobotMain.myuserid == 0) {
RobotMain.myuserid = userID;
RobotMain.myname = userName;
logger.info("我自己的userid=" + userID);
}
}
return list;
} catch (Exception e) {
logger.error(e, e);
}
return null;
C#开发QQ农场外挂实践
最新推荐文章于 2025-10-26 14:48:50 发布
本文介绍了一个针对QQ农场的游戏辅助工具,该工具提供了多种实用功能,包括查看个人信息、管理农场作物及仓库物品等,并详细展示了使用C#和Java实现的好友列表获取功能。
861

被折叠的 条评论
为什么被折叠?



