forked from amarillonmc/phpdts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.php
116 lines (101 loc) · 3.52 KB
/
game.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
define('CURSCRIPT', 'game');
require './include/common.inc.php';
require GAME_ROOT.'./include/game.func.php';
if(!$cuser||!$cpass) { gexit($_ERROR['no_login'],__file__,__line__); }
if($mode == 'quit') {
gsetcookie('user','');
gsetcookie('pass','');
header("Location: index.php");
exit();
}
$result = $db->query("SELECT * FROM {$tablepre}players WHERE name = '$cuser' AND type = 0");
if(!$db->num_rows($result)) { header("Location: valid.php");exit(); }
$pdata = $db->fetch_array($result);
if($pdata['pass'] != $cpass) {
$tr = $db->query("SELECT `password` FROM {$tablepre}users WHERE username='$cuser'");
$tp = $db->fetch_array($tr);
$password = $tp['password'];
if($password == $cpass) {
$db->query("UPDATE {$tablepre}players SET pass='$password' WHERE name='$cuser'");
} else {
gexit($_ERROR['wrong_pw'],__file__,__line__);
}
}
if($gamestate == 0) {
header("Location: end.php");exit();
}
extract($pdata);
init_playerdata();
init_profile();
$log = '';
//读取聊天信息
$chatdata = getchat(0,$teamID);
//读取玩家互动信息
$result = $db->query("SELECT lid,time,log FROM {$tablepre}log WHERE toid = '$pid' AND prcsd = 0 ORDER BY time,lid");
$llist = '';
while($logtemp = $db->fetch_array($result)){
$log .= date("H:i:s",$logtemp['time']).','.$logtemp['log'].'<br />';
$llist .= $logtemp['lid'].',';
}
if(!empty($llist)){
$llist = '('.substr($llist,0,-1).')';
$db->query("UPDATE {$tablepre}log SET prcsd=1 WHERE toid = '$pid' AND lid IN $llist");
}
if($hp > 0){//判断冷却时间是否过去
//显示枪声信息
if(($now <= $noisetime+$noiselimit)&&$noisemode&&($noiseid!=$pid)&&($noiseid2!=$pid)) {
if(($now-$noisetime) < 60) {
$noisesec = $now - $noisetime;
$log .= "<span class=\"yellow b\">{$noisesec}秒前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
} else {
$noisemin = floor(($now-$noisetime)/60);
$log .= "<span class=\"yellow b\">{$noisemin}分钟前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
}
}
if($coldtimeon){
$cdover = $cdsec*1000 + $cdmsec + $cdtime;
$nowmtime = floor(getmicrotime()*1000);
$rmcdtime = $nowmtime >= $cdover ? 0 : $cdover - $nowmtime;
}
}
//var_dump($itm3);
if($hp <= 0){
$dtime = date("Y年m月d日H时i分s秒",$endtime);
$kname='';
if($bid) {
$result = $db->query("SELECT name FROM {$tablepre}players WHERE pid='$bid'");
if($db->num_rows($result)) { $kname = $db->result($result,0); }
}
$mode = 'death';
} elseif($state ==1 || $state == 2 || $state == 3){
$mode = 'rest';
} elseif($itms0){
$mode = 'itemmain';
} else {
$mode = 'command';
}
$cmd = $main = '';
if((strpos($action,'corpse')===0 || strpos($action,'pacorpse')===0) && $gamestate<40){
$cid = strpos($action,'corpse')===0 ? str_replace('corpse','',$action) : str_replace('pacorpse','',$action);
if($cid){
$result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='$cid' AND hp=0");
if($db->num_rows($result)>0){
$edata = $db->fetch_array($result);
include_once GAME_ROOT.'./include/game/battle.func.php';
findcorpse($edata);
extract($edata,EXTR_PREFIX_ALL,'w');
init_battle(1);
$main = 'battle';
}
}
}
if($hp > 0 && $coldtimeon && $showcoldtimer && $rmcdtime){$log .= "行动冷却时间:<span id=\"timer\" class=\"yellow\">0.0</span>秒<script type=\"text/javascript\">demiSecTimerStarter($rmcdtime);</script><br>";}
if ($club==0)
{
include_once GAME_ROOT.'./include/game/clubslct.func.php';
getclub($name,$c1,$c2,$c3);
$clubavl[0]=0; $clubavl[1]=$c1; $clubavl[2]=$c2; $clubavl[3]=$c3;
}
include template('game');
?>