本帖最后由 阿哈 于 2009-12-25 02:10 编辑
f发扬共享精神,现分享 小小宇版QQ农场自己放草和加虫后可以自己杀虫除草的解决方法,修改后,自己放的草自己不能除,出现提示: 证据是不能毁灭的! ,和QQ农场的提示一样。
新修订基本应该可以使用,欢迎大家测试使用。
方法如下:
打开: /happyfarm/happyfarm.php
第一处修改: 除草检查
找到:
$query = $_SGLOBAL['db']->query( "SELECT Status,log,dog FROM ".tname( "happyfarm_nc" )." where uid=".intval( $_REQUEST['ownerId'] ) );
while ( $value = $_SGLOBAL['db']->fetch_array( $query ) )
{
$list[] = $value;
}
修改为:
$query = $_SGLOBAL['db']->query( "SELECT Status,log,dog,Weed FROM ".tname( "happyfarm_nc" )." where uid=".intval( $_REQUEST['ownerId'] ) );
while ( $value = $_SGLOBAL['db']->fetch_array( $query ) )
{
$list[] = $value;
}
$farm_weed = unserialize( $list[0][Weed] );
接着找到:
$f = $farm->farmlandstatus[$id]->f;
if ( $f > 0 )
{
$f -= 1;
$money += 2;
$exp += 2;
修改为:
$f = $farm->farmlandstatus[$id]->f;
if ( $f > 0 ){
//除草顺序 3\2\1
if ($farm_weed[$id][$f] == $UID) {
echo '{"code":0,"direction":"证据是不能毁灭的!","farmlandIndex":'.$id.',"poptype":1,"weed":'.$f.'}';
exit;
}
if ($farm_weed[$id][$f]) {
unset($farm_weed[$id][$f]);
}
$f -= 1;
$money += 2;
$exp += 2;
接着找到:
$farm_log = str_replace( "\\\"#009900\\\"", "\\\\\\\"#009900\\\\\\\"", $farm_log );
$_SGLOBAL['db']->query( "UPDATE ".tname( "happyfarm_nc" )." set Status='".$farm_srt."',log='".$farm_log."' where uid=".$_REQUEST['ownerId'] );
修改为:
$farm_log = str_replace( "\\\"#009900\\\"", "\\\\\\\"#009900\\\\\\\"", $farm_log );
$farm_weed_srt = serialize($farm_weed);
$_SGLOBAL['db']->query( "UPDATE ".tname( "happyfarm_nc" )." set Status='".$farm_srt."',log='".$farm_log."',Weed='$farm_weed_srt' where uid=".$_REQUEST['ownerId'] );
第二处修改:放草
找到 :
if ($_REQUEST['mod'] == "farmlandstatus" && $_REQUEST['act'] == "scatterSeed" ){
下面接着找:
$farm_Status = json_decode( $list[0][Status] );
$farm_log = json_decode( $list[0][log] );
$farm_weed = json_decode( $list[0][weed] );
修改为:
$farm_Status = json_decode( $list[0][Status] );
$farm_log = json_decode( $list[0][log] );
$farm_weed = (array)unserialize( $list[0][Weed] );
接着找到:
$code_temp = 1;
//unset($p[$UID]);
$farm_weed[$UID][] = $_SGLOBAL['timestamp'];
//$p[$UID]=(array)json_decode("");
$f += 1;
修改为:
$code_temp = 1;
$f += 1;
//unset($p[$UID]);
//$farm_weed[$UID][] = $_SGLOBAL['timestamp'];
//$id = 地块 $f= 从左到右 1\2\3
$farm_weed[$id][$f] = $UID;
找到:
$farm_log = str_replace( "\\\"#009900\\\"", "\\\\\\\"#009900\\\\\\\"", $farm_log );
$_SGLOBAL['db']->query( "UPDATE ".tname( "happyfarm_nc" )." set Status='".$farmarr_str."',log='".$farm_log."' where uid=".intval( $_REQUEST['ownerId'] ) );
修改为:
$farm_log = str_replace( "\\\"#009900\\\"", "\\\\\\\"#009900\\\\\\\"", $farm_log );
$farm_weed_str = serialize($farm_weed);
$_SGLOBAL['db']->query( "UPDATE ".tname( "happyfarm_nc" )." set Status='".$farmarr_str."',log='".$farm_log."',Weed='$farm_weed_str' where uid=".intval( $_REQUEST['ownerId'] ) );
以上除草的bug应该解决了。除虫的方法和以上类似,除虫的表列可以使用 pest ,其他方法应该是一样的。
未作更多验证,欢迎大家测试使用。
欢迎大家修改测试。 |