论坛宠物forD4正式版
经过若干修改,终于基本成型演示见本站[url]http://www.9232.org/pet.php[/url]
下拉菜单装的是小F的下拉菜单,我的坛子有,大家可以下,压缩包里我就不改了,注:压缩包里的下拉菜单无效,大家不要用
图片包下载地址:[url]http://www.hotcz.com/images.rar[/url](借泓村的空间放的,感谢昏鸦)
文件包是我论坛文件打压而成,是最新版的,有问题请提出,我将力能所及的解答.
[color=Blue]
关于下一个版本的说明,由于我论坛的宠物被我修改的太多,与我论坛的其它插件(俱乐部,广告中心,打工等)结合起来了,因为考虑到了论坛负载能力又增加了杀怪体力值的消耗,所以无法放出,不然大家安装会出错的,等我有时间的话,重新整理一下,把结合的部分代码去除再说吧.[/color]
[color=Red]重要更新[/color]
[quote]
在weaponshop.php文件中找
[code]if ($petmoney<$totalmoney) {showmessage('你没有那么多钱购买这些物品[/code]
在上面有这么两行:
[code]$petmoney=$usermoney;
$totalmoney=intval($totalmoney*$discount);
[/code]
改为
[code]$petmoney=floor($usermoney);
$totalmoney=floor($totalmoney*$discount);
[/code]
在itemshop.php文件中找
[code]if ($petmoney<$totalmoney) {showmessage('你没有那么多钱购买这些物品[/code]
在上面有这么两行:
[code]$petmoney=$usermoney;
$totalmoney=intval($totalmoney*$discount);
[/code]
改为
[code]$petmoney=floor($usermoney);
$totalmoney=floor($totalmoney*$discount);
[/code]
这个问题主要是PHP函数问题,当时未考虑到这个问题,[/quote]
装备能当药吃的BUG
itemuse.php
找
[code]$query = $db->query("SELECT A.id,A.itemtype,A.itemnum,A.itemplus,B.itemname,B.itemtext,B.itemlevel FROM {$tablepre}mypetpacket A,{$tablepre}mypetitemdata B WHERE A.username='$discuz_user' And A.id ='$itemid' And A.itemtype =B.itemtype AND A.deleted<>1 order by A.itemtype,A.id ;");[/code]
替换成
[code]$query = $db->query("SELECT A.id,A.itemtype,A.itemnum,A.itemplus,B.itemname,B.itemtext,B.itemlevel,B.trade FROM {$tablepre}mypetpacket A,{$tablepre}mypetitemdata B WHERE A.username='$discuz_user' And A.id ='$itemid' And A.itemtype =B.itemtype AND A.deleted<>1 order by A.itemtype,A.id ;");[/code]
在
[code]if(!$itemdata=$db->fetch_array($query)){ showmessage("道具使用失败!!","pet.php?index=$returl"); } [/code]
下加:
[code] if(strpos($itemdata['trade'],"useable")===false) showmessage("此物品不可使用!!","pet.php?index=$returl");[/code] 在首面显示运作
在actions.lang.php里面适当位置加上
221 => '社区宠物',
就行了,注意排序 在个人资料中显示宠物数据forD4
演示:本站
经本人测试通过,如有问题请大家指正
修改viewthread.php:
查找:
[code]
m.email, m.gender, m.showemail
[/code]
在后面添加:
[code]
,b.mypetname,b.mypet,b.mypetname,b.mypetlevel,b.mypetdead,b.openpk,b.mypethp,b.mypetsp,b.mypetexp,b.mypetsex,b.mypetsx
[/code]
查找:
[code]
LEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid
[/code]
在下面添加:
[code]
LEFT JOIN $tablepre"."mypetdata b ON b.username=p.author
[/code]
查找:
[code]
$post['dateline'] = gmdate("$dateformat $timeformat", $post['dateline'] + $timeoffset * 3600);
[/code]
在下面添加:
[code]
$post[petpic]=$post[mypetname];
$petnowexp=$post[mypetexp];
$post[mypetlevel] = floor(sqrt(sqrt($petnowexp)));
$petlevel = $post[mypetlevel] ;
$post[picdisplay] = intval($post[mypetlevel]/10);
if ($post[picdisplay]>10){$post[picdisplay]=11;}
$petnextlvexp = pow($petlevel+1,4);
[/code]
修改 templates/viewthread.htm
查找:
[code]
{lang online_status} {lang offline}
<!--{/if}-->
<!--{/if}-->
[/code]
在下面添加:
[code]
<!--{if $post[mypet]}-->
<br><br>
<div align="center">
<table width='120'>
<b>宠物资料:</b><br>
</table>
<table width='150' border="1" cellpadding="9">
<tr rowspan="2"><td><div align="center"><!--{if $post[mypetdead]==1 or $post[mypetdead]==2}--><img src='images/pet/$post[petpic]/$post[petpic].$post[picdisplay].gif' style=filter:GRAY><!--{else}--><img src='images/pet/$post[petpic]/$post[petpic].$post[picdisplay].gif'><!--{/if}--></div></td></tr>
<td>
<span class="smalltxt">
名称:$post[mypet]<br>
性别:<!--{if $post[mypetsex]==1}-->雄<!--{else}-->雌<!--{/if}--><br>
级别:$post[mypetlevel]<br>
属性:$post['mypetsx']<br>
状态:<!--{if $post[mypetdead]==0}-->生存<!--{elseif $post[mypetdead]==1}-->死亡<!--{else}-->封印<!--{/if}--><br>
战斗:<!--{if $post['openpk']<2 && $post['mypethp']>0 && $post['mypetsp']>0}--><a href="pet.php?index=petbattle&atkname=$post[username]&action=atkpet" target="_blank"><b>等待挑战</b></a><!--{else}-->拒绝挑战<!--{/if}--><br>
<div align="left">
</span></td></table></div>
<!--{/if}-->
[/code] [color=Red][size=4]关于发贴回贴加经验[/size][/color]
发新贴加宠物经验
在include/newthread.inc.php中末尾
[code]
showmessage('post_newthread_succeed', "viewthread.php?tid=$tid&extra=$extra");
[/code]
的上面加入
[code]
$db->query("UPDATE {$tablepre}mypetdata SET mypetexp= mypetexp+300 WHERE username='$discuz_user' and mypetdead <1 ");
[/code]
本例是发新贴+300经验 具体数值可自行修改,本例死亡的状态下不加经验,要想去掉这个条件去掉 mypetdead <1
回贴加经验需要修改include/newreply.php
在include/newthread.inc.php中末尾
[code]
!$allowuseblog || empty($isblog) ? showmessage('post_reply_succeed', "viewthread.php?tid=$tid&pid=$pid&page=".(@ceil(($thread['replies'] + 2) / $ppp))."&extra=$extra#pid$pid") :
[/code]
的上面加入
[code]
$db->query("UPDATE {$tablepre}mypetdata SET mypetexp= mypetexp+200 WHERE username='$discuz_user' and mypetdead <1 ");
[/code]
本例是回贴+200经验 具体数值可自行修改,本例死亡的状态下不加经验,要想去掉这个条件去掉 mypetdead <1
[color=Red]修正会员利用反复发贴删贴刷宠物经验的BUG[2006.01.08更新][/color]
在editpost.inc.php
中找到
[code]
$db->query("DELETE FROM {$tablepre}polls WHERE tid='$tid'", 'UNBUFFERED');
[/code]
在下面加
[code]
$db->query("UPDATE {$tablepre}mypetdata SET mypetexp= mypetexp-300 WHERE username='$discuz_user'");
[/code]
找到
[code]
(!empty($delete) && $isfirstpost) ? showmessage('post_edit_delete_succeed', "forumdisplay.php?fid=$fid") :
[/code]
在下面加
[code]
$db->query("UPDATE {$tablepre}mypetdata SET mypetexp= mypetexp-200 WHERE username='$discuz_user'");
[/code] 删贴减少宠物经验
修改topicadmin.php文件
找
[code] if($uidarray) {
updatepostcredits('-', $uidarray, array());
}
if($tuidarray) {
updatepostcredits('-', $tuidarray, $postcredits);
[/code]
在后面加
[code]
$db->query("UPDATE {$tablepre}mypetdata SET mypetexp= mypetexp-300 WHERE username='$discuz_user'");
[/code]
找
[code] if($uidarray) {
updatepostcredits('-', $uidarray, array());
}
if($puidarray) {
updatepostcredits('-', $puidarray, $replycredits);
[/code]
在后面加
[code]
$db->query("UPDATE {$tablepre}mypetdata SET mypetexp= mypetexp-200 WHERE username='$discuz_user'");
[/code] 在帖子里显示失败啊! 我怎么总安装错啊 我没有搞错啊?怎么不让下??? 修正会员利用反复发贴删贴刷宠物经验的BUG[2006.01.08更新]
在editpost.inc.php
中找到
$db->query("DELETE FROM {$tablepre}polls WHERE tid='$tid'", 'UNBUFFERED');
找到了两个,要加在那个上面??
第二个 最高等級 , 打怪經驗..如何增加 ddddddd 问下哈~
那个发帖回帖增加经验~
偶现在改成发帖+500
回帖+300
在初期还好拉~
8过当小宠等级愈高~
发的帖子要更多才行哦~
小宠到80级的话~
差不多要7000帖呢~
汗~MS不可能的任务哦~
能不能修正一下哈~
当等级提高时~发帖的经验值也随之适当的增加~ 再问一下~
为虾米偶尔有会员碰到这种情况
明明宠物死掉了
使用了多次的复活药还是显示死亡
但是依旧可以进升级
就是不能打怪 支持!!
论坛宠物和PHPWIND里面有什么不同?? 老大 为什么我 装上这个版本的宠物
买道具装备什么的都是买的总是双倍的 钱也是扣双倍的 为什么啊
我论坛里的会员都疯了 只喊还钱~ 好!看看! 为什么宠物名字显示的是???? 更新到4.1 了. 这个宠物好象无法安装啊~~~ 怎么我的1连接我的宠物或其他都会.
Discuz! info: MySQL Query Error
User: 兔仔
Time: 2006-3-4 10:33pm
Script: /bbs/plugin.php
SQL: SELECT * FROM cdb_mypetdata WHERE username='兔仔';
Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (gbk_chinese_ci,COERCIBLE) for operation '='
Errno.: 1267
Similar error report has beed dispatched to administrator before. ,,,,,,,,,,,,,,,,,,,,,