<!--#include file="Inc.asp"-->
<!-- #include file=pet_conn.asp -->
<%
If Not BBS94KK.Founduser Then BBS94KK.GoToErr(10)
BBS94KK.Head("宠物宝贝 → 宠物排行榜")

    dim allpetpeople,mypetname,mypet,levelpic,mypetlevel,username,level1,petatk,petdef,petdead
    dim str,ski,def,vit
    Dim Rs,SQL
	
%>
<table width="760" border="0" cellspacing="1" cellpadding="5" align="center" class=TBone>
 
  <tr>
	<td class=tbbg1 valign=top>

<table width="100%" border="0" cellspacing="2" cellpadding="2">
			  <tr>
				<td width="30%" valign=top>
				<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>　</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 relive DESC,mypetexp DESC"
			set rs = connpet.execute(SQL)
			while not rs.eof 
					str=rs("str")
					ski=rs("ski")
					def=rs("def")
					vit=rs("vit")
					level1=int(rs("mypetlevel"))
					petatk=rs("mypetatk")+rs("item1Num")+rs("item2Num")+int(str/2)
					petdef=rs("mypetdef")+rs("item3Num")+rs("item4Num")+rs("item5Num")+int(ski/2)
					if rs("mypethp")<1 or rs("mypetsp")<1 then 
						petdead="死亡"
						else
						petdead="生存"
					end if
%>
					<tr><td width='20%'><div align='center'><a href="userinfo.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="20%"><div align="center">宠物照片</div></td>
					  <td width="20%"><div align="center">宠物名字</div></td>
					  <td width="20%"><div align="center">宠物等级</div></td>
					  <td width="20%"><div align="center">宠物转生</div></td>
					  <td width="20%"><div align="center">宠物主人</div></td>
					</tr>

<%
			SQL = "SELECT top 10 username,mypet,mypetlevel,mypetname,imgset,relive FROM mypetdata ORDER BY relive DESC,mypetexp DESC"
			set rs = connpet.execute(SQL)
			dim num,imgset
			num = 0
			while not rs.eof and num < 10
				levelpic=int(rs("mypetlevel")/10)
				if levelpic>10 then levelpic=11 end if
				imgset = rs("imgset") 

%>
					<tr><td width='20'><div align='center'>
					<%if rs("imgset")=-1 then%>
					<IMG src='images/pet/<%=rs("mypetname")%>/<%=rs("mypetname")%><%=levelpic%>.gif'></div></td>
					<%else%>
					<IMG src='images/pet/<%=rs("mypetname")%>/<%=rs("mypetname")%><%=imgset%>.gif'></div></td>
					<%end if%>
					<td width='20%'><div align='center'><a href="petview.asp?username=<%=rs("username")%>"><%=rs("mypet")%></a></div></td>
					<td width='20%'><div align='center'><%=rs("mypetlevel")%></div></td>
					<td width='20%'><div align='center'><%=rs("relive")%></div></td>
					<td width='20%'><div align='center'><a href="userinfo.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>
<%bbs94kk.footer()%>





