<!--#include file="setup_pet.asp"-->
<!--#include file="pet_conn.asp"-->
<!--#include file="pet_config.asp"-->
<%
top
if Request.Cookies("username")=empty then error("<li>您还未<a href=login.asp>登录</a>论坛")


    dim allpetpeople,mypetname,mypet,levelpic,mypetlevel,username
    Dim rs_pet,sql_pet
    sql_pet = "SELECT * FROM mypetdata WHERE username='"&request.querystring("username")&"'"
    set rs_pet = conn_pet.execute(sql_pet)
    if rs_pet.eof then
            message="<li>他还没有宠物啊~"
			succeed(message&"<meta http-equiv=refresh content=3;url='petshop.asp'")
        else

dim t,today,pett,petlevel,petep,petshowlevel,level1,level2,petpic,pethp,petatk,petdef,petmaxhp,petsp
dim hpf,spf,petdead,petsex,petpk,mypetsx         
t=now()
today = date()
pett= DateDiff("d", rs_pet("petregdate"), today)
petlevel = (Log(rs_pet("mypetexp")) / Log(10)) * (Log(rs_pet("mypetexp")) / Log(10)) * (Log(rs_pet("mypetexp")) / Log(10))
petep = int (100 * (petlevel - int (petlevel)))
petshowlevel = int (petlevel + 1)
levelpic=int(petshowlevel/10)
if (levelpic>10) then levelpic=11 end if
level1=int(petshowlevel/2)
level2=int(petshowlevel/2)
petpic=rs_pet("mypetname")
pethp=rs_pet("mypethp")
petatk=rs_pet("mypetatk")+rs_pet("item1")+rs_pet("item2")+2+level1
petdef=rs_pet("mypetdef")+rs_pet("item3")+rs_pet("item4")+rs_pet("item5")+3+level1
if (petshowlevel<2) then 
    petmaxhp=DEF_PET_basichp 
else 
    petmaxhp=DEF_PET_basichp+petshowlevel*5
end if
petsp=rs_pet("mypetsp")-pett*DEF_PET_basicsp2
if(petsp>DEF_PET_basicsp) then petsp=DEF_PET_basicsp end if
hpf= int (100 * (pethp / petmaxhp)) - 1
spf= int (100 * (petsp / DEF_PET_basicsp)) - 1
if (pethp<0) then pethp=0 end if
if (petsp<0) then petsp=0 end if
if (pethp<1 or petsp<1) then
    petdead="死亡"
    else
    petdead="生存"
end if
if (rs_pet("mypetsex")<2) then
    petsex="雄"
    else
    petsex="雌"
end if
if (rs_pet("openpk") < 2) then
    petpk="等待挑战"
    else
    petpk="拒绝挑战"
end if
if pethp > petmaxhp then
    pethp = petmaxhp
end if
if ( hpf >= 98 ) then hpf = hpf - 2 end if
if ( spf >= 98 ) then spf = spf - 2 end if
        
dim item1,item2,item3,item4,item5
item1=rs_pet("item1")
item2=rs_pet("item2")
item3=rs_pet("item3")
item4=rs_pet("item4")
item5=rs_pet("item5")
mypet=rs_pet("mypet")
mypetsx = rs_pet("mypetsx")
mypetlevel = rs_pet("mypetlevel")
    end if
    rs_pet.close
%>
<title>宠物资料</title>
<table border=0 width=<%=dkuan%> align=center cellspacing=1 cellpadding=4 class=a2>
<tr class=a3>
<td height=25>&nbsp;<img src=images/Forum_nav.gif>&nbsp; <%ClubTree%> → 
<a href="petcenter.asp">宠物中心</a></td>
</tr>
</table><br>

<table width="100%" border="0" cellspacing="2" cellpadding="2">
                          <tr> 
                            <td width="35%">&nbsp;</td>
                            <td width="20%"> <div align="center"><img src="images/pet/head/<%=item3%>.gif" alt="宠物头盔"></div></td>
                            <td width="35%">&nbsp;</td>
                          </tr>
                          <tr> 
                            <td><div align="right"><img height=30 src="images/pet/sword/<%=item1%>.gif" alt="宠物武器 "></div></td>
                            <td rowspan="2"><div align="center"><a href="petbattle.asp?atkname=<%=request.querystring("username")%>&action=atkpet">
                      <%if pethp<1 or petsp<1 then%>
                      <img border="0" src='images/pet/<%=petpic%>/<%=petpic%><%=levelpic%>.gif' style=filter:GRAY alt="攻击 <%=request.querystring("username")%> 的宝宝">
                      <%else%>
                      <img border="0" src='images/pet/<%=petpic%>/<%=petpic%><%=levelpic%>.gif' alt="攻击 <%=request.querystring("username")%> 的宝宝">
                      <%end if%>
                            </a></div></td>
                            <td><img src="images/pet/body/<%=item4%>.gif" alt="宠物盔甲"></td>
                          </tr>
                          <tr> 
                            <td><div align="right"><img src="images/pet/necklace/<%=item2%>.gif" alt="宠物项链" ></div></td>
                            <td><img src="images/pet/foot/<%=item5%>.gif" alt="宠物鞋子"></td>
                          </tr>
                        </table>
                  <table width='63%' border='0' align="center" cellpadding='1' cellspacing='1'>
                    <tr> 
                      <td width='33%'><div align="left">宠物名称：<%=mypet%>
                          <br>
                          宠物性别：<%=petsex%><br>
                          攻击力：<%=petatk%><br>
                          防御力：<%=petdef%></div></td>
                      <td width='33%'> 宠物状态：<%=petdead%><br>
                        宠物级别：<%=mypetlevel%><br>
                        宠物属性：<%=mypetsx%><br>
                        宠物PK：<%=petpk%></td>
                      <td width='33%'> HP : <%=pethp%> / <%=petmaxhp%><br> <table width='120' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
                          <tr> 
                            <TD width=3 height=13><IMG height=13 src='images/rpg/img_left.gif' width=3></TD>
                            <TD width=114 background=images/rpg/img_backing.gif height=13><img src='images/rpg/orange.gif' width='<%=hpf%>%' height='9'><img src='images/rpg/hp.gif' height='9'></td>
                            <TD width=3 height=13><IMG height=13 src='images/rpg/img_right.gif' width=3></TD>
                          </tr>
                        </table>
                        SP : <%=petsp%> / <%=DEF_PET_basicsp%><br> <table width='120' border='0' cellspacing='0' cellpadding='0' bordercolor='#000000'>
                          <tr> 
                            <TD width=3 height=13><IMG height=13 src='images/rpg/img_left.gif' width=3></TD>
                            <TD width=114 background=images/rpg/img_backing.gif height=13><img src='images/rpg/green.gif' width='<%=spf%>%' height='9'><img src='images/rpg/mp.gif' height='9'></td>
                            <TD width=3 height=13><IMG height=13 src='images/rpg/img_right.gif' width=3></TD>
                          </tr>
                        </table>
                        
                      </td>
                    </tr>
                  </table>
<%
htmlend
%>
