2018-01-28 16:40:49 +00:00
< ? php
2018-03-09 02:13:08 +00:00
/**
* Центральная площадь
*/
2018-01-28 16:40:49 +00:00
session_start ();
2018-02-12 19:53:19 +00:00
if ( $_SESSION [ 'uid' ] == null ) {
header ( " Location: index.php " );
2020-09-29 22:39:06 +00:00
exit ;
2018-02-12 19:53:19 +00:00
}
2020-09-29 22:39:06 +00:00
require_once " functions.php " ;
$user = $user ? ? [];
2018-01-28 16:40:49 +00:00
$tm = time ();
2020-09-29 22:39:06 +00:00
if ( $user -> battle ) {
2018-02-12 19:53:19 +00:00
header ( 'location: fbattle.php' );
2020-09-29 22:39:06 +00:00
exit ;
2018-02-12 19:53:19 +00:00
}
2020-09-29 22:39:06 +00:00
if ( $user -> in_tower == 1 ) {
2018-02-12 19:53:19 +00:00
header ( 'Location: towerin.php' );
2020-09-29 22:39:06 +00:00
exit ;
2018-02-12 19:53:19 +00:00
}
2020-09-29 22:39:06 +00:00
if ( $user -> zayavka ) {
exit ;
2018-02-12 19:53:19 +00:00
}
2018-01-28 16:40:49 +00:00
2020-09-29 22:39:06 +00:00
function move ( $room , $redirect = null )
2018-03-09 02:13:08 +00:00
{
2020-09-29 22:39:06 +00:00
$d = db :: c () -> query ( 'SELECT SUM(`massa`) AS `mass` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0' , $_SESSION [ 'uid' ]) -> fetch_assoc ();
$eff = db :: c () -> query ( 'SELECT `type` FROM `effects` WHERE `owner` = ?i AND (`type` = 10 OR `type` = 13 OR `type` = 14)' , $_SESSION [ 'uid' ]) -> fetch_assoc ();
2018-03-09 02:13:08 +00:00
if ( $d [ 'mass' ] > get_meshok ()) {
2020-09-29 22:39:06 +00:00
return 'У вас переполнен рюкзак, вы не можете передвигаться...' ;
2018-03-09 02:13:08 +00:00
}
2018-03-09 14:53:10 +00:00
if ( $eff [ 'type' ] == 10 ) {
2020-09-29 22:39:06 +00:00
return 'Вы парализованы и не можете передвигаться...' ;
2018-03-09 02:13:08 +00:00
}
2020-09-29 22:39:06 +00:00
if ( $eff [ 'type' ] == 13 || $eff [ 'type' ] == 14 ) {
return 'У вас тяжелая травма, вы не можете передвигаться...' ;
2018-03-09 02:13:08 +00:00
}
2020-09-29 22:39:06 +00:00
db :: c () -> query ( 'UPDATE `users`,`online` SET `users`.`room` = ?i,`online`.`room` = ?i WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i' , $room , $room , $_SESSION [ 'uid' ]);
if ( $redirect ) {
header ( 'location: ' . $redirect );
exit ;
2019-01-18 19:56:07 +00:00
}
2020-09-29 22:39:06 +00:00
return true ;
2018-03-09 02:13:08 +00:00
}
2018-03-09 14:53:10 +00:00
$location = explode ( '/' , filter_input ( INPUT_SERVER , 'QUERY_STRING' ));
switch ( $location [ 0 ]) {
case 'cp' :
2019-09-24 15:52:39 +00:00
move ( 20 , 'city.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'strah' :
2019-09-24 15:52:39 +00:00
move ( 21 , 'city.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'bps' :
2019-09-24 15:52:39 +00:00
move ( 26 , 'city.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'ps' :
2019-09-24 15:52:39 +00:00
move ( 51 , 'city.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'zaliv' :
2019-09-24 15:52:39 +00:00
move ( 2111 , 'city.php' );
2018-03-09 14:54:54 +00:00
break ;
2018-03-09 14:53:10 +00:00
case 'zamk' :
2019-09-24 15:52:39 +00:00
move ( 2601 , 'city.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'abog' :
2019-09-24 15:52:39 +00:00
move ( 2655 , 'city.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'torg' :
2019-09-24 15:52:39 +00:00
move ( 2702 , 'city.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'got' :
2020-09-30 12:01:33 +00:00
if ( $user -> room == 20 ) {
2018-03-09 14:53:10 +00:00
switch ( $location [ 1 ]) {
case 'level1' :
2019-09-18 14:06:05 +00:00
header ( 'location: main.php?goto=arena' );
2020-09-30 12:01:33 +00:00
exit ;
2018-03-09 14:53:10 +00:00
break ;
case 'level7' :
header ( 'location: city.php?strah' );
break ;
case 'level8' :
header ( 'location: city.php?bps' );
break ;
case 'level13' :
header ( 'location: quest_room.php' );
break ;
case 'level222' :
header ( 'location: city.php?torg' );
break ;
case 'level17' :
2019-01-18 19:56:07 +00:00
move ( 50 , 'ashop.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level2' :
2019-01-18 19:56:07 +00:00
move ( 22 , 'shop.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level4' :
2019-01-18 19:56:07 +00:00
move ( 23 , 'repair.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level6' :
2019-01-18 19:56:07 +00:00
move ( 27 , 'post.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level3' :
2019-01-18 19:56:07 +00:00
move ( 25 , 'comission.php' );
2018-03-09 14:53:10 +00:00
break ;
}
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 21 ) {
2018-03-09 14:53:10 +00:00
switch ( $location [ 1 ]) {
case 'level4' :
header ( 'location: city.php?cp' );
break ;
case 'level3' :
header ( 'location: city.php?zaliv' );
break ;
case 'level13' :
2019-01-18 19:56:07 +00:00
move ( 34 , 'fshop.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level5' :
2019-01-18 19:56:07 +00:00
move ( 29 , 'bank.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level16' :
2019-01-18 19:56:07 +00:00
move ( 31 , 'tower.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level14' :
2019-06-21 10:22:26 +00:00
move ( 30 , 'clan_create.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level650' :
2019-01-18 19:56:07 +00:00
move ( 650 , 'ul_clans.php' );
2018-03-09 14:53:10 +00:00
break ;
}
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2111 ) {
2018-03-09 14:53:10 +00:00
switch ( $location [ 1 ]) {
case 'level1' :
header ( 'location: city.php?strah' );
break ;
case 'level2' :
header ( 'location: city.php?haos' );
break ;
case 'level203' :
2019-01-18 19:56:07 +00:00
move ( 1055 , 'group_arena.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level1000' :
2019-01-18 19:56:07 +00:00
move ( 620 , 'enter_cave.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'room666' :
2019-01-18 19:56:07 +00:00
move ( 666 , 'jail.php' );
2018-03-09 14:53:10 +00:00
break ;
}
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2601 ) {
2018-03-09 14:53:10 +00:00
switch ( $location [ 1 ]) {
case 'level4' :
header ( 'location: city.php?bps' );
break ;
case 'level55' :
header ( 'location: city.php?abog' );
break ;
case 'level1' :
2019-01-18 19:56:07 +00:00
move ( 37 , 'gotzamok.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level1051' :
2019-01-18 19:56:07 +00:00
move ( 1051 , 'lab_enter.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level5' :
2019-01-18 19:56:07 +00:00
move ( 404 , 'vxod.php' );
2018-03-09 14:53:10 +00:00
break ;
}
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2701 ) {
2018-03-09 14:53:10 +00:00
switch ( $location [ 1 ]) {
case 'level1' :
header ( 'location: city.php?zaliv' );
break ;
case 'level2' :
2019-01-18 19:56:07 +00:00
move ( 402 , 'lab_chaos_enter.php' );
2018-03-09 14:53:10 +00:00
break ;
}
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2702 ) {
2018-03-09 14:53:10 +00:00
switch ( $location [ 1 ]) {
case 'level10' :
header ( 'location: city.php?cp' );
break ;
case 'level6' :
2019-01-18 19:56:07 +00:00
move ( 61 , 'akadem.php' );
2018-03-09 14:53:10 +00:00
break ;
}
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2655 ) {
2018-03-09 14:53:10 +00:00
switch ( $location [ 1 ]) {
case 'level10' :
header ( 'location: city.php?zamk' );
break ;
case 'level2055' :
2019-01-18 19:56:07 +00:00
move ( 603 , 'aren_of_angels.php' );
2018-03-09 14:53:10 +00:00
break ;
}
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 26 ) {
2018-03-09 14:53:10 +00:00
switch ( $location [ 1 ]) {
case 'level4' :
header ( 'location: city.php?cp' );
break ;
case 'level3' :
header ( 'location: city.php?zamk' );
break ;
case 'level660' :
2019-01-18 19:56:07 +00:00
move ( 660 , 'hostel.php' );
2018-03-09 14:53:10 +00:00
break ;
case 'level7' :
2019-01-18 19:56:07 +00:00
move ( 777 , 'obshaga.php' );
2018-03-09 14:53:10 +00:00
break ;
2019-01-18 19:56:07 +00:00
case 'level56' :
move ( 401 , 'hell.php' );
break ;
2018-03-09 14:53:10 +00:00
}
}
2018-03-09 02:13:08 +00:00
}
2019-01-18 19:56:07 +00:00
function getSeason ()
{
$todayMonth = date ( 'n' );
2020-09-29 22:39:06 +00:00
if ( $todayMonth >= 3 && $todayMonth <= 5 ) {
return 'spring_' ;
}
if ( $todayMonth >= 6 && $todayMonth <= 8 ) {
return 'summer_' ;
}
if ( $todayMonth >= 9 && $todayMonth <= 11 ) {
return 'autumn_' ;
}
2019-01-18 19:56:07 +00:00
return 'winter_' ;
}
function buildset ( $id , $img , $top , $left , $des , $noSeason = 0 )
{
2020-09-29 22:39:06 +00:00
if ( ! $noSeason ) {
$img = getSeason () . $img ;
}
2019-01-18 19:56:07 +00:00
?>
< div style = " position:absolute; left:<?= $left ?>px; top:<?= $top ?>px; z-index:90; cursor: pointer; " >
< img src = " i/city/sub/<?= $img ?>.png " alt = " <?= $des ?> " title = " <?= $des ?> " class = " building "
id = " <?= $id ?> " onclick = " solo(<?= $id ?>) " />
</ div >
< ? php
}
function bgset ( $img )
{
$daytime = date ( 'H' );
2020-09-29 22:39:06 +00:00
if ( $daytime >= 6 && $daytime <= 21 ) {
$background = getSeason () . $img . '_day' ;
}
else {
$background = getSeason () . $img . '_night' ;
}
2019-09-16 14:01:59 +00:00
echo sprintf ( '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="i/city/%s.jpg">' , $background );
2019-01-18 19:56:07 +00:00
}
2018-03-09 02:13:08 +00:00
$online = db :: c () -> query ( 'SELECT 1 FROM `online` WHERE `real_time` >= ?i' , ( time () - 60 ));
2018-01-28 16:40:49 +00:00
?>
2018-03-09 14:53:10 +00:00
<! doctype html >
2019-09-16 14:01:59 +00:00
< html lang = " ru " >
2018-02-12 19:53:19 +00:00
< HEAD >
2018-03-09 02:13:08 +00:00
< link rel = stylesheet href = " css/main.css " >
< meta charset = " utf-8 " >
2018-03-09 16:39:17 +00:00
< style >
2019-01-18 19:56:07 +00:00
img . building : hover {
filter : drop - shadow ( 2 px 2 px 2 px white ) sepia ( 15 % );
}
2018-03-09 16:39:17 +00:00
</ style >
2018-02-12 19:53:19 +00:00
< script type = " text/javascript " >
function solo ( n ) {
top . changeroom = n ;
2018-03-09 14:53:10 +00:00
window . location . href = 'city.php?got/level' + n ;
2018-02-12 19:53:19 +00:00
}
function Down () {
top . CtrlPress = window . event . ctrlKey
}
2018-03-09 14:53:10 +00:00
2018-02-12 19:53:19 +00:00
document . onmousedown = Down ;
</ script >
2019-09-16 14:01:59 +00:00
< title ></ title >
2018-02-12 19:53:19 +00:00
</ HEAD >
2018-03-09 02:13:08 +00:00
< body >
2019-09-24 09:53:08 +00:00
< table class = " allzeroes " >
2018-02-12 19:53:19 +00:00
< TR >
< TD align = center ></ TD >
2018-03-09 14:53:10 +00:00
< TD align = right > Сейчас в игре : < ? = $online -> getNumRows () ?> игроков.</TD>
2018-02-12 19:53:19 +00:00
</ TR >
< TR >
2018-03-09 02:13:08 +00:00
< TD align = center colspan = 2 >
< ? php
2020-09-30 12:01:33 +00:00
if ( $user -> room == 20 ) {
2018-03-09 02:13:08 +00:00
bgset ( 'cap_cp' );
2018-03-09 15:37:02 +00:00
buildset ( 1 , " cap_club " , 30 , 235 , " Бойцовский Клуб " );
buildset ( 2 , " cap_shop " , 202 , 171 , " Магазин " );
buildset ( 3 , " cap_kom " , 205 , 105 , " Комиссионный магазин " );
2020-09-29 22:39:06 +00:00
buildset ( 4 , " cap_rem " , 202 , 290 , " Ремонтная мастерская " );
2018-03-09 02:13:08 +00:00
buildset ( 13 , " cap_statue " , 222 , 365 , " Памятник Мэру Города " );
2018-03-09 15:37:02 +00:00
buildset ( 6 , " cap_po4ta " , 180 , 540 , " Почта " );
2018-03-09 14:53:10 +00:00
buildset ( 7 , " cap_arr_right " , 260 , 710 , " Страшилкина Улица " , 1 );
buildset ( 222 , " cap_arr_top " , 180 , 650 , " Торговая улица " , 1 );
2019-01-18 19:56:07 +00:00
buildset ( 8 , " cap_arr_left " , 258 , 21 , " Большая парковая улица " , 1 );
2018-03-09 15:37:02 +00:00
buildset ( 17 , " cap_berezka " , 205 , 435 , " Березка " );
2019-02-12 14:00:13 +00:00
buildset ( 9 , " cap_tree2 " , 260 , 530 , " Новогодняя елка " );
buildset ( 14 , " cap_sneg_3 " , 210 , 390 , " Снеговик " );
2018-03-09 02:13:08 +00:00
echo " </div> " ;
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 21 ) {
2018-03-09 02:13:08 +00:00
bgset ( 'cap_strash' );
2020-09-29 22:39:06 +00:00
buildset ( 5 , " cap_bank " , 180 , 485 , " Банк " );
2018-03-09 02:13:08 +00:00
buildset ( 14 , " cap_registratura " , 170 , 113 , " Регистратура кланов " );
buildset ( 16 , " cap_tower " , 5 , 315 , " Башня смерти " );
buildset ( 16555 , " cap_tree " , 165 , 20 , " Дерево " );
2018-03-09 14:53:10 +00:00
buildset ( 3 , " cap_arr_right " , 255 , 708 , " Ристалище " , 1 );
2019-09-24 09:53:08 +00:00
buildset ( 13 , " cap_flowershop " , 220 , 613 , " Цветочный магазин " );
2018-03-09 14:53:10 +00:00
buildset ( 4 , " cap_arr_left " , 258 , 21 , " Центральная площадь " , 1 );
2018-03-09 02:13:08 +00:00
echo " </div> " ;
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 26 ) {
2018-03-09 02:13:08 +00:00
bgset ( 'cap_park' );
2019-01-18 19:56:07 +00:00
buildset ( 6 , " cap_gate " , 170 , 340 , " Городские ворота " , 1 );
2018-03-09 02:13:08 +00:00
buildset ( 660 , " cap_vokzal " , 163 , 43 , " Общежитие " );
2018-03-09 14:53:10 +00:00
buildset ( 3 , " cap_arr_left " , 259 , 27 , " Замковая площадь " , 1 );
buildset ( 4 , " cap_arr_right " , 259 , 715 , " Центральная площадь " , 1 );
2018-03-09 02:13:08 +00:00
echo " </div> " ;
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2601 ) {
2018-03-09 02:13:08 +00:00
bgset ( 'cap_zamk' );
buildset ( 1052 , " cap_lavka " , 240 , 425 , " Храмовая лавка " );
2019-09-24 09:53:08 +00:00
buildset ( 10 , " ava_post " , 240 , 300 , " Сувенирный магазинчик " , 1 );
2018-03-09 02:13:08 +00:00
buildset ( 1 , " cap_ruins " , 166 , 48 , " Руины Старого замка " );
buildset ( 1051 , " cap_lab " , 130 , 327 , " Вход в Лабиринт Х а о с а " );
2018-03-09 14:53:10 +00:00
buildset ( 55 , " cap_arr_left " , 258 , 21 , " Арена Богов " , 1 );
2018-03-09 17:16:48 +00:00
buildset ( 4 , " cap_arr_right " , 260 , 710 , " Большая парковая улица " , 1 );
2018-03-09 02:13:08 +00:00
echo " </div> " ;
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2655 ) {
2018-03-09 02:13:08 +00:00
bgset ( 'ar_e_n' );
2018-03-09 15:37:02 +00:00
buildset ( 2055 , " cap_altr_g " , 230 , 340 , " Арена Ангелов " );
2018-03-09 14:53:10 +00:00
buildset ( 10 , " arr_right_png " , 260 , 710 , " Замковая площадь " , 1 );
2018-03-09 02:13:08 +00:00
echo " </div> " ;
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2111 ) {
2018-03-09 02:13:08 +00:00
bgset ( 'rist_bg' );
2018-03-09 14:53:10 +00:00
buildset ( 1 , " cap_arr_uleft " , 240 , 30 , " Страшилкина Улица " , 1 );
buildset ( 2 , " cap_arr_right " , 245 , 708 , " Секретный Лабиринт " , 1 );
2018-03-09 02:13:08 +00:00
buildset ( 14 , " cap_rist_solo " , 210 , 160 , " Вход в Одиночные сражения " );
buildset ( 14 , " cap_rist_group " , 243 , 340 , " Вход в Сражение отрядов " );
2018-02-12 19:53:19 +00:00
buildset ( 1000 , " av_zamk_rud " , 80 , 310 , " Рудник " );
2018-03-09 02:13:08 +00:00
buildset ( 203 , " cap_rist_monstr " , 145 , 570 , " Вход в Груповые сражения " );
2018-03-09 14:53:10 +00:00
buildset ( 21 , " angelscastle " , 131 , 628 , " Замок Мэра Города " );
2018-03-09 12:57:41 +00:00
echo " </div> " ;
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2701 ) {
2018-03-09 12:57:41 +00:00
bgset ( 'arena_bg1' );
2018-03-09 15:37:02 +00:00
buildset ( 1 , " cap_3strelka " , 260 , 30 , " Берег Залива " );
buildset ( 2 , " cap_shar_dark " , 234 , 356 , " Лабиринт Х а о с а " );
2018-03-09 12:57:41 +00:00
echo " </div> " ;
2020-09-30 12:01:33 +00:00
} elseif ( $user -> room == 2702 ) {
2018-03-09 12:57:41 +00:00
bgset ( 'cap_torg' );
buildset ( 6 , " cap_arenda " , 175 , 70 , " Академия " );
2018-03-09 15:37:02 +00:00
buildset ( 16 , " cap_t_build42 " , 120 , 300 , " Аукцион " );
2018-03-09 12:57:41 +00:00
buildset ( 16555 , " cap_prokat " , 155 , 480 , " Прокатная лавка " );
buildset ( 21 , " cap_lombard " , 150 , 565 , " Ломбард " );
2018-03-09 14:53:10 +00:00
buildset ( 10 , " cap_arr_uleft " , 259 , 25 , " Центральная площадь " , 1 );
2018-03-09 12:57:41 +00:00
echo " </div> " ;
2018-02-12 19:53:19 +00:00
}
?>
</ td >
</ tr >
2018-01-28 16:40:49 +00:00
</ table >
</ body >
</ html >