<!--#include file="Class_SQL.asp"-->

<% 
Class PetManageClass

Sub ShowPetManage%>
<table width=100% align="center" border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 bordercolordark=#FFFFFF class=a3>
<tr align=center>
<td width='32%'>设置名称</td>
<td width='30%'>参数</td>
<td width='38%'>相关说明</td>
</tr>
<form action='PetManage.asp?Action=Modify' method=post>

<tr>
<td>宠物管理员：</td>
<td><input type=text name="PetMaster" value='<%=PetMaster%>' size=38 maxlength=50>
<td>设定宠物管理员,可以设定多人,使用"|"隔开</td>
</tr>

<tr>
<td>宠物名字长度：</td>
<td><input type=text name="DEF_PET_namelong" value='<%=DEF_PET_namelong%>' size=38 maxlength=50 <%NumOnly%>>
<td>用户自定义宠物的名字长度</td>
</tr>
<tr>
<td>宠物名字过滤：</td>
<td><input type=text name="DEF_PET_nameexpt" value='<%=DEF_PET_nameexpt%>' size=38 maxlength=50></td>
<td>不允许的宠物名字,使用"|"隔开</td>
</tr>
<tr>
<td>宠物的体力值：</td>
<td><input type=text name="DEF_PET_basichp" value='<%=DEF_PET_basichp%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>建议100</td>
</tr>
<tr>
<td>宠物的饥饿值：</td>
<td><input type=text name="DEF_PET_basicsp" value='<%=DEF_PET_basicsp%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>建议10000</td>
</tr>
<tr>
<td>每天宠物消耗饥饿值：</td>
<td><input type=text name="DEF_PET_basicsp2" value='<%=DEF_PET_basicsp2%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>建议500，注意不要超过SP的基本量</td>
</tr>

<tr>
<td>恢复宠物体力药水的价格：</td>
<td><input type=text name="DEF_PET_basichpmoney" value='<%=DEF_PET_basichpmoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>，建议1000</td>
</tr>
<tr>
<td>恢复宠物饥饿值药水的价格：</td>
<td><input type=text name="DEF_PET_basicspmoney" value='<%=DEF_PET_basicspmoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>，建议500</td>
</tr>
<tr>
<td>增加宠物经验值药水的价格：</td>
<td><input type=text name="DEF_PET_basicexpmoney" value='<%=DEF_PET_basicexpmoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>，建议价格设置贵一些</td>
</tr>
<tr>
<td>对武器施法的卷轴的价格：</td>
<td><input type=text name="DEF_PET_atkmoney" value='<%=DEF_PET_atkmoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>对盔甲施法的卷轴的价格：</td>
<td><input type=text name="DEF_PET_defmoney" value='<%=DEF_PET_defmoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>魂之精的价格：</td>
<td><input type=text name="DEF_PET_livemoney" value='<%=DEF_PET_livemoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>使用一次增加宠物体力的数量：</td>
<td><input type=text name="DEF_PET_basicusehp" value='<%=DEF_PET_basicusehp%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>建议100</td>
</tr>
<tr>
<td>使用一次增加宠物饥饿的数量：</td>
<td><input type=text name="DEF_PET_basicusesp" value='<%=DEF_PET_basicusesp%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>建议100</td>
</tr>
<tr>
<td>使用一次增加宠物经验的数量：</td>
<td><input type=text name="DEF_PET_basicuseexp" value='<%=DEF_PET_basicuseexp%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>建议50数量不要太大</td>
</tr>
<tr>
<td>使用对武器施法的卷轴的增加量：</td>
<td><input type=text name="DEF_PET_atkup" value='<%=DEF_PET_atkup%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>建议不要超过5</td>
</tr>
<tr>
<td>使用对盔甲施法的卷轴的增加量：</td>
<td><input type=text name="DEF_PET_defup" value='<%=DEF_PET_defup%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>建议不要超过5</td>
</tr>
<tr>
<td>PK时当一方宠物HP低于多少便停止：</td>
<td><input type=text name="DEF_PET_petpkhp" value='<%=DEF_PET_petpkhp%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>如果设置为1则直到一方死亡PK才告结束，如果想要一方死亡PK才结束，请设置为1</td>
</tr>
<tr>
<td>宠物PK时的攻击间隔：</td>
<td><input type=text name="DEF_PET_petpktime" value='<%=DEF_PET_petpktime%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>为了防止恶意刷新请设置100以上,以秒为单位</td>
</tr>
<tr>
<td>宠物之间PK级别间隔：</td>
<td><input type=text name="DEF_PET_petpklv" value='<%=DEF_PET_petpklv%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>宠物之间PK时候当两个宠物级别低于这个值时，不能PK建议设置10以上</td>
</tr>
<tr>
<td>宠物变性手术价格：</td>
<td><input type=text name="DEF_PET_changesexmoney" value='<%=DEF_PET_changesexmoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点攻击力武器价格：</td>
<td><input type=text name="DEF_Pet_PerSwordMoney" value='<%=DEF_Pet_PerSwordMoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点攻击力项链价格：</td>
<td><input type=text name="DEF_PET_pernecklacemoney" value='<%=DEF_PET_pernecklacemoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点防御力头盔价格：</td>
<td><input type=text name="DEF_PET_perheadmoney" value='<%=DEF_PET_perheadmoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点防御力盔甲价格：</td>
<td><input type=text name="DEF_PET_perbodyemoney" value='<%=DEF_PET_perbodyemoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>每1点防御力鞋子价格：</td>
<td><input type=text name="DEF_PET_perfootmoney" value='<%=DEF_PET_perfootmoney%>' size=38 maxlength=50 <%NumOnly%>></td>
<td><%=DEF_PointsName%>　</td>
</tr>
<tr>
<td>回复主题增加经验值：</td>
<td><input type=text name="DEF_PET_replytopicexp" value='<%=DEF_PET_replytopicexp%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>EXP</td>
</tr>
<tr>
<td>发表主题增加经验值：</td>
<td><input type=text name="DEF_PET_newtopicexp" value='<%=DEF_PET_newtopicexp%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>EXP</td>
</tr>
<tr>
<td>是否发送攻击短消息：</td>
<td><input type=text name="DEF_PET_sendbattlemsg" value='<%=DEF_PET_sendbattlemsg%>' size=38 maxlength=50 <%NumOnly%>></td>
<td>1为发送，0为不发送</td>
</tr>
<tr>
<td>论坛货币名称：</td>
<td><input type=text name="DEF_PointsName" value='<%=DEF_PointsName%>' size=38 maxlength=50></td>
<td>默认设置为"永恒币"</td>
</tr>

<tr>
<td colspan="3">
注意：以上宠物名字过滤字符使用"|"隔开，论坛货币为文本字符,其它各项必须填写数字。
</td>
</tr>                          
<tr>
<td colspan="3" align="center">

<input type="submit" value="提交修改" OnClick="return CheckElements(this.form)">  
</td>
</tr>                          
</form>
</table>
<%
End Sub


Public Sub Modify
Set Pet=New SQLString
  With Pet
  .Clear
  .TableName="PetSetup"
  .SQLType=1
  
  .AddField "PetMaster",request("PetMaster")
  .AddField "DEF_PET_namelong",request("DEF_PET_namelong")
  .AddField "DEF_PET_nameexpt",request("DEF_PET_nameexpt")
  .AddField "DEF_PET_Basichp",request("DEF_PET_Basichp")
  .AddField "DEF_PET_Basicsp",request("DEF_PET_Basicsp")
  .AddField "DEF_PET_Basicsp2",request("DEF_PET_Basicsp2")
  .AddField "DEF_PET_Basichpmoney",request("DEF_PET_Basichpmoney")
  .AddField "DEF_PET_Basicspmoney",request("DEF_PET_Basicspmoney")
  .AddField "DEF_PET_Basicexpmoney",request("DEF_PET_Basicexpmoney")
  .AddField "DEF_PET_atkmoney",request("DEF_PET_atkmoney")
  .AddField "DEF_PET_defmoney",request("DEF_PET_defmoney")
  .AddField "DEF_PET_livemoney",request("DEF_PET_livemoney")
  .AddField "DEF_PET_Basicusehp",request("DEF_PET_Basicusehp")
  .AddField "DEF_PET_Basicusesp",request("DEF_PET_Basicusesp")
  .AddField "DEF_PET_Basicuseexp",request("DEF_PET_Basicuseexp")
  .AddField "DEF_PET_atkup",request("DEF_PET_atkup")
  .AddField "DEF_PET_defup",request("DEF_PET_defup")
  .AddField "DEF_PET_petpkhp",request("DEF_PET_petpkhp")
  .AddField "DEF_PET_petpktime",request("DEF_PET_petpktime")
  .AddField "DEF_PET_petpklv",request("DEF_PET_petpklv")
  .AddField "DEF_PET_changesexmoney",request("DEF_PET_changesexmoney")
  .AddField "DEF_Pet_PerSwordMoney",request("DEF_Pet_PerSwordMoney")
  .AddField "DEF_PET_pernecklacemoney",request("DEF_PET_pernecklacemoney")
  .AddField "DEF_PET_perheadmoney",request("DEF_PET_perheadmoney")
  .AddField "DEF_PET_perbodyemoney",request("DEF_PET_perbodyemoney") 
  .AddField "DEF_PET_perfootmoney",request("DEF_PET_perfootmoney")
  .AddField "DEF_PET_replytopicexp",request("DEF_PET_replytopicexp")
  .AddField "DEF_PET_newtopicexp",request("DEF_PET_newtopicexp")
  .AddField "DEF_PET_sendbattlemsg",request("DEF_PET_sendbattlemsg")
  .AddField "DEF_PointsName",request("DEF_PointsName")
  
  ConnPet.ExeCute(.ReturnSQL)
  End With
  Set Pet=Nothing

message="<li>成功保存各项设置.<li><a href='PetManage.asp'>返回宠物管理</a>"
succeed(message&"<meta http-equiv=refresh content=3;url='PetManage.asp'")
End Sub

'删除用户宠物
Public Sub DelSort
ConnPet.execute("delete from [PetSort] where PetID="&request("id")&"")
message="<li>成功删除该宠物.<li><a href='PetManage.asp'>返回宠物管理</a>"
succeed(message&"<meta http-equiv=refresh content=3;url='PetManage.asp'")
End Sub

'删除宠物类别
Public Sub DelPet
PetId=int(request("PetId"))
ConnPet.ExeCute("delete from [PetData] where id="&petid&"")
message="<li>成功删除该用户的宠物.<li><a href='PetManage.asp'>返回宠物管理</a>"
succeed(message&"<meta http-equiv=refresh content=3;url='PetManage.asp'")
End Sub

'删除pk短消息
Public Sub DelPkMsg
conn.execute("delete from [BBSXP_Messages] where instr(Content,'【宠物PK消息】')>0")
response.write "<script>alert('成功删除所有宠物PK短消息.')</script>"
ShowPkMsg
End Sub

'修改宠物类别
Public Sub GoEditSort
Set Pet=New SQLString
  With Pet
  .Clear
  .TableName="PetSort"
  .Where="PetId="&request.form("PetId")
  .SQLType=1
  
  .AddField "PetName",request.Form("PetName")
  .AddField "PetFolder",request.Form("PetFolder")
  .AddField "PetDepartment",request.Form("PetDepartment")
  .AddField "PetAttribute",request.Form("PetAttribute")
  .AddField "PetDescription",request.Form("PetDescription")
  .AddField "PetDefaultAtk",request.Form("PetDefaultAtk")
  .AddField "PetDefaultDef",request.Form("PetDefaultDef")
  .AddField "PetPrice",request.Form("PetPrice")
  ConnPet.ExeCute(.ReturnSQL)
  End With
  Set Pet=Nothing

message="<li>成功修改该宠物信息.<li><a href='PetManage.asp'>返回宠物管理</a>"
succeed(message&"<meta http-equiv=refresh content=3;url='PetManage.asp'")
End Sub


'添加宠物类别
Public Sub GoAddSort
Set Pet=New SQLString
  With Pet
  .Clear
  .TableName="PetSort"
  .SQLType=0
  
  .AddField "PetName",request.Form("PetName")
  .AddField "PetFolder",request.Form("PetFolder")
  .AddField "PetDepartment",request.Form("PetDepartment")
  .AddField "PetAttribute",request.Form("PetAttribute")
  .AddField "PetDescription",request.Form("PetDescription")
  .AddField "PetDefaultAtk",request.Form("PetDefaultAtk")
  .AddField "PetDefaultDef",request.Form("PetDefaultDef")
  .AddField "PetPrice",request.Form("PetPrice")
  ConnPet.ExeCute(.ReturnSQL)
  End With
  Set Pet=Nothing

message="<li>成功添加该宠物类别.<li><a href='PetManage.asp'>返回宠物管理</a>"
succeed(message&"<meta http-equiv=refresh content=3;url='PetManage.asp'")
End Sub


'显示短消息管理
Sub ShowPkMsg
%>
<table width=100% border="1" align="center" cellspacing=0 cellpadding=2 class=a3>
<tr align=center>
<td>论坛共有 <b><%=conn.execute("Select count(id) from [BBSXP_Messages] where instr(Content,'【宠物PK消息】')=1")(0)%> </b> 条竞技短消息</td>
</tr>
<tr align=center>
<td>
<input type="button" value="删除所有竞技短消息" name="title"  onclick="javascript:window.location='PetManage.asp?action=DelPkMsg';">
</td>
</tr>
</table>
<%End Sub

'显示用户宠物
Sub ShowUserPet
%>

<table width=100% border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 

bordercolordark=#FFFFFF class=a3>
<tr><td align="center" class=a3>点击宠物名字查看详细
</td></tr>
</table>   
                                   
<table width=100% border="1" cellspacing=0 cellpadding=2 bordercolorlight=#c0c0c0 

bordercolordark=#FFFFFF class=a3>
<tr align=center>
<td width='20%'>宠物主人</td>
<td width='20%'>宠物名字</td>
<td width='10%'>宠物等级</td>
<td width='10%'>宠物攻击力</td>
<td width='10%'>宠物防御力</td>
<td width='15%'>相关状态</td>
<td width='15%'>相关操作</td>
</tr>


<%Set RsPet = server.createobject("adodb.recordset")
RsPet.open "Select * From [PetData] Order By PetLevel desc",ConnPet,1,1
if RsPet.eof then
Response.write "<tr><td colspan='7' align='center'>论坛无人领养宠物</td></tr>"
else
    do while not RsPet.eof
    Level1=int(RsPet("Petlevel")/2)
    PetAtk=RsPet("PetAtk")+RsPet("item1")+RsPet("item2")+2+level1
    PetDef=RsPet("PetDef")+RsPet("item3")+RsPet("item4")+RsPet("item5")+3+level1
%>                                          
<tr align="center">
<td><a href="Profile.asp?UserName=<%=RsPet("UserName")%>"><%=RsPet("UserName")%></a></td>
<td><a href="PetMyPet.asp?UserName=<%=RsPet("UserName")%>"><%=RsPet("MyPet")%></a></td>
<td><%=RsPet("Petlevel")%></td>
<td><%=PetAtk%></td>
<td><%=PetDef%></td>
<td>
<%
if RsPet("PetHp")<1 or RsPet("PetSp")<1 then 
response.write "死亡"
else
response.write "生存"
end if
%>
</td>
<td><a href="?Action=DelPet&PetId=<%=RsPet("id")%>" onClick="javascript:{if(confirm('您确定执行删除操作吗?')){return true;}return false;}">删除</a></td>

<%                          
RsPet.movenext                                          
loop  

response.Write "</tr></table>"
                                       
End If
End Sub

'显示现有宠物类别
Sub ShowPetSort

response.write "<table width='100%' cellpadding=5 cellspacing=1 class=a2><tr class=a3>"
response.write "<form action='PetShop.asp' name='petname' mtehod='post'>"

PetSortSql="SELECT * FROM [PetSort] Order By PetID asc"
Set RsPetSort=ConnPet.Execute(PetSortSql)
Do while not RsPetSort.EOF
PetID=RsPetSort(0)
PetName=RsPetSort(1)
PetFolder=RsPetSort(2)
PetDepartment=RsPetSort(3)
PetAttribute=RsPetSort(4)
PetDescription=RsPetSort(5)
PetDefaultAtk=RsPetSort(6)
PetDefaultDef=RsPetSort(7)
PetPrice=RsPetSort(8)

If PetDefaultAtk=0 then PetDefaultAtk="随机"
If PetDefaultDef=0 then PetDefaultDef="随机"
i=i+1

response.write "<td align='center' height=120 valign=bottom>"
response.write "<img src='Pet/Images/Sort/"&PetFolder&"/"&PetFolder&".gif'>"
response.write "<br /><b>"&PetName&"("&PetDepartment&")</b><br />"
response.write "<hr><a href='?Action=EditSort&ID="&PetID&"' class='petbutton'>编&nbsp;&nbsp;辑</a>"
response.write "&nbsp;&nbsp;<a href='?Action=DelSort&ID="&PetID&"' class='petbutton' onClick='javascript:{if(confirm(""确认要删除吗？"")){return true;}return false;}'>删&nbsp;&nbsp;除</a>"
response.write "</td>"

if (i mod 6)=0 then response.write "</tr><tr class=a3>"
response.write "</form>"
RsPetSort.MoveNext
Loop
response.Write "<tr class=a3><td colspan=7 align=right height=30><a href='?Action=AddSort' class='petbutton'>添加新的宠物类别</a></td></tr>" 
response.write "</tr></table>"


Set RsPetSort=Nothing
End Sub

'编辑宠物类别
Sub EditSort
PetID=int(request("id"))
response.write "<form action='?Action=GoEditSort' method=post>"
response.write "<table width=100% border=0 align=center cellspacing=1 cellpadding=2 class=a2>"
response.write "<tr align=center class=a1><td>宠物名</td><td>图片文件夹</td><td>系别</td><td>属性</td><td>描述</td><td>攻击力</td><td>防御力</td><td>售价</td></tr>"
response.write "<tr align=center class=a3>"
Set RsPetSort=ConnPet.Execute("Select * From [PetSort] where PetID="&PetID&"")
response.write "<td><input name=PetName value="&RsPetSort(1)&" size=12></td>"
response.write "<td><input name=PetFolder value="&RsPetSort(2)&" size=8></td>"
response.write "<td><input name=PetDepartment value="&RsPetSort(3)&" size=6></td>"
response.write "<td><input name=PetAttribute value="&RsPetSort(4)&" size=4></td>"
response.write "<td><input name=PetDescription value="&RsPetSort(5)&" size=44></td>"
response.write "<td><input name=PetDefaultAtk value="&RsPetSort(6)&" size=2 "
NumOnly
response.write "></td>"
response.write "<td><input name=PetDefaultDef value="&RsPetSort(7)&" size=2 "
NumOnly
response.write "></td>"
response.write "<td><input name=PetPrice value="&RsPetSort(8)&" size=4 "
NumOnly
response.write "></td>"
response.write "</tr>"
response.write "<tr class=a3><td colspan=7>攻击力和防御力添0为随机(1-10)</td><td colspan=2 align=right>"
response.write "<input type=hidden name=PetID value="&PetID&"><input type=submit value='确认修改' OnClick='return CheckElements(this.form)'></td></tr></table>"
response.write "</form>"
End Sub

Sub AddSort

response.write "<form action='?Action=GoAddSort' method=post>"
response.write "<table width=100% border=0 align=center cellspacing=1 cellpadding=2 class=a2>"
response.write "<tr align=center class=a1><td>宠物名</td><td>图片文件夹</td><td>系别</td><td>属性</td><td>描述</td><td>攻击力</td><td>防御力</td><td>售价</td></tr>"
response.write "<tr align=center class=a3>"
response.write "<td><input name=PetName  size=12></td>"
response.write "<td><input name=PetFolder  size=8></td>"
response.write "<td><input name=PetDepartment  size=6></td>"
response.write "<td><input name=PetAttribute  size=4></td>"
response.write "<td><input name=PetDescription  size=44></td>"
response.write "<td><input name=PetDefaultAtk  size=2 "
NumOnly
response.write "></td>"
response.write "<td><input name=PetDefaultDef size=2 "
NumOnly
response.write "></td>"
response.write "<td><input name=PetPrice size=4 "
NumOnly
response.write "></td>"
response.write "</tr>"
response.write "<tr class=a3><td colspan=7>攻击力和防御力添0为随机(1-10)</td><td colspan=2 align=right>"
response.write "<input type=submit value='确认添加' OnClick='return CheckElements(this.form)'></td></tr></table>"
response.write "</form>"
End Sub

End class 
%>