<%@ LANGUAGE=VBScript codepage ="936" %>
<!--#include file="sjfunc.asp"-->
<%
Response.Expires=0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Pragma","No-Cache"
Response.AddHeader "Cache-Control","Private"
Response.CacheControl ="No-Cache"
cwjh_jhdj=Session("cwjh_jhdj")
if cwjh_jhdj<17 then
	Response.Write "<script language=JavaScript>{alert('提示:抢夺宝物需要17等级！');}</script>"
	Response.End
end if
if Instr(LCase(Application("cwjh_useronlinename"&nowinroom)),LCase(" "&cwjh_name&" "))=0 then 
	Session("cwjh_inthechat")="0" 
	Response.Redirect "chaterr.asp?id=001" 
end if 
towho=Trim(Request.Form("towho"))
towhoway=Request.Form("towhoway")
saycolor=Request.Form("saycolor")
addwordcolor=Request.Form("addwordcolor")
addsays=Request.Form("addsays")
says=Trim(Request.Form("sy"))
'对暂离开、点哑穴判断
call dianzan(towho)
if len(says)>150 then says=Left(says,150)
says=lcase(says)
says=Replace(says,"&amp;","&")
if cwjh_grade<9 then
says=bdsays(says)
end if
act=1
towhoway=0
i=instr(says,"$")
fnn1=mid(says,i+1)
says="<font color=green>【抢夺宝物】<font color=" & saycolor & ">"+qiang(mid(says,i+1),towho)+"</font>"
call chatsay(act,towhoway,towho,saycolor,addwordcolor,addsays,says)
'抢夺
function qiang(fn1,to1)
if to1="大家" or to1=cwjh_name then
	Response.Write "<script language=JavaScript>{alert('抢夺对象有错，请看仔细了！！');}</script>"
	Response.End
exit function
end if
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("cwjh_usermdb")
rs.open "select * FROM 用户 WHERE 姓名='" & cwjh_name &"'",conn,2,2
sj=DateDiff("n",rs("操作时间"),now())
if sj<1 then
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	ss=1-sj
	Response.Write "<script language=JavaScript>{alert('提示：请你等上["& ss &"]分,再操作！');}</script>"
	Response.End
end if
if rs("grade")>=6 then
	Response.Write "<script language=JavaScript>{alert('提示:官府不能进行操作！');}</script>"
	Response.End
end if
nowinroom=session("nowinroom")
cwjh_roominfo=split(Application("cwjh_room"),";")
chatinfo=split(cwjh_roominfo(nowinroom),"|")
if chatinfo(0)<>"聊天大厅" then
 Response.Write "<script language=javascript>{alert('提示：抢夺宝物请去大厅！');}</script>"
 Response.End
end if
if rs("宝物")=Application("cwjh_baowuname") then
	Response.Write "<script language=JavaScript>{alert('你自己有宝物还要抢人家的呀！');}</script>"
	rs.close
	set rs=nothing	
	conn.close
	set conn=nothing
	Response.End
end if
rs.close
'对方的判断
rs.open "select 宝物,宝物修练,grade from 用户 where 姓名='"&to1&"'",conn
if rs("grade")>=6 then
  Response.Write "<script language=javascript>{alert('提示：不能对官府进行操作！');}</script>"
  Response.End
end if
if rs("宝物")=Application("cwjh_baowuname") then
		conn.execute "update 用户 set 操作时间=now(),宝物修练=0,宝物='"& Application("cwjh_baowuname") &"' where 姓名='"&cwjh_name&"'"
		conn.execute "update 用户 set 宝物修练=0,宝物='无' where 姓名='"&to1&"'"
	qiang=cwjh_name & "把"& to1 &"的宝物:"& Application("cwjh_baowuname") &"抢走，因得到此宝。江湖宝物需要进行修练才可以得到更多的东西！"
		
else
conn.execute "update 用户 set 操作时间=now() where 姓名='"&cwjh_name&"'"
qiang=cwjh_name & "想抢"& to1 &"的宝物,可是"& to1 &"身上并没有什么宝物啊!"
end if
rs.close
set rs=nothing	
conn.close
set conn=nothing
end function
%>