<?php
namespace player;
class player
{
var $uname;//昵称
var $uid;
var $sid;//sid
var $ulv;//等级
var $uyxb;//游戏币
var $uczb;//充值币
var $uexp;//经验
var $umaxexp;//经验上限
var $uhp;//生命
var $umaxhp;//生命
var $ugj;//攻击
var $ufy;//防御
var $ubj;//暴击
var $uxx;//吸血
var $uwx;//五行
var $usex;//性别
var $vip;//vip
var $nowmid;//当前地图
var $endtime;
var $tool1;
var $tool2;
var $tool3;
var $tool4;
var $tool5;
var $tool6;
var $jingjie;
var $sfxl;
var $sfzx;
var $xiuliantime;
var $yp1;
var $yp2;
var $yp3;
var $cw;
var $jn1;
var $jn2;
var $jn3;
var $ispvp;
var $cengci;
}
function getplayer($sid,$dblj){
$player = new player();
$sql="select * from game1 where sid='$sid'";
$cxjg = $dblj->query($sql);
$cxjg->bindColumn('uname',$player->uname);
$cxjg->bindColumn('sid',$player->sid);
$cxjg->bindColumn('uid',$player->uid);
$cxjg->bindColumn('ulv',$player->ulv);
$cxjg->bindColumn('uyxb',$player->uyxb);
$cxjg->bindColumn('uczb',$player->uczb);
$cxjg->bindColumn('uexp',$player->uexp);
$cxjg->bindColumn('uhp',$player->uhp);
$cxjg->bindColumn('umaxhp',$player->umaxhp);
$cxjg->bindColumn('ugj',$player->ugj);
$cxjg->bindColumn('ufy',$player->ufy);
$cxjg->bindColumn('ubj',$player->ubj);
$cxjg->bindColumn('uxx',$player->uxx);
$cxjg->bindColumn('uwx',$player->uwx);
$cxjg->bindColumn('usex',$player->usex);
$cxjg->bindColumn('vip',$player->vip);
$cxjg->bindColumn('nowmid',$player->nowmid);
$cxjg->bindColumn('endtime',$player->endtime);
$cxjg->bindColumn('tool1',$player->tool1);
$cxjg->bindColumn('tool2',$player->tool2);
$cxjg->bindColumn('tool3',$player->tool3);
$cxjg->bindColumn('tool4',$player->tool4);
$cxjg->bindColumn('tool5',$player->tool5);
$cxjg->bindColumn('tool6',$player->tool6);
$cxjg->bindColumn('sfxl',$player->sfxl);
$cxjg->bindColumn('xiuliantime',$player->xiuliantime);
$cxjg->bindColumn('yp1',$player->yp1);
$cxjg->bindColumn('yp2',$player->yp2);
$cxjg->bindColumn('yp3',$player->yp3);
$cxjg->bindColumn('jn1',$player->jn1);
$cxjg->bindColumn('jn2',$player->jn2);
$cxjg->bindColumn('jn3',$player->jn3);
$cxjg->bindColumn('cw',$player->cw);
$cxjg->bindColumn('sfzx',$player->sfzx);
$cxjg->bindColumn('ispvp',$player->ispvp);
$cxjg->fetch(\PDO::FETCH_ASSOC);
if ($player->tool1!=0){
$zhuangbei = getzb($player->tool1,$dblj);
$player->ugj = $player->ugj + $zhuangbei->zbgj;
$player->ufy = $player->ufy + $zhuangbei->zbfy;
$player->ubj = $player->ubj + $zhuangbei->zbbj;
$player->uxx = $player->uxx + $zhuangbei->zbxx;
$player->umaxhp = $player->umaxhp + $zhuangbei->zbhp;
}
if ($player->tool2!=0){
$zhuangbei = getzb($player->tool2,$dblj);
$player->ugj = $player->ugj + $zhuangbei->zbgj;
$player->ufy = $player->ufy + $zhuangbei->zbfy;
$player->ubj = $player->ubj + $zhuangbei->zbbj;
$player->uxx = $player->uxx + $zhuangbei->zbxx;
$player->umaxhp = $player->umaxhp + $zhuangbei->zbhp;
}
if ($player->tool3!=0){
$zhuangbei = getzb($player->tool3,$dblj);
$player->ugj = $player->ugj + $zhuangbei->zbgj;
$player->ufy = $player->ufy + $zhuangbei->zbfy;
$player->ubj = $player->ubj + $zhuangbei->zbbj;
$player->uxx = $player->uxx + $zhuangbei->zbxx;
$player->umaxhp = $player->umaxhp + $zhuangbei->zbhp;
}
if ($player->tool4!=0){
$zhuangbei = getzb($player->tool4,$dblj);
$player->ugj = $player->ugj + $zhuangbei->zbgj;
$player->ufy = $player->ufy + $zhuangbei->zbfy;
$player->ubj = $player->ubj + $zhuangbei->zbbj;
$player->uxx = $player->uxx + $zhuangbei->zbxx;
$player->umaxhp = $player->umaxhp + $zhuangbei->zbhp;
}
if ($player->tool5!=0){
$zhuangbei = getzb($player->tool5,$dblj);
$player->ugj = $player->ugj + $zhuangbei->zbgj;
$player->ufy = $player->ufy + $zhuangbei->zbfy;
$player->ubj = $player->ubj + $zhuangbei->zbbj;
$player->uxx = $player->uxx + $zhuangbei->zbxx;
$player->umaxhp = $player->umaxhp + $zhuangbei->zbhp;
}
if ($player->tool6!=0){
$zhuangbei = getzb($player->tool6,$dblj);
$player->ugj = $player->ugj + $zhuangbei->zbgj;
$player->ufy = $player->ufy + $zhuangbei->zbfy;
$player->ubj = $player->ubj + $zhuangbei->zbbj;
$player->uxx = $player->uxx + $zhuangbei->zbxx;
$player->umaxhp = $player->umaxhp + $zhuangbei->zbhp;
}
$rangeslv = array(0, 30, 50, 70, 80, 90, 100, 110);
$rangesexp = array(2.5, 5, 7.5, 10, 12.5, 15, 17.5);
$playernextlv = $player->ulv + 1;
$rangesjj = array('练气', '筑基', '金丹', '元婴', '化神', '炼虚', '合体', '大乘');
for ($i=0;$i < count($rangeslv);$i++){
if ($player->ulv >= $rangeslv[$i] && $player->ulv < $rangeslv[$i+1]){
$rangesjd = array('一','二','三','四','五','六','七','八','九','十');
$djc = $player->ulv - $rangeslv[$i];
$jds = ($rangeslv[$i+1]-$rangeslv[$i])/10;
$jieduan = floor($djc/$jds);
$jd = $rangesjd[$jieduan];
$player->jingjie = $rangesjj[$i];
$player->cengci = $jd.'层';
$player->umaxexp = $playernextlv*($playernextlv+round($playernextlv/2))*12*$rangesexp[$i]+$playernextlv;
break;
}
}
return $player;
}
function getplayer1($uid,$dblj){
$player = new player();
$sql="select * from game1 where uid='$uid'";
$cxjg = $dblj->query($sql);
$cxjg->bindColumn('sid',$player->sid);
$cxjg->fetch(\PDO::FETCH_ASSOC);
$player = getplayer($player->sid,$dblj);
return $player;
}
class guaiwu
{
var $gname;//昵称
var $ginfo;
var $gsex;
var $gzb;//装备
var $dljv;//装备几率
var $gdj;//道具
var $djjv;//道具几率
var $gyp;//药品
var $ypjv;//药品几率
var $gid;
var $sid;
var $glv;
var $gexp;//经验
var $ghp;//生命
var $gmaxhp;
var $ggj;//攻击
var $gfy;//防御
var $gbj;//暴击
var $gxx;//吸血
var $gyid;
var $jingjie;
}
function getguaiwu($gid,$dblj){//获取怪物
$guaiwu = new guaiwu();
$sql = "select * from midguaiwu where id = $gid";
$cxjg = $dblj->query($sql);
$cxjg->bindColumn('gname',$guaiwu->gname);
$cxjg->bindColumn('id',$guaiwu->gid);
$cxjg->bindColumn('sid',$guaiwu->sid);
$cxjg->bindColumn('glv',$guaiwu->glv);
$cxjg->bindColumn('gexp',$guaiwu->gexp);
$cxjg->bindColumn('ghp',$guaiwu->ghp);
$cxjg->bindColumn('gmaxhp',$guaiwu->gmaxhp);
$cxjg->bindColumn('ggj',$guaiwu->ggj);
$cxjg->bindColumn('gfy',$guaiwu->gfy);
$cxjg->bindColumn('gbj',$guaiwu->gbj);
$cxjg->bindColumn('gxx',$guaiwu->gxx);
$cxjg->bindColumn('gyid',$guaiwu->gyid);
$cxjg->fetch(\PDO::FETCH_ASSOC);
$rangeslv = array(0, 30, 50, 70, 80, 90, 100, 110);
$rangesjj = array('练气', '筑基', '金丹', '元婴', '化神', '炼虚', '合体', '大乘');
for ($i=0;$i < count($rangeslv);$i++){
if ($guaiwu->glv >= $rangeslv[$i] && $guaiwu->glv < $rangeslv[$i+1]){
$rangesjd = array('一','二','三','四','五','六','七','八','九','十');
$djc = $guaiwu->glv - $rangeslv[$i];
$jds = ($rangeslv[$i+1]-$rangeslv[$i])/10;
$jieduan = floor($djc/$jds);
$jd = $rangesjd[$jieduan];
$guaiwu->jingjie = $rangesjj[$i].$jd.'层';
break;
}
}
- 1
- 2
前往页