2018-01-28 16:40:49 +00:00
|
|
|
|
<?php
|
|
|
|
|
// magic выход из боя
|
2021-08-26 14:44:14 +00:00
|
|
|
|
use Battles\GameLogs;
|
|
|
|
|
use Battles\Nick;
|
|
|
|
|
|
2020-09-30 12:30:00 +00:00
|
|
|
|
if (empty($_SESSION['uid'])) {
|
2020-09-30 12:01:33 +00:00
|
|
|
|
header("Location: index.php");
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2020-09-30 12:30:00 +00:00
|
|
|
|
|
2020-10-29 23:30:05 +00:00
|
|
|
|
$raid_t = mysql_fetch_array(mysql_query("SELECT * FROM variables WHERE var='raid_on_status' LIMIT 1;"));
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
|
|
|
|
if ($user['battle'] == 0) {
|
2020-10-29 23:30:05 +00:00
|
|
|
|
echo "Это боевая магия...";
|
2021-02-01 19:20:23 +00:00
|
|
|
|
} elseif ($user->getRoom() == 600 || $user->getRoom() == 601 || $user->getRoom() == 602 || $us['room'] == 43 || $us['room'] == 45) {
|
2020-10-29 23:30:05 +00:00
|
|
|
|
echo "В этой локации выход из боя запрещен!";
|
|
|
|
|
} elseif ($user['battle'] == $raid_t['value']) {
|
|
|
|
|
echo "Вы защищаете весь город, а не только себя. Победа или смерть!";
|
2018-01-28 16:40:49 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
2020-10-29 23:30:05 +00:00
|
|
|
|
//unset($fbattle->battle[$user['id']]);
|
|
|
|
|
if ($us['sex'] == 1) {
|
2021-08-26 14:44:14 +00:00
|
|
|
|
GameLogs::addBattleLog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' вышла из боя!<BR>');
|
2020-10-29 23:30:05 +00:00
|
|
|
|
} else {
|
2021-08-26 14:44:14 +00:00
|
|
|
|
GameLogs::addBattleLog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' вышел из боя!<BR>');
|
2020-10-29 23:30:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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 "Вы вышли из боя";
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|