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

 找回密码
 立即注册
搜索

======SAM3.1版牧场好友、牧草为0的修改说明=========

[复制链接]
dansui1314 发表于 2010-1-17 21:42:26 | 显示全部楼层 |阅读模式
其实这两个问题都不是什么大问题!!!
好友列表的问题,你自己查找一下原来newmc.php的代码
找到if ( $_REQUEST['mmod'] == "friend" && $_REQUEST['mod'] == "common" )
从下面一行{开始
......中间省略代码若干.....
一直到
}
if ( $_REQUEST['mod'] == "cgi_get_Exp" )
复制中间的代码...
打开3.1版的newmc.php
找到if ( $_REQUEST['mod'] == "friend" )
然后自己看着替换里面的内容就可以了。。。

另外一个问题,牧草的问题
SAM现在的设置是,只要没加草就一直消耗
这个食量可能太大了一些!所以如果你很长时间没有加草的话,那么就会出现加个几百颗牧草还是为0的情况!
现在修改为这样,如果你没有加草,那么牧草的消耗只到动物成长到收获期
那么如果你很长时间没有加草的话,下次只要补足动物成长过程所需要的牧草即可!!
这个代码并非原创,经常来论坛的人应该知道是liuzhly放出来的,我只是放出来让一些不知道的人用!
查找3.1版newmc.php
找到
  1.                                 //*********************************************
  2.                                 $value->feedtime == null && $value->feedtime = $animal[animalfeedtime];
  3.                                 $needfood = ( $_SGLOBAL['timestamp'] - $value->feedtime ) / 3600 * $shop[$value->cId][consum] / 4;
  4.                                 if( $needfood <= $animal[animalfood] ){
  5.                                         $value->feedtime = $_SGLOBAL['timestamp'];
  6.                                         $animal[animalfood] -= $needfood;
  7.                                         $hungry = 0;
  8.                                 }else{
  9.                                         $value->feedtime += $animal[animalfood] * 4 / $shop[$value->cId][consum] * 3600;
  10.                                         $hungry = 1;
  11.                                         $animal[animalfood] = 0;
  12.                                 }
  13.                                 //*********************************************
复制代码
替换为
  1.                                 //*********************************************
  2.                                 $value->feedtime == null && $value->feedtime = $animal[animalfeedtime];
  3.                                 $value_feedtime = $_SGLOBAL['timestamp'] - $value->feedtime > $animaltime[$value->cId][5] ? $animaltime[$value->cId][5] : $_SGLOBAL['timestamp'] - $value->feedtime;
  4.                                 $needfood = $value_feedtime / 3600 * $shop[$value->cId][consum] / 4;
  5.                                 if( $needfood <= $animal[animalfood] ){
  6.                                         $value->feedtime = $_SGLOBAL['timestamp'];
  7.                                         $animal[animalfood] -= $needfood;
  8.                                         $hungry = 0;
  9.                                 }else{
  10.                                         $value->feedtime += $animal[animalfood] * 4 / $shop[$value->cId][consum] * 3600;
  11.                                         $hungry = 1;
  12.                                         $animal[animalfood] = 0;
  13.                                 }
  14.                                 //*********************************************
复制代码
一共有5处要改!!
回复

使用道具 举报

hs999 发表于 2010-1-17 22:26:01 | 显示全部楼层
回复

使用道具 举报

xiaolooo 发表于 2010-1-18 13:10:39 | 显示全部楼层
回复

使用道具 举报

老鼠有理想 发表于 2010-1-18 13:39:32 | 显示全部楼层
回复

使用道具 举报

changdaojun 发表于 2010-1-18 13:48:03 | 显示全部楼层
分析的很合理!兄弟 牛!
回复

使用道具 举报

w02080208 发表于 2010-1-19 13:59:08 | 显示全部楼层
顶起啊啊((em:06))
回复

使用道具 举报

jerrynet 发表于 2010-1-19 14:40:01 | 显示全部楼层
呵呵,真的非常不错的呢。
回复

使用道具 举报

szzzlong 发表于 2010-1-19 14:49:35 | 显示全部楼层
和那个大象裤衩有一拼
hy439709 发表于 2010-01-19 14:01



    我一直以为是犀牛~
回复

使用道具 举报

liuzhly 发表于 2010-1-19 16:08:13 | 显示全部楼层
本帖最后由 liuzhly 于 2010-01-19 16:11 编辑

我帮你补个完美的吧!!帮用户节省每一粒草!
顺便让楼上朋友看清大裤衩

  1. //*********************************************
  2.                         $value->feedtime == null && $value->feedtime = $animal[animalfeedtime];
  3.                         if( $_SGLOBAL['timestamp'] - $value->feedtime > $animaltime[$value->cId][5] ){
  4.                                 $value_feedtime = $animaltime[$value->cId][5];
  5.                                 $value->feedtime = $_SGLOBAL['timestamp'] - $animaltime[$value->cId][5];
  6.                         }else{
  7.                                 $value_feedtime = $_SGLOBAL['timestamp'] - $value->feedtime;
  8.                         }
  9.                         $needfood = $value_feedtime / 3600 * $shop[$value->cId][consum] / 4;
  10.                         if( $needfood <= $animal[animalfood] ){
  11.                                 $value->feedtime = $_SGLOBAL['timestamp'];
  12.                                 $animal[animalfood] -= $needfood;
  13.                                 $hungry = 0;
  14.                         }else{
  15.                                 $value->feedtime += round($animal[animalfood] * 4 / $shop[$value->cId][consum] * 3600);
  16.                                 $hungry = 1;
  17.                                 $animal[animalfood] = 0;
  18.                         }
  19. //*********************************************
复制代码
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-16 16:41 , Processed in 0.107934 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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