battles/city.php

213 lines
7.1 KiB
PHP
Raw Normal View History

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();
require_once "functions.php";
$user = $user ?? new \Battles\User($_SESSION['uid']);
2018-01-28 16:40:49 +00:00
if ($user->zayavka) {
exit;
}
2018-01-28 16:40:49 +00:00
2020-10-26 18:16:28 +00:00
$online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60));
$location = explode('/', filter_input(INPUT_SERVER, 'QUERY_STRING'));
2020-10-26 18:16:28 +00:00
switch ($location[0]) {
2020-10-26 18:16:28 +00:00
default:
break;
case 'cp':
Battles\Travel::toRoom(20,$user->room);
break;
case 'strah':
Battles\Travel::toRoom(21,$user->room);
break;
case 'bps':
Battles\Travel::toRoom(26,$user->room);
break;
case 'ps':
Battles\Travel::toRoom(51,$user->room);
break;
case 'zaliv':
Battles\Travel::toRoom(2111,$user->room);
break;
case 'zamk':
Battles\Travel::toRoom(2601,$user->room);
break;
case 'abog':
Battles\Travel::toRoom(2655,$user->room);
break;
case 'torg':
Battles\Travel::toRoom(2702,$user->room);
break;
case 'got':
if ($user->room == 20) {
switch ($location[1]) {
2020-10-26 18:16:28 +00:00
default:
break;
case 'level1':
Battles\Travel::toRoom(1,$user->room);
break;
case 'level7':
Battles\Travel::toRoom(21,$user->room);
break;
case 'level8':
Battles\Travel::toRoom(26,$user->room);
break;
case 'level13':
header('location: quest_room.php');
break;
case 'level222':
Battles\Travel::toRoom(2702,$user->room);
break;
case 'level17':
Battles\Travel::toRoom(50,$user->room);
break;
case 'level2':
Battles\Travel::toRoom(22,$user->room);
break;
case 'level4':
Battles\Travel::toRoom(23,$user->room);
break;
case 'level6':
Battles\Travel::toRoom(27,$user->room);
break;
case 'level3':
Battles\Travel::toRoom(25,$user->room);
break;
}
} elseif ($user->room == 21) {
switch ($location[1]) {
2020-10-26 18:16:28 +00:00
default:
break;
case 'level4':
Battles\Travel::toRoom(20,$user->room);
break;
case 'level3':
Battles\Travel::toRoom(2111,$user->room);
break;
case 'level13':
Battles\Travel::toRoom(34,$user->room);
break;
case 'level5':
Battles\Travel::toRoom(29,$user->room);
break;
case 'level16':
Battles\Travel::toRoom(31,$user->room);
break;
case 'level14':
Battles\Travel::toRoom(30,$user->room);
break;
case 'level650':
Battles\Travel::toRoom(650,$user->room);
break;
}
} elseif ($user->room == 2111) {
switch ($location[1]) {
2020-10-26 18:16:28 +00:00
default:
break;
case 'level1':
Battles\Travel::toRoom(21,$user->room);
break;
case 'level203':
Battles\Travel::toRoom(1055,$user->room);
break;
case 'level1000':
Battles\Travel::toRoom(620,$user->room);
break;
case 'room666':
//Нет на карте
//Battles\Travel::toRoom(666,$user->room);
break;
}
} elseif ($user->room == 2601) {
switch ($location[1]) {
2020-10-26 18:16:28 +00:00
default:
break;
case 'level4':
Battles\Travel::toRoom(26,$user->room);
break;
case 'level55':
Battles\Travel::toRoom(2655,$user->room);
break;
case 'level1':
Battles\Travel::toRoom(37,$user->room);
break;
case 'level1051':
Battles\Travel::toRoom(1051,$user->room);
break;
case 'level5':
Battles\Travel::toRoom(404,$user->room);
break;
}
} elseif ($user->room == 2701) {
switch ($location[1]) {
2020-10-26 18:16:28 +00:00
default:
break;
case 'level1':
Battles\Travel::toRoom(2111,$user->room);
break;
case 'level2':
Battles\Travel::toRoom(402,$user->room);
break;
}
} elseif ($user->room == 2702) {
switch ($location[1]) {
2020-10-26 18:16:28 +00:00
default:
break;
case 'level10':
Battles\Travel::toRoom(20,$user->room);
break;
case 'level6':
Battles\Travel::toRoom(61,$user->room);
break;
}
} elseif ($user->room == 2655) {
switch ($location[1]) {
2020-10-26 18:16:28 +00:00
default:
break;
case 'level10':
Battles\Travel::toRoom(2601,$user->room);
break;
case 'level2055':
Battles\Travel::toRoom(603,$user->room);
break;
}
} elseif ($user->room == 26) {
switch ($location[1]) {
2020-10-26 18:16:28 +00:00
default:
break;
case 'level4':
Battles\Travel::toRoom(20,$user->room);
break;
case 'level3':
Battles\Travel::toRoom(2601,$user->room);
break;
case 'level660':
Battles\Travel::toRoom(660,$user->room);
break;
case 'level7':
Battles\Travel::toRoom(777,$user->room);
break;
2019-01-18 19:56:07 +00:00
case 'level56':
Battles\Travel::toRoom(401,$user->room);
2019-01-18 19:56:07 +00:00
break;
}
}
2018-03-09 02:13:08 +00:00
}
\Battles\Template::header('city');
2020-10-26 18:16:28 +00:00
echo sprintf('<div style="text-align: right;">Сейчас в игре: %s игроков.></div>', $online->getNumRows());
if (in_array($user->room, [20, 21, 26, 2601, 2655, 2111, 2701, 2702])) {
/* Улицы:
* 20 Центральная
* 21 Страшилкина
* 26 Парковая
* 2601 Замковая
* 2655 С ареной
* 2111 С ристалищем
* 2701 С ещё одним ристалищем?
* 2702 Торговая
*/
Battles\City::showStreet($user->room);
2020-10-26 18:16:28 +00:00
}