<!--#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 money,smoney,saveday,allmoney,time1,time2,daikuang,dkdu,daiday,sucmsg
    dim Form_userphoto,Form_FaceUrl,Form_FaceWidth,Form_FaceHeight
    
    Dim Rs,SQL

	set rs=Dvbbs.execute("select Jamonery from [JaUser] where Jauid="&DvBBS.UserId)
      	
    money=rs("Jamonery")

	    

    rs.close
    

    
    if request("action") = "buy" then
        
        SQL = "SELECT * FROM mypetdata WHERE username='"& Dvbbs.MemberName &"' "
        rs.open sql,conn,1,3
        if not rs.eof then
            call showmessage("你已经有一个宠物了，做人不要三心两意啊~","petshop.asp")
            elseif request("petname") = "" then
                call showmessage("你还没有选定你要的宝宝啊，请重新选择","petshop.asp")
                elseif money < DEF_PET_eggmoney then
                    call showmessage("你没有足够的钱买宠物","petshop.asp")
                    else
                    dim pettoday,pets,eggmoney,pethp,petsp,petatk,petdef
                    
                    Randomize '初始化随机数生成器。

                    pettoday = date()
                    pets = Int((2 * Rnd) + 1)
                    eggmoney = DEF_PET_eggmoney 
                    pethp = DEF_PET_basichp
                    petsp = DEF_PET_basicsp
                    petatk = Int((10 * Rnd) + 1)
                    petdef = Int((10 * Rnd) + 1)
                    
                    if request("petname") = 1 then
                        SQL = "UPDATE [Jauser] SET Jamonery=Jamonery-"&eggmoney&" WHERE Jauid="&Dvbbs.UserId
                        Dvbbs.ExeCute(SQL)
                        SQL = "INSERT INTO mypetdata (username, mypet,mypetname,mypetlevel,mypetexp,mypethp,mypetmaxhp,mypetsp,mypetatk,mypetdef,mypetdead,mypetsex,mypetsx,petregdate,hpitem,spitem,expitem)VALUES ('"& Dvbbs.MemberName &"', '泡泡龙', 'dragon', '1', '1', '"&pethp&"', '"&pethp&"', '"&petsp&"', '"&petatk&"', '"&petdef&"', '0', '"&pets&"', '火', '"&pettoday&"', '1', '1', '0')"
                        'response.write sql : response.end
                        conn.ExeCute(SQL)
                        call showmessage("你已经有了一个泡泡龙宝宝，一定要好好照顾他/她啊","petmypet.asp")
                    elseif request("petname") = 2 then
                        SQL = "UPDATE [Jauser] SET Jamonery=jamonery-"&eggmoney&" WHERE Jauid="&Dvbbs.UserId
                        Dvbbs.ExeCute(SQL)
                        SQL = "INSERT INTO mypetdata (username, mypet,mypetname,mypetlevel,mypetexp,mypethp,mypetmaxhp,mypetsp,mypetatk,mypetdef,mypetdead,mypetsex,mypetsx,petregdate,hpitem,spitem,expitem)VALUES ('"& Dvbbs.MemberName &"', '猫尾球', 'bst', '1', '1', '"&pethp&"', '"&pethp&"', '"&petsp&"', '"&petatk&"', '"&petdef&"', '0', '"&pets&"', '土', '"&pettoday&"', '1', '1', '0')"
                        conn.ExeCute(SQL)
                        call showmessage("你已经有了一个猫尾球宝宝，一定要好好照顾他/她啊","petmypet.asp")
                    elseif request("petname") = 3 then
                        SQL = "UPDATE [Jauser] SET Jamonery=Jamonery-"&eggmoney&" WHERE Jauid="&Dvbbs.UserId
                        Dvbbs.ExeCute(SQL)
                        SQL = "INSERT INTO mypetdata (username, mypet,mypetname,mypetlevel,mypetexp,mypethp,mypetmaxhp,mypetsp,mypetatk,mypetdef,mypetdead,mypetsex,mypetsx,petregdate,hpitem,spitem,expitem)VALUES ('"& Dvbbs.MemberName &"', '天使球', 'bird', '1', '1', '"&pethp&"', '"&pethp&"', '"&petsp&"', '"&petatk&"', '"&petdef&"', '0', '"&pets&"', '水', '"&pettoday&"', '1', '1', '0')"
                        conn.ExeCute(SQL)
                        call showmessage("你已经有了一个天使球宝宝，一定要好好照顾他/她啊","petmypet.asp")
                    elseif request("petname") = 4 then
                        SQL = "UPDATE [Jauser] SET Jamonery=Jamonery-"&eggmoney&" WHERE Jauid="&Dvbbs.UserId
                        Dvbbs.ExeCute(SQL)
                        SQL = "INSERT INTO mypetdata (username, mypet,mypetname,mypetlevel,mypetexp,mypethp,mypetmaxhp,mypetsp,mypetatk,mypetdef,mypetdead,mypetsex,mypetsx,petregdate,hpitem,spitem,expitem)VALUES ('"& Dvbbs.MemberName &"', '苹果宝宝', 'green', '1', '1', '"&pethp&"', '"&pethp&"', '"&petsp&"', '"&petatk&"', '"&petdef&"', '0', '"&pets&"', '木', '"&pettoday&"', '1', '1', '0')"
                        conn.ExeCute(SQL)
                        call showmessage("你已经有了一个苹果宝宝，一定要好好照顾他/她啊","petmypet.asp")
                    elseif request("petname") = 5 then
                        SQL = "UPDATE [Jauser] SET Jamonery=Jamonery-"&eggmoney&" WHERE Jauid="&Dvbbs.UserId
                        Dvbbs.ExeCute(SQL)
                        SQL = "INSERT INTO mypetdata (username, mypet,mypetname,mypetlevel,mypetexp,mypethp,mypetmaxhp,mypetsp,mypetatk,mypetdef,mypetdead,mypetsex,mypetsx,petregdate,hpitem,spitem,expitem)VALUES ('"& Dvbbs.MemberName &"', '幽灵球', 'devil', '1', '1', '"&pethp&"', '"&pethp&"', '"&petsp&"', '"&petatk&"', '"&petdef&"', '0', '"&pets&"', '金', '"&pettoday&"', '1', '1', '0')"
                        conn.ExeCute(SQL)
                        call showmessage("你已经有了一个幽灵球宝宝，一定要好好照顾他/她啊","petmypet.asp")
                    end if
                end if
        end if
                    

%>
<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> 
            <form action=petshop.asp name="petname" mtehod=post>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td width="28%">
                    <table width="79%"  border="0" align="center" cellpadding="3" cellspacing="3">
                      <tr> 
                        <td width="100%"> 
                          <div align="center">我的资料</div>
                        </td>
                      </tr>
                      <tr> 
                        <td> 
                          <div align="center"> 
                            <script src=z_visual_const2.asp?n=1></script>
                            <br>
                            <img src=../images/blank.gif width=2 height=5><br>
                          </div>
                        </td>
                      </tr>
                      <tr> 
                        <td> 
                          <div align="center"> <nobr>现金货币: <%=money%></nobr> </div>
                        </td>
                      </tr>
                    </table>
                    <br>
                    <br>
                    <table width="79%"  border="0" align="center" cellpadding="3" cellspacing="3">
                      <tr> 
                        <td width="100%"> 
                          <div align="center"><img src="images/pet/25.gif"></div>
                        </td>
                      </tr>
                    </table>
                    <div align="right"></div>
                  </td>
                  <td width="72%">
                    <table width="100%"  border="0" align="center" cellpadding="3" cellspacing="3">
                      <tr> 
                        <td width="24%">
                          <div align="center">宠物名称</div>
                        </td>
                        <td width="58%">
                          <div align="center">宠物介绍</div>
                        </td>
                        <td width="18%">
                          <div align="center">购买宠物</div>
                        </td>
                      </tr>
                      <tr> 
                        <td>
                          <div align="center"><img src="images/pet/dragon.gif" width="45" height="46"><br>
                            泡泡龙（龙系）</div>
                        </td>
                        <td>来自东方的一条龙，随着你升级而升级，最终形态将是十分帅气人龙。<br>
                          宠物属性：火 <font color="#FF0000">出售价格： <%=DEF_PET_eggmoney%> 
                          <%=DEF_PointsName%> </font><br>
                        </td>
                        <td>
                          <div align="center"> 
                            <input type="radio" name="petname" value="1">
                            购买</div>
                        </td>
                      </tr>
                      <tr> 
                        <td>
                          <div align="center"><img src="images/pet/bst.gif" width="45" height="42"><br>
                            猫尾球（兽系） </div>
                        </td>
                        <td>可爱的兽系宠物，也是人类最好的朋友，最终形态是黑暗守护犬。<br>
                          宠物属性：土 <font color="#FF0000">出售价格： <%=DEF_PET_eggmoney%> 
                          <%=DEF_PointsName%> </font></td>
                        <td>
                          <div align="center"> 
                            <input type="radio" name="petname" value="2">
                            购买</div>
                        </td>
                      </tr>
                      <tr> 
                        <td>
                          <div align="center"><img src="images/pet/bird.gif" width="45" height="44"><br>
                            天使球（鸟系） </div>
                        </td>
                        <td>小鸟每个人都喜欢，但是你知道他们还有强大的能力，最终形态是大红鹰<br>
                          宠物属性：水 <font color="#FF0000">出售价格： <%=DEF_PET_eggmoney%> 
                          <%=DEF_PointsName%> </font></td>
                        <td>
                          <div align="center"> 
                            <input type="radio" name="petname" value="3">
                            购买</div>
                        </td>
                      </tr>
                      <tr> 
                        <td>
                          <div align="center"><img src="images/pet/green.gif" width="45" height="46"><br>
                            苹果宝宝（植物系） </div>
                        </td>
                        <td>谁也没有想到植物有如此强大的能力，最终形态是节节高<br>
                          宠物属性：木 <font color="#FF0000">出售价格： <%=DEF_PET_eggmoney%> 
                          <%=DEF_PointsName%> </font></td>
                        <td>
                          <div align="center"> 
                            <input type="radio" name="petname" value="4">
                            购买</div>
                        </td>
                      </tr>
                      <tr> 
                        <td>
                          <div align="center"><img src="images/pet/devil.gif" width="45" height="46"><br>
                            幽灵球（恶魔系） </div>
                        </td>
                        <td>一生下来就有神秘色彩的幽灵球，同时也拥有神秘的功能，最终形态是巨灵恶魔<br>
                          宠物属性：金 <font color="#FF0000">出售价格： <%=DEF_PET_eggmoney%> 
                          <%=DEF_PointsName%> </font></td>
                        <td>
                          <div align="center"> 
                            <input type="radio" name="petname" value="5">
                            购买</div>
                        </td>
                      </tr>
                      <tr> 
                        <td colspan="3">
                          <div align="center"> 
                            <input type="hidden" name="action" value="buy">
                            <input name="submit" type="submit" value="购买">
                          </div>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </form>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<% End If :  Set Dv_plus=Nothing : Dvbbs.Footer%>