📄 checksheep.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="connsheep.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="sheepconfig.asp"-->
<!-- #include file="inc/DvADChar.asp" -->
<%
Dvbbs.stats="社区农场->喂养宠物"
Dvbbs.nav()
Dvbbs.Head_var 2,0,"",""
call sheephead()
call checksheep()
dvbbs.activeonline()
Dvbbs.Footer
sub checksheep()
dim username
username=dvbbs.membername
if username="" then
response.redirect"login.asp"
exit sub
end if
dim sheepname,sheepid
sheepid=request("id")
dim dellifeday,sheeptype,sheeppic,milkname,milkprice,eatname,eatplushungry,cleanplusclean,sunplushealth,peiplushappy,uplife
dim freezpay
set conn1=server.createobject("adodb.connection")
conn1.open dbname
set rs=server.createobject("adodb.recordset")
rs.open"select * from sheep where id="&sheepid&" and username='"&username&"'",conn1,1,1
if rs.bof then'没找到宠物
%>
<script language="Vbscript">
msgbox"您不是这只宠物的主人!",0,"提示"
history.back
</script>
<%
rs.close
conn1.close
exit sub
end if
'找到宠物
sheeptype=rs("type")
sheepname=rs("sheepname")
Dvbbs.stats="社区农场->喂养宠物:"&sheeptype&":"&sheepname
rs.close
rs.open"select * from rules where type='"&sheeptype&"'",conn1,1,1
if rs.bof then
rs.close
conn1.close
Errmsg=Errmsg+ "<li>没有规则存在,请与管理人员联系。"
dvbbs.FoundIsChallenge=true
dvbbs_error()
exit sub
end if
freezpay=rs("freezpay")
dellifeday=rs("dellifeday")
uplife=rs("uplife")
sheeppic=rs("sheeppic")
if not isnull(rs("milkname")) then
milkname=rs("milkname")
else
milkname=""
end if
milkprice=rs("milkprice")
eatname=rs("eatname")
eatplushungry=rs("eatplushungry")
cleanplusclean=rs("cleanplusclean")
sunplushealth=rs("sunplushealth")
peiplushappy=rs("peiplushappy")
rs.close
rs.open"select * from sheep where id="&sheepid&" and username='"&username&"'",conn1,1,1
dim logintoday,feeddate,life,hungry,clean,sheephappy,sheephealth,freez,freeztype
logintoday=rs("logintoday")
feeddate=rs("feeddate")
life=rs("life")
hungry=rs("hungry")
clean=rs("clean")
sheephappy=rs("sheephappy")
sheephealth=rs("sheephealth")
freez=rs("freez")
rs.close
dim tempdatetoday
if (not freez) then
if datediff("d",logintoday,date)<>0 then
tempdatetoday=date
conn1.execute"update sheep set logintoday='"&tempdatetoday&"' where id="&sheepid&" and username='"&username&"'"
dim temptime
dim templife
dim temphungry
temptime=datediff("d",feeddate,date)
templife=life-dellifeday*temptime
temphungry=hungry-dellifeday*temptime/2
if temphungry<0 then
temphungry=0
end if
dim tempclean
tempclean=clean-dellifeday*temptime/2
if tempclean<0 then
tempclean=0
end if
dim tempsheephappy
tempsheephappy=sheephappy-dellifeday*temptime/2
if tempsheephappy<0 then
tempsheephappy=0
end if
dim tempsheephealth
tempsheephealth=sheephealth-dellifeday*temptime/2
if tempsheephealth<0 then
tempsheephealth=0
end if
conn1.execute"update sheep set life='"&templife&"',hungry='"&temphungry&"',clean='"&tempclean&"',sheephappy='"&tempsheephappy&"',sheephealth='"&tempsheephealth&"' where id="&sheepid&" and username='"&username&"'"
end if
end if
rs.open"select * from sheep where id="&sheepid&" and username='"&username&"'"
if rs("life")<=0 or rs("clean")<=0 or rs("sheephappy")<=0 or rs("sheephealth")<=0 or rs("hungry")<=0 then
rs.close
conn1.execute"delete * from sheep where id="&sheepid&" and username='"&username&"'"
conn1.close
Errmsg=Errmsg+ "<li>由于您没有精心照顾您的"&sheeptype&"!您的"&sheeptype&"已经死了,您好狠心哟!!!要不重新再养一只吧?"
dvbbs.FoundIsChallenge=true
dvbbs_error()
exit sub
end if
rs.close
rs.open"select * from sheep where id="&sheepid&" and username='"&username&"'",conn1,1,1
%>
<table class=tableborder1 cellspacing=1 cellpadding=3 align=center>
<td class=tablebody1 width="100%" class=p8>
<table style="BORDER-COLLAPSE: collapse" cellspacing=0 cellpadding=2 border=0 width="100%">
<tr>
<td width="30%" valign="top" ><!--#include file="usersheep.asp"--> </td>
<td width="70%">
<div align="center">
<table border="0" borderColor="#ffffff" cellPadding="0" cellspacing="1" width="100%" height="20">
<tbody>
<tr>
<td>
<center>
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="20" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td class=p3 width="9%">
<p align="center"><img border="0" src=<%=sheeppic%>></td>
<td class=p3 width="28%">
<p align="center"><img src=images/dot2.gif>-<%=sheeptype%>名字:<%=rs("sheepname")%></td>
<td class=p3 width="24%">
<p align="center"><img src=images/dot2.gif>-今天是您第<%=rs("feedsheepday")%>天养</td>
<td class=p3 width="39%">
<p align="center"><img src=images/dot2.gif>-上次养<%=sheeptype%>日期:<%=rs("feeddate")%></td>
</tr>
</table>
</center>
<div align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="192" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td class=p2 width="25%" height="18">
<p align="right"><img src=images/dot2.gif>-<%=sheeptype%>生命值:</td>
<td class=p2 width="25%" height="18">
<%
dim typelife,typelifeup
if rs("life")>80 then
typelife="健康"
typelifeup="健康"
end if
if rs("life")<=80 and rs("life")>60 then
typelife="良好"
typelifeup="健康"
end if
if rs("life")<=60 and rs("life")>40 then
typelife="虚弱"
typelifeup="良好"
end if
if rs("life")<=40 and rs("life")>20 then
typelife="生病"
typelifeup="虚弱"
end if
if rs("life")<=20 and rs("life")>0 then
typelife="病危"
typelifeup="生病"
end if
if rs("life")<=0 then
typelife="死亡"
typelifeup="良好"
end if
if freez then
freeztype="解除冬眠"
else
freeztype="送进冬眠房"
end if
response.write typelife
%>
</td>
<td class=p2 width="25%" height="18">
<p align="right"><img src=images/dot2.gif>-<%=sheeptype%>的<span lang="zh-cn">生日</span>:</td>
<td class=p2 width="25%" height="18"><%=rs("sheepdate")%></td>
</tr>
<tr>
<td class=p3 width="25%" height="18">
<p align="right"><img src=images/dot2.gif>-饥饿程度:</td>
<td class=p3 width="25%" height="18"><%=rs("hungry")%></td>
<td class=p3 width="25%" height="18">
<p align="right"><img src=images/dot2.gif>-清洁程度:</td>
<td class=p3 width="25%" height="18"><%=rs("clean")%></td>
</tr>
<tr>
<td class=p2 width="25%" height="18">
<p align="right"><img src=images/dot2.gif>-健康程度:</td>
<td class=p2 width="25%" height="18"><%=rs("sheephealth")%></td>
<td class=p2 width="25%" height="18">
<p align="right"><img src=images/dot2.gif>-快乐程度:</td>
<td class=p2 width="25%" height="18"><%=rs("sheephappy")%></td>
</tr>
<tr>
<td class=p1 width="100%" colspan="4" height="17">
<img src=images/dot1.gif>-<b><font color="#FF0000">兽医站</font></b>
</td>
</tr> <tr>
<td class=p2 width="25%" colspan="4" height="38">
<form method="POST" action="sheepdoctor.asp">
<p align="center">
<input class=input type="submit" value="花<%=uplife%>两银子让兽医将您的小<%=sheeptype%>由[<%=typelife%>]治疗为[<%=typelifeup%>]" name="B1" style="font-family: 宋体; font-size: 12px"><br>
<input class=input type="hidden" name="id" value="<%=sheepid%>"><input class=input type="hidden" name="typelife" value="<%=typelife%>"><input class=input type="hidden" name="typelifeup" value="<%=typelifeup%>"> <input class=input type="hidden" name="sheepname" value="<%=sheepname%>">
</form>
</td> </tr>
<tr>
<td class=p1 width="100%" colspan="4" height="17">
<img src=images/dot1.gif>-<b><font color="#FF0000">农场主敬告</font></b>
</td>
</tr>
<tr>
<td class=p3 width="100%" colspan="4" height="71"> <br>
<img src=pic/Forum_nav.gif>
-你通过不同的方法照顾小<%=sheeptype%>会得到不同的产<%=milkname%>量。<br>
<img src=pic/Forum_nav.gif> -你只有长时间的积累经验,才可能使小<%=sheeptype%>产更多的<%=milkname%>。<br>
<img src=pic/Forum_nav.gif>
<span lang="en-us">-</span>每次照料小<%=sheeptype%>要花费一定的费用。<br>
<img src=pic/Forum_nav.gif> -每天可照料三次(三次为一个周期),照顾小<%=sheeptype%>五个周期就可以顺利生产<%=milkname%>了
。<br>
<img src=pic/Forum_nav.gif><span lang="en-us">
-</span><%=milkname%>的市场价格会有不同,请尽量在价格高的时候卖出。<br>
<img src=pic/Forum_nav.gif> -现在<%=milkname%>的价格是每斤<font color="#FF0000"><%=milkprice%></font>元。<br>
<img src=pic/Forum_nav.gif> -<font color="#FF0000"><b>请注意</b></font>:
每天<%=sheeptype%>的各项值会减少<%=dellifeday%>点。<br>
<img src=pic/Forum_nav.gif> -当<%=sheeptype%>的四项值中有任何一项值为0时,<%=sheeptype%>
就会死去。 <br>
</td>
</tr>
<tr>
<td class=p2 width="25%" height="38">
<form method=POST action=sheeppei.asp?action=eat&freez=<%=freez%>>
<p align="center">
<input class=input type="submit" value="为<%=sheeptype%>喂<%=eatname%>" name="B1" style="font-family: 宋体; font-size: 12px"><br>
<span lang="zh-cn">非</span>饥饿<span lang="zh-cn">度</span>+<%=eatplushungry%><input class=input type="hidden" name="id" value="<%=sheepid%>"><input class=input type="hidden" name="sheepname" value="<%=sheepname%>">
</form>
</td>
<td class=p2 width="25%" height="38">
<form method=POST action=sheeppei.asp?action=clean&freez=<%=freez%>>
<p align="center">
<input class=input type="submit" value="给<%=sheeptype%>洗澡" name="B1" style="font-family: 宋体; font-size: 12px"><br>
清洁<span lang="zh-cn">度</span>+<%=cleanplusclean%><input class=input type="hidden" name="id" value="<%=sheepid%>"><input class=input type="hidden" name="sheepname" value="<%=sheepname%>">
</form>
</td>
<td class=p2 width="25%" height="38">
<form method=POST action=sheeppei.asp?action=sun&freez=<%=freez%>>
<p align="center">
<input class=input type="submit" value="带<%=sheeptype%>晒太阳" name="B1" style="font-family: 宋体; font-size: 12px"><br>
健康<span lang="zh-cn">状况</span>+<%=sunplushealth%><input class=input type="hidden" name="id" value="<%=sheepid%>"><input class=input type="hidden" name="sheepname" value="<%=sheepname%>">
</form>
</td>
<td class=p2 width="25%" height="38">
<form method=POST action=sheeppei.asp?action=pei&freez=<%=freez%>>
<p align="center">
<input class=input type="submit" value="陪<%=sheeptype%>玩" name="B1" style="font-family: 宋体; font-size: 12px"><br>
快乐<span lang="zh-cn">度</span>+<%=peiplushappy%><input class=input type="hidden" name="id" value="<%=sheepid%>"><input class=input type="hidden" name="sheepname" value="<%=sheepname%>">
</form>
</td>
</tr>
<tr>
<td class=p2 align="left" width="25%" height="38" colspan="4">
<form method=POST action=sheeppei.asp?action=freez&freez=<%=freez%>>
<p align="center">
<input class=input type="submit" value="<%=freeztype%>" name="B1" style="font-family: 宋体; font-size: 12px">
<input class=input type="hidden" name="id" value="<%=sheepid%>">
<input class=input type="hidden" name="sheepname" value="<%=sheepname%>">
</form> 冬眠期间不吃不喝,不会影响健康状况,但送进冬眠房之前你必须<br>让它饱吃一顿才能让它挨过严寒的冬眠期。<font color="red">费用:<%=freezpay%>,冬眠和解除价钱一样</font>
</td>
</tr>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<%
dim tempmod
if rs("feedsheepday")<>0 and (not freez) then
tempmod=rs("feedsheepday") mod 5
if tempmod=0 and (len(milkname)>0) then
%>
<div align="center">
<center>
<table border="0" cellspacing="0" cellpadding="0" height="60" width="100%" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td class=p3 width="100%">
<form method="POST" action="sellmilk.asp">恭喜!您的<%=sheeptype%>终于产<%=milkname%>了,这次的产量为<%=rs("milk")%>斤<br>
想卖出多少呢?<input class=input type="text" name="milk" size="9" style="font-family: 宋体; font-size: 12px"><input class=input type="submit" value="卖<%=milkname%>啦" name="B1" style="font-family: 宋体; font-size: 12px">
<input class=input type="hidden" name="id" value="<%=sheepid%>">
<input class=input type="hidden" name="sheepname" value="<%=sheepname%>">
<input class=input type="hidden" name="sheeptype" value="<%=sheeptype%>">
</form>
</td>
</tr>
</table>
</center>
</div>
<%end if%>
<div align="center">
<center>
</center>
</div>
<%
end if
rs.close
conn1.close
%>
</td></tr></table>
</table></table>
</body>
</html>
<%
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -