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

    dim money,smoney,saveday,allmoney,time1,time2,daikuang,dkdu,daiday,sucmsg
    dim Form_userphoto,Form_FaceUrl,Form_FaceWidth,Form_FaceHeight
    
    Dim rs_pet,sql_pet

	set rs_pet=conn.execute("select money from [user] where username='"&Request.Cookies("username")&"'")
      	
    money=rs_pet("money")

	    

    rs_pet.close
    

    

    sql_pet = "SELECT * FROM mypetdata WHERE username='"&Request.Cookies("username")&"'"
    rs_pet.open sql_pet,conn_pet,1,3
    if rs_pet.eof then
        error("你还没有宠物啊，<a href=petshop.asp>快攒钱去买吧~</a>")
        else
        
dim basichpmoney,basicspmoney,basicexpmoney,atkmoney,defmoney,livemoney
dim hpitem,spitem,expitem,atkitem,defitem,liveitem
dim item1,item2,item3,item4,item5,item6,tmoney,petmoney

basichpmoney=def_pet_basichpmoney
basicspmoney=def_pet_basicspmoney
basicexpmoney=def_pet_basicexpmoney
atkmoney=def_pet_atkmoney
defmoney=def_pet_defmoney
livemoney=def_pet_livemoney

hpitem=rs_pet("hpitem")
spitem=rs_pet("spitem")
expitem=rs_pet("expitem")
atkitem=rs_pet("atkitem")
defitem=rs_pet("defitem")
liveitem=rs_pet("liveitem")

item1 = request("item1")
item2 = request("item2")
item3 = request("item3")
item4 = request("item4")
item5 = request("item5")
item6 = request("item6")


if request("action") = "" then
    action = "showroom"
    else
    action = lcase(request("action"))
end if

select case action
    case "countitem"


        if (item1<0 or item2<0 or item3<0 or item4<0 or item5<0 or item6<0) then
            error("你购买数量有错误，<a href=petitemshop.asp>请重新购买~</a>")
            else
            tmoney=item1*basichpmoney+item2*basicspmoney+item3*basicexpmoney+item4*atkmoney+item5*defmoney+item6*livemoney
        end if
    case "buyitem"
        petmoney=money
        tmoney=item1*basichpmoney+item2*basicspmoney+item3*basicexpmoney+item4*atkmoney+item5*defmoney+item6*livemoney
        if (petmoney<tmoney) then
            error("<a href=petitemshop.asp>你没有那么多钱购买这些物品</a>")
        elseif (item1<0 or item2<0 or item3<0 or item4<0 or item5<0 or item6<0) then
            error("你购买数量有错误，<a href=petitemshop.asp>请重新购买~</a>")
        else
             Set rs = Server.CreateObject("ADODB.Recordset")
					sql="select * from [user] where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn,1,3
 rs("money")=rs("money")-tmoney
 rs.update
			
            conn_pet.ExeCute("UPDATE mypetdata SET hpitem=hpitem+"&item1&",spitem=spitem+"&item2&",expitem=expitem+"&item3&",atkitem=atkitem+"&item4&",defitem=defitem+"&item5&",liveitem=liveitem+"&item6&" WHERE username='"&Request.Cookies("username")&"'")
            message="<li>购买成功!<br><br>你治愈药水增加了 "&item1&" 个<br>糖果增加了 "&item2&" 个<br>EXP药水增加了 "&item3&" 个<br>对武器施法的卷轴增加了 "&item4&" 个<br>对盔甲施法的卷轴增加了 "&item5&" 个<br>复活卷轴增加了 "&item6&" 个！<br><br>"
			succeed(message&"<meta http-equiv=refresh content=3;url='petitemshop.asp'")
        end if
end select
    end if
    
    rs_pet.close    
%>
<title>宠物道具店</title>
<table border=0 width=97% 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="0" cellpadding="0">
            <tr>
              <td width="28%">
                <table width="79%"  border="0" align="center" cellpadding="3" cellspacing="3">
                  <tr> 
                    <td width="100%">
<!-- #include file=petnav.asp -->
                     <div align="center"><img src="images/pet/25.gif"></div>
                      </td>
                  </tr>
                </table> 
                <div align="left"></div></td>
                <td width="520">
                  <%if action = "showroom" then%>
                  <form action=petitemshop.asp name="name" mtehod=post><div align="left">
<TABLE cellSpacing=1 cellPadding=3 width="100%" align="center" valign="top" border=0 class=a2>
                      <TR> 
                        <TD colspan="3" class=a1><div align="center">物品列表</div></TD>
                      </TR>
                      <TR colspan="3" class=a3> 
                        <TD width="12%"> <DIV align=center><IMG height=35 src="images/pet/hp.gif" width=34><BR>
                            治愈药水</DIV></TD>
                        <TD width="18%"><div align="center">增加宠物 <%=DEF_PET_basicusehp%> 
                            点HP <FONT color=#ff0000><BR>
                            出售价格： </FONT><font color="#FF0000"><%=DEF_PET_basichpmoney%> 
                            <%=DEF_PointsName%> </font><BR>
                          </div></TD>
                        <TD width="19%"> <DIV align=center>购买数量： 
                            <input name="item1" type="text" value="0" size="6" maxlength="5">
                            <br>
                            你所拥有数量：<%=hpitem%> <BR>
                          </DIV></TD>
                      </TR>
                      <TR colspan="3" class=a3> 
                        <TD><DIV align=center><img height=35 src="images/pet/sp.gif" width=35><BR>
                            糖果</DIV></TD>
                        <TD><div align="center">补满宠物的SP<FONT color=#ff0000><BR>
                            出售价格： </FONT><font color="#FF0000"> <%=def_pet_basicspmoney%> 
                            <%=DEF_PointsName%> </font></div></TD>
                        <TD><DIV align=center>购买数量： 
                            <input name="item2" type="text" value="0" size="6" maxlength="5">
                            <br>
                            你所拥有数量：<%=spitem%><BR>
                          </DIV></TD>
                      </TR>
                      <TR colspan="3" class=a3> 
                        <TD><DIV align=center><IMG height=35 src="images/pet/exp.gif" width=35><BR>
                            EXP药水</DIV></TD>
                        <TD><div align="center">增加宠物 <%=def_pet_basicuseexp%>点EXP<FONT color=#ff0000><BR>
                            出售价格： </FONT><font color="#FF0000"> <%=def_pet_basicexpmoney%> 
                            <%=DEF_PointsName%></font></div></TD>
                        <TD><DIV align=center>购买数量： 
                            <input name="item3" type="text" value="0" size="6" maxlength="5">
                            <br>
                            你所拥有数量：<%=expitem%><BR>
                          </DIV></TD>
                      </TR>
                      <TR colspan="3" class=a3> 
                        <TD><div align="center"><IMG height=35 src="images/pet/wj.gif" width=34><BR>
                            对武器施法的卷轴</div></TD>
                        <TD><div align="center">随机增加宠物 0－2 点攻击力<FONT color=#ff0000><BR>
                            出售价格： </FONT><font color="#FF0000"><%=def_pet_atkmoney%> 
                            <%=DEF_PointsName%> </font></div></TD>
                        <TD><div align="center">购买数量： 
                            <input name="item4" type="text" value="0" size="6" maxlength="5">
                            <br>
                            你所拥有数量：<%=atkitem%><BR>
                          </div></TD>
                      </TR>
                      <TR colspan="3" class=a3> 
                        <TD><div align="center"><IMG height=35 src="images/pet/fang.gif" width=34><BR>
                            对盔甲施法的卷轴</div></TD>
                        <TD><div align="center">随机增加宠物 0－3 点防御力<FONT color=#ff0000><BR>
                            出售价格： </FONT><font color="#FF0000"><%=def_pet_defmoney%> 
                            <%=DEF_PointsName%> </font></div></TD>
                        <TD><div align="center">购买数量： 
                            <input name="item5" type="text" value="0" size="6" maxlength="5">
                            <br>
                            你所拥有数量：<%=defitem%><BR>
                          </div></TD>
                      </TR>
                      <TR colspan="3" class=a3> 
                        <TD><div align="center"><IMG height=35 src="images/pet/fuhuo.gif" width=34><BR>
                            <font color="#000000">复活卷轴</font></div></TD>
                        <TD><div align="center">使你的宝宝复活<FONT color=#ff0000><BR>
                            出售价格： </FONT><font color="#FF0000"><%=def_pet_livemoney%> 
                            <%=DEF_PointsName%></font></div></TD>
                        <TD><div align="center">购买数量： 
                            <input name="item6" type="text" value="0" size="6" maxlength="5">
                            <br>
                            你所拥有数量：<%=liveitem%><BR>
                          </div></TD>
                      </TR>
                      <TR colspan="3" class=a3> 
                        <TD colspan="3"><div align="center"> 
                            <table width="100%" border="0" cellspacing="2" cellpadding="2">
                              <tr colspan="3" class=a3> 
                                <td> <div align="center"> 
                                    <input type="hidden" name="action" value="countitem">
                                    <input type="submit" name="submit" value="结帐购买">
                                  </div>
                                  <div align="left"> </div></td>
                              </tr>
                            </table>
                          </div></TD>
                      </TR>
                    </TABLE></div><br><br>
                  </form><%end if%>

  <%if action = "countitem" then%>
<form action=petitemshop.asp name="name" mtehod=post><br>
                    <TABLE cellSpacing=1 cellPadding=3 width="100%" align=center valign="top" border=0 class=a2>
                      <TR> 
                        <TD width="49%" class=a1><div align="center">购买清单</div></TD>
                      </TR>
                      <TR class=a3> 
                        <TD> <DIV align=center> 
                            <table width="100%" border="0" cellspacing=1 cellpadding=3 class=a3>
                              <%if item1>0 then%>
                              <tr class=a3> 
                                <td width="44%"><div align="right">治愈药水：</div></td>
                                <td width="56%"><font color=blue><%=item1%></font> 个</td>
                              </tr>
                              <%end if%>
                              <%if item2>0 then%>
                              <tr class=a3> 
                                <td><div align="right">糖果：</div></td>
                                <td><font color=blue><%=item2%></font> 个</td>
                              </tr>
                              <%end if%>
                              <%if item3>0 then%>
                              <tr class=a3> 
                                <td><div align="right">EXP药水：</div></td>
                                <td><font color=blue><%=item3%></font> 个</td>
                              </tr>
                              <%end if%>
                              <%if item4>0 then%>
                              <tr class=a3> 
                                <td><div align="right">对武器施法的卷轴：</div></td>
                                <td><font color=blue><%=item4%></font> 个</td>
                              </tr>
                              <%end if%>
                              <%if item5>0 then%>
                              <tr class=a3> 
                                <td><div align="right">对盔甲施法的卷轴：</div></td>
                                <td><font color=blue><%=item5%></font> 个</td>
                              </tr>
                              <%end if%>
                              <%if item6>0 then%>
                              <tr class=a3> 
                                <td><div align="right">复活卷轴：</div></td>
                                <td><font color=blue><%=item6%></font> 个</td>
                              </tr>
                              <%end if%>
                              <tr class=a3> 
                                <td><div align="right">总计价格：</div></td>
                                <td><font color=red><%=tmoney%></font> <font color="#000000"><%=DEF_PointsName%></font></td>
                              </tr>
                            </table>
                          </DIV>
                          
                          </TD>
                      </TR>
                      <TR class=a3> 
                        <TD><div align="center"> 

<TABLE cellSpacing=2 cellPadding=1 width="100%" border=0 class=a3>
<TR><TD><DIV align=center> 
<input type="hidden" name="item1" value="<%=item1%>">
<input type="hidden" name="item2" value="<%=item2%>">
<input type="hidden" name="item3" value="<%=item3%>">
<input type="hidden" name="item4" value="<%=item4%>">
<input type="hidden" name="item5" value="<%=item5%>">
<input type="hidden" name="item6" value="<%=item6%>">
<input type="hidden" name="action" value="buyitem">
<input type="submit" value="付  帐">
</DIV></TD></TR></TABLE></div>
</TD></TR></TABLE></form><%end if%>
<table height=100%><tr><td></td></tr></table></td>
            </tr>
          </table> 

<%
htmlend
%>
