2022-06-06 21:30:34 +00:00
< ? php
2022-12-30 19:03:37 +00:00
use Core\Config ;
use Core\Db ;
require_once dirname ( __DIR__ ) . DIRECTORY_SEPARATOR . '_incl_data/autoload.php' ;
if ( ! defined ( 'GAME' )) {
die ();
}
if ( isset ( $_GET [ 'r' ])) {
$_GET [ 'r' ] = ( int ) $_GET [ 'r' ];
2022-06-06 21:30:34 +00:00
} else {
2022-12-30 19:03:37 +00:00
$_GET [ 'r' ] = null ;
2022-06-06 21:30:34 +00:00
}
2022-12-30 19:03:37 +00:00
if ( $_GET [ 'r' ] == 3 || $_GET [ 'r' ] == 8 || ! isset ( $_GET [ 'r' ])) {
$_GET [ 'r' ] = 2 ;
2022-06-06 21:30:34 +00:00
}
2023-04-11 20:21:03 +00:00
/** @var User $u */
2022-12-30 19:03:37 +00:00
if ( $u -> info [ 'inTurnir' ] > 0 && $u -> info [ 'inUser' ] == 0 && $u -> info [ 'room' ] == 318 ) {
die ( '<script>location="main.php";</script>' );
2022-06-06 21:30:34 +00:00
}
2022-12-30 19:03:37 +00:00
2022-08-25 11:23:36 +00:00
$zv = new FightRequest ();
2022-12-30 19:03:37 +00:00
$js_5356 = sprintf (
" top.lafstReg[%d] = 0; top.startHpRegen( \" main \" ,%d,%d,%d,%d,%d,%d,%d,%d,%d,1); " ,
$u -> info [ 'id' ], $u -> info [ 'id' ], 0 + $u -> stats [ 'hpNow' ], 0 + $u -> stats [ 'hpAll' ],
0 + $u -> stats [ 'mpNow' ], 0 + $u -> stats [ 'mpAll' ], time () - $u -> info [ 'regHP' ], time () - $u -> info [ 'regMP' ],
0 + $u -> rgd [ 0 ], 0 + $u -> rgd [ 1 ]
);
2023-04-11 20:21:03 +00:00
$code ? ? = PassGen :: intCode ();
2022-06-06 21:30:34 +00:00
?>
< script type = " text/javascript " src = " js/jquery.js " ></ script >
< script >
var zv_Priem = 0 ;
2022-12-30 19:03:37 +00:00
2022-06-06 21:30:34 +00:00
function openfizrmk () {
2022-12-30 19:03:37 +00:00
$ ( '#hidezv1_btn' ) . slideUp ( 300 , function () {
$ ( '#hidezv1' ) . slideDown ( 700 );
});
2022-06-06 21:30:34 +00:00
}
2022-12-30 19:03:37 +00:00
2022-06-06 21:30:34 +00:00
< ? = $js_5356 ?>
</ script >
< style >
2022-12-30 19:03:37 +00:00
table . wfix {
table - layout : fixed ;
width : 100 % ;
}
. m {
background : #99CCCC;
text - align : center ;
}
. s {
background : #BBDDDD;
text - align : center ;
}
. firsttd {
width : 70 px ;
}
2022-06-06 21:30:34 +00:00
</ style >
< TABLE class = " wfix " cellspacing = 1 cellpadding = 3 >
2022-12-30 19:03:37 +00:00
< TR >
< TD colspan =< ? = $u -> info [ 'level' ] == 0 ? '4' : '6' ?> align=right>
< div style = " float:left " >< ? = $zv -> userInfo () ?> </div>
< div style = " float:right; " >
< INPUT class = " btn " onClick = " location='main.php?zayvka&r=<?= $_GET['r'] ?>&rnd=<?= $code ?>'; "
2023-01-10 16:29:32 +00:00
TYPE = button name = tmp value = " Обновить " >
< INPUT class = " btn " TYPE = button value = " Вернуться " onClick = " location.href='main.php?rnd=<?= $code ?>'; " >
2022-12-30 19:03:37 +00:00
</ div >
</ td >
</ tr >
< tr >
2023-01-10 16:29:32 +00:00
< td class = " firsttd m " >& nbsp ; < b > Бои :</ b >& nbsp ; </ td >
2022-12-30 19:03:37 +00:00
< ? php if ( $u -> info [ 'level' ] == 0 ) : ?>
2023-04-11 20:21:03 +00:00
< td class = " <?= $_GET['r'] == 1 ? 's' : 'm' ?> " >< a href = " /main.php?zayvka=1&r=1&rnd=<?= $code ?> " > Новички </ a >
2022-12-30 19:03:37 +00:00
</ td >
< ? php else : ?>
2023-04-11 20:21:03 +00:00
< td class = " <?= $_GET['r'] == 2 ? 's' : 'm' ?> " >< a href = " /main.php?zayvka=1&r=2&rnd=<?= $code ?> " > Турниры </ a >
2022-12-30 19:03:37 +00:00
</ td >
< td class = " <?= $_GET['r'] == 4 ? 's' : 'm' ?> " >< a
2023-04-11 20:21:03 +00:00
href = " main.php?zayvka=1&r=4&rnd=<?= $code ?> " > Групповые </ a ></ td >
2022-12-30 19:03:37 +00:00
< td class = " <?= $_GET['r'] == 5 ? 's' : 'm' ?> " >< a
2023-04-11 20:21:03 +00:00
href = " main.php?zayvka=1&r=5&rnd=<?= $code ?> " > Хаотичные </ a ></ td >
2022-12-30 19:03:37 +00:00
< ? php endif ; ?>
2023-04-11 20:21:03 +00:00
< td class = " <?= $_GET['r'] == 6 ? 's' : 'm' ?> " >< a href = " /main.php?zayvka=1&r=6&rnd=<?= $code ?> " > Текущие </ a >
</ td >
< td class = " <?= $_GET['r'] == 7 ? 's' : 'm' ?> " >< a href = " /main.php?zayvka=1&r=7&rnd=<?= $code ?> " > Завершенные </ a >
2022-12-30 19:03:37 +00:00
</ td >
</ tr >
</ table >
2022-06-06 21:30:34 +00:00
< script >
2022-12-30 19:03:37 +00:00
function console_clonelogin () {
2023-01-10 16:29:32 +00:00
var s = prompt ( " Введите логин персонажа с которым хотите сразиться: " , " " );
2022-12-30 19:03:37 +00:00
if (( s !== null ) && ( s !== '' )) {
location . href = " main.php?zayvka=1&r=2&bot_clone= " + s + " &rnd=1 " ;
}
}
2022-06-06 21:30:34 +00:00
</ script >
< div style = " padding:2px; " >
2022-12-30 19:03:37 +00:00
< ? php
$zi = false ;
2022-06-06 21:30:34 +00:00
2022-12-30 19:03:37 +00:00
if ( $u -> info [ 'battle' ] == 0 ) {
if ( isset ( $_POST [ 'add_new_zv' ])) {
$zv -> add ();
} elseif ( isset ( $_GET [ 'bot' ]) && ( $u -> info [ 'level' ] <= 7 || $u -> info [ 'admin' ] > 0 )) {
$zv -> addBot ();
} elseif ( isset ( $_GET [ 'bot_clone' ])) {
$zvclone = Db :: getValue (
'select id from users where admin = 0 and `real` = 1 and login = ?' ,
[ $_GET [ 'bot_clone' ]]
);
$zv -> addBotClone ( $zvclone [ 'id' ]);
} elseif ( isset ( $_GET [ 'add_group' ])) {
$zv -> add ();
} elseif ( isset ( $_GET [ 'start_haot' ])) {
$zv -> add ();
}
}
2022-06-06 21:30:34 +00:00
2022-12-30 19:03:37 +00:00
if ( $u -> info [ 'zv' ] != 0 ) {
2023-04-11 20:21:03 +00:00
$zi = Db :: getRow ( 'select id, razdel from zayvki where id = ? and start = 0 and cancel = 0 and time > unix_timestamp() - 60 * 60 * 2 or razdel > 3' , [ $u -> info [ 'zv' ]]);
2022-12-30 19:03:37 +00:00
if ( ! isset ( $zi [ 'id' ])) {
$zi = false ;
$u -> info [ 'zv' ] = 0 ;
2023-04-11 20:21:03 +00:00
Db :: sql ( 'update stats set zv = 0 where id = ?' , [ $u -> info [ 'id' ]]);
2022-12-30 19:03:37 +00:00
}
}
if ( $u -> info [ 'battle' ] == 0 ) {
if ( isset ( $_POST [ 'groupClick' ]) && ! isset ( $zi [ 'id' ])) {
2023-04-11 20:21:03 +00:00
$zg = Db :: getRow ( 'select * from zayvki where id = ? and start = 0 and cancel = 0 and time > unix_timestamp() - 60 * 60 * 2 and btl_id = 0 and razdel = 4' , [( int ) $_POST [ 'groupClick' ]]);
2022-12-30 19:03:37 +00:00
if ( ! isset ( $zg [ 'id' ])) {
2023-04-11 20:21:03 +00:00
echo '<div style="text-align: center;"><br><br>Заявка на групповой бой не найдена.</div>' ;
2022-12-30 19:03:37 +00:00
} else {
$tm_start = floor (( $zg [ 'time' ] + $zg [ 'time_start' ] - time ()) / 6 ) / 10 ;
$tm_start = $zv -> rzv ( $tm_start );
$tm1 = '' ;
$tm2 = '' ;
2023-04-11 20:21:03 +00:00
$tm3 = '' ;
$users = Db :: getRow ( 'select users.id, login, level, align, clan, admin, team from users left join stats on users.id = stats.id where zv = ?' , [ $zg [ 'id' ]]);
foreach ( $users as $user ) {
$ { 'tm' . $user [ 'team' ]} .= '<b>' . $user [ 'login' ] . '</b> [' . $user [ 'level' ] . ']<a href="info/' . $user [ 'id' ] . '" target="_blank"><img src="//' . Config :: get ( 'img' ) . '/i/inf_capitalcity.gif" title="Инф. о ' . $user [ 'login' ] . '" alt="inf"></a><br>' ;
2022-12-30 19:03:37 +00:00
}
if ( empty ( $tm1 )) {
2023-01-10 16:29:32 +00:00
$tm1 = 'группа пока не набрана' ;
2022-12-30 19:03:37 +00:00
} else {
$tm1 = rtrim ( $tm1 , '<br />' );
}
if ( empty ( $tm2 )) {
2023-01-10 16:29:32 +00:00
$tm2 = 'группа пока не набрана' ;
2022-12-30 19:03:37 +00:00
} else {
$tm2 = rtrim ( $tm2 , '<br />' );
}
//
if ( $zg [ 'teams' ] == 3 ) {
if ( empty ( $tm3 )) {
2023-01-10 16:29:32 +00:00
$tm3 = 'группа пока не набрана' ;
2022-12-30 19:03:37 +00:00
} else {
$tm3 = rtrim ( $tm3 , '<br />' );
}
}
$sv1 = Db :: getValue ( 'select count(*) from stats where zv = ? and team = 1' );
$sv2 = Db :: getValue ( 'select count(*) from stats where zv = ? and team = 2' );
$sv3 = Db :: getValue ( 'select count(*) from stats where zv = ? and team = 3' );
$sv1 = $zg [ 'tm1max' ] - $sv1 ;
$sv2 = $zg [ 'tm2max' ] - $sv2 ;
if ( $zg [ 'teams' ] == 3 ) {
$sv3 = $zg [ 'tm2max' ] - $sv3 ;
}
2023-04-11 20:21:03 +00:00
?>
</ div >
2022-12-30 19:03:37 +00:00
< table style = " margin-top:2px; " width = " 100% " >
< tr >
2023-03-31 16:54:33 +00:00
< td > Бой начнется через < ? = $tm_start ; ?> мин.</td>
2022-12-30 19:03:37 +00:00
< td align = " right " >
2023-03-31 16:54:33 +00:00
< INPUT class = " btn " onClick = " location='main.php?zayvka&r=<?= $_GET['r'] ; ?>&rnd=<?= $code ; ?>'; "
2023-01-10 16:29:32 +00:00
TYPE = button name = tmp value = " Обновить " >
< input class = " btn " type = " button " value = " Вернуться "
2023-03-31 16:54:33 +00:00
onclick = " location.href='main.php?zayvka&r=<?= $_GET['r'] ; ?>&rnd=<?= $code ; ?>'; " >
2022-12-30 19:03:37 +00:00
</ td >
</ tr >
</ table >
2023-01-10 16:29:32 +00:00
< h3 align = " center " > Н а чьей стороне будете сражаться ? </ h3 >
2022-12-30 19:03:37 +00:00
< table align = " center " cellspacing = " 4 " cellpadding = " 1 " >
< tr >
2023-01-10 16:29:32 +00:00
< td bgcolor = " 99CCCC " >< b > Группа один :</ b >< br />
2023-03-31 16:54:33 +00:00
Максимальное кол - во : < ? = $zg [ 'tm1max' ]; ?> <br/>
Ограничения по уровню : < ? = $zg [ 'min_lvl_1' ] . ' - ' . $zg [ 'max_lvl_1' ]; ?> </td>
2023-01-10 16:29:32 +00:00
< td bgcolor = " 99CCCC " >< b > Группа два :</ b >< br />
2023-03-31 16:54:33 +00:00
Максимальное кол - во : < ? = $zg [ 'tm2max' ]; ?> <br/>
Ограничения по уровню : < ? = $zg [ 'min_lvl_2' ] . ' - ' . $zg [ 'max_lvl_2' ]; ?> </td>
2023-03-31 18:42:06 +00:00
< ? php
2022-12-30 19:03:37 +00:00
if ( $zg [ 'teams' ] == 3 ) {
?>
2023-01-10 16:29:32 +00:00
< td bgcolor = " 99CCCC " >< b > Группа три :</ b >< br />
2023-03-31 16:54:33 +00:00
Максимальное кол - во : < ? = $zg [ 'tm2max' ]; ?> <br/>
Ограничения по уровню : < ? = $zg [ 'min_lvl_2' ] . ' - ' . $zg [ 'max_lvl_2' ]; ?> </td>
2023-03-31 18:42:06 +00:00
< ? php
2022-12-30 19:03:37 +00:00
}
?>
</ tr >
< tr >
2023-03-31 16:54:33 +00:00
< td align = " center " >< ? = $tm1 ; ?>
2022-12-30 19:03:37 +00:00
< br />
</ td >
2023-03-31 16:54:33 +00:00
< td align = " center " >< ? = $tm2 ; ?>
2022-12-30 19:03:37 +00:00
< br />
</ td >
2023-03-31 18:42:06 +00:00
< ? php
2022-12-30 19:03:37 +00:00
if ( $zg [ 'teams' ] == 3 ) {
?>
2023-03-31 16:54:33 +00:00
< td align = " center " >< ? = $tm3 ; ?>
2022-12-30 19:03:37 +00:00
< br />
</ td >
2023-03-31 18:42:06 +00:00
< ? php
2022-12-30 19:03:37 +00:00
}
?>
</ tr >
< tr >
< td align = " center " >
2023-01-10 16:29:32 +00:00
< input class = " btn " title = " Н а данный момент свободно мест: <?= $sv1 ?> "
2022-12-30 19:03:37 +00:00
onclick = " location='main.php?r=<?= $_GET['r'] ?>&zayvka&btl_go=<?= $zg['id'] ?>&tm1=<?= $code ?>' "
2023-01-10 16:29:32 +00:00
type = " submit " name = " confirm1 " value = " Я за этих! " />
2022-12-30 19:03:37 +00:00
</ td >
< td align = " center " >
2023-01-10 16:29:32 +00:00
< input class = " btn " title = " Н а данный момент свободно мест: <?= $sv2 ?> "
2022-12-30 19:03:37 +00:00
onclick = " location='main.php?r=<?= $_GET['r'] ?>&zayvka&btl_go=<?= $zg['id'] ?>&tm2=<?= $code ?>' "
2023-01-10 16:29:32 +00:00
type = " submit " name = " confirm2 " value = " Я за этих! " />
2022-12-30 19:03:37 +00:00
</ td >
< ? php
if ( $zg [ 'teams' ] == 3 ) {
?>
< td align = " center " >
2023-01-10 16:29:32 +00:00
< input class = " btn " title = " Н а данный момент свободно мест: <?= $sv3 ?> "
2022-12-30 19:03:37 +00:00
onclick = " location='main.php?r=<?= $_GET['r'] ?>&zayvka&btl_go=<?= $zg['id'] ?>&tm3=<?= $code ?>' "
2023-01-10 16:29:32 +00:00
type = " submit " name = " confirm3 " value = " Я за этих! " />
2022-12-30 19:03:37 +00:00
</ td >
< ? php
}
?>
</ tr >
</ table >
< ? php
}
} elseif ( isset ( $_GET [ 'cancelzv' ]) && ! isset ( $_POST [ 'add_new_zv' ])) {
$zv -> cancelzv ();
2023-04-11 20:21:03 +00:00
} elseif ( isset ( $_GET [ 'startBattle' ]) && isset ( $zi [ 'id' ]) && ( $zi [ 'razdel' ] >= 1 && $zi [ 'razdel' ] <= 3 )) {
2022-12-30 19:03:37 +00:00
$zv -> startBattle ( $zi [ 'id' ]);
}
2022-06-06 21:30:34 +00:00
}
2022-12-30 19:03:37 +00:00
if ( isset ( $_POST [ 'btl_go' ])) {
$zv -> go ( $_POST [ 'btl_go' ]);
} elseif ( isset ( $_GET [ 'btl_go' ])) {
$zv -> go ( $_GET [ 'btl_go' ]);
2022-06-06 21:30:34 +00:00
}
2023-04-11 20:21:03 +00:00
if ( $zv -> error ) {
echo '<b style="color: red">' . $zv -> error . '</b><br>' ;
2022-06-06 21:30:34 +00:00
}
2023-04-11 20:21:03 +00:00
if ( $zv -> test_s ) {
echo '<b style="color: red">' . $zv -> test_s . '</b><br>' ;
2022-06-06 21:30:34 +00:00
}
?>
< table style = " padding:2px; " width = " 100% " border = " 0 " cellspacing = " 0 " cellpadding = " 2 " >
2022-12-30 19:03:37 +00:00
< tr >
< td >< ? php $zv -> see (); ?> </td>
</ tr >
< tr >
< td >< ? php $zv -> seeZv (); ?> </td>
</ tr >
</ table >< br />
< div style = " text-align: right " >
< ? = Config :: get ( 'counters' ) ?>
</ div >