⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class_petstatus.asp

📁 威客系统调试通过 但功能简单但是对初学者还是很有帮助的
💻 ASP
📖 第 1 页 / 共 2 页
字号:
ReSponse.write "</TR>"

ReSponse.write "<TR>"
ReSponse.write "<TD width='25%' align=center><IMG height=35 src='pet/images/Item/Live.gif' width=34></TD>"
Response.write "<TD width='25%' align=center>魂之精"
Response.Write "<TD width='30%' align=center>拥有数量:"&LiveItem&"</TD>"
ReSponse.write "<TD width='25%' align=center>[<a href=PetMyPet.asp?UserName="&CookieUserName&"&Action=UseLive>使用</a>]"
ReSponse.write "</TR>"

ReSponse.write "</TABLE>"

End Sub


Public Sub ShowPetInfo
ReSponse.write "<table  border='0' cellpadding='0' cellSpacing='0' width=300><tr>"
ReSponse.write "<td width='50%'>宠物主人:"&GetUserName&" <br />"
ReSponse.write "宠物职业:"&PetMajor&" <br />"
ReSponse.write "宠物性别:"&PetSex&" <br />"
ReSponse.write "攻击力:"&PetAtk&" <br />"
ReSponse.write "防御力:"&PetDef&"</td>"
ReSponse.write "<td width='50%'> 宠物名称:"&Pet&" <br />"
ReSponse.write "宠物状态:"&IfPetDead&" <br />"
ReSponse.write "宠物级别:"&Petlevel&" <br />"
ReSponse.write "宠物属性:"&Petsx&" <br />"
ReSponse.write "宠物PK:"&IfOpenPk&"</td>"
ReSponse.write "</tr></table>"
End Sub



Public Sub UseHp
 if(HpItem<1) then
            message="<li>你没有治愈药水"
			
        elseif(PetHp=PetMaxHp or PetDead=1) then
            if (PetHp=PetMaxHp) then
                message="<li>你的宝宝体力充沛,不用喝药水了"
				
            else 
                message="<li>先把宝宝救活再说吧:("
				
            end if
        elseif(HpTemp<BasicUseHp) then
            ConnPet.ExeCute("UPDATE Petdata SET PetHp=PetMaxHp,HpItem=HpItem-1 WHERE UserName='"&CookieUserName&"'")
            message="<li>使用成功,你的宝宝Hp增加了 "& HpTemp &" !"
			
        else
            ConnPet.ExeCute("UPDATE Petdata SET PetHp=PetHp+"&BasicUseHp&",HpItem=HpItem-1 WHERE UserName='"&CookieUserName&"'")
             message="<li>使用成功,你的宝宝Hp增加了 "&BasicUseHp&" !"
			 
        end if
		succeed(message&"<meta http-equiv=refresh content=3;url='"&Request.ServerVariables("HTTP_REFERER")&"'")
End Sub


Public Sub UseSp
if (SpItem<1 or Petdead=1) then
               if (SpItem<1) then
                message="<li>你没有粮食"
				
               else 
                message="<li>先救活宝宝再喂它吧:("
				
               end if
        else
            ConnPet.ExeCute("UPDATE Petdata SET PetSp="&Basicsp&",SpItem=SpItem-1,PetFeedDate='"&Date()&"' WHERE UserName='"&CookieUserName&"'")
            message="<li>使用成功,你的宝宝吃饱了 !"
			
        end if
		succeed(message&"<meta http-equiv=refresh content=3;url='"&Request.ServerVariables("HTTP_REFERER")&"'")
End Sub

Public Sub UseExp
if (ExpItem<1 or Petdead=1) then
            if (ExpItem<1) then
               message="<li>你没有EXP药水"
			   
               else 
               message="<li>先救活宝宝再喂它吧:("
			   
            end if
        else
			PetExp=PetExp+BasicUseExp
            
           
            
            ConnPet.ExeCute("UPDATE Petdata SET PetExp="&PetExp&",ExpItem=ExpItem-1 WHERE UserName='"&CookieUserName&"'")
            message="<li>使用成功,你的宝宝EXP增加了 "& BasicUseExp &"!"
			
        end if
		succeed(message&"<meta http-equiv=refresh content=3;url='"&Request.ServerVariables("HTTP_REFERER")&"'")
End Sub

Public Sub UseAtk
if (atkItem<1) then
            message="<li>你没有对武器施法的卷轴"
			
        else
        Randomize
        	adatk=fix(rnd*atkup)+0
            ConnPet.ExeCute("UPDATE Petdata SET PetAtk=PetAtk+"&adatk&",atkItem=atkItem-1 WHERE UserName='"&CookieUserName&"'")
            if (adatk=0) then
            message="<li>施法失败...卷轴消失了..."
            else
            message="<li>使用成功,你的宝宝攻击力增加了 "& adatk &" !"
            end if
			
        end if
		succeed(message&"<meta http-equiv=refresh content=3;url='"&Request.ServerVariables("HTTP_REFERER")&"'")
End Sub

Public Sub UseDef
if (defItem<1) then
            message="<li>你没有对盔甲施法的卷轴"
			
        else
                Randomize
        	addef=fix(rnd*defup)+0
            ConnPet.Execute("UPDATE Petdata SET PetDef=PetDef+"&addef&",defItem=defItem-1 WHERE UserName='"&CookieUserName&"'")
            if (addef=0) then
            message="<li>施法失败...卷轴消失了..."
            else
            message="<li>使用成功,你的宝宝防御力增加了 "& addef &" !"
            end if
			
        end if
		succeed(message&"<meta http-equiv=refresh content=3;url='"&Request.ServerVariables("HTTP_REFERER")&"'")
End Sub

Public Sub UseLive    
	
	
        if (liveItem<1) then
            message="<li>你没有魂之精"
			
        elseif(Petdead<1) then
            message="<li>你的宝宝还没有死,干吗复活啊?"
			
        else
            ConnPet.ExeCute("Update [PetData] Set PetHp="& Petmaxhp &",PetSp="& Basicsp &",liveItem=liveItem-1,PetFeedDate='"& date() &"',PetDead=0 WHERE UserName='"&CookieUserName&"'")
            message="<li>使用成功,你的宝宝复活了 !"
			succeed(message&"<meta http-equiv=refresh content=3;url='"&Request.ServerVariables("HTTP_REFERER")&"'")
        end if
		succeed(message&"<meta http-equiv=refresh content=3;url='"&Request.ServerVariables("HTTP_REFERER")&"'")

End Sub



'''''''''使用技能模块
Public Sub UseSkillForm
If Skill2=0 then error("<li>你没有这个技能<li><a href='PetMyPet.asp'>返回我的宠物</a>") end if
if PetDead=1 then error("<li>先救活你的宠物再说吧.<li><a href='PetMyPet.asp'>返回我的宠物</a>") end if

'技能信息
select case request("skillsort")
case 2
SkillName="为主救贴"
MpReduction=45
SkillDetail="请输入帖子ID:<input name='ThreadID' size=5><input type=submit value=提交>"
end select

'技能具体操作
select case request.form("sort")
case 2

If PetHp<HpReduction+1 then error("<li>宠物的HP不足以使用这个技能.<li><a href='PetMyPet.asp'>返回我的宠物</a>")
Set RsSkill=Conn.execute("select id from [BBSXP_Threads] where id="&request.form("ThreadID")&"")
If RsSkill.Eof then
error("<li>没有找到对应你输入ID的帖子,请检查帖子ID是否正确")
else
ConnPet.execute("update [PetData] set PetMp=PetMp-"&MpReduction&" where UserName='"&GetUserName&"'")
Conn.execute("update [BBSXP_Threads] set lasttime="&SqlNowString&" where id="&request.form("ThreadID")&"")

Message="<li>技能使用成功,该贴已经被拉前<li><a href=PetMyPet.asp>我的宠物</a>"
succeed(message&"<meta http-equiv=refresh content=3;url='PetMyPet.asp'")
end if

end select


'技能界面

response.write "<form method=post>"
response.write "<table class=a2 cellspacing=1 cellpadding=4>"
response.write "<tr class=a1><td>使用技能</td></tr>"
response.write "<tr class=a3><td>技能名称:"&SkillName&"</td></tr>"
response.write "<tr class=a3><td>消耗MP:"&MpReduction&"</td></tr>"
response.write "<tr class=a3><td>"
response.write SkillDetail
response.write "</td></tr></table>"
response.write "<input type=hidden name=sort value="&request("skillsort")&" >"
response.write "<br><input type=button value='返回我的宠物' onclick=history.back()></form>"


htmlend
End Sub

Public Property Get OwnerPetList
OwnerPetList=PetOwnerList
End Property 
Public Property Get OwnerPetExist
OwnerPetExist=PetExist
End Property  
Public Property Get OwnerPetName
OwnerPetName=Pet
End Property 
Public Property Get OwnerPetLevel
OwnerPetLevel=PetLevel
End Property 
Public Property Get OwnerPetExp
OwnerPetExp=PetExp
End Property 
Public Property Get OwnerPetHp
OwnerPetHp=PetHp
End Property 
Public Property Get OwnerPetMaxHp
OwnerPetMaxHp=PetMaxHp
End Property 
Public Property Get OwnerPetAtk
OwnerPetAtk=PetAtk
End Property 
Public Property Get OwnerPetDef
OwnerPetDef=PetDef
End Property 
Public Property Get OwnerPkTime
OwnerPkTime=PkTime
End Property
Public Property Get OwnerIfOpenPk
OwnerIfOpenPk=IfOpenPk
End Property
Public Property Get OwnerPetDead
OwnerPetDead=PetDead
End Property
Public Property Get OwnerIfPetDead
OwnerIfPetDead=IfPetDead
End Property 
Public Property Get OwnerOpenPk
OwnerOpenPk=OpenPk
End Property

Public Property Get OwnerSkill1
OwnerSkill1=Skill1
End Property 
Public Property Get OwnerSkill2
OwnerSkill2=Skill2
End Property  

Public Sub ShowRank

ShowPetTop("宠物排行榜")

%>
     
<table width="100%" cellpadding="1" cellspacing="1" class="a2">
<tr class="a1">
		      <td align="center">宠物名字</td>
                      <td align="center">宠物名称</td>
		      <td align="center">宠物主人</td>
                      <td align="center">宠物等级</td>
                      <td align="center">宠物攻击力</td>
                      <td align="center">宠物防御力</td>
                      <td align="center">宠物状态</td>
                      <td align="center">是否接受挑战</td>
</tr>
<%

Set RsRank = Server.CreateObject("ADODB.Recordset")  
RsRank.open "SELECT top 10 * FROM [PetData] ORDER BY PetExp DESC,PetRegDate asc",ConnPet,1,1
RsRank.MoveFirst
Do while not RsRank.eof

           LetUserName=RsRank("UserName")
           FormatPetData
response.write "<tr class='a3' align='center'>"
 response.write "<td>"
 call ShowPetFace(2,45,45)
 response.Write "</td>"
  response.write "<td>"&OwnerPetName&"</td>"
	response.write "<td><a href='profile.asp?UserName="&RsRank("username")&"'>"&RsRank("username")&"</a></td>"
    response.write "<td>"&OwnerPetlevel&"</td>"
    response.write "<td>"&OwnerPetAtk&"</td>"
     response.write "<td>"&OwnerPetDef&"</td>"
      response.write "<td>"&OwnerIfPetDead&"</td>"
	  response.write "<td>"&OwnerIfOpenPk&"</td>"
               
response.write "</tr>"
       
RsRank.movenext
Loop
RsRank.Close
Set RsRank=Nothing


%>
</table>   

<%
ShowPetBottom
HtmlEnd
End Sub


End class 
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -