- UID
- 1
- 最後登錄
- 1970-1-1
- 精華
- 閱讀權限
- 200
- 積分
- 11536
- 金錢
- 元
- 威望
- 點
- 貢獻
- 點
|
樓主 |
發表於 2008-6-13 13:25:38
|
顯示全部樓層
全新安装寵物貼內顯示
需要更改的檔:
viewthread.php
templates/default/viewthread.htm (或你的風格檔)
一、viewthread.php 文件
1、查找在其後面緊跟著插入- , pd.petname, pd.mypetpic, pd.pettype, pd.mypetjob, pd.mypetlevel, pd.mypetexp, pd.mypethp, pd.mypetmaxhp, pd.mypetsp, pd.mypetmp, pd.mypetmaxmp, pd.mypetgood, pd.mastername
複製代碼 2、查找- LEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid
複製代碼 在其下面插入- LEFT JOIN {$tablepre}wxpetdata pd ON pd.username=m.username
複製代碼 3、查找- if(!$newpostanchor && $post['dateline'] > $lastvisit) {
複製代碼 在其上面插入- // 寵物數據>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- if($post['petname']!=''){
- $petjob = $post['mypetjob'];
- $petlevel= $post['mypetlevel'];
- $levelpic = ($petlevel/50)>11?11:intval($petlevel/50);
- if ($petjob == 0 or ($petjob <=3 && $petlevel < 200) or $post['mypetpic']=='') {
- $post['petpic'] = "<img src=wxpet/images/pet/$post[pettype]/$post[pettype]$levelpic.gif border=0>";
- } else {
- $post['petpic'] = "<img src=$post[mypetpic] border=0>";
- }
-
- $petlevelfloor = pow (log10 (ceil($post['mypetexp']/ ($petjob * 0.2 + 1))), 3);
- $epf=intval (100 * ($petlevelfloor - intval ($petlevelfloor)));
- $hpf = floor (100 * ($post['mypethp'] / $post['mypetmaxhp']));
- $mpf = $post['mypetmaxmp']?(floor (100 * ($post['mypetmp'] / $post['mypetmaxmp']))):0;
- $spf = floor (100 * ($post['mypetsp'] / 5000)) - 1;
- $post['epf']=$epf>97?97:$epf;
- $post['hpf']=$hpf>97?97:$hpf;
- $post['mpf']=$mpf>97?97:$mpf;
- $post['spf']=$spf>97?97:$spf;
-
- $post['petdead']=($post['mypetsp'] && $post['mypethp'])?'生存':'死亡';
- if($post['mastername']==''){
- $post['mastername'] = "<font color=#aaaaaa>無</font>";
- }else{
- $post['mastername'] = "<a href='pet.php?index=viewpet&username=".rawurlencode($post['mastername'])."'>$post[mastername]</a>";
- }
- $petgood = $post['mypetgood'];
- if ($petgood >= 100) {
- $post['love'] = "死忠";
- }elseif($petgood >=50) {
- $post['love']="忠誠";
- }elseif($petgood >= -50) {
- $post['love'] = "猜疑";
- }elseif($petgood > -100) {
- $post['love'] = "厭惡";
- }else{
- $post[love] = "<font color=red>不鳥!</font>";
- }
- }
- //寵物數據<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<
複製代碼 二. 修改 viewthread.htm
查找:- <script type="text/javascript">zoomstatus = parseInt($zoomstatus);</script>
複製代碼 在其下面插入- <script type="text/javascript">
- function showpetinfo(obj,s){
- if(document.getElementById(obj).style.display=='none'){
- document.getElementById(obj).style.display='block';
- document.getElementById(s).innerHTML='[<font color=darkgreen>隱藏寵物數據</font>]';
- }else{
- document.getElementById(obj).style.display='none';
- document.getElementById(s).innerHTML='[<font color=blue>顯示寵物資料</font>]';
- }
- }
- </script>
複製代碼 查找:- $post[author]</cite>
- {lang member_deleted}
- <!--{/if}-->
- <!--{/if}-->
複製代碼 在下面加上- <!--{if $post[petname]}-->
- <div align="left">
- <font color=red>寵物名字:</font><a href="pet.php?index=viewpet&username=$post[author]">$post[petname]</a>
- <font color=darkgreen>師傅名字:</font>$post['mastername']
- <span style="cursor:hand;" onclick="javascript:showpetinfo('none$post[number]','block$post[number]');" id=block$post[number] title="顯示/隱藏 寵物資料">[<font color=blue>顯示寵物資料</font>]</span>
- <div id=none$post[number] style=display:none>
- <div align="center">$post[petpic]</div>
- 寵物狀態: $post[petdead] $post[love]
- 寵物級別: $post[mypetjob] 轉/ $post[mypetlevel] 級
- HP: $post[mypethp] / $post[mypetmaxhp]
- <table width='120px' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
- <tr>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='wxpet/images/rpg/img_left.gif' width=3></TD>
- <TD style="padding:0px;" height=13 background= "wxpet/images/rpg/img_backing.gif" ><img src='wxpet/images/rpg/orange.gif' width=' $post[hpf]%' height='9'><img src='wxpet/images/rpg/hp.gif' height='9'></td>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='wxpet/images/rpg/img_right.gif' width=3></TD>
- </tr>
- </table>
- MP: $post[mypetmp] / $post[mypetmaxmp]
- <table width='120' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
- <tr>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='wxpet/images/rpg/img_left.gif' width=3></TD>
- <TD style="padding:0px;" height=13 background="wxpet/images/rpg/img_backing.gif"><img src='wxpet/images/rpg/blue.gif' width=' $post[mpf]%' height='9'><img src='wxpet/images/rpg/exp.gif' height='9'></td>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='wxpet/images/rpg/img_right.gif' width=3></TD>
- </tr>
- </table>
- SP: $post[mypetsp] / 5000
- <table width='120' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
- <tr>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='wxpet/images/rpg/img_left.gif' width=3></TD>
- <TD style="padding:0px;" height=13 background="wxpet/images/rpg/img_backing.gif"><img src='wxpet/images/rpg/green.gif' width='$post[spf]%' height='9'><img src='wxpet/images/rpg/mp.gif' height='9'></td>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='wxpet/images/rpg/img_right.gif' width=3></TD>
- </tr>
- </table>
- EXP: $post[epf]%
- <table width='120' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
- <tr>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='wxpet/images/rpg/img_left.gif' alt= $post[mypetexp] width=3></TD>
- <TD style="padding:0px;" height=13 background="wxpet/images/rpg/img_backing.gif"><img src='wxpet/images/rpg/blue.gif' width='$post[epf]%' alt= $post[mypetexp] height='9'><img src=' wxpet/images/rpg/exp.gif' height='9'></td>
- <TD style="padding:0px;" width=3 height=13><IMG height=13 src='wxpet/images/rpg/img_right.gif' alt= $post[mypetexp] width=3></TD>
- </tr>
- </table>
- </div>
- </div>
- <!--{/if}-->
複製代碼 完成修改!
演示:
|
|