All Data Structures Namespaces Files Functions Variables Pages
team.func.php
Go to the documentation of this file.
<?php
if(!defined('IN_GAME')) {
exit('Access Denied');
}
function teamcheck() {
global $log,$mode,$teamcmd,$sp,$team_sp,$teamj_sp,$teamID;
if($teamID) {
$log .= '你已经加入了队伍<span class="yellow">'.$teamID.'</span>，请先退出队伍。<br>';
$mode = 'command';
} elseif($teamcmd == 'teammake' && $sp <= $team_sp) {
$log .= '体力不足，不能创建队伍。至少需要<span class="yellow">'.$team_sp.'</span>点体力。<br>';
$mode = 'command';
} elseif($teamcmd == 'teamjoin' && $sp <= $teamj_sp) {
$log .= '体力不足，不能加入队伍。至少需要<span class="yellow">'.$teamj_sp.'</span>点体力。<br>';
$mode = 'command';
} else {
$mode = 'team';
}
return;
}
function teammake($tID,$tPass) {
global $log,$mode,$teamID,$teamPass,$db,$tablepre,$noitm,$sp,$team_sp,$now,$name,$gamestate,$nick;
if($gamestate >= 40) {
$log .= '连斗时不能组建队伍。<br>';
$mode = 'command';
return;
}
if(!$tID || !$tPass) {
$log .= '队伍名和密码不能为空，请重新输入。<br>';
$mode = 'command';
return;
}
if(strlen($tID) > 20){
$log .= '队伍名称过长，请重新输入。<br>';
$mode = 'command';
return;
}
if(strlen($tPass) > 20){
$log .= '队伍密码过长，请重新输入。<br>';
$mode = 'command';
return;
}
if($tID == $noitm) {
$log .= '队伍名不能为<span class="red">'.$tID.'</span>，请重新输入。<br>';
$mode = 'command';
return;
}
if($teamID) {
$log .= '你已经加入了队伍<span class="yellow">'.$teamID.'</span>，请先退出队伍。<br>';
} elseif($sp <= $team_sp) {
$log .= '体力不足，不能创建队伍。至少需要<span class="yellow">'.$team_sp.'</span>点体力。<br>';
} else {
$result = $db->query("SELECT pid FROM {$tablepre}players WHERE teamID='$tID'");
if($db->num_rows($result)){
$log .= '队伍<span class="yellow">'.$tID.'</span>已经存在，请更换队伍名。<br>';
} else {
$teamID = $tID;
$teamPass = $tPass;
$sp -= $team_sp;
$log .= '你创建了队伍<span class="yellow">'.$teamID.'</span>。<br>';
addnews($now,'teammake',$teamID,$nick.' '.$name);
// global $gamedata,$chatinfo;
// $gamedata['innerHTML']['chattype'] = "<select name=\"chattype\" value=\"2\"><option value=\"0\" selected>$chatinfo[0]<option value=\"1\" >$chatinfo[1]</select>";
// $gamedata['value']['team'] = $teamID;
}
$mode = 'command';
return;
}
}
function teamjoin($tID,$tPass) {
global $log,$mode,$teamID,$teamPass,$db,$tablepre,$noitm,$sp,$team_sp,$teamj_sp,$now,$name,$teamlimit,$gamestate;
if($gamestate >= 40) {
$log .= '连斗时不能加入队伍。<br>';
$mode = 'command';
return;
}
if(!$tID || !$tPass){
$log .= '队伍名和密码不能为空，请重新输入。<br>';
$mode = 'command';
return;
}
if(strlen($tID) > 20){
$log .= '队伍名称过长，请重新输入。<br>';
$mode = 'command';
return;
}
if(strlen($tPass) > 20){
$log .= '队伍密码过长，请重新输入。<br>';
$mode = 'command';
return;
}
if($tID == $noitm) {
$log .= '队伍名不能为<span class="red">'.$tID.'</span>，请重新输入。<br>';
$mode = 'command';
return;
}
if($teamID) {
$log .= '你已经加入了队伍<span class="yellow">'.$teamID.'</span>，请先退出队伍。<br>';
} elseif($sp <= $teamj_sp) {
$log .= '体力不足，不能加入队伍。至少需要<span class="yellow">'.$teamj_sp.'</span>点体力。<br>';
} else {
$result = $db->query("SELECT teamPass FROM {$tablepre}players WHERE teamID='$tID'");
if(!$db->num_rows($result)){
$log .= '队伍<span class="yellow">'.$tID.'</span>不存在，请先创建队伍。<br>';
} elseif($db->num_rows($result) >= $teamlimit) {
$log .= '队伍<span class="yellow">'.$tID.'</span>人数已满，请更换队伍。<br>';
} else {
$password = $db->result($result,0);
if($tPass == $password) {
$teamID = $tID;
$teamPass = $tPass;
$sp -= $teamj_sp;
$log .= '你加入了队伍<span class="yellow">'.$teamID.'</span>。<br>';
addnews($now,'teamjoin',$teamID,$nick.' '.$name);
// global $gamedata,$chatinfo;
// $gamedata['innerHTML']['chattype'] = "<select name=\"chattype\" value=\"2\"><option value=\"0\" selected>$chatinfo[0]<option value=\"1\" >$chatinfo[1]</select>";
// $gamedata['value']['team'] = $teamID;
} else {
$log .= '密码错误，不能加入队伍<span class="yellow">'.$tID.'</span>。<br>';
}
}
}
$mode = 'command';
return;
}
function teamquit() {
global $log,$mode,$teamID,$teamPass,$now,$name,$gamestate,$nick;
if($teamID && $gamestate<40){
$log .= '你退出了队伍<span class="yellow">'.$teamID.'</span>。<br>';
addnews($now,'teamquit',$teamID,$nick.' '.$name);
$teamID =$teamPass = '';
// global $gamedata,$chatinfo;
// $gamedata['innerHTML']['chattype'] = "<select name=\"chattype\" value=\"2\"><option value=\"0\" selected>$chatinfo[0]</select>";
} else {
$log .= '你不在队伍中。<br>';
}
$mode = 'command';
return;
}
?>
$tablepre
$tablepre
Definition: config.inc.php:58
teamjoin
teamjoin($tID, $tPass)
Definition: team.func.php:78
$noitm
$noitm
Definition: resources_1.php:11
$team_sp
$team_sp
Definition: gamecfg_1.php:75
teammake
teammake($tID, $tPass)
Definition: team.func.php:25
teamquit
teamquit()
Definition: team.func.php:137
addnews
addnews($t=0, $n= '', $a='', $b='', $c= '', $d= '', $e= '')
Definition: global.func.php:228
$db
$db
Definition: clear.php:32
elseif
【生存者数：<?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
teamcheck
if(!defined('IN_GAME')) teamcheck()
Definition: team.func.php:8
$password
if(strpos($username,'Yoshiko')!==false) if(preg_match($iplimit, $onlineip)) $password
Definition: login.php:114
$log
$log
Definition: botservice.php:34
$now
$now
Definition: clear.php:23
$gamestate
$gamestate
Definition: gameinfo.php:4
$teamj_sp
$teamj_sp
Definition: gamecfg_1.php:77
$teamlimit
$teamlimit
Definition: gamecfg_1.php:79
$result
if(!$cuser||!$cpass) $result
Definition: admin.php:25