<!--#include file="connection.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/plus_check.asp"-->
<!-- #include file=pet_conn.asp -->
<%

dim menu,savem,rsbank,rssql,chentitle,chenbackasp,stats,errmsg,founderr

chentitle="宠物排行榜"
Dv_plus.name="petcenter"
Dv_plus.checklogin()
Dvbbs.LoadTemplates("")
Dvbbs.Stats="宠物排行榜"
Dvbbs.Nav()
Dvbbs.Head_var 0,"","宠物中心","petcenter.asp"

if DvBBS.UserId = 0 then
	AlarmErrmsg
else
    dim allpetpeople,mypetname,mypet,levelpic,mypetlevel,username,level1,petatk,petdef,petdead
    Dim Rs,SQL
    
%>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="TableBorder1">
  <tr> 
    <th height="25">&nbsp;</th>
  </tr>
  <tr> 
    <td height="200" valign="top" class=TableBody1> 
      <table width="100%" border="0" cellspacing="1" cellpadding="5" align="center" class=TBone>
        <tr> 
          <td height=27 align="center" class=tbhead2><b><font class=HeadFont><%=stats%></font></b></td>
        </tr>
        <tr> 
          <td class=tbbg1> 
            <table width="100%" border="0" cellspacing="2" cellpadding="2">
              <tr> 
                <td width="30%"> 
                  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
                    <tr> 
                      <td>
                        <div align="center"><img src="images/pet/28.gif" width="150" height="150"></div>
                      </td>
                    </tr>
                  </table>
                  <br>
                  <br>
                  <table width="90%"  border="0" align="center" cellpadding="3" cellspacing="3">
                    <tr> 
                      <td>
                        <div align="center"></div>
                        <!-- #include file=petnav.asp -->
                      </td>
                    </tr>
                  </table>
                  <p>&nbsp;</p>
                </td>
                <td> 
                  <%
    select case lcase(request("action"))
        case "pkon"
%>
                  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="3">
                    <tr> 
                      <td width="20%">
                        <div align="center">宠物主人</div>
                      </td>
                      <td width="20%">
                        <div align="center">宠物名字</div>
                      </td>
                      <td width="15%">
                        <div align="center">宠物等级</div>
                      </td>
                      <td width="15%">
                        <div align="center">宠物攻击力</div>
                      </td>
                      <td width="15%">
                        <div align="center">宠物防御力</div>
                      </td>
                      <td width="15%">
                        <div align="center">宠物状态</div>
                      </td>
                    </tr>
                    <%
            SQL = "SELECT * FROM mypetdata where openpk<2 ORDER BY mypetexp DESC"
            set rs = conn.execute(SQL)
            while not rs.eof 
                    level1=int(rs("mypetlevel")/2)
                    petatk=rs("mypetatk")+rs("item1")+rs("item2")+2+level1
                    petdef=rs("mypetdef")+rs("item3")+rs("item4")+rs("item5")+3+level1
                    if rs("mypethp")<1 or rs("mypetsp")<1 then 
                        petdead="死亡"
                        else
                        petdead="生存"
                    end if
%>
                    <tr>
                      <td width='20%'>
                        <div align='center'><a href="dispuser.asp?name=<%=rs("username")%>"><%=rs("username")%></a></div>
                      </td>
                      <td width="20%">
                        <div align="center"><a href="petview.asp?username=<%=rs("username")%>"><%=rs("mypet")%></a></div>
                      </td>
                      <td width='15%'>
                        <div align='center'><%=rs("mypetlevel")%></div>
                      </td>
                      <td width='15%'>
                        <div align='center'><%=petatk%></div>
                      </td>
                      <td width='15%'>
                        <div align='center'><%=petdef%></div>
                      </td>
                      <td width='15%'>
                        <div align='center'><%=petdead%></div>
                      </td>
                    </tr>
                    <%              rs.movenext    
            wend
            rs.close
%>
                  </table>
                  <%
        case else 'pettop
%>
                  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td width="28%">
                        <div align="center">宠物照片</div>
                      </td>
                      <td width="24%">
                        <div align="center">宠物名字</div>
                      </td>
                      <td width="24%">
                        <div align="center">宠物等级</div>
                      </td>
                      <td width="24%">
                        <div align="center">宠物主人</div>
                      </td>
                    </tr>
                    <%
            SQL = "SELECT top 10 username,mypet,mypetlevel,mypetname FROM mypetdata ORDER BY mypetlevel desc,mypetexp DESC"
            set rs = conn.execute(SQL)
            dim num
            num = 0
            while not rs.eof and num < 10
                levelpic=int(rs("mypetlevel")/10)
                if levelpic>10 then levelpic=11 end if
%>
                    <tr>
                      <td width='28%'>
                        <div align='center'><img src='images/pet/<%=rs("mypetname")%>/<%=rs("mypetname")%><%=levelpic%>.gif'></div>
                      </td>
                      <td width='24%'>
                        <div align='center'><a href="petview.asp?username=<%=rs("username")%>"><%=rs("mypet")%></a></div>
                      </td>
                      <td width='24%'>
                        <div align='center'><%=rs("mypetlevel")%></div>
                      </td>
                      <td width='24%'>
                        <div align='center'><a href="dispuser.asp?name=<%=rs("username")%>"><%=rs("username")%></a></div>
                      </td>
                    </tr>
                    <%              rs.movenext    
                num = num + 1
            wend
            rs.close
%>
                  </table>
                  <%            
    end select
%>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<% End If :  Set Dv_plus=Nothing : Dvbbs.Footer%>