64 lines
2.9 KiB
PHP
64 lines
2.9 KiB
PHP
<?php
|
||
// magic выход из боя
|
||
if ($_SESSION['uid'] == null) {
|
||
header("Location: index.php");
|
||
exit;
|
||
}
|
||
$raid_t=mysql_fetch_array(mysql_query("SELECT * FROM variables WHERE var='raid_on_status' LIMIT 1;"));
|
||
|
||
if ($user['battle'] == 0) {
|
||
echo "Это боевая магия...";
|
||
} elseif ($user->room==600 || $user->room==601 || $user->room==602 || $us['room'] == 43 || $us['room'] == 45) {
|
||
echo "В этой локации выход из боя запрещен!";
|
||
} elseif ($user['battle']==$raid_t['value']) {
|
||
echo "Вы защищаете весь город, а не только себя. Победа или смерть!";
|
||
} else {
|
||
|
||
|
||
|
||
|
||
//unset($fbattle->battle[$user['id']]);
|
||
if($us['sex'] == 1) {
|
||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' вышла из боя!<BR>');
|
||
} else {
|
||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' вышел из боя!<BR>');
|
||
}
|
||
|
||
$bd = mysql_fetch_array(mysql_query ('SELECT * FROM `battle` WHERE `id` = '.$user['battle'].' LIMIT 1;'));
|
||
$battle = unserialize($bd['teams']);
|
||
//$ak = array_keys($battle[$user['id']]);
|
||
//$battle[$user['id']] = $battle[$ak[0]];
|
||
unset($battle[$user['id']]);
|
||
foreach($battle as $k => $v) {
|
||
unset( $battle[$user['id']][$k]);// =array(0,0,time());
|
||
unset( $battle[$k][$user['id']]);// = array(0,0,time());
|
||
}
|
||
$t1 = explode(";",$bd['t1']);
|
||
// проставляем кто-где
|
||
if (in_array ($user['id'],$t1)) {
|
||
$t1 = explode(";",$bd['t1']);
|
||
unset ($t1[array_search($user['id'],$t1)]);
|
||
$tu=$t1;
|
||
$ttt=1;
|
||
|
||
} else {
|
||
$t2 = explode(";",$bd['t2']);
|
||
unset ($t2[array_search($user['id'],$t2)]);
|
||
$tu=$t2;
|
||
$ttt=2;
|
||
}
|
||
mysql_query("UPDATE `inventory` SET `duration`=`duration`+1 WHERE `type` <>12 AND `dressed` = 1 AND `owner` = '{$user['id']}';");
|
||
$magictime=time()+(10*60);
|
||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('".$user['id']."','Путы','$magictime',10);");
|
||
addchp ('<font color=red>Внимание!</font> Вы вышли из боя! ','{[]}'.Nick::id($user['id'])->short().'{[]}');
|
||
mysql_query("UPDATE `battle` SET `teams` = '".serialize($battle)."', `t".$ttt."`='".implode(";",$tu)."' WHERE `id` = ".$user['battle']." ;");
|
||
mysql_query('UPDATE users SET `battle` =0, `hp` = 0 WHERE `id` = '.$user['id'].';');
|
||
header("Location:fbattle.php");
|
||
|
||
$bet=1;
|
||
echo "Вы вышли из боя";
|
||
|
||
|
||
}
|
||
|