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

'注册用户物品箱子
Dim Rs2,SQL2,username1
sql2 = "SELECT * FROM useritem WHERE username='"&Dvbbs.MemberName&"' "
set rs2=connpet.ExeCute(sql2)
username1=Dvbbs.MemberName

if rs2.eof then
	SQL2 = "INSERT INTO useritem (username)VALUES ('"& Dvbbs.MemberName &"')"
	connpet.ExeCute(SQL2)
end if
rs2.close

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,"","宠物中心","YD_petcenter.asp"

if DvBBS.UserId = 0 then
	AlarmErrmsg
else
	'宠物插件状态
	if DEF_PET_close>1 then
		'暂时关掉开始
		if not dvbbs.master then
			call showmessage("调试中,请以后再来~","index.asp")
		end if
		'暂时关掉结束
	end if
	dim allpetpeople,mypetname,mypet,levelpic,mypetlevel,username,relive
	Dim Rs,SQL
	SQL = "SELECT username,mypet,mypetlevel,mypetname,relive FROM mypetdata ORDER BY relive DESC,mypetexp DESC"
	set rs = connpet.execute(SQL)
	if rs.eof then
		call showmessage("社区还没有宠物啊，抢先去买一个吧~","YD_petshop.asp")
	else
		username = rs("username")
		mypet = rs("mypet")
		mypetlevel = rs("mypetlevel")
		mypetname = rs("mypetname")
		relive = rs("relive")
		levelpic = int(mypetlevel/10)
		if levelpic>10 then
			levelpic=11
		end if
	end if
	rs.close
	if mypetlevel<7 then  '小于7级自动关PK
		connpet.ExeCute("UPDATE mypetdata SET openpk=2 WHERE username='"&Dvbbs.MemberName&"'")
	end if
	SQL = "SELECT COUNT(mypetexp) FROM mypetdata "
	rs.open SQL,connpet,1,3
	allpetpeople = rs(0)
	rs.close
	call main()
End If
Set Dv_plus=Nothing
Dvbbs.Footer

sub main()
%>
<table class=tableborder1 cellspacing=1 cellpadding=3 align=center>
  <tr>
    <th height=27 align=center><%=Dvbbs.stats%></th>
  </tr>
  <tr>
    <td class=TableBody1>
      <table width="90%" align="center" cellpadding="4" cellspacing="4">
	<tr> 
	  <td width=34% align=center> 本社区共有 <%=allpetpeople%> 只宠物宝宝<br><br>
	    <!-- #include file=YD_petnav.asp -->
	  </td>
	  <td width="66%">  
	    <table width="100%" cellspacing="2" cellpadding="0">
	      <tr>
		<td colspan=2 align=center>宠物明星</td>
	      </tr>
	      <tr>
		<td width="41%" rowspan="3" align="center"><IMG src="YD_plus/YD_pet/PET/<%=mypetname%>/<%=mypetname%><%=levelpic%>.gif"></td>
		<td width="59%">宠物名字：<%=mypet%><p></td>
	      </tr>
	      <tr>
		<td>宠物等级：<%=mypetlevel%>
                    <p>宠物转生：<%=relive%><p>
		</td>
	      </tr>
	      <tr>
		<td>宠物主人：<a href="dispuser.asp?name=<%=username%>"><%=username%></a></td>
	      </tr>
	    </table>
	    <BR>
	    <font color="#FF0000"><a href="YD_petitemshop.asp">点这里购买SP药水</a></font>
	  </td>
	</tr>
      </table>
    </td>
  </tr>
</table>
<%
end sub
%>