2018-01-28 16:40:49 +00:00
|
|
|
|
<?php
|
|
|
|
|
session_start();
|
2018-06-22 14:35:54 +00:00
|
|
|
|
if ($_SESSION['uid'] == null) {
|
|
|
|
|
header("Location: index.php");
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
include("config.php");
|
|
|
|
|
include("functions.php");
|
|
|
|
|
|
2018-06-22 14:35:54 +00:00
|
|
|
|
$start = db::c()->query('SELECT `value` FROM `variables` WHERE `var` = "arena_of_gods"')->fetch_assoc();
|
|
|
|
|
$is_now = db::c()->query('SELECT `id` FROM `battle` WHERE `aren_of` = 1 AND `win` = 3 ORDER BY `id` DESC')->fetch_assoc();
|
|
|
|
|
$eff = db::c()->query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND (`type` = 11 OR `type` = 12)', $user['id'])->fetch_assoc();
|
|
|
|
|
$w = db::c()->query('SELECT `value` FROM `variables` WHERE `var` = "arena_win"')->fetch_assoc();
|
2018-01-28 16:40:49 +00:00
|
|
|
|
$al = aligntype($user['align']);
|
|
|
|
|
|
2018-07-02 15:35:25 +00:00
|
|
|
|
function join_arena($u, $btl, $team, $at)
|
|
|
|
|
{
|
|
|
|
|
$bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $btl . '" LIMIT 1'));
|
|
|
|
|
$battle = unserialize($bd['teams']);
|
|
|
|
|
$ak = array_keys($battle[$at]);
|
|
|
|
|
$battle[$u] = $battle[$ak[0]];
|
|
|
|
|
foreach ($battle[$u] as $k => $v) {
|
|
|
|
|
$battle[$u][$k] = array(0, 0, time());
|
|
|
|
|
$battle[$k][$u] = array(0, 0, time());
|
|
|
|
|
}
|
|
|
|
|
if ($team == 1) {
|
|
|
|
|
$adtxt = 'За сторону <b>Тьмы</b>.';
|
|
|
|
|
} else {
|
|
|
|
|
$adtxt = 'За сторону <b>Света</b>.';
|
|
|
|
|
}
|
2018-11-05 20:15:13 +00:00
|
|
|
|
addlog($btl, '<span class=date>' . date("H:i") . '</span> ' . nick::id($u)->short() . ' вмешался в поединок! ' . $adtxt . '<br />');
|
2018-07-02 15:35:25 +00:00
|
|
|
|
mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $team . '` = CONCAT(`t' . $team . '`,\';' . $u . '\') WHERE `id` = "' . $btl . '" LIMIT 1');
|
|
|
|
|
mysql_query("UPDATE users SET `battle` = '" . $btl . "', `zayavka` = 0 WHERE `id` = '" . $u . "' LIMIT 1");
|
|
|
|
|
header("Location: fbattle.php");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function aligntype($a)
|
|
|
|
|
{
|
|
|
|
|
$lightaligns = array("1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9");
|
|
|
|
|
$darkaligns = array("2.2", "3", "8.21");
|
|
|
|
|
$neutralaligns = array("2", "8.31");
|
|
|
|
|
if (in_array($a, $lightaligns)) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (in_array($a, $darkaligns)) {
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
if (in_array($a, $neutralaligns)) {
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-22 14:35:54 +00:00
|
|
|
|
if ($w['value'] == 1) {
|
|
|
|
|
$winers = 'Прошлая победа за Силами Тьмы';
|
|
|
|
|
} elseif ($w['value'] == 2) {
|
|
|
|
|
$winers = 'Прошлая победа за Силами Света';
|
2018-01-28 16:40:49 +00:00
|
|
|
|
} else {
|
2018-06-22 14:35:54 +00:00
|
|
|
|
$winers = 'Прошлая битва завершилась ничьей.';
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$error = '';
|
|
|
|
|
|
2018-06-22 14:35:54 +00:00
|
|
|
|
if (isset($_GET['append'])) {
|
|
|
|
|
if ($_GET['append'] == 1) { ##### team 2
|
|
|
|
|
if ($al == 1 || $al == 3) {
|
|
|
|
|
if (isset($is_now['id'])) {
|
|
|
|
|
if (!isset($eff['id'])) {
|
|
|
|
|
if ($user['level'] >= 7) {
|
|
|
|
|
if ($user['hp'] > $user['maxhp'] * 0.33) {
|
|
|
|
|
if ($user['align'] != 4) {
|
|
|
|
|
if ($is_now['time_m'] < (time() + 60 * 60)) {
|
|
|
|
|
$bot = db::c()->query('SELECT `id` FROM `bots` WHERE `battle` = ?i AND `prototype` = 10023', $is_now['id'])->fetch_assoc();
|
|
|
|
|
join_arena($user['id'], $is_now['id'], 2, $bot['id']);
|
|
|
|
|
} else {
|
|
|
|
|
$error = 'Время истекло ...';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$error = 'Хаосникам тут не место ...';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$error = 'Вы слишком ослаблены ...';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$error = 'Данный вид поединков доступен с 7 уровня ...';
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
} else {
|
2018-06-22 14:35:54 +00:00
|
|
|
|
$error = 'Вы травмированны и не можете принять участие в поединке ...';
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2018-06-22 14:35:54 +00:00
|
|
|
|
$error = 'Поединок не найден ...';
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2018-06-22 14:35:54 +00:00
|
|
|
|
$error = 'Не Ваша склонность ...';
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
2018-06-22 14:35:54 +00:00
|
|
|
|
} elseif ($_GET['append'] == 2) { ##### team 1
|
|
|
|
|
if ($al == 2 || $al == 3) {
|
|
|
|
|
if (isset($is_now['id'])) {
|
|
|
|
|
if (!isset($eff['id'])) {
|
|
|
|
|
if ($user['level'] >= 7) {
|
|
|
|
|
if ($user['hp'] > $user['maxhp'] * 0.33) {
|
|
|
|
|
if ($user['align'] != 4) {
|
|
|
|
|
if ($is_now['time_m'] < (time() + 60 * 60)) {
|
|
|
|
|
$bot = db::c()->query('SELECT `id` FROM `bots` WHERE `battle` = ?i AND `prototype` = 10024', $is_now['id'])->fetch_assoc();
|
|
|
|
|
join_arena($user['id'], $is_now['id'], 1, $bot['id']);
|
|
|
|
|
} else {
|
|
|
|
|
$error = 'Время истекло ...';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$error = 'Хаосникам тут не место ...';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$error = 'Вы слишком ослаблены ...';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$error = 'Данный вид поединков доступен с 7 уровня ...';
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
} else {
|
2018-06-22 14:35:54 +00:00
|
|
|
|
$error = 'Вы травмированны и не можете принять участие в поединке ...';
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2018-06-22 14:35:54 +00:00
|
|
|
|
$error = 'Поединок не найден ...';
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2018-06-22 14:35:54 +00:00
|
|
|
|
$error = 'Не Ваша склонность ...';
|
2018-01-28 16:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|
2018-06-22 14:44:24 +00:00
|
|
|
|
<!DOCTYPE html>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
<html>
|
|
|
|
|
<head>
|
2018-06-22 14:44:24 +00:00
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<link href="css/main.css" rel="stylesheet"/>
|
2020-07-22 08:43:14 +00:00
|
|
|
|
<link href="css/fight.css" rel="stylesheet"/>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</head>
|
|
|
|
|
<style>
|
2018-06-22 14:35:54 +00:00
|
|
|
|
.hs {
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
font-size: 19px;
|
|
|
|
|
color: #8f0000;
|
2018-06-22 14:44:24 +00:00
|
|
|
|
font-family: arial, serif;
|
2018-06-22 14:35:54 +00:00
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2018-06-22 14:35:54 +00:00
|
|
|
|
.bt {
|
|
|
|
|
float: right;
|
|
|
|
|
border: solid 1px #b0b0b0;
|
|
|
|
|
margin-top: 1px;
|
|
|
|
|
margin-bottom: 2px;
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
color: #191970;
|
|
|
|
|
background-color: white;
|
|
|
|
|
padding: 1px 6px;
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2018-06-22 14:35:54 +00:00
|
|
|
|
.credenzaBox {
|
|
|
|
|
width: 800px;
|
|
|
|
|
height: 367px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2018-06-22 14:35:54 +00:00
|
|
|
|
.credenzaItem {
|
|
|
|
|
width: 540px;
|
|
|
|
|
margin: 15px 120px;
|
|
|
|
|
padding: 6px 10px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
|
2018-06-22 14:35:54 +00:00
|
|
|
|
.credenza-stateCaption {
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
color: #FFF;
|
|
|
|
|
font: 19px Arial, sans-serif;
|
|
|
|
|
text-shadow: red 1px 1px 0, red -1px -1px 0,
|
|
|
|
|
red -1px 1px 0, red 1px -1px 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.buttonContainer {
|
|
|
|
|
position: relative;
|
2018-06-22 14:44:24 +00:00
|
|
|
|
right: 0;
|
2018-06-22 14:35:54 +00:00
|
|
|
|
top: 1px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
padding: 2px;
|
|
|
|
|
zoom: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.contentContainer {
|
|
|
|
|
margin-left: auto;
|
|
|
|
|
margin-right: auto;
|
|
|
|
|
width: 800px;
|
|
|
|
|
height: auto;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
|
font-size: 13px;
|
2018-06-22 14:44:24 +00:00
|
|
|
|
margin-bottom: 0;
|
2018-06-22 14:35:54 +00:00
|
|
|
|
color: #FFF;
|
2018-06-22 14:44:24 +00:00
|
|
|
|
font-family: verdana, sans-serif;
|
2018-06-22 14:35:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a {
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
color: #FFF;
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a:hover {
|
|
|
|
|
color: Red;
|
|
|
|
|
}
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</style>
|
|
|
|
|
<body>
|
2018-06-22 14:44:24 +00:00
|
|
|
|
<h1>Арена Ангелов</h1>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
<div class="contentContainer">
|
2018-06-22 14:35:54 +00:00
|
|
|
|
<div class="buttonContainer">
|
|
|
|
|
<input type="button" onclick="location.href='city.php?bps=1';" class="bt" value="Вернуться"/>
|
|
|
|
|
<input type="button" onclick="location.reload();" class="bt" value="Обновить"/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="credenzaBox" style="background: url('/i/im/u1001573_1407648022.jpg') no-repeat center;">
|
|
|
|
|
<div class="credenzaItem">
|
|
|
|
|
<? if (!isset($is_now['id'])) { ?>
|
|
|
|
|
<div class="credenza-stateCaption">
|
2018-06-22 14:44:24 +00:00
|
|
|
|
<?=$winers?>.<br/>Следующая битва для 7-21 ур. состоится: <?=date("d.m.Y H:i", $start['value'])?>
|
2018-06-22 14:35:54 +00:00
|
|
|
|
</div>
|
|
|
|
|
<? } else { ?>
|
|
|
|
|
<div class="credenza-stateCaption">
|
2018-06-22 14:44:24 +00:00
|
|
|
|
<h2>Идет сражение [7-21 уровни]</h2>
|
|
|
|
|
<br/><a href="/logs.php?log=<?=$is_now['id']?>" target="_blank" style="text-align: center;">ход боя »»</a>
|
|
|
|
|
</div>
|
2018-06-22 14:35:54 +00:00
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td align="left">
|
|
|
|
|
<a href="?append=1" style="display: inline;"><img src="/i/im/append_1.png"
|
2018-06-22 14:44:24 +00:00
|
|
|
|
height="80"/><br/>Вмешаться</a>
|
2018-06-22 14:35:54 +00:00
|
|
|
|
</td>
|
|
|
|
|
<td align="center">
|
|
|
|
|
<img src="/i/im/logo_big2.png"/>
|
|
|
|
|
</td>
|
|
|
|
|
<td align="right">
|
|
|
|
|
<a href="?append=2" style="display: inline;"><img src="/i/im/append_2.png"
|
2018-06-22 14:44:24 +00:00
|
|
|
|
height="80"/><br/>Вмешаться</a>
|
2018-06-22 14:35:54 +00:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
<? } ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</div>
|
2018-06-22 14:44:24 +00:00
|
|
|
|
<? if (!empty($error)) err($error); ?>
|
2018-01-28 16:40:49 +00:00
|
|
|
|
</body>
|
|
|
|
|
</html>
|