有很多版本声称已经解决问题,不过大家不要完全相信他们,要彻底自己检测一下才放心,我的下的程序版 ,用加速齿轮收自己的菜无法收了,但是可以用来偷好友的菜,哎............
现将方法原理解释一下:
运行变速齿轮打开IE ,打开农场 ,调整速度加快 自己植物成熟速度加快,几分钟后,作物成熟,(可在成熟前点击收获的手),点击收获,如果农场后台没有检测代码,那么就可以收获了!
同理,打开好友,同样方法,就可以偷取好友的蔬菜了,呵呵 .....
其实解决方法很简单,在后台 newfarmjson.php 文件,分别找到两处:
if ( $_REQUEST['mod'] == "farmlandstatus" && $_REQUEST['act'] == "harvest" )
$query = $_SGLOBAL['db']->query( "SELECT fruit,farmlandstatus,nosegay FROM ".tname( "plug_newfarm" )." where uid=".$_SGLOBAL['supe_uid'] );
while ( $value = $_SGLOBAL['db']->fetch_array( $query ) )
{
$list[] = $value;
}
$farmarr = json_decode( $list[0][farmlandstatus] );
$fruitarr = json_decode( $list[0][fruit] );
$nosegayarr = json_decode( $list[0][nosegay] );
看看下面有没有相关的
if ( $farmarr->farmlandstatus[$_REQUEST['place']]->j == 0 && $_SGLOBAL['timestamp'] - $farmarr->farmlandstatus[$_REQUEST['place']]->q < $cropstime[$farmarr->farmlandstatus[$_REQUEST['place']]->a][4] )
{
exit( );
}
if ( $farmarr->farmlandstatus[$_REQUEST['place']]->j > 0 && $_SGLOBAL['timestamp'] - $farmarr->farmlandstatus[$_REQUEST['place']]->q < $cropstime[$farmarr->farmlandstatus[$_REQUEST['place']]->a][4])
{
exit( );
}
这样的代码,上面变色的代码我看了一遍,汗了 ,真不懂这程序员想干什么,这么大些代码完全可以精简为:
if ($_SGLOBAL['timestamp'] - $farmarr->farmlandstatus[$_REQUEST['place']]->q < $cropstime[$farmarr->farmlandstatus[$_REQUEST['place']]->a][4]){ //防止变速器应用
echo "{\"farmlandIndex\":".$_REQUEST['place'].",\"code\":0,\"poptype\":1,\"direction\":\"\\u6B64\\u4F5C\\u7269\\u8FD8\\u6CA1\\u6709\\u6210\\u719F\\u5462\"}";
exit( );
}
这是我自己修改的,判断作物的季度无用,而且代码重复,让服务器重复判断两次,浪费资源,所以直接判断作物的时间是否达到成熟程度,如果没有成熟,提示:作物没成熟,呵呵,大家可以改成其他的!
另外,在另一出,是关于偷菜代码判断,找到
if ( $_REQUEST['mod'] == "farmlandstatus" && $_REQUEST['act'] == "scrounge" )
.........代码省略...........
if($dog_ok==0){
$cid = $farmarr->farmlandstatus[$_REQUEST['place']]->a;
$fruitarr->$cid = $fruitarr->$cid + 1;
$farmarr->farmlandstatus[$_REQUEST['place']]->m = $farmarr->farmlandstatus[$_REQUEST['place']]->m - 1;
if ( $farmarr->farmlandstatus[$_REQUEST['place']]->m < $farmarr->farmlandstatus[$_REQUEST['place']]->l )
{
exit( );
}
找找看有没有类似的防变速代码,如果没有,在其后面增加:
if ($_SGLOBAL['timestamp'] - $farmarr->farmlandstatus[$_REQUEST['place']]->q < $cropstime[$farmarr->farmlandstatus[$_REQUEST['place']]->a][4]){ //防止变速齿轮应用
echo "{\"farmlandIndex\":".$_REQUEST['place'].",\"code\":0,\"poptype\":1,\"direction\":\"\\u6B64\\u4F5C\\u7269\\u8FD8\\u6CA1\\u6709\\u6210\\u719F\\u5462\"}";
exit( );
}
解释:
$_SGLOBAL['timestamp'] 为系统时间 --减去---查询数据表中此作物的Q[Q的含义见下面说明]时间,得出的时间秒数,看看是否小于程序上面已定义好的此作物的成熟所需要的所有时间,如果小于,提示未成熟,退出。
个人说明:
我看了这些后台代码,看出广大网友的热心,稍微会点的人都在改进升级,但是朋友们,你们要注意,注意程序执行效率,我看程序代码,说心里话,那些代码并非专业程序员编写,虽然我也不是,但是大家可以查看代码分析一下,里面代码非常乱,能用 case 不用,能用elseif不用,偏偏要比如:
里面很多我举个例子,不要看内容,看判断:
foreach(){
if($type ==‘’){}
if($type ==‘’){}
if($type ==‘’){}
if($type ==‘’){}
if($type ==‘’){}
}
这样的语句很多,如果程序执行,那么循环一次,就得判断5次,如果将代码改进:
foreach(){
if($type ==‘’){}
elseif($type ==‘’){}
elseif($type ==‘’){}
elseif($type ==‘’){}
elseif($type ==‘’){}
}
或者用CASE。
这样,一个循环最多判断5此,最少的时候判断1次,虽然针对服务器来说,影响微乎其微,但是这服务器资源能节省就节省啊,人多就能看出服务器快慢了。
希望改程序的朋友们,替我们这些网友多想想,别完成功能就算了,还要优化,功能要建立在节省服务器资源基础上增加。
说这么多,希望朋友们别拍我,肺腑之言,改程序、论坛、社区已好多年,现在懒得只想吃白饭,嘿嘿....
开心农场数据字段farmlandstatus 各字母代表的含义
A:植物ID
B:地的状态,7代表枯萎,6代表存在,0代表空地
F:草
G:虫子
H:干旱
I:杀大虫(用户ID与时间记录)
J:判断农作物生长季度
K:产量
L:剩余数量比较值(阀值)
M:当前剩余数量
N:偷菜人的ID,如果存在就不让偷了
O:用于施肥判断,放置反复施肥
P:ACTION
Q:此阶段种植时间逐渐减小,等到与R的差值在程序定义范围后就升为另一阶段(PLANTIME),以此时间段判断成熟
R:种植时间(UPDATETIME)
S:大虫子
T:虫子当前血量
U:虫子总血量 |