<%@ LANGUAGE=VBScript codepage ="936" %>
<!--#include file="sjfunc.asp"-->
<!--#include file="func.asp"-->
<!--#include file="../../mywp.asp"-->
<%
cwjh_name=Session("cwjh_name")
cwjh_grade=Session("cwjh_grade")
cwjh_jhdj=Session("cwjh_jhdj")
nowinroom=session("nowinroom")
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)
pk="【学习技能】"
says="<font color=red>"&pk&"<font color=" & saycolor & ">"+xuexi(mid(says,i+1),towho)+"</font>"
call chatsay("学习",towhoway,towho,saycolor,addwordcolor,addsays,says)
'学习
function xuexi(fn1,to1)
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("cwjh_usermdb")
rs.open "select * from 技能 where 技能='" & trim(fn1) & "'",conn,1,1
if rs.eof or rs.bof then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：学习的（"& fn1 &"）技能在江湖数据库中并不存在！');}</script>"
	Response.End	
end if
zsfb=rs("词")'攻击的描述词
zsfc=rs("说明")'说明
zsfd=rs("条件")'条件
zsfk=rs("属性")'是否为防御技能
zsfe=rs("pic")'图片
zsfk=rs("角色")
zsfg=rs("g")'消耗的法力
xhfl=int(zsfg/10)
rs.close
rs.open "select * from 用户 where 姓名='" & cwjh_name & "' and "&zsfd,conn,1,3
if rs.eof or rs.bof then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：用户数据出错或者不满足进行" & zsfk & "技能学习的条件！');}</script>"
	Response.End	
end if
if rs("角色")<>zsfk then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：不是" & zsfk & "，不可以进行" & zsfk & "技能的学习操作！');}</script>"
	Response.End	
end if
if rs("法力")<xhfl then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：你的法力不足"& xhfl &"点，不可以进行学习操作！');}</script>"
	Response.End
end if
if rs("银两")<zsfg then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('提示：你的银两不足"& zsfg &"，不可以进行学习操作！');}</script>"
	Response.End
end if
duyao=rs("w11")
if isnull(duyao) or duyao=abate(rs("w11"),fn1,1)  then 
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing

	Response.Write "<script Language=Javascript>alert('提示：你连一本【"&fn1&"】也没有耶.看清楚好吗!');</script>"
	response.end
end if
addmf=add(rs("mf"),fn1,1)
duyao=abate(rs("w11"),fn1,1)
conn.execute "update 用户 set mf='"& addmf &"',w11='"& duyao &"',银两=银两-"& zsfg &",体力=体力-"&xhfl&",法力=法力-"&xhfl&" where 姓名='" & cwjh_name &"'"
xuexi="["&cwjh_name&"]翻开了角色（"&zsfk&"）的<b><font color=black>【"&fn1&"】</font></b>技能书，机缘巧合居然学会了<b><font color=black>【"&fn1&"】</font></b>，！"&cwjh_name&"损失了体力"&xhfl&"点和法力"&xhfl&"点"
exit function
rs.close
set rs=nothing
conn.close
set conn=nothing
Response.Write "<script Language=Javascript>alert('提示：学习角色技能书【"&fn1&"】成功！');location.href = 'javascript:history.go(-1)';</script>"
Response.end
end function
%>