不是啊。我说的是给队员补血和复活那一块~~
我把代码给你全帖上,你到时候覆盖到你的petinfo.php上
- <?php
- if (!defined('IN_DISCUZ')) {
- exit('Access Denied');
- }
- if (!groupid == "guest" || $discuz_uid == '') pet_showmessage("您没有权限使用此功能");
- $petsettings = $db->fetch_array($db->query("SELECT * FROM " . $tablepre . "petconfig WHERE 1"));
- $members = $db->fetch_array($db->query("SELECT * FROM " . $tablepre . "mypetdata WHERE username='$discuz_user'"));
- $mypethp2 = $members['mypethp'];
- $mypetmaxhp2 = $members['mypetmaxhp'];
- $mypetmp2 = $members['mypetmp'];
- $mypetmaxmp2 = $members['mypetmaxmp'];
- $mypetsp2 = $members['mypetsp'];
- $mypetjob = $members[mypetjob];
- $hpitem2 = $members['hpitem'];
- $mpitem2 = $members['mpitem'];
- $bhpitem2 = $members['bhpitem'];
- $bmpitem2 = $members['bmpitem'];
- $spitem2 = $members['spitem'];
- $liveitem2 = $members['liveitem'];
- $basichp = $petsettings['basichp'];
- $basicsp = $petsettings['basicsp'];
- $basicusehp = $petsettings['basicusehp'];
- $basicusebhp = $petsettings['basicusebhp'];
- $basicusemp = $petsettings['basicusemp'];
- $basicusebmp = $petsettings['basicusebmp'];
- $hptemp2 = $mypetmaxhp2 - $mypethp2;
- $mptemp2 = $mypetmaxmp2 - $mypetmp2;
- $pettoday2 = time();
- $petlevel2 = pow (log10 ($members[mypetexp] / ($mypetjob * 0.2 + 1)), 3);
- $petshowlevel2 = floor ($petlevel2 + 1);
- if ($action == "usehp") {
- echo "<META HTTP-EQUIV=REFRESH CONTENT='3;URL=petshop.php?index=petinfo'>";
- if ($hpitem2 < 1) {
- $Showmsg = "";
- } else if ($mypethp2 == $mypetmaxhp2) {
- $Showmsg = "";
- } else if ($mypethp2 == '0' or $mypetsp2 == '0' or $useitem['mypetdead'] == '1') {
- $Showmsg = "";
- } else if ($hptemp2 < $basicusehp) {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypethp=mypethp+$hptemp2,hpitem=hpitem-1 WHERE username='$discuz_user'");
- $Showmsg = "<font color=green>+$hptemp2</font>";
- } else {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypethp=mypethp+$basicusehp,hpitem=hpitem-1 WHERE username='$discuz_user'");
- $Showmsg = "<font color=green>+$basicusehp</font>";
- }
- }
- if ($action == "usebhp") {
- echo "<META HTTP-EQUIV=REFRESH CONTENT='3;URL=petshop.php?index=petinfo'>";
- if ($bhpitem2 < 1) {
- $Showmsg = "";
- } else if ($mypethp2 == $mypetmaxhp2) {
- $Showmsg = "";
- } else if ($mypethp2 == '0' or $mypetsp2 == '0' or $useitem['mypetdead'] == '1') {
- $Showmsg = "";
- } else if ($hptemp2 < $basicusebhp) {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypethp=mypethp+$hptemp2,bhpitem=bhpitem-1 WHERE username='$discuz_user'");
- $Showmsg = "<font color=green>+$hptemp2</font>";
- } else {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypethp=mypethp+$basicusebhp,bhpitem=bhpitem-1 WHERE username='$discuz_user'");
- $Showmsg = "<font color=green>+$basicusebhp</font>";
- }
- }
- if ($action == "usemp") {
- echo "<META HTTP-EQUIV=REFRESH CONTENT='3;URL=petshop.php?index=petinfo'>";
- if ($mpitem2 < 1) {
- $Showmsg2 = "";
- } else if ($mypetmp2 == $mypetmaxmp2) {
- $Showmsg2 = "";
- } else if ($mypethp2 == '0' or $mypetsp2 == '0' or $members['mypetdead'] == '1') {
- $Showmsg2 = "";
- } else if ($mptemp2 < $basicusemp) {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypetmp=mypetmp+$mptemp2,mpitem=mpitem-1 WHERE username='$discuz_user'");
- $Showmsg2 = "<font color=green>+$mptemp</font>";
- } else {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypetmp=mypetmp+$basicusemp,mpitem=mpitem-1 WHERE username='$discuz_user'");
- $Showmsg2 = "<font color=green>+$basicusemp</font>";
- }
- }
- if ($action == "usebmp") {
- echo "<META HTTP-EQUIV=REFRESH CONTENT='3;URL=petshop.php?index=petinfo'>";
- if ($bmpitem2 < 1) {
- $Showmsg2 = "";
- } else if ($mypetmp2 == $mypetmaxmp2) {
- $Showmsg2 = "";
- } else if ($mypethp2 == '0' or $mypetsp2 == '0' or $members['mypetdead'] == '1') {
- $Showmsg2 = "";
- } else if ($mptemp2 < $basicusebmp) {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypetmp=mypetmp+$mptemp2,bmpitem=bmpitem-1 WHERE username='$discuz_user'");
- $Showmsg2 = "<font color=green>+$mptemp2</font>";
- } else {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypetmp=mypetmp+$basicusebmp,bmpitem=bmpitem-1 WHERE username='$discuz_user'");
- $Showmsg2 = "<font color=green>+$basicusebmp</font>";
- }
- }
- if ($action == "usesp") {
- echo "<META HTTP-EQUIV=REFRESH CONTENT='3;URL=petshop.php?index=petinfo'>";
- if ($spitem2 < 1) {
- $Showmsg3 = "";
- } else if ($mypethp2 == '0' or $mypetsp2 == '0' or $members['mypetdead'] == '1') {
- $Showmsg3 = "";
- } else {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypetsp=$basicsp,spitem=spitem-1 WHERE username='$discuz_user'");
- $Showmsg3 = "<font color=green>+$basicsp</font>";
- }
- }
- if ($action == "uselive") {
- echo "<META HTTP-EQUIV=REFRESH CONTENT='3;URL=petshop.php?index=petinfo'>";
- if ($liveitem2 < 1) {
- $Showmsg = "";
- $Showmsg2 = "";
- } else if ($mypethp2 > 0 && $mypetsp2 > 0) {
- $Showmsg = "";
- $Showmsg2 = "";
- $Showmsg3 = "";
- } else {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypethp=$mypetmaxhp2,mypetmp=$mypetmaxmp2,mypetdead=0,mypetsp=$basicsp,liveitem=liveitem-1 WHERE username='$discuz_user'");
- $Showmsg = "<font color=green>+$mypetmaxhp2</font>";
- $Showmsg2 = "<font color=green>+$mypetmaxmp2</font>";
- $Showmsg3 = "<font color=green>+$basicsp</font>";
- }
- }
- if (!$members[mypet]) {
- pet_showmessage('你还没有宠物啊,快赚钱去买吧~<BR><BR><a href=petshop.php?index=petshop>宠物商店</a>');
- }
- // 会员宠物
- $petoldlevel = $members[mypetlevel];
- $petlevel = pow (log10 ($members['mypetexp'] / ($mypetjob * 0.2 + 1)), 3);
- $petep = floor (100 * ($petlevel - floor ($petlevel)));
- $losexp = intval ($members['mypetexp'] * 0.01);
- $petshowlevel = floor ($petlevel + 1);
- $petjob = $members[mypetjob];
- $points = $members['points'];
- $str = $members['str'];
- $strtemp = $str * 3 * ($members[mypetjob] + 1) * floor($petlevel / 200 + 1);
- $vit = $members['vit'];
- $vittemp = $vit * 9;
- $vittemp2 = intval($vit * 1.3);
- $agi = $members['agi'];
- if ($agi >= 30) {
- $agitemp = intval(($agi-30) * 1.5) * ($members[mypetjob] + 1) * floor($petlevel / 200 + 1);
- }
- $int = $members['kno'];
- $inttemp = $int * 5;
- $dex = $members['dex'];
- $dextemp = intval($dex * 2.7) * ($members[mypetjob] + 1) * floor($petlevel / 200 + 1);
- if ($members[item4] == 500) {
- $ftt = 10;
- } else {
- $ftt = 0;
- }
- $petflee = floor($agi / 50) + $ftt;
- if ($petflee > 100) {
- $petflee = 99;
- }
- $level1 = intval($petshowlevel / 2);
- $petpic = $members['mypetname'];
- $petjob = $members['mypetjob'];
- $petgd = $members['mypetgd'];
- $tm = $members['tmid'];
- if ($petgd <= -1) {
- $color = "red";
- } else if ($petgd == 0) {
- $color = "gray";
- } else if ($petgd >= 1000) {
- $color = "blue";
- }
- if ($petgd > 32767) {
- $petgd = 32767;
- } else if ($petgd < -32767) {
- $petgd = -32767;
- }
- if ($members[mypetdead] == 1) {
- $petdead = "<font color=red>死亡</font>";
- } else {
- $petdead = "<font color=green>生存</font>";
- }
- $petsx = $members['mypetsx'];
- $pethp = $members['mypethp'];
- $petmp = $members['mypetmp'];
- $petatk = $members['atktemp'] + $members['mypetatk'] + $strtemp + $members['item1'] + $members['item2'] + 2 + $level1 + $agitemp;
- $petmatk = $members['kno'] * 5 * ($petjob + 1) * floor($petlevel / 200 + 1) + 2 + $level1;
- $petdef = $members['deftemp'] + $members['deftemp2'] + $members['mypetdef'] + $vittemp2 + $dextemp + $members['item3'] + $members['item4'] + $members['item5'] + 3 + $level1;
- if ($petdef < 0) {
- $petdef = 0;
- }
- $petmaxhp = $members[mypetmaxhp] + ($petshowlevel - $petoldlevel) * 25;
- $petmaxmp = $members[mypetmaxmp] + ($petshowlevel - $petoldlevel) * 2;
- $petsp = $mypetsp2;
- $hpf = floor (100 * ($pethp / $petmaxhp)) - 1;
- $mpf = floor (100 * ($petmp / $petmaxmp)) - 1;
- $spf = floor (100 * ($petsp / $petsettings['basicsp'])) - 1;
- if ($members['openpk'] == 1) {
- $petpk = '接受挑战';
- } else {
- $petpk = '躲在家里';
- }
- if ($hpf >= 98) {
- $hpf = $hpf - 2;
- }
- if ($mpf >= 98) {
- $mpf = $mpf - 2;
- }
- if ($spf >= 98) {
- $spf = $spf - 2;
- }
- if ($petshowlevel > $members[leveltemp2]) {
- $petmaxhp = $members[mypetmaxhp] + ($petshowlevel - $members[leveltemp2]) * 25;
- $petmaxmp = $members[mypetmaxmp] + ($petshowlevel - $members[leveltemp2]) * 2;
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET mypetlevel=$petshowlevel, leveltemp2=$petshowlevel,mypethp=$petmaxhp,mypetmp=$petmaxmp,mypetmaxhp=$petmaxhp,mypetmaxmp=$petmaxmp,mypetsp=$petsettings[basicsp] WHERE username='$discuz_user'");
- echo "<META HTTP-EQUIV=REFRESH CONTENT='0;URL=petshop.php?index=petinfo'>";
- }
- // 队友数据
- if ($members[havetm] == 1) {
- $tmpet = $db->fetch_array($db->query("SELECT * FROM " . $tablepre . "mypetdata WHERE username='$tm'"));
- $tmaxhp = $tmpet['mypetmaxhp'];
- $tmaxmp = $tmpet['mypetmaxmp'];
- $tmpetlevel = pow (log10 ($tmpet[mypetexp] / ($tmpet[mypetjob] * 0.2 + 1)), 3);
- $tmpetshowlevel = floor ($tmpetlevel + 1);
- $tname = $tmpet['mypet'];
- $thost = $tmpet['username'];
- $tmjob = $tmpet[mypetjob];
- $tlevel = $tmpetshowlevel;
- $thp = $tmpet['mypethp'];
- $tmp = $tmpet['mypetmp'];
- $tlevel1 = "{$tmjob}转{$tlevel}级";
- if ($thp <= $tmaxhp * 60 / 100 && $tmpet[mypetdead] != 1) {
- $hpadd = "补血 <a href=petshop.php?index=petinfo&action=ubhptm><font color=red>大</font></a>/<a href=petshop.php?index=petinfo&action=ushptm><font color=red>小</font></a>";
- }
- if ($action == "ubhptm") {
- echo "<META HTTP-EQUIV=REFRESH CONTENT='1;URL=petshop.php?index=petinfo'>";
- if ($members[bhpitem] < 1) {
- $tmhpshow = "<font color=red>NoItem</font>";
- } elseif ($tmpet[mypetdead] == 1) {
- $tmhpshow = "<font color=red>已死亡</font>";
- } else {
- if ($basicusebhp > $tmaxhp - $thp) {
- $bubhp = $tmaxhp - $thp;
- } else {
- $bubhp = $basicusebhp;
- }
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET bhpitem=bhpitem-1,mypethp=mypethp+$bubhp WHERE username='$tm'");
- $tmhpshow = "<font color=green>+$bubhp</font>";
- }
- }
- if ($action == "ushptm") {
- echo "<META HTTP-EQUIV=REFRESH CONTENT='1;URL=petshop.php?index=petinfo'>";
- if ($members[hpitem] < 1) {
- $tmhpshow = "<font color=red>NoItem</font>";
- } elseif ($tmpet[mypetdead] == 1) {
- $tmhpshow = "<font color=red>已死亡</font>";
- } else {
- if ($basicusehp > $tmaxhp - $thp) {
- $bubhp = $tmaxhp - $thp;
- } else {
- $bubhp = $basicusehp;
- }
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET hpitem=hpitem-1,mypethp=mypethp+$bubhp WHERE username='$tm'");
- $tmhpshow = "<font color=green>+$bubhp</font>";
- }
- }
- if ($tmpet[mypetdead] == 0) {
- $tmspet = "<font color=green>生存</font>";
- } else {
- $tmspet = "<font color=red>死亡</font>";
- $ulive = "→<a href=petshop.php?index=petinfo&action=livetm><font color=green>复活?</font></a>";
- }
- if ($action == "livetm") {
- echo "<META HTTP-EQUIV=REFRESH CONTENT='1;URL=petshop.php?index=petinfo'>";
- if ($members[liveitem] < 1) {
- $liveshow = "<font color=red>NoItem</font>";
- } else {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET liveitem=liveitem-1,mypetdead=0,mypethp=$tmaxhp,mypetmp=$tmaxmp WHERE username='$tm'");
- $liveshow = "$tm 复活了!";
- }
- }
- } else {
- $thost = "--";
- $tlevel1 = "--";
- $tmaxhp = "--";
- $thp = "--";
- }
- if ($tmpet[opentm] == 0 || $tmpet[havetm] == 0) {
- $query = $db->query("UPDATE " . $tablepre . "mypetdata SET havetm=0,tmid='0' WHERE username='$discuz_user'");
- }
- // 会员宠物
- include template('petinfo');
- ?>
复制代码
[ 本帖最后由 离恨天 于 2006-7-6 21:13 编辑 ] |