Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
gameinfomng.php
Go to the documentation of this file.
1 <?php
2 if(!defined('IN_ADMIN')) {
3  exit('Access Denied');
4 }
5 //if($mygroup < 5){
6 // exit($_ERROR['no_power']);
7 //}
8 
9 if($command == 'wthedit'){
10  $iweather = (int)$_POST['iweather'];
11  if($iweather == $weather){
12  $cmd_info = '当前天气已经为'.$wthinfo[$iweather].',无需修改天气!';
13  }elseif(!isset($wthinfo[$iweather])){
14  $cmd_info = '天气数据错误,请重新输入!';
15  }else{
16  $cmd_info = '当前天气修改为:'.$wthinfo[$iweather];
17  $weather = $iweather;
18  save_gameinfo();
19  adminlog('wthedit',$iweather);
20  addnews($now,'syswthchg',$iweather);
21  }
22 }elseif($command == 'hackedit'){
23  $ihack = $_POST['ihack'] != 0 ? 1 : 0;
24  if($ihack == $hack){
25  $cmd_info = '当前禁区已经为该状态,无需修改!';
26  }else{
27  $cmd_info = '当前禁区状态修改为:'.($ihack ? '解除' : '未解除');
28  $hack = $ihack;
29  save_gameinfo();
30  adminlog('hackedit',$ihack);
31  addnews($now,'syshackchg',$ihack);
32  include_once GAME_ROOT.'./include/system.func.php';
33  movehtm();
34  }
35 }elseif(strpos($command, 'gsedit')===0){
36  $igamestate = explode('_',$command);
37  $igamestate = $igamestate[1];
38 
39  if(!isset($gstate[$igamestate])){
40  $cmd_info = '游戏状态数据错误,请重新输入!';
41  }elseif($gamestate == $igamestate){
42  $cmd_info = '游戏当前已经处于此状态,请重新输入!';
43  }elseif($gamestate == 0 && $igamestate != 10){
44  $cmd_info = '游戏未准备,不可进入后期状态!';
45  }elseif($gamestate == 10 && $igamestate > 20){
46  $cmd_info = '游戏未开始,不可进入后期状态!';
47  }elseif($igamestate && $igamestate < $gamestate){
48  $cmd_info = '游戏已开始,状态不可回溯!';
49  }elseif($igamestate > 20){
50  $cmd_info = '当前游戏状态修改为:'.$gstate[$igamestate];
51  $gamestate = $igamestate;
52  save_gameinfo();
53  adminlog('gsedit',$igamestate);
54  addnews($now,'sysgschg',$igamestate);
55  }elseif($igamestate == 20){
56  $cmd_info = '游戏立即开始!请访问任意游戏页面以刷新游戏状态。';
57  $starttime = $now;
58  save_gameinfo();
59  adminlog('gsedit',$igamestate);
60  addnews($now,'sysgschg',$igamestate);
61  }elseif($igamestate == 10){
62  $cmd_info = '游戏立即进入准备状态!请访问任意游戏页面以刷新游戏状态。';
63  $starttime = $now + $startmin * 60;
64  save_gameinfo();
65  adminlog('gsedit',$igamestate);
66  }else{
67  $cmd_info = "第 $gamenum 局大逃杀紧急中止";
68  include_once GAME_ROOT.'./include/system.func.php';
69  gameover($now,'end6');
70  save_gameinfo();
71  adminlog('gameover');
72  }
73 }elseif($command == 'sttimeedit'){
74  if($gamestate){
75  $cmd_info = "本局游戏尚未结束,不能设置时间。";
76  }else{
77  $settime = mktime((int)$_POST['sethour'],(int)$_POST['setmin'],0,(int)$_POST['setmonth'],(int)$_POST['setday'],(int)$_POST['setyear']);
78  if($settime <= $now){
79  $cmd_info = '开始时间不能早于当前时间。';
80  }else{
81  $starttime = $settime;
82  save_gameinfo();
83  $cmd_info = '游戏开始时间设置成功。';
84  }
85  }
86 }elseif($command == 'areaadd'){
87  if($gamestate <= 10){
88  $cmd_info = "本局游戏尚未开始,不能增加禁区。";
89  }elseif((!$areanum && $starttime + 30 > $now) || ($areanum && $areatime - $areahour*60 + 30 > $now)){
90  $cmd_info = "禁区到来后30秒内不能增加禁区。";
91  }else{
92  $areatime = $now;
93  save_gameinfo();
94  $areatime += $areahour * 60;
95  $cmd_info = '下一次禁区时间提前到来。请访问任意游戏页面以刷新游戏状态。';
96  addnews($now,'sysaddarea');
97  }
98 }
99 
100 if($starttime){
101  list($stsec,$stmin,$sthour,$stday,$stmonth,$styear,$stwday,$styday,$stisdst) = localtime($starttime);
102  $stmonth++;
103  $styear += 1900;
104 }else{
105  list($stsec,$stmin,$sthour,$stday,$stmonth,$styear,$stwday,$styday,$stisdst) = localtime($now+3600);
108  $styear += 1900;
109 }
110 
111 $arealiststr = $nextarealiststr = '';
112 $col = 0;
113 $areaarr = array_slice($arealist,0,$areanum+1);
114 foreach($areaarr as $val){
115  if($col == 4){
116  $arealiststr .= $plsinfo[$val].'<br>';
117  $col = 0;
118  }else{
119  $arealiststr .= $plsinfo[$val].' ';
120  $col ++;
121  }
122 }
123 $col = 0;
125 foreach($nareaarr as $val){
126  if($col == 4){
127  $nextarealiststr .= $plsinfo[$val].'<br>';
128  $col = 0;
129  }else{
130  $nextarealiststr .= $plsinfo[$val].' ';
131  $col ++;
132  }
133 }
134 list($arsec,$armin,$arhour,$arday,$armonth,$aryear,$arwday,$aryday,$arisdst) = localtime($areatime);
136 $aryear += 1900;
137 include template('admin_gameinfomng');
138 ?>
139 
while($gm=$db->fetch_array($result)) $cmd_info
Definition: gmlist.php:10
$gstate
Definition: resources_1.php:23
$wthinfo
Definition: resources_1.php:50
$aryear
$areanum
Definition: gameinfo.php:9
$plsinfo
gameover($time=0, $mode= '', $winname= '')
$styear
addnews($t=0, $n= '', $a='', $b='', $c= '', $d= '', $e= '')
movehtm($atime=0)
$nareaarr
【生存者数:<?php echo $alivenum?> 人】< input type="button"value="显示全部幸存者"onClick="$('alivemode').value='all';$('gbmode').value='none';postCmd('alive','alive.php');"></p > if($gamblingon &&$gamestate >=20) elseif($gamblingon &&$gamestate<=10)
Definition: 1_alive.tpl.php:18
const GAME_ROOT
Definition: clear.php:6
$armonth
$weather
Definition: gameinfo.php:11
$col
$arealiststr
$now
Definition: clear.php:23
$hack
Definition: gameinfo.php:12
$arealist
Definition: gameinfo.php:8
$gamestate
Definition: gameinfo.php:4
$startmin
Definition: system.php:20
$areahour
Definition: gamecfg_1.php:5
$areatime
Definition: gameinfo.php:10
$starttime
Definition: gameinfo.php:5
$areaarr
$stmonth
$areaadd
Definition: gamecfg_1.php:7
$stmin
adminlog($op, $an1='', $an2='', $an3='')
Definition: admin.php:58
save_gameinfo()