<!-- #include file="setup.asp" -->
<%
top
if Request.Cookies("username")=empty then
response.redirect "login.asp"
end if

if instr(Request.Cookies("username")," ")>0 then:error("<li>非法操作"):end if

sql="select * from [user] where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn,1,3

if Request.Cookies("userpass")<>rs("userpass") then
error2("密码错误！")
end if
username=Request.Cookies("username")
rs.close

select case Request("menu")
case "use"
succtitle="成功使用物品!"
use
case "sell"
succtitle="卖出物品成功!"
sell
end select

%>

<head>
<title>我的物品</title>


</head>

<table border=0 width=<%=dkuan%> 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="mytools.asp">我的物品</a></td>
</tr>
</table><br>


<table border="0" cellpadding="0" align="center" cellspacing="0" style="border-collapse: collapse; border-width: 0" width="<%=dkuan%>" id="AutoNumber1">
  <tr>
    <td width="3%"><img src="images/announce.gif" align="middle"></td>
    <td width="67%"><marquee onmouseover="this.stop()" onmouseout="this.start()" width="400" scrollAmount="3"><a href="#" onclick="javascript:open('affiche.asp','','width=400,height=180,resizable,scrollbars')"><%=affichetitle%></a>　［<%=affichetime%>］</marquee></td>
      </tr>
</table> 
<SCRIPT>valigntop()</SCRIPT>
<table cellspacing="1" cellpadding="1" width="<%=dkuan%>" align="center" border="0" class="a2"><tr><td height="25" class="a1" colspan="2">　■<b>社区物品选购<font color=#000000>　　<a href="shop2.asp"><font color=#000000>礼品店</font></a>　|　<a href="wqshop.asp"><font color=#000000>武器店</font></a>　|　<a href="aqshop.asp"><font color=#000000>暗器店</font></a>　|　<a href="fjshop.asp"><font color=#000000>防具店</font></a>　|　<a href="dangpu.asp"><font color=#000000>社区当铺</font></a>  &nbsp;&nbsp;|　<a href="shop.asp"><font color=#000000>其他商品</font></a>　|　<a href="mytools.asp"><font color=#000000>我的物品</font></a></font></b></td></tr><tr>
<td class="a3"><table cellspacing="0" cellpadding="3" width="100%" border="0" style="border-left: 0px none; border-top: 0px none; border-bottom: 1px none"><tr><td><table border="0" cellpadding="0" cellspacing="0" width="100%">          
<br>
<table width="100%" border="0" cellspacing="1" cellpadding="0" height="20" class="a2">
  <tr align="center"> 
    <td width="12%" height="25" class="a1">物品名称</td>
    <td width="12%" height="25" class="a1">购买价格</td>
     <td width="12%" height="25" class="a1">数量</td>
    <td width="12%" height="25" class="a1">购买日期</td>
    <td width="40%" height="25" class="a1">物品介绍</td>
    <td width="12%" height="25" class="a1">使用物品</td>
  </tr>
<form method="post" action="?menu=use">
<%
rs.Open "select * from [mytools] where username='"&username&"' and use < 5",Conn,1,3
if rs.eof then
Response.Write "<table width=100% border=0 cellspacing=1 cellpadding=0 height=20 class=a2><tr align=center>"
Response.Write "<td width=100% height=25 class=a4>你现在没有物品!</td></tr>"
end if
while not rs.eof
%>
  <tr align="center"> 
    <td width="12%" class="a3"><a href=# onclick=javascript:open('showtool.asp?toolname=<%=rs("toolname")%>','','width=220,height=170')><%=rs("toolname")%></a></td>
    <td width="12%" class="a4"><%=rs("price")%></td>
     <td width="12%" class="a3"><%=rs("sum")%></td>
    <td width="12%" class="a4"><%=rs("buydate")%></td>
    <td width="40%" align="left" class="a3"><%=rs("info")%></td>
    <td width="12%" class="a4"><input type="radio" name="toolname" value="<%=rs("toolname")%>"></td>
  </tr>

<%
rs.movenext
wend
rs.close
%></table><br><br>
<table width="97%" border="0" cellspacing="0" cellpadding="0" height="20">
  <tr> 
    <td align="center"><input type="submit" name="Submit" value="使用物品" class="a7" style="width:70px;height:22px">
    </td>
  </tr>
</table>

</form>
<br>

</td>
</tr>
</table>
 </table>
<SCRIPT>valignbottom()</SCRIPT>


<br>
<SCRIPT>valigntop()</SCRIPT>
<table cellspacing="1" cellpadding="1" width="<%=dkuan%>" align="center" border="0" class="a2"><tr><td height="25" class="a1" colspan="2">　■<b> 您的个人状态</b></td></tr><tr>
		<td align="middle" width="5%" class="a3"><img src="images/mystate.gif"></td><td class="a4"><table cellspacing="0" cellpadding="3" width="100%" border="0" style="border-left: 0px none; border-top: 0px none; border-bottom: 1px none"><tr><td><table border="0" cellpadding="0" cellspacing="0" width="100%"> 
<%sql="select * from [user] where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn,1,3
%>  <tr><td width="25%">        社区昵称：<%=rs("username")%></td><td width="20%">
				社区等级：<Script>document.write(level(<%=rs("experience")%>,<%=rs("membercode")%>,'','')+levelname);</Script>  </td><td width="20%">
				社区金币：<%=rs("money")%>  </td><td width="17%">
				发表文章：<%=rs("posttopic")+rs("postrevert")%>  </td><td width="18%">
				精华文章：<%=rs("goodtopic")%>   </td></tr><tr><td>
				社区经验：<%=rs("experience")%>  </td><td>
				社区存款：<%=rs("savemoney")%>  </td><td>
                                魅 力 值：<%=rs("magicpower")%> </td><td>
				体 力 值：<%=rs("userlife")%> </td></tr> <tr><td>
				社区伴侣：<%if ""&rs("consort")&""=empty then
					response.write "无"
					else
					response.write "<a href=Profile.asp?username="&rs("consort")&">"&rs("consort")&"</a>"
					end if%> </td><td>
				社区门派：<%if ""&rs("faction")&""="" then
					response.write "无"
					else
					response.write rs("faction")
					end if%></td><td colspan="2">
				注册日期： <%=rs("regtime")%> </td></tr>
		</table></td></tr>
	</table></td></tr>
  </table><%
       rs.close
       %>
<SCRIPT>valignbottom()</SCRIPT>

<br>
<%

htmlend


sub use
Set rs1 = Server.CreateObject("ADODB.Recordset")
toolname=request("toolname")
if toolname="" then
error("请选择要使用的物品")
end if
rs.Open "select * from [tools] where toolname='"&toolname&"'",Conn,1,3
exps=rs("exp")
magicpower=rs("magicpower")
life=rs("life")
'if rs("use")=0 then
'error("这个物品不能直接使用,它将留在你身边作为某种场合的必要物品!")
'end if
rs1.Open "select * from [user] where username='"&username&"'",Conn,1,3
rs1("experience")=rs1("experience")+exps
rs1("userlife")=rs1("userlife")-5
rs1("magicpower")=rs1("magicpower")+magicpower
rs1("userlife")=rs1("userlife")+life
if rs1("userlife")>100 then
rs1("userlife")=100
end if
rs1.update
rs1.close
rs.close
rs.Open "select * from [mytools] where username='"&username&"' and toolname='"&toolname&"'",Conn,1,3
if rs("sum")>1 then
rs("sum")=rs("sum")-1
else 
rs.delete
end if
rs.update
rs.close


succeed("你已经使用了"&toolname&"，你的魅力值增加了<font color=#FF0000>"&magicpower&"，</font>体力值增加了<font color=#FF0000>"&life&"</font>，经验值增加了<font color=#FF0000>"&exps&"</font>!!<meta http-equiv=refresh content=3;url='mytools.asp'>")
end sub

sub sell
Set rs1 = Server.CreateObject("ADODB.Recordset")
toolname=request("toolname")
if toolname="" then
error("请选择要使用的物品")
end if
rs.Open "select * from [mytools] where username='"&username&"' and toolname='"&toolname&"'",Conn,1,3
rs1.Open "select * from [tools] where toolname='"&toolname&"'",Conn,1,3
price=rs1("price")
rs1.close

rs1.Open "select * from [user] where username='"&username&"'",Conn,1,3
rs1("money")=rs1("money")+price/2
rs.delete
rs.update
rs1.update
rs.close
rs1.close
succeed("你已经出售了<font color=#0000FF>"&toolname&"</font>，获得了<font color=#FF0000>"&price/2&"</font>金币!!<meta http-equiv=refresh content=3;url='dangpu.asp'>")
end sub
%>