<!--#include file="Inc.asp"-->
<!-- #include file=pet_conn.asp -->
<%
If Not BBS94KK.Founduser Then BBS94KK.GoToErr(10)
BBS94KK.Head("宠物管理区")

if bbs94kk.myadmin<>9 then
    call showmessage("你不是社区管理员，不能进入宠物管理区~","petcenter.asp")
end if


	    dim money,smoney,saveday,allmoney,Chk1,Chk2,daikuang,dkdu,daiday
	    dim Form_userphoto,Form_FaceUrl,Form_FaceWidth,Form_FaceHeight,action
		dim rs,sql

		action = request("action")
		if action = "" then 
	  	  action = "config"
		end if
	


select case action

case "addnew"
	SQL="INSERT INTO petshopdata (pet, newpetclass, pettxt, petsx)VALUES ('"&request("newname")&"', '"&request("newclass")&"', '"&request("newtxt")&"', '"&request("newsx")&"')"
	response.write SQL
	connpet.execute(SQL)
	response.redirect "pet_config_edit.asp?action=add"
	response.end

case "changeconfig" 
    config_file

sub config_file()
  dim filetype,file_name
  
  DEF_PET_close = request("DEF_PET_close")	 '我添加的宠物中心开关
  DEF_PET_namelong = request("DEF_PET_namelong")
  DEF_PET_basichp = request("DEF_PET_basichp")
  DEF_PET_basicsp = request("DEF_PET_basicsp")
  DEF_PET_basicsp2 = request("DEF_PET_basicsp2")
  DEF_PET_eggmoney = request("DEF_PET_eggmoney")
  DEF_PET_relmoney = request("DEF_PET_relmoney")
  DEF_PET_basichpmoney = request("DEF_PET_basichpmoney")
  DEF_PET_basicspmoney = request("DEF_PET_basicspmoney")
  DEF_PET_basicexpmoney = request("DEF_PET_basicexpmoney")
  DEF_PET_atkmoney = request("DEF_PET_atkmoney")
  DEF_PET_defmoney = request("DEF_PET_defmoney")
  DEF_PET_livemoney = request("DEF_PET_livemoney")
  DEF_PET_basicusehp = request("DEF_PET_basicusehp")
  DEF_PET_basicusesp = request("DEF_PET_basicusesp")
  DEF_PET_basicuseexp = request("DEF_PET_basicuseexp")
  DEF_PET_atkup = request("DEF_PET_atkup")
  DEF_PET_defup = request("DEF_PET_defup")
  DEF_PET_petpkhp = request("DEF_PET_petpkhp")
  DEF_PET_petpktime = request("DEF_PET_petpktime")
  DEF_PET_petpklv = request("DEF_PET_petpklv")
  DEF_PET_changesexmoney = request("DEF_PET_changesexmoney")
  DEF_PET_perswordmoney = request("DEF_PET_perswordmoney")
  DEF_PET_pernecklacemoney = request("DEF_PET_pernecklacemoney")
  DEF_PET_perheadmoney = request("DEF_PET_perheadmoney")
  DEF_PET_perbodyemoney = request("DEF_PET_perbodyemoney") 
  DEF_PET_perfootmoney = request("DEF_PET_perfootmoney")
  DEF_PET_nameexpt = request("DEF_PET_nameexpt")
  DEF_PET_newtopicexp = request("DEF_PET_newtopicexp")
  DEF_PET_replytopicexp = request("DEF_PET_replytopicexp")
  DEF_PET_sendbattlemsg = request("DEF_PET_sendbattlemsg")
  DEF_PointsName = request("DEF_PointsName")
  DEF_UpWeopMoney = request("DEF_UpWeopMoney")
  DEF_Pet_ImgMoney = request("DEF_Pet_ImgMoney")
  
  dim errorflag
  if not isnumeric(DEF_PET_namelong) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basichp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicsp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicsp2) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_eggmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_relmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basichpmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicspmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicexpmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_atkmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_defmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_livemoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicusehp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicusesp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_basicuseexp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_atkup) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_defup) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_petpkhp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_petpktime) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_petpklv) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_changesexmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_perswordmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_pernecklacemoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_perheadmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_perbodyemoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_perfootmoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_newtopicexp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_replytopicexp) then
      errorflag = 1
  elseif  not isnumeric(DEF_PET_sendbattlemsg) then
      errorflag = 1
  elseif  not isnumeric(DEF_UpWeopMoney) then
      errorflag = 1
  elseif  not isnumeric(DEF_Pet_ImgMoney) then
      errorflag = 1  
  elseif  DEF_PointsName="" then
      errorflag = 1
  end if  
  

  if errorflag=1 then
      call showmessage("至少有一项设置填写有误，请按要求填写~","pet_config_edit.asp")
  end if
  
  filetype=filetype&"<"&""&"%" & vbcrlf & _
    "dim DEF_PET_version,DEF_PET_close,DEF_PET_message,DEF_PET_namelong,DEF_PET_basichp,DEF_PET_basicsp,DEF_PET_basicsp2" & vbcrlf & _
    "dim DEF_PET_eggmoney,DEF_PET_basichpmoney,DEF_PET_basicspmoney,DEF_PET_basicexpmoney,DEF_PET_atkmoney,DEF_PET_defmoney" & vbcrlf & _
    "dim DEF_PET_livemoney,DEF_PET_basicusehp,DEF_PET_basicusesp,DEF_PET_basicuseexp,DEF_PET_atkup,DEF_PET_defup,DEF_PET_petpkhp" & vbcrlf & _
    "dim DEF_PET_petpktime,DEF_PET_petpklv,DEF_PET_changesexmoney,DEF_PET_perswordmoney,DEF_PET_pernecklacemoney" & vbcrlf & _
    "dim DEF_PET_perheadmoney,DEF_PET_perbodyemoney,DEF_PET_perfootmoney,DEF_PET_nameexpt,DEF_PET_author" & vbcrlf & _
    "dim DEF_PET_newtopicexp,DEF_PET_replytopicexp,DEF_PET_sendbattlemsg,DEF_PointsName,DEF_UpWeopMoney,DEF_Pet_ImgMoney" & vbcrlf & _
    "dim DEF_PET_relmoney" & vbcrlf & _
    "   " & vbcrlf & _
    "DEF_PET_close = "&DEF_PET_close&"                     '宠物中心是否开启" & vbcrlf & _
    "DEF_PET_message = """"                  '保留" & vbcrlf & _
    "DEF_PET_namelong = "&DEF_PET_namelong&"                 '宠物的名字长度10" & vbcrlf & _
    "DEF_PET_nameexpt = """&DEF_PET_nameexpt&"""                 '宠物名字过滤字符，不允许的宠物名字" & vbcrlf & _
    "DEF_PET_basichp = 100                 '宠物的体力值,建议100" & vbcrlf & _
    "DEF_PET_basicsp = 10000               '宠物的饥饿值,建议10000" & vbcrlf & _
    "DEF_PET_basicsp2 = 500                '每天宠物消耗饥饿值,建议500，注意不要超过SP的基本量" & vbcrlf & _
    "DEF_PET_eggmoney = 100                  '基本宠物蛋价格" & vbcrlf & _
    "DEF_PET_relmoney = "&DEF_PET_relmoney&"                '转生费用" & vbcrlf & _
	"DEF_PET_basichpmoney = 100             '恢复宠物体力药水的价格,建议100   " & vbcrlf & _
    "DEF_PET_basicspmoney = 500              '恢复宠物饥饿值药水的价格，建议500" & vbcrlf & _
    "DEF_PET_basicexpmoney = "&DEF_PET_basicexpmoney&"           '增加宠物经验值药水的价格，建议价格设置贵一些" & vbcrlf & _
    "DEF_PET_atkmoney = "&DEF_PET_atkmoney&"                 '攻击力药水的价格" & vbcrlf & _
    "DEF_PET_defmoney = "&DEF_PET_defmoney&"                 '防御力药水的价格" & vbcrlf & _
    "DEF_PET_livemoney = "&DEF_PET_livemoney&"                 '复活药水的价格" & vbcrlf & _
    "DEF_PET_basicusehp = 50              '使用一次增加宠物体力的数量，建议50" & vbcrlf & _
    "DEF_PET_basicusesp = 500             '使用一次增加宠物饥饿的数量，建议500" & vbcrlf & _
    "DEF_PET_basicuseexp = "&DEF_PET_basicuseexp&"              '使用一次增加宠物经验的数量，建议20，数量不要太大" & vbcrlf & _
    "DEF_PET_atkup = 5                     '使用攻击力药水的增加量，建议0" & vbcrlf & _
    "DEF_PET_defup = "&DEF_PET_defup&"                     '使用防御力药水的增加量，建议0" & vbcrlf & _
    "DEF_PET_petpkhp = "&DEF_PET_petpkhp&"                   '宠物之间PK时候当一方宠物低于多少PK便停止，如果设置为1则直到一方死亡PK才告结束，如果想要一方死亡PK才结束，请设置为1" & vbcrlf & _
    "DEF_PET_petpktime = "&DEF_PET_petpktime&"                '宠物PK时的攻击间隔，为了防止恶意刷新请设置100以上,以秒为单位" & vbcrlf & _
    "DEF_PET_petpklv = "&DEF_PET_petpklv&"                  '宠物之间PK时候当两个宠物级别低于这个值时，不能PK，建议设置10以上" & vbcrlf & _
    "DEF_PET_changesexmoney = "&DEF_PET_changesexmoney&"           '宠物变性手术价格" & vbcrlf & _
    "DEF_PET_perswordmoney = "&DEF_PET_perswordmoney&"            '每1点攻击力武器价格(注意：实际是你填的1.1倍Aven这样弄我也懒得改)" & vbcrlf & _
    "DEF_PET_pernecklacemoney = "&DEF_PET_pernecklacemoney&"         '每1点攻击力项链价格(注意：实际是你填的1.1倍Aven这样弄我也懒得改)" & vbcrlf & _
    "DEF_PET_perheadmoney = "&DEF_PET_perheadmoney&"             '每1点防御力头盔价格(注意：实际是你填的1.1倍Aven这样弄我也懒得改)" & vbcrlf & _
    "DEF_PET_perbodyemoney = "&DEF_PET_perbodyemoney&"            '每1点防御力盔甲价格(注意：实际是你填的1.1倍Aven这样弄我也懒得改)" & vbcrlf & _
    "DEF_PET_perfootmoney = 1000             '每1点防御力鞋子价格(注意：实际是你填的1.1倍Aven这样弄我也懒得改)" & vbcrlf & _
    "DEF_PET_replytopicexp = 20             '回复主题时给作者的宠物增加的exp点数    " & vbcrlf & _
    "DEF_PET_newtopicexp = 100               '发表新主题时给作者的宠物增加的exp点数    " & vbcrlf & _
    "DEF_PET_sendbattlemsg = 1             '是否发送攻击短消息，1为发送，0为不发送" & vbcrlf & _
    "DEF_UpWeopMoney = 1000             '每次升级武器消耗的金钱，建议稍大一点" & vbcrlf & _
    "DEF_Pet_ImgMoney = 1000             '固定宠物形象需要的金钱，建议10000" & vbcrlf & _
	"DEF_PointsName = """&DEF_PointsName&"""             '论坛货币名称" & vbcrlf & _
	"%"&""&">"
  file_name="pet_config.asp"
  call create_file(file_name,filetype)
  
  call showmessage("成功保存各项设置~","pet_config_edit.asp")
end sub


sub create_file(file_name,filetype)
  dim filetemp,fileos,filepath
  'dim createtextfile 
  set fileos=CreateObject("Scripting.FileSystemObject")
  filepath=server.mappath(file_name)
  set filetemp=fileos.createtextfile(filepath,true)
  filetemp.writeline( filetype )
  filetemp.close
  set filetemp=nothing
  set fileos=nothing
end sub

case "orphpet"
    if request("petid") <> "" and isnumeric(request("petid")) then
		set rs=connpet.execute("SELECT * FROM mypetdata WHERE id="&cint(request("petid")))
		dim newexp
		newexp=rs("mypetexp")-int(rs("mypetexp")*20/100)
		connpet.ExeCute("INSERT INTO petdeldata (username, mypet,mypetname,mypetlevel,mypetexp,mypetmaxhp,mypetatk,mypetdef,mypetsex,mypetsx,petdeldate)VALUES ('"& rs("username") &"', '"& rs("mypet") &"', '"& rs("mypetname") &"', '"& rs("mypetlevel") &"', '"& newexp &"','"& rs("mypetmaxhp") &"', '"& rs("mypetatk") &"', '"& rs("mypetdef") &"', '"& rs("mypetsex") &"', '"& rs("mypetsx") &"', '"& now() &"')")
		bbs94kk.execute("INSERT INTO kk_sMs (myname, name, Content, addTime) values('"&rs("username")&"','宠物中心','因为你长期不给宝宝喂食，你的宝宝不堪忍受虐待，离家出走了。现在正在宠物收容所呢！快把它找回来吧！','"&now&"')")
        connpet.ExeCute("DELETE FROM mypetdata WHERE id = " & request("petid"))
		call showmessage("丢弃完了，宠物已经放在宠物收容所了","pet_config_edit.asp?action=userpet")
        else
        call showmessage("该用户还没有宠物~","pet_config_edit.asp?action=userpet")
	end if

case "delpet"
    if request("petid") <> "" and isnumeric(request("petid")) then
        connpet.ExeCute("DELETE FROM mypetdata WHERE id = " & request("petid"))
        call showmessage("成功删除该用户的宠物~","pet_config_edit.asp?action=userpet")
        else
        call showmessage("该用户还没有宠物~","pet_config_edit.asp?action=userpet")
    end if
case "delallbattlemsg"
   
    call showmessage("成功删除所有竞技短消息~","pet_config_edit.asp?action=battlemsg")
case "delreadbattlemsg"    
    
    call showmessage("成功删除所有已读竞技短消息~","pet_config_edit.asp?action=battlemsg")
case "changepet"   '我添加的部分
    call chkchange
    call change_pet
    call showmessage("成功保存各项设置~","pet_config_edit.asp?action=userpet")
end select
%>

<table width="760" border="0" cellspacing="1" cellpadding="5" align="center" class=TBone>
  <tr>
    <td class=tbbg1>

<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="25%"><div align="center"><a href="?action=config">宠物参数设置</a></div></td>
<td width="25%"><div align="center"><a href="?action=userpet">用户宠物管理</a></div></td>
<td width="25%"><div align="center"><a href="?action=battlemsg">竞技消息删除</a></div></td>
<td width="25%"><div align="center"><a href="?action=add">添加新宠物</a></div></td>
</tr></table>    

    </td>
  </tr>
  <tr>
    <td class=tbbg1>
<%if action="config" then%>
<div align="center">
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<tr align=center>
<td width='36%'>设置名称</td>
<td width='20%'>参数</td>
<td width='34%'>相关说明</td>
</tr>
<form action='pet_config_edit.asp' method=post>

<tr>
<td>程序制作：</td>
<td><%=DEF_PET_author%>　</td>
<td>　</td>
</tr>
<tr>
<td>版本信息：</td>
<td><%=DEF_PET_version%>　</td>
<td> </td>
</tr>
<tr>
<td>宠物名字长度：</td>
<td><input type=text class=fminpt name="DEF_PET_namelong" value='<%=DEF_PET_namelong%>' size=38 maxlength=50></td>
<td>用户自定义宠物的名字长度</td>
</tr>
<tr>
<td>宠物名字过滤：</td>
<td><input type=text class=fminpt name="DEF_PET_nameexpt" value='<%=DEF_PET_nameexpt%>' size=38 maxlength=50></td>
<td>不允许的宠物名字,使用"|"隔开</td>
</tr>
<tr>
<td>宠物的基础体力值：</td>
<td><input type=text class=fminpt name="DEF_PET_basichp" value='<%=DEF_PET_basichp%>' size=38 maxlength=50></td>
<td>建议100</td>
</tr>
<tr>
<td>宠物的饥饿值：</td>
<td><input type=text class=fminpt name="DEF_PET_basicsp" value='<%=DEF_PET_basicsp%>' size=38 maxlength=50></td>
<td>建议10000</td>
</tr>
<tr>
<td>每天宠物消耗饥饿值：</td>
<td><input type=text class=fminpt name="DEF_PET_basicsp2" value='<%=DEF_PET_basicsp2%>' size=38 maxlength=50></td>
<td>建议500，注意不要超过SP的基本量</td>
</tr>
<tr>
<td>基本宠物蛋价格：</td>
<td><input type=text class=fminpt name="DEF_PET_eggmoney" value='<%=DEF_PET_eggmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>转生费用：</td>
<td><input type=text class=fminpt name="DEF_PET_relmoney" value='<%=DEF_PET_relmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>，建议10000</td>
</tr>
<tr>
<td>恢复宠物体力药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_basichpmoney" value='<%=DEF_PET_basichpmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>，建议1000</td>
</tr>
<tr>
<td>恢复宠物饥饿值药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_basicspmoney" value='<%=DEF_PET_basicspmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>，建议500</td>
</tr>
<tr>
<td>增加宠物经验值药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_basicexpmoney" value='<%=DEF_PET_basicexpmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>，建议价格设置贵一些</td>
</tr>
<tr>
<td>攻击力药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_atkmoney" value='<%=DEF_PET_atkmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>防御力药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_defmoney" value='<%=DEF_PET_defmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>复活药水的价格：</td>
<td><input type=text class=fminpt name="DEF_PET_livemoney" value='<%=DEF_PET_livemoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>使用一次增加宠物体力的数量：</td>
<td><input type=text class=fminpt name="DEF_PET_basicusehp" value='<%=DEF_PET_basicusehp%>' size=38 maxlength=50></td>
<td>建议100</td>
</tr>
<tr>
<td>使用一次增加宠物饥饿的数量：</td>
<td><input type=text class=fminpt name="DEF_PET_basicusesp" value='<%=DEF_PET_basicusesp%>' size=38 maxlength=50></td>
<td>建议100</td>
</tr>
<tr>
<td>使用一次增加宠物经验的数量：</td>
<td><input type=text class=fminpt name="DEF_PET_basicuseexp" value='<%=DEF_PET_basicuseexp%>' size=38 maxlength=50></td>
<td>建议50数量不要太大</td>
</tr>
<tr>
<td>使用攻击力药水的增加量：</td>
<td><input type=text class=fminpt name="DEF_PET_atkup" value='<%=DEF_PET_atkup%>' size=38 maxlength=50></td>
<td>建议不要超过5</td>
</tr>
<tr>
<td>使用防御力药水的增加量：</td>
<td><input type=text class=fminpt name="DEF_PET_defup" value='<%=DEF_PET_defup%>' size=38 maxlength=50></td>
<td>建议不要超过5</td>
</tr>
<tr>
<td>PK时当一方宠物HP低于多少便停止：</td>
<td><input type=text class=fminpt name="DEF_PET_petpkhp" value='<%=DEF_PET_petpkhp%>' size=38 maxlength=50></td>
<td>如果设置为1则直到一方死亡PK才告结束，如果想要一方死亡PK才结束，请设置为1</td>
</tr>
<tr>
<td>宠物PK时的攻击间隔：</td>
<td><input type=text class=fminpt name="DEF_PET_petpktime" value='<%=DEF_PET_petpktime%>' size=38 maxlength=50></td>
<td>为了防止恶意刷新请设置100以上,以秒为单位</td>
</tr>
<tr>
<td>宠物之间PK级别间隔：</td>
<td><input type=text class=fminpt name="DEF_PET_petpklv" value='<%=DEF_PET_petpklv%>' size=38 maxlength=50></td>
<td>宠物之间PK时候当两个宠物级别低于这个值时，不能PK建议设置10以上</td>
</tr>
<tr>
<td>宠物变性手术价格：</td>
<td><input type=text class=fminpt name="DEF_PET_changesexmoney" value='<%=DEF_PET_changesexmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点攻击力武器价格：</td>
<td><input type=text class=fminpt name="DEF_PET_perswordmoney" value='<%=DEF_PET_perswordmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点攻击力项链价格：</td>
<td><input type=text class=fminpt name="DEF_PET_pernecklacemoney" value='<%=DEF_PET_pernecklacemoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点防御力头盔价格：</td>
<td><input type=text class=fminpt name="DEF_PET_perheadmoney" value='<%=DEF_PET_perheadmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点防御力盔甲价格：</td>
<td><input type=text class=fminpt name="DEF_PET_perbodyemoney" value='<%=DEF_PET_perbodyemoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点防御力鞋子价格：</td>
<td><input type=text class=fminpt name="DEF_PET_perfootmoney" value='<%=DEF_PET_perfootmoney%>' size=38 maxlength=50></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>回复主题增加经验值：</td>
<td><input type=text class=fminpt name="DEF_PET_replytopicexp" value='<%=DEF_PET_replytopicexp%>' size=38 maxlength=50></td>
<td>EXP</td>
</tr>
<tr>
<td>发表主题增加经验值：</td>
<td><input type=text class=fminpt name="DEF_PET_newtopicexp" value='<%=DEF_PET_newtopicexp%>' size=38 maxlength=50></td>
<td>EXP</td>
</tr>
<tr>
<td>是否发送攻击短消息：</td>
<td><input type=text class=fminpt name="DEF_PET_sendbattlemsg" value='<%=DEF_PET_sendbattlemsg%>' size=38 maxlength=50></td>
<td>1为发送，0为不发送</td>
</tr>
<tr>
<td>每次升级武器消耗的金钱：</td>
<td><input type=text class=fminpt name="DEF_UpWeopMoney" value='<%=DEF_UpWeopMoney%>' size=38 maxlength=50></td>
<td>建议设置大一点</td>
</tr>
<tr>
<td>固定宠物形象消耗的金钱：</td>
<td><input type=text class=fminpt name="DEF_Pet_ImgMoney" value='<%=DEF_Pet_ImgMoney%>' size=38 maxlength=50></td>
<td>建议设置大一点</td>
</tr>
<tr>
<td>论坛货币名称：</td>
<td><input type=text class=fminpt name="DEF_PointsName" value='<%=DEF_PointsName%>' size=38 maxlength=50></td>
<td>默认设置为"货币"</td>
</tr>
<% 
 if DEF_PET_close>1 then		'论坛开启状态判断
	Chk1=""
	Chk2="Checked"
else
	Chk1="Checked"
	Chk2=""
end if
%>
<td>宠物中心状态：</td>
<td><input type="radio" name="DEF_PET_close" <% =Chk1 %> value="1">开启   <input type="radio" name="DEF_PET_close"  <% =Chk2 %> value="2"><Font color=red>关闭</Font>    
</td>
<td>默认设置为"开启"</td>
</tr>

<tr>
<td colspan="3">
注意：以上宠物名字过滤字符使用"|"隔开，其它各项必须填写数字。
</td>
</tr>                          
<tr>
<td colspan="3" align="center">
<input type="hidden" name="action" value="changeconfig"> 
<input type="submit" value="提交修改" class=fmbtn>
</td>
</tr>                          
</form>
</table>
</div>
<%end if%>

<!-- 我添加的部分 -->
<%if action="editpet" then%>
<div align="center">
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<tr align=center>
<td width='36%'>设置名称</td>
<td width=* >参数</td>
</tr>
<% 
  if request("petid") <> "" and isnumeric(request("petid")) then
    sql = "select * from mypetdata WHERE id = " & request("petid") &""
    set rs = connpet.execute(sql)
    dim level1,petatk,petdef,Chksex1,Chksex2,Chkcon1,Chkcon2,Chkpk1,Chkpk2,hpmaxskill,maxhp,str,ski,def,vit

    level1=int(rs("mypetlevel")/2)
    petatk=rs("mypetatk")
    petdef=rs("mypetdef")
    str=rs("str")
	ski=rs("ski")
	def=rs("def")
	vit=rs("vit")
         '获取生命上限
   	      hpmaxskill=1
          if rs("hpmaxskill")>0 then
          hpmaxskill=1+rs("hpmaxskill")/100
          end if 
          if rs("hpmaxskill")>30 then
          hpmaxskill=1.2+rs("hpmaxskill")/100
          end if 
          if rs("hpmaxskill")>100 then
          hpmaxskill=1.5+rs("hpmaxskill")/100
          end if 
          maxhp =int((rs("mypetmaxhp")+vit)*hpmaxskill)
%>
<form action='pet_config_edit.asp' method=post>
<tr>
<td  align="center">宠物主人：</td>
<td  align="center"><input type=text class=fminpt name="username" value='<% = rs("username")%>' size=70></td>
</tr>
<tr>
<td  align="center">宠物名字：</td>
<td  align="center"><input type=text class=fminpt name="mypet" value='<% = rs("mypet")%>' size=70></td>
</tr>
<tr>
<td  align="center">宠物物种：</td>
<td  align="center"><input type=text class=fminpt name="mypetname" value='<% = rs("mypetname")%>'size=70 ><br> 有dragon(泡泡龙)、bst(猫尾球)、bird(天使球)、green(苹果宝宝)、devil(幽灵球)</td>
</tr>
<tr>
<td  align="center">宠物性别：</td>
<td>
<%
if rs("mypetsex")>1 then 
Chksex1=""
Chksex2="Checked"
else
Chksex1="Checked"
Chksex2=""
end if
%>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" name="mypetsex" <% =Chksex1 %> value="1">男生   <input type="radio" name="mypetsex"  <% =Chksex2 %> value="2">女生
</td>
</tr>
<tr>
<td  align="center">宠物状态：</td>
<td>
<%
if rs("mypethp")<1 or rs("mypetsp")<1 or rs("mypetdead")>0 then 
Chkcon1=""
Chkcon2="Checked"
else
Chkcon1="Checked"
Chkcon2=""
end if
%>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" name="petcon" <% =Chkcon1 %> value="0">生存  <input type="radio" name="petcon"  <% =Chkcon2 %> value="1">死亡
</td>
</tr>
<tr>
<td  align="center">宠物PK：</td>
<td>
<%
if rs("openpk")>1 then 
Chkpk1=""
Chkpk2="Checked"
else
Chkpk1="Checked"
Chkpk2=""
end if
%>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" name="openpk" <% =Chkpk1 %> value="1">开启  <input type="radio" name="openpk"  <% =Chkpk2 %> value="2">关闭
</td>
</tr>
<tr>
<td  align="center">宠物属性：</td>
<td  align="center"><input type=text class=fminpt name="mypetsx" value='<% = rs("mypetsx")%>' size=70></td>
</tr>
<tr>
<td  align="center">宠物级别：</td>
<td  align="center"><input type=text class=fminpt name="mypetlevel" value='<% = rs("mypetlevel")%>' size=70></td>
</tr>
<td  align="center">基础攻击力：</td>
<td  align="center"><input type=text class=fminpt name="petatk" value='<% = petatk %>' size=70></td>
</tr>
<tr>
<td  align="center">基础防御力：</td>
<td  align="center"><input type=text class=fminpt name="petdef" value='<% = petdef %>' size=70></td>
</tr>
<tr>
<td  align="center">宠物HP：</td>
<td  align="center"><input type=text class=fminpt name="mypethp" value='<% = rs("mypethp") %>' size=30>/<%= maxhp %></td>
</tr>
<tr>
<td align="center">宠物基础HP：</td>
<td align="center"><input type=text class=fminpt name="mypetmaxhp" value='<% = rs("mypetmaxhp")%>' size=30></td>
</tr>
<tr>
<td  align="center">宠物SP：</td>
<td  align="center"><input type=text class=fminpt name="mypetsp" value='<% = rs("mypetsp") %>' size=38>/<%=DEF_PET_basicsp%></td>
</tr>
<tr>
<td  align="center">*宠物EXP：</td>
<td  align="center"><input type=text class=fminpt name="mypetexp" value='<% = rs("mypetexp") %>' size=38></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="hidden" name="petid" value='<% = rs("id") %>'> 
<input type="hidden" name="action" value="changepet"> 
<input type="submit" value="提交修改" class=fmbtn>
</td>
</tr>
</form>
</table>
</div>
<%
    rs.close
  end if
end if
%>
<%
 

'做数据合法性检查和改动检查
 sub Chkchange		
      dim errorflag
      if request("username") = "" then
        errorflag = 1
      elseif request("mypet") = "" then
        errorflag = 1
      elseif request("mypetname") = "" then
        errorflag = 1
      elseif request("mypetsx") = "" then
        errorflag = 1
      end if
     if errorflag = 1 then
       call showmessage("至少有一项设置填写有误，请按要求填写~","pet_config_edit.asp")
     end if
  end sub
  
  
  
  
  sub change_pet	'未完成
    dim SQL,maxsp

          
'饥饿值的限制
           if request("mypetsp")>10000  then
              maxsp = 10000
           else
              maxsp = request("mypetsp")
           end if
            SQL = "UPDATE mypetdata SET username='"& request("username") &"' ,mypet='"& request("mypet") &"' ,mypetname='"& request("mypetname") &"',mypetsex='"& request("mypetsex") &"' ,openpk='"& request("openpk") &"',mypetsx='"& request("mypetsx") &"',mypetlevel='"& request("mypetlevel") &"' ,mypethp='"& request("mypethp") &"' ,mypetmaxhp='"& request("mypetmaxhp") &"' ,mypetatk='"& request("petatk") &"' ,mypetdef='"& request("petdef") &"' ,mypetdead='"& request("petcon") &"' ,mypetsp='"& maxsp &"',mypetexp='"& request("mypetexp") &"'  WHERE id = " & request("petid") &""
            connpet.ExeCute(SQL)
  end sub
%>
<!-- 我添加的部分结束 -->


<%if action="userpet" then%>
<div align="center">
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<form name="searchuser" method="POST" action="pet_config_edit.asp?action=userpet">
<tr><td align="center">点击宠物名字查看详细,查找用户的宠物:  <input type="text" name="txtitle" size="13" class=fminpt>	<input type="submit" value="查询" name="title" class=fmbtn>                                            
</td></tr>
</form>
</table>                                      
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<tr align=center>
<td width='15%'>宠物主人</td>
<td width='15%'>宠物名字</td>
<td width='10%'>宠物等级</td>
<td width='5%'>基础攻击力</td>
<td width='5%'>基础防御力</td>
<td width='10%'>宠物HP</td>
<td width='10%'>宠物SP</td>
<td width='15%'>相关状态</td>
<td width='15%'>相关操作</td>
</tr>

<%
dim title 
title=request("txtitle") 
if not isempty(request("page")) then 
  		currentPage=cint(request("page")) 
else 
  		currentPage=1 
end if 

if title = "" then
sql = "select * from mypetdata ORDER BY relive DESC,mypetlevel DESC"
else
sql = "select * from mypetdata where username like '%"& title &"%' ORDER BY mypetlevel DESC"
end if
set rs = server.createobject("adodb.recordset")
rs.open sql,connpet,1,1
if rs.eof then
    %>
<tr>
<td colspan="7" align="center">社区无人领养宠物</td>
</tr>
    <%
    else
      		dim totalPut,currentpage,MaxAnnouncePerpage
      		MaxAnnouncePerPage=25
      		
      		totalPut=rs.recordcount
      		if currentpage<1 then
          		currentpage=1
      		end if
			MaxAnnouncePerpage=Clng(MaxAnnouncePerpage)                                          
      		if (currentpage-1)*MaxAnnouncePerPage>totalput then                                           
				if (totalPut mod MaxAnnouncePerPage)=0 then                                           
						currentpage= totalPut \ MaxAnnouncePerPage                                           
				else                                           
						currentpage= totalPut \ MaxAnnouncePerPage + 1                                           
				end if                                           
      		end if                                           
       		if currentPage=1 then                                           
            		showContent                                           
            		showpage totalput,MaxAnnouncePerPage,"pet_config_edit.asp?action=userpet"
       		else                                           
          		if (currentPage-1)*MaxAnnouncePerPage<totalPut then                                           
            			rs.move  (currentPage-1)*MaxAnnouncePerPage                                          
            			dim bookmark                                           
            			bookmark=rs.bookmark                                            
            			showContent                                           
             			showpage totalput,MaxAnnouncePerPage,"pet_config_edit.asp?action=userpet"                                           
        		else                                           
	        		currentPage=1                                           
           			showContent                                           
           			showpage totalput,MaxAnnouncePerPage,"pet_config_edit.asp?action=userpet"                                           
	      		end if                                           
	   		end if                  
end if
%>
</table>
</div>
<%
sub showContent                                          
   	dim i                                          
	i=0                                          
	dim saveday,level1,petatk,petdef,pethp1,petsp1
	do while not rs.eof

    level1=int(rs("mypetlevel")/2)
    petatk=rs("mypetatk")
    petdef=rs("mypetdef")
	pethp1=rs("mypethp")
	petsp1=rs("mypetsp")-(DateDiff("d", rs("petregdate"), date())*DEF_PET_basicsp2)
%>                                          
<tr align="center">
<td><a href="Userinfo.asp?Name=<%=rs("username")%>" target="viewuser"><%=rs("username")%></a></td>
<td><a href="petview.asp?username=<%=rs("username")%>" target="viewpet"><%=rs("mypet")%></a></td>
<td><%=rs("mypetlevel")%></td>
<td><%=petatk%></td>
<td><%=petdef%></td>
<td><%=pethp1%></td>
<td><%=petsp1%></td>
<td>
<%
if rs("mypethp")<1 or rs("mypetsp")<1 then 
response.write "死亡"
else
response.write "生存"
end if
%>
</td>
<td><a href="?action=editpet&petid=<%=rs("id")%>">编辑</a>   <a href="?action=orphpet&petid=<%=rs("id")%>" onclick="javascript:{if(confirm('您确定执行抛弃操作吗?')){return true;}return false;}">抛弃</a>　<a href="?action=delpet&petid=<%=rs("id")%>" onclick="javascript:{if(confirm('您确定执行删除操作吗?')){return true;}return false;}">删除</a></td>
</tr>
<%                                           
	i=i+1                                          
	if i>=MaxAnnouncePerPage then exit do                                          
	rs.movenext                                          
	loop                                          
end sub

function showpage(totalnumber,MaxAnnouncePerPage,filename)                                          
%>
<div align="center">
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<tr>
<td>
<%
    dim n                                    
  if totalnumber mod MaxAnnouncePerPage=0 then                                          
     n= totalnumber \ MaxAnnouncePerPage                                          
  else                                          
     n= totalnumber \ MaxAnnouncePerPage+1                                          
  end if                                          
  response.write "<p align='center'> "                                          
  if CurrentPage<2 then                                          
    response.write "首页 上一页 "                                          
  else                                          
    response.write "<a href="&filename&"&page=1&txtitle="&request("txtitle")&">首页</a> "                                          
    response.write "<a href="&filename&"&page="&CurrentPage-1&"&txtitle="&request("txtitle")&">上一页</a> "                                          
  end if                                          
  if n-currentpage<1 then                                          
    response.write "下一页 尾页"                                          
  else                                          
    response.write "<a href="&filename&"&page="&(CurrentPage+1)&"&txtitle="&request("txtitle")&">"                                          
    response.write "下一页</a> <a href="&filename&"&page="&n&"&txtitle="&request("txtitle")&">尾页</a>"                                          
  end if                                          
   response.write " 页次：</font><strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "                                          
   response.write " 共<b>"&totalnumber&"</b>个用户 <b>"&MaxAnnouncePerPage&"</b>个用户/页 "                                          
%> 　</td>
</tr>
</table>
</div>
<%
end function                                          

end if%>

<div align="center">
<table width="95%" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF>
<!--<tr align=center>
<td>社区共有 <b><'%=allbattlemsg%></b> 条竞技短消息，已读 <b><'%=readbattlemsg%></b> 条，未读 <b><'%=allbattlemsg-readbattlemsg%></b> 条。</td>
</tr>-->
<tr align=center>
<td>
    <input type="button" value="删除已读竞技短消息" name="title" class=fmbtn onclick="javascript:window.location='pet_config_edit.asp?action=delreadbattlemsg';">
    <input type="button" value="删除所有竞技短消息" name="title" class=fmbtn onclick="javascript:window.location='pet_config_edit.asp?action=delallbattlemsg';">
</td>
</tr>
</table>
</div>


<%if action="add" then%>
	<center><table>
<form method=post action="pet_config_edit.asp">
		<tr>
		<td>名字</td>
		<td><input type="text" name="newname" size="20"></td>
	</tr>
	<tr>
		<td>英文识别</td>
		<td><input type="text" name="newclass" size="20"></td>
	</tr>
	    <tr>
		<td>属性（中文）</td>
		<td><input type="text" name="newsx" size="20"></td>
	    </tr>

	<tr>
		<td>说明</td>
		<td><input type="text" name="newtxt" size="20"></td>
	</tr>
	<tr>
	<input type="hidden" name="action" value="addnew">
	</tr>
	        <tr>
		<td><input type="submit"></td>
		<td><input type="reset"></td>
	    </tr>
	</form>
	</table>
</center>
<%end if%>

            </td>
            </tr>
          </table> 

	</td></tr></table>
<%bbs94kk.footer()%>

