2022-06-06 21:30:34 +00:00
< ? php
if ( ! defined ( 'GAME' ))
{
die ();
}
if ( $u -> room [ 'file' ] == 'ab/vokzal' )
{
$cs = '' ; $cbuy = array (); $tmref = 0 ;
$sp = mysql_query ( 'SELECT * FROM `vokzal` WHERE `city` = "' . $u -> info [ 'city' ] . '" OR `tocity` = "' . $c [ 'city' ] . '"' );
while ( $pl = mysql_fetch_array ( $sp ))
{
2023-01-10 16:29:32 +00:00
$vz1 = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `room` WHERE `name` = "Вокзал" AND `city` = "' . $pl [ 'city' ] . '" LIMIT 1' ));
$vz2 = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `room` WHERE `name` = "Вокзал" AND `city` = "' . $pl [ 'tocity' ] . '" LIMIT 1' ));
2022-06-06 21:30:34 +00:00
$crm = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `room` WHERE `name` = "' . $pl [ 'name' ] . '" LIMIT 1' ));
2023-01-10 16:29:32 +00:00
//period 0 - прибытие в город (стоянка), 1 - движение, 3 - прибытие в другой город (стоянка), 4 - движение (из tocity)
2022-06-06 21:30:34 +00:00
if ( $pl [ 'time_start_go' ] == 0 )
{
2023-01-10 16:29:32 +00:00
//Это новая карета обновляем данные
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `vokzal` SET `time_start_go` = "' . ( time () + $pl [ 'timeStop' ] * 60 ) . '",`time_finish_go` = "' . ( time () + $pl [ 'timeStop' ] * 60 + $pl [ 'time_go' ] * 60 ) . '" WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
$pl [ 'time_start_go' ] = time () + $pl [ 'timeStop' ] * 60 ;
$pl [ 'time_finish_go' ] = $pl [ 'time_start_go' ] + $pl [ 'time_go' ] * 60 ;
}
$see = 1 ;
$plc = $pl [ 'tocity' ];
$col = 'e6e6e6" style="color:#B7B7B7;"' ;
2023-01-10 16:29:32 +00:00
$tmgo = '<small>(Прибудет в <b>' . date ( 'H:i' , $pl [ 'time_finish_go' ]) . '</b>)</small>' ;
2022-06-06 21:30:34 +00:00
$bl = '--' ;
2023-01-10 16:29:32 +00:00
$bb = 'билетов нет' ;
2022-06-06 21:30:34 +00:00
if ( $pl [ 'time_start_go' ] - 600 < time () && $pl [ 'time_start_go' ] > time ())
{
2023-01-10 16:29:32 +00:00
//можно знанимать места в карете
2022-06-06 21:30:34 +00:00
if ( isset ( $crm [ 'id' ]))
{
$sr = mysql_query ( 'SELECT `uid`,`id` FROM `items_users` WHERE `secret_id` = "' . $pl [ 'time_start_go' ] . '_b' . $pl [ 'id' ] . '" AND `delete` = "0" LIMIT 100' );
while ( $pr = mysql_fetch_array ( $sr ))
{
$upd1 = mysql_query ( 'UPDATE `items_users` SET `delete` = "' . time () . '" WHERE `id` = "' . $pr [ 'id' ] . '" LIMIT 1' );
if ( $upd1 )
{
mysql_query ( 'UPDATE `users` SET `room` = "' . $crm [ 'id' ] . '" WHERE `online` > ' . ( time () - 120 ) . ' AND `id` = "' . $pr [ 'uid' ] . '" LIMIT 1' );
}
}
}
}
if ((( $pl [ 'period' ] == 0 && $u -> info [ 'city' ] == $pl [ 'city' ]) || ( $pl [ 'period' ] == 3 && $u -> info [ 'city' ] == $pl [ 'tocity' ])) && $pl [ 'time_start_go' ] > time () && $pl [ 'citygo' ] != $u -> info [ 'city' ])
{
$see = 1 ;
2023-01-10 16:29:32 +00:00
$tmgo = date ( 'd.m.Y в H:i' , $pl [ 'time_start_go' ]);
2022-06-06 21:30:34 +00:00
$col = 'c9c9c9' ;
$bl = $pl [ 'bilets' ];
2023-01-10 16:29:32 +00:00
$bb = '<input type="button" onClick="location=\'main.php?buy=' . $pl [ 'id' ] . '&sd4=' . $u -> info [ 'nextAct' ] . '\'" value="купить билет">' ;
2022-06-06 21:30:34 +00:00
if ( $pl [ 'bilets' ] <= 0 )
{
2023-01-10 16:29:32 +00:00
$bb = 'билетов нет' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
//отправляем карету в другой город
2022-06-06 21:30:34 +00:00
if ( $pl [ 'time_finish_go' ] < time ())
{
2023-01-10 16:29:32 +00:00
//прибыли
2022-06-06 21:30:34 +00:00
if ( $pl [ 'period' ] == 0 )
{
2023-01-10 16:29:32 +00:00
//Прибыли в город, время стоянки закончилось, и поехали
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `vokzal` SET `period` = "1",`citygo` = "' . $pl [ 'tocity' ] . '" WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
$pl [ 'period' ] = 1 ;
} elseif ( $pl [ 'period' ] == 1 )
{
2023-01-10 16:29:32 +00:00
//приехалис в другой город, делаем там стоянку
2022-06-06 21:30:34 +00:00
if ( isset ( $crm [ 'id' ]))
{
mysql_query ( 'UPDATE `users` SET `city` = "' . $pl [ 'tocity' ] . '",`room` = "' . $vz2 [ 'id' ] . '" WHERE `room` = "' . $crm [ 'id' ] . '" LIMIT ' . $pl [ 'bilets_default' ] . '' );
}
mysql_query ( 'UPDATE `vokzal` SET `bilets` = "' . $pl [ 'bilets_default' ] . '",`citygo`="' . $pl [ 'city' ] . '",`time_finish_go` = "' . ( time () + $pl [ 'timeStop' ] * 60 + $pl [ 'time_go' ] * 60 ) . '",`time_start_go` = "' . ( time () + $pl [ 'timeStop' ] * 60 ) . '",`period` = "3" WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
$pl [ 'period' ] = 3 ;
} elseif ( $pl [ 'period' ] == 3 )
{
2023-01-10 16:29:32 +00:00
//Прибыли в город, время стоянки закончилось, и поехали
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `vokzal` SET `period` = "4" WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
$pl [ 'period' ] = 4 ;
} elseif ( $pl [ 'period' ] == 4 )
{
2023-01-10 16:29:32 +00:00
//приехалис в другой город, делаем там стоянку
2022-06-06 21:30:34 +00:00
if ( isset ( $crm [ 'id' ]))
{
mysql_query ( 'UPDATE `users` SET `city` = "' . $pl [ 'city' ] . '",`room` = "' . $vz1 [ 'id' ] . '" WHERE `room` = "' . $crm [ 'id' ] . '" LIMIT ' . $pl [ 'bilets_default' ] . '' );
}
mysql_query ( 'UPDATE `vokzal` SET `bilets` = "' . $pl [ 'bilets_default' ] . '",`citygo`="' . $pl [ 'tocity' ] . '",`time_finish_go` = "' . ( time () + $pl [ 'timeStop' ] * 60 + $pl [ 'time_go' ] * 60 ) . '",`time_start_go` = "' . ( time () + $pl [ 'timeStop' ] * 60 ) . '",`period` = "0" WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
$pl [ 'period' ] = 0 ;
} else {
echo '[?]' ;
}
}
}
if ( $see == 1 )
{
if ( $pl [ 'period' ] == 0 || $pl [ 'period' ] == 1 )
{
$plc = $pl [ 'tocity' ];
} else {
$plc = $pl [ 'city' ];
}
$cs .= ' < tr >
< td height = " 30 " bgcolor = " #'. $col .' " align = " center " > '.$tmgo.' </ td >
< td bgcolor = " #'. $col .' " align = " center " > '.$u->city_name[$plc].' </ td >
2023-01-10 16:29:32 +00:00
< td bgcolor = " #'. $col .' " align = " center " > '.$pl[' time_go '].' мин .</ td >
< td bgcolor = " #'. $col .' " align = " center " > '.$pl[' price1 '].' кр .</ td >
< td bgcolor = " #'. $col .' " align = " center " > нет </ td >
2022-06-06 21:30:34 +00:00
< td bgcolor = " #'. $col .' " align = " center " > '.$bl.' </ td >
< td bgcolor = " #'. $col .' " align = " center " > '.$bb.' </ td >
</ tr > ' ;
if ( $pl [ 'time_start_go' ] - time () < $tmref )
{
$tmref = $pl [ 'time_start_go' ] - time ();
}
if ( $bl != '--' && $bl > 0 && $pl [ 'citygo' ] != $u -> info [ 'city' ])
{
$cbuy [ $pl [ 'id' ]] = 1 ;
}
}
}
if ( isset ( $_GET [ 'buy' ]) && $u -> newAct ( $_GET [ 'sd4' ]) == true )
{
$buy = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `vokzal` WHERE `time_start_go` > "' . time () . '" AND `citygo` != "' . $u -> info [ 'city' ] . '" AND `id` = "' . mysql_real_escape_string ( $_GET [ 'buy' ]) . '" LIMIT 1' ));
if ( isset ( $buy [ 'id' ]) && isset ( $cbuy [ $buy [ 'id' ]]))
{
if ( $buy [ 'bilets' ] <= 0 )
{
2023-01-10 16:29:32 +00:00
$error = 'Билетов больше нет, загляните позже' ;
2022-06-06 21:30:34 +00:00
} elseif ( $u -> info [ 'money' ] >= $buy [ 'price1' ])
{
$u -> info [ 'money' ] -= $buy [ 'price1' ];
$upd = mysql_query ( 'UPDATE `users` SET `money` = "' . $u -> info [ 'money' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1' );
if ( $upd )
{
2023-01-10 16:29:32 +00:00
//передаем Билет персонажу
$error = 'Вы заплатили ' . $buy [ 'price1' ] . ' кр. за билет в ' . $u -> city_name [ $buy [ 'tocity' ]] . '<br>Отправка в ' . date ( 'd.m.Y H:i' , $buy [ 'time_start_go' ]) . ' по серверу' ;
$ib = 'Дата отправления кареты в ' . $u -> city_name [ $buy [ 'tocity' ]] . ': ' . date ( 'd.m.Y в H:i' , $buy [ 'time_start_go' ]) . '<br>Билет на имя: <b>' . $u -> info [ 'login' ] . '</b>' ;
2022-06-06 21:30:34 +00:00
$ins = mysql_query ( 'INSERT INTO `items_users` (`1price`,`maidin`,`data`,`uid`,`item_id`,`iznosMAX`,`lastUPD`,`secret_id`,`time_create`) VALUES ("' . $buy [ 'price1' ] . '","' . $u -> info [ 'city' ] . '","info=' . $ib . '|noodet=1","' . $u -> info [ 'id' ] . '","866","1","' . time () . '","' . $buy [ 'time_start_go' ] . '_b' . $buy [ 'id' ] . '","' . time () . '")' );
if ( $ins )
{
2023-01-10 16:29:32 +00:00
$error .= '<br>Предмет "Билет" был перемещен к Вам в инвентарь, в раздел "прочее".' ;
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `vokzal` SET `bilets` = "' . ( $buy [ 'bilets' ] - 1 ) . '" WHERE `id` = "' . $buy [ 'id' ] . '" LIMIT 1' );
} else {
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось приобрести билет' ;
2022-06-06 21:30:34 +00:00
}
} else {
$u -> info [ 'money' ] += $buy [ 'price1' ];
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось приобрести билет' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$error = 'У В а с недостаточно денег' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось приобрести билет' ;
2022-06-06 21:30:34 +00:00
}
}
$zd = $u -> testAction ( '`uid` = "' . $u -> info [ 'id' ] . '" AND `time` >= ' . time () . ' AND `vars` = "teleport" LIMIT 1' , 1 );
if ( isset ( $_GET [ 'teleport' ]) && ! isset ( $zd [ 'id' ]))
{
$tp = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `teleport` WHERE `city` = "' . $u -> info [ 'city' ] . '" AND `cancel` = "0" AND `id` = "' . (( int ) $_GET [ 'teleport' ]) . '" LIMIT 1' ));
if ( isset ( $tp [ 'id' ]))
{
if ( $u -> info [ 'money' ] >= $tp [ 'price1' ])
{
2023-01-10 16:29:32 +00:00
$rm = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `room` WHERE `name` = "Вокзал" AND `city` = "' . $tp [ 'toCity' ] . '" LIMIT 1' ));
2022-06-06 21:30:34 +00:00
if ( isset ( $rm [ 'id' ]))
{
$u -> info [ 'money' ] -= $tp [ 'price1' ];
$u -> info [ 'city' ] = $tp [ 'toCity' ];
mysql_query ( 'UPDATE `users` SET `money` = "' . $u -> info [ 'money' ] . '",`city` = "' . $u -> info [ 'city' ] . '",`room` = "' . $rm [ 'id' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1' );
if ( $u -> stats [ 'silver' ] >= 3 ) {
$tp [ 'time' ] = round ( $tp [ 'time' ] / 2 );
}
$u -> addAction (( time () + $tp [ 'time' ] * 60 ), 'teleport' , $tp [ 'toCity' ]);
die ( '<script>location="main.php";</script>' );
} else {
2023-01-10 16:29:32 +00:00
$error = 'Нельзя телепортироваться, возможно вокзал в этом городе был разрушен...' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$error = 'У вас недостаточно средсв' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$error = 'Нельзя телепортироваться...' ;
2022-06-06 21:30:34 +00:00
}
}
$cst = '' ;
$sp = mysql_query ( 'SELECT * FROM `teleport` WHERE `city` = "' . $u -> info [ 'city' ] . '" AND `cancel` = "0"' );
while ( $pl = mysql_fetch_array ( $sp ))
{
$col = 'e6e6e6" style="color:#B7B7B7;"' ;
if ( ! isset ( $zd [ 'id' ]))
{
$col = 'c9c9c9' ;
}
$cst .= ' < tr >
< td bgcolor = " #'. $col .' " align = " center " > '.$pl[' toCity '].' </ td >
< td bgcolor = " #'. $col .' " align = " center " > '.$u->timeOut($pl[' time ']*60).' </ td >
2023-01-10 16:29:32 +00:00
< td bgcolor = " #'. $col .' " align = " center " > '.$pl[' price1 '].' кр .</ td > ' ;
2022-06-06 21:30:34 +00:00
if ( isset ( $zd [ 'id' ]))
{
2023-01-10 16:29:32 +00:00
$cst .= '<td bgcolor="#' . $col . '" align="center">Задержка еще ' . $u -> timeOut ( $zd [ 'time' ] - time ()) . '</td>' ;
2022-06-06 21:30:34 +00:00
} else {
2023-01-10 16:29:32 +00:00
$cst .= '<td bgcolor="#' . $col . '" align="center"><a href="?teleport=' . $pl [ 'id' ] . '">Поехали!</a></td>' ;
2022-06-06 21:30:34 +00:00
}
$cst .= '</tr>' ;
}
if ( $re != '' ){ echo '<div align="right"><font color="red"><b>' . $re . '</b></font></div>' ; } ?>
< style type = " text/css " >
. pH3 { COLOR : #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 12pt; FONT-WEIGHT: bold; }
. class_ {
font - weight : bold ;
color : #C5C5C5;
cursor : pointer ;
}
. class_st {
font - weight : bold ;
color : #659BA3;
cursor : pointer ;
}
. class__ {
font - weight : bold ;
color : #FFFFFF;
cursor : pointer ;
background - color : #659BA3;
}
. class__st {
font - weight : bold ;
color : #FFFFFF;
cursor : pointer ;
background - color : #659BA3;
font - size : 10 px ;
}
. class_old {
font - weight : bold ;
color : #919191;
cursor : pointer ;
}
. class__old {
font - weight : bold ;
color : #FFFFFF;
cursor : pointer ;
background - color : #838383;
font - size : 10 px ;
}
</ style >
< TABLE width = " 100% " cellspacing = " 0 " cellpadding = " 0 " >
< tr >< td valign = " top " >< div align = " center " class = " pH3 " >< ? echo $u -> room [ 'name' ] . ' "' . $u -> city_name [ $u -> info [ 'city' ]] . '"' ; ?> </div>
< ? php
echo '<b style="color:red">' . $error . '</b>' ;
if ( $cst != '' )
{
?>
< center >
2023-01-10 16:29:32 +00:00
< b > Телепортация в другие города < ? if ( isset ( $zd [ 'id' ])){ echo ' </b>(Возможна через ' . $u -> timeOut ( $zd [ 'time' ] - time ()) . ')<b>' ; } ?> </b>
2022-06-06 21:30:34 +00:00
</ center >
< ? if ( ! isset ( $zd [ 'id' ])){ ?>
< br />
< table width = " 100% " border = " 0 " cellspacing = " 1 " cellpadding = " 0 " >
< tr >
2023-01-10 16:29:32 +00:00
< td width = " 25% " bgcolor = " #81888e " >< div align = " center " > пункт назначения </ div ></ td >
< td width = " 25% " bgcolor = " #81888e " >< div align = " center " > время задержки телепортации </ div ></ td >
< td width = " 25% " bgcolor = " #81888e " >< div align = " center " > цена телепортации </ div ></ td >
< td width = " 25% " bgcolor = " #81888e " >< div align = " center " > Телепортироваться </ div ></ td >
2022-06-06 21:30:34 +00:00
</ tr >
< ? echo $cst ; ?>
</ table >
< br />
< ? } } unset ( $zd ); ?>
2023-01-10 16:29:32 +00:00
< center >< b >< br /> Расписание движения карет на сегодня </ b ></ center >
2022-06-06 21:30:34 +00:00
< br />
< table width = " 100% " border = " 0 " cellspacing = " 1 " cellpadding = " 0 " >
< tr >
2023-01-10 16:29:32 +00:00
< td width = " 16% " bgcolor = " #81888e " >< div align = " center " > время отправления </ div ></ td >
< td width = " 14% " bgcolor = " #81888e " >< div align = " center " > пункт назначения </ div ></ td >
< td width = " 14% " bgcolor = " #81888e " >< div align = " center " > время в пути </ div ></ td >
< t d width = " 14% " bgcolor = " #81888e " >< div align = " center " > цена билета </ div ></ td >
< td width = " 14% " bgcolor = " #81888e " >< div align = " center " > требуется виза </ div ></ td >
< td width = " 14% " bgcolor = " #81888e " >< div align = " center " > осталось билетов </ div ></ td >
< td width = " 14% " bgcolor = " #81888e " >< div align = " center " > приобрести билет </ div ></ td >
2022-06-06 21:30:34 +00:00
</ tr >
< ? echo $cs ; ?>
</ table >
2023-01-10 16:29:32 +00:00
< ? if ( $tmref > 600 && $tmref > 0 ){ echo '<script>setTimer(\'location = location;\',' . ( 1000 * $tmref - 600 ) . ');</script>' ; } if ( $cs == '' ){ echo '<center><br>Сегодня нет свободных карет для перемещения в другие города</center>' ; } ?>
2022-06-06 21:30:34 +00:00
< br />< br />
< small style = " color:#999999; " >
2023-01-10 16:29:32 +00:00
- Для отправления в другой город Вы должны быть онлайн когда будет отправляться карета < br />
- Если Вы опоздали на карету , тогда билет можно сдать в магазин за половину е г о стоимости < br />
2022-06-06 21:30:34 +00:00
</ small >
< td width = " 280 " valign = " top " >
< TABLE cellspacing = " 0 " cellpadding = " 0 " >< TD width = " 100% " >& nbsp ; </ TD >< TD >
< table border = " 0 " cellpadding = " 0 " cellspacing = " 0 " >
< tr align = " right " valign = " top " >
< td >
<!-- -->
< ? echo $goLis ; ?>
<!-- -->
< table border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td nowrap = " nowrap " >
< table width = " 100% " border = " 0 " cellpadding = " 0 " cellspacing = " 1 " bgcolor = " #DEDEDE " >
< tr >
< td bgcolor = " #D3D3D3 " >< img src = " https://img.new-combats.com/i/move/links.gif " width = " 9 " height = " 7 " /></ td >
2023-01-10 16:29:32 +00:00
< td bgcolor = " #D3D3D3 " nowrap >< a href = " # " id = " greyText " class = " menutop " onclick = " location='main.php?loc=3.180.0.267&rnd=<? echo $code ; ?>'; " title = " <? thisInfRm('3.180.0.267',1); ?> " > Центральная Площадь </ a ></ td >
2022-06-06 21:30:34 +00:00
</ tr >
</ table >
</ td >
</ tr >
</ table >
</ td ></ table >
</ td ></ table >
< div >
< br />
< div align = " right " >
< small >
2023-01-10 16:29:32 +00:00
М а с с а : < ? = $u -> aves [ 'now' ] ?> /<?=$u->aves['max']?> <br />
У вас в наличии : < b style = " color:#339900; " >< ? php echo round ( $u -> info [ 'money' ], 2 ); ?> кр.</b>
2022-06-06 21:30:34 +00:00
</ small >
</ div >
< br />
< br />
</ div >
</ td >
</ table >
< br >
< div id = " textgo " style = " visibility:hidden; " ></ div >
< ?
}
?>