Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

====开心农场====农场除虫次数满100次赠送2袋普通化肥~~~

[复制链接]
iamxyh 发表于 2010-1-22 01:36:02 | 显示全部楼层 |阅读模式
UCHome插件
语言编码: GBK简体 
插件名称:
插件作者:
适用版本: UCHome 2.0
本帖最后由 iamxyh 于 2010-01-22 01:39 编辑

启用经验上限之后,部分农田的虫子和草没人清理,为增加除虫的积极性,参照liuzhly的帖子(====开心农场====关于升级奖励优化方法及说明https://discuz.dismall.com/viewthread.php?tid=1543631)及山姆的3.1版农场,增加此礼包。下面是截图:

Snap1.jpg



具体修改如下:
1、新增字段pest,int(10),默认为值0。
2、修改代码:红色为修改或新增的,请对照自己的程序修改,不要照搬。
if ( $_REQUEST['mod'] == "farmlandstatus" && $_REQUEST['act'] == "spraying" )
{
               $farm = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT farmlandstatus FROM ".tname( "plug_newfarm" )." where uid=".intval( $_POST['ownerId'] ) ), 0 );
                $query = $_SGLOBAL['db']->query( "SELECT pest,fertilizer,username FROM ".tname( "plug_newfarm" )." where uid=".$_SGLOBAL['supe_uid'] );
               while ( $value = $_SGLOBAL['db']->fetch_array( $query ) )
                 {
                       $list[] = $value;
                  }
                  $fertilizer = json_decode( $list[0][fertilizer] );        
                  $pest=$list[0][pest];

                  $farm = json_decode( $farm );
                  $money = 0;
                  $qlscj=6;
                  $getExp=0;
。。。
{省略若干代码}
。。。

      $farm->farmlandstatus[$_REQUEST['place']]->i=$killer;        
        $farm_srt = json_encode( $farm );        
        $levelup_arr="false";
        if ( $pest > 100 ){
                $putonghuafei = 1;
                $fertilizer->$putonghuafei = $fertilizer->$putonghuafei + 2;
                $fertilizer = json_encode( $fertilizer );
                $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set fertilizer='".$fertilizer."',pest=pest-100 where uid=".$_SGLOBAL['supe_uid'] );               
                $levelup_arr="{\"title\":\"\\u9664\\u866B\\u5956\\u52B1\",\"eDesc\":\"".unicode_encodegb( $list[0][username] )."\\uFF0C\\u4F60\\u70ED\\u5FC3\\u5E2E\\u52A9\\u5927\\u5BB6\\u9664\\u866B\\u5DF2\\u7D2F\\u8BA1100\\u6B21\\uFF0C\\u5956\\u52B1\\u4F602\\u888B\\u666E\\u901A\\u5316\\u80A5\\u54E6\\uFF0C\\u5FEB\\u5230\\u80CC\\u5305\\u91CC\\u770B\\u770B\\u5427\\u3002\",\"item\":[{\"eType\":\"3\",\"eParam\":\"1\",\"eNum\":\"2\",\"name\":\"\\u666e\\u901a\\u5316\\u80a5\"}],\"level\":1}";
        }

                if($_REQUEST['tId']==6){
                        $fertilizer = json_encode( $fertilizer );
                        $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set fertilizer='".$fertilizer."' where uid=".$_SGLOBAL['supe_uid'] );
                }
                if ( intval( $_POST['ownerId'] ) == $_SGLOBAL['supe_uid'] )
                {
                        if ($getExp==0){$money=0;}
                        $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+".$money.",exp=exp+".$getExp.",farmlandstatus='".$farm_srt."',pest=pest+1 where uid=".$_SGLOBAL['supe_uid'] );
                        if($farm->farmlandstatus[$_REQUEST['place']]->s==0){
                                $direction = "";
                        }else{
                                $direction = "\\u5927\\u866b\\u5b50\\u5f88\\u5389\\u5bb3\\uff0c\\u5feb\\u627e\\u597d\\u53cb\\u5e2e\\u5fd9\\u3002";//大虫子很厉害,快找好友帮忙。
                        }
                }else{
                        $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set farmlandstatus='".$farm_srt."' where uid=".intval( $_POST['ownerId'] ) );
                        if ($getExp==0){$money=0;}
                        $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set money=money+".$money.",exp=exp+".$getExp.",pest=pest+1 where uid=".$_SGLOBAL['supe_uid'] );
                        if($farm->farmlandstatus[$_REQUEST['place']]->s==0){
                                $direction = "\\u8C22\\u8C22\\u4F60\\uFF0C\\u5927\\u866B\\u6E05\\u9664\\u5E72\\u51C0\\u4E86\\uFF01";//谢谢你,大虫清除干净了!
                }else{
                                $direction = "\\u5927\\u866b\\u5b50\\u5f88\\u5389\\u5bb3\\uff0c\\u5feb\\u627e\\u597d\\u53cb\\u5e2e\\u5fd9\\u3002";//大虫子很厉害,快找好友帮忙。
               }
          }
               
                echo "{\"tId\":".$_REQUEST['tId'].",\"farmlandIndex\":".$_REQUEST['place'].",\"code\":1,\"poptype\":1,\"direction\":\"".$direction."\",\"money\":".$money.",\"exp\":".$getExp.",\"levelUp\":".$levelup_arr.",\"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\":".json_encode( $farm->farmlandstatus[$_REQUEST['place']]->i )."}";
}
回复

使用道具 举报

kazzak 发表于 2010-1-22 07:51:21 | 显示全部楼层
沙发啊,支持,衣钵?
回复

使用道具 举报

朋友窝 发表于 2010-1-22 09:00:22 | 显示全部楼层
这个不敢动,因为你的代码,与sam的代码有区别
回复

使用道具 举报

无-痕 发表于 2010-1-22 09:10:37 | 显示全部楼层
前来顶贴!!!!!!!前来顶贴!!!!!!!
回复

使用道具 举报

 楼主| iamxyh 发表于 2010-1-22 09:41:39 | 显示全部楼层
这个不敢动,因为你的代码,与sam的代码有区别
朋友窝 发表于 2010-01-22 09:00


是的,我修改的也很多,用的是fbean的版本。
回复

使用道具 举报

hs999 发表于 2010-1-22 10:16:39 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-10-21 07:31 , Processed in 0.128149 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表