本帖最后由 kufun 于 2009-11-8 00:45 编辑
每日经验上限,由fbean提供
一.找到
- include_once( "../common.php" );
复制代码 在这句上面加
- function getExpVerify($db,$uid){
- $query = $db->query( "SELECT exp,expLimit FROM ".tname( "plug_newfarm" )." where uid=".$uid );
- while ( $value = $db->fetch_array( $query ) )
- {
- $list[] = $value;
- }
- $addExp=2; //调整浇水、杀虫、除草经验
- $dt=date('Y'.'z');
- $exp=$list[0][exp];
- $explit=$list[0][expLimit];
- $lv=0;
- if($exp<4200){
- $lv=1;
- }elseif($exp<13200){
- $lv=2;
- }elseif($exp<27200){
- $lv=3;
- }elseif($exp<46200){
- $lv=4;
- }elseif($exp<70200){
- $lv=5;
- }else{
- $lv=6;
- }
- if($explit==null || $explit==""){
- $db->query( "UPDATE ".tname( "plug_newfarm" )." set expLimit='".$dt.",".$addExp."' where uid=".$uid );
- return $addExp;
- }else{
- $rtnexp=0;
- $expLimit = explode(",",$list[0][expLimit]);
- if($expLimit[0]==$dt){
- if($expLimit[1]==$lv*150){
- return 0;
- }elseif($expLimit[1]+$addExp>$lv*150){
- $rtnexp=$lv*150-$expLimit[1];
- $expLimit[1]=$lv*150;
- }else{
- $rtnexp=$addExp;
- $expLimit[1]=$expLimit[1]+$addExp;
- }
- $db->query( "UPDATE ".tname( "plug_newfarm" )." set expLimit='".implode(",", $expLimit)."' where uid=".$uid );
- return $rtnexp;
- }else{
- $db->query( "UPDATE ".tname( "plug_newfarm" )." set expLimit='".$dt.",".$addExp."' where uid=".$uid );
- return $addExp;
- }
- }
- }
复制代码 二,找到
- if ( $farm->farmlandstatus[$_REQUEST['place']]->f == 0 )
复制代码 在这句上面加
- $getExp=getExpVerify($_SGLOBAL['db'],$_SGLOBAL['supe_uid']);
复制代码 这句有三个地方相同的,这是从最上面向下查找的第二处,第一处忽略
三,找到- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+2,farmlandstatus='".$farm_srt."' where uid=".$_SGLOBAL['supe_uid'] );
复制代码 改为- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+".$getExp.",farmlandstatus='".$farm_srt."' where uid=".$_SGLOBAL['supe_uid'] );
复制代码 四,找到- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+2 where uid=".$_SGLOBAL['supe_uid'] );
复制代码 改为- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+".$getExp." where uid=".$_SGLOBAL['supe_uid'] );
复制代码 五,找到- echo "{"tId":0,"farmlandIndex":".$_REQUEST['place'].","code":1,"poptype":1,"direction":"".$direction."","money":2,"exp":2,"levelUp":false,"humidity":".$farm->farmlandstatus[$_REQUEST['place']]->h.","pest":".$farm->farmlandstatus[$_REQUEST['place']]->g.","weed":".$farm->farmlandstatus[$_REQUEST['place']]->f.","pId":".$farm->farmlandstatus[$_REQUEST['place']]->s.","nph":".$farm->farmlandstatus[$_REQUEST['place']]->t.","mph":".$farm->farmlandstatus[$_REQUEST['place']]->u.","killer":[]}";
复制代码 改为- echo "{"tId":0,"farmlandIndex":".$_REQUEST['place'].","code":1,"poptype":1,"direction":"".$direction."","money":2,"exp":".$getExp.","levelUp":false,"humidity":".$farm->farmlandstatus[$_REQUEST['place']]->h.","pest":".$farm->farmlandstatus[$_REQUEST['place']]->g.","weed":".$farm->farmlandstatus[$_REQUEST['place']]->f.","pId":".$farm->farmlandstatus[$_REQUEST['place']]->s.","nph":".$farm->farmlandstatus[$_REQUEST['place']]->t.","mph":".$farm->farmlandstatus[$_REQUEST['place']]->u.","killer":[]}";
复制代码 六,找到- if ( intval( $_REQUEST['ownerId'] ) == $_SGLOBAL['supe_uid'] )
复制代码 这句上面加- $getExp=getExpVerify($_SGLOBAL['db'],$_SGLOBAL['supe_uid']);
复制代码 这句有三个地方相同的,这是从最上面查找下来的第三处,第一处忽略
七,找到- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+2,farmlandstatus='".$farm_srt."' where uid=".$_SGLOBAL['supe_uid'] );
复制代码 改为- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+".$getExp.",farmlandstatus='".$farm_srt."' where uid=".$_SGLOBAL['supe_uid'] );
复制代码 八,找到- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+2 where uid=".$_SGLOBAL['supe_uid'] );
复制代码 改为- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+".$getExp." where uid=".$_SGLOBAL['supe_uid'] );
复制代码 九,找到- echo "{"tId":0,"farmlandIndex":".$_REQUEST['place'].","code":1,"poptype":1,"direction":"".$direction."","money":2,"exp":2,"levelUp":false,"humidity":".$farm->farmlandstatus[$_REQUEST['place']]->h.","pest":".$farm->farmlandstatus[$_REQUEST['place']]->g.","weed":".$farm->farmlandstatus[$_REQUEST['place']]->f.","pId":".$farm->farmlandstatus[$_REQUEST['place']]->s.","nph":".$farm->farmlandstatus[$_REQUEST['place']]->t.","mph":".$farm->farmlandstatus[$_REQUEST['place']]->u.","killer":[]}";
复制代码 改为- echo "{"tId":0,"farmlandIndex":".$_REQUEST['place'].","code":1,"poptype":1,"direction":"".$direction."","money":2,"exp":".$getExp.","levelUp":false,"humidity":".$farm->farmlandstatus[$_REQUEST['place']]->h.","pest":".$farm->farmlandstatus[$_REQUEST['place']]->g.","weed":".$farm->farmlandstatus[$_REQUEST['place']]->f.","pId":".$farm->farmlandstatus[$_REQUEST['place']]->s.","nph":".$farm->farmlandstatus[$_REQUEST['place']]->t.","mph":".$farm->farmlandstatus[$_REQUEST['place']]->u.","killer":[]}";
复制代码 十,找到- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+2,farmlandstatus='".$farm_srt."' where uid=".$_SGLOBAL['supe_uid'] );
复制代码 改为- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+".$getExp.",farmlandstatus='".$farm_srt."' where uid=".$_SGLOBAL['supe_uid'] );
复制代码 十一,找到- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+2 where uid=".$_SGLOBAL['supe_uid'] );
复制代码 改为- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+2,exp=exp+".$getExp." where uid=".$_SGLOBAL['supe_uid'] );
复制代码 十二,找到- echo "{"tId":0,"farmlandIndex":".$_REQUEST['place'].","code":1,"poptype":1,"direction":"".$direction."","money":2,"exp":2,"levelUp":false,"humidity":".$farm->farmlandstatus[$_REQUEST['place']]->h.","pest":".$farm->farmlandstatus[$_REQUEST['place']]->g.","weed":".$farm->farmlandstatus[$_REQUEST['place']]->f.","pId":".$farm->farmlandstatus[$_REQUEST['place']]->s.","nph":".$farm->farmlandstatus[$_REQUEST['place']]->t.","mph":".$farm->farmlandstatus[$_REQUEST['place']]->u.","killer":[]}";
复制代码 改为- echo "{"tId":0,"farmlandIndex":".$_REQUEST['place'].","code":1,"poptype":1,"direction":"".$direction."","money":2,"exp":".$getExp.","levelUp":false,"humidity":".$farm->farmlandstatus[$_REQUEST['place']]->h.","pest":".$farm->farmlandstatus[$_REQUEST['place']]->g.","weed":".$farm->farmlandstatus[$_REQUEST['place']]->f.","pId":".$farm->farmlandstatus[$_REQUEST['place']]->s.","nph":".$farm->farmlandstatus[$_REQUEST['place']]->t.","mph":".$farm->farmlandstatus[$_REQUEST['place']]->u.","killer":[]}";
复制代码 添加字段expLimit,进数据库执行SQL- ALTER TABLE `uchome_plug_newfarm` ADD COLUMN `expLimit` VARCHAR(30) NOT NULL DEFAULT ''
复制代码 |