battles/city.php
2020-10-26 20:16:28 +02:00

229 lines
6.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Центральная площадь
*/
session_start();
if (empty($_SESSION['uid'])) {
header("Location: index.php");
exit;
}
require_once "functions.php";
$user = $user ?? [];
if ($user->battle) {
header('location: fbattle.php');
exit;
}
if ($user->in_tower == 1) {
header('Location: towerin.php');
exit;
}
if ($user->zayavka) {
exit;
}
$online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60));
$location = explode('/', filter_input(INPUT_SERVER, 'QUERY_STRING'));
switch ($location[0]) {
default:
break;
case 'cp':
Travel::toRoom(20);
break;
case 'strah':
Travel::toRoom(21);
break;
case 'bps':
Travel::toRoom(26);
break;
case 'ps':
Travel::toRoom(51);
break;
case 'zaliv':
Travel::toRoom(2111);
break;
case 'zamk':
Travel::toRoom(2601);
break;
case 'abog':
Travel::toRoom(2655);
break;
case 'torg':
Travel::toRoom(2702);
break;
case 'got':
if ($user->room == 20) {
switch ($location[1]) {
default:
break;
case 'level1':
header('location: main.php?goto=arena');
exit;
break;
case 'level7':
Travel::toRoom(21);
break;
case 'level8':
Travel::toRoom(26);
break;
case 'level13':
header('location: quest_room.php');
break;
case 'level222':
Travel::toRoom(2702);
break;
case 'level17':
Travel::toRoom(50, 'ashop.php');
break;
case 'level2':
Travel::toRoom(22, 'shop.php');
break;
case 'level4':
Travel::toRoom(23, 'repair.php');
break;
case 'level6':
Travel::toRoom(27, 'post.php');
break;
case 'level3':
Travel::toRoom(25, 'comission.php');
break;
}
} elseif ($user->room == 21) {
switch ($location[1]) {
default:
break;
case 'level4':
Travel::toRoom(20);
break;
case 'level3':
Travel::toRoom(2111);
break;
case 'level13':
Travel::toRoom(34, 'fshop.php');
break;
case 'level5':
Travel::toRoom(29, 'bank.php');
break;
case 'level16':
Travel::toRoom(31, 'tower.php');
break;
case 'level14':
Travel::toRoom(30, 'clan_create.php');
break;
case 'level650':
Travel::toRoom(650, 'ul_clans.php');
break;
}
} elseif ($user->room == 2111) {
switch ($location[1]) {
default:
break;
case 'level1':
Travel::toRoom(21);
break;
case 'level2':
header('location: city.php?haos');
break;
case 'level203':
Travel::toRoom(1055, 'group_arena.php');
break;
case 'level1000':
Travel::toRoom(620, 'enter_cave.php');
break;
case 'room666':
Travel::toRoom(666, 'jail.php');
break;
}
} elseif ($user->room == 2601) {
switch ($location[1]) {
default:
break;
case 'level4':
Travel::toRoom(26);
break;
case 'level55':
Travel::toRoom(2655);
break;
case 'level1':
Travel::toRoom(37, 'gotzamok.php');
break;
case 'level1051':
Travel::toRoom(1051, 'lab_enter.php');
break;
case 'level5':
Travel::toRoom(404, 'vxod.php');
break;
}
} elseif ($user->room == 2701) {
switch ($location[1]) {
default:
break;
case 'level1':
Travel::toRoom(2111);
break;
case 'level2':
Travel::toRoom(402, 'lab_chaos_enter.php');
break;
}
} elseif ($user->room == 2702) {
switch ($location[1]) {
default:
break;
case 'level10':
Travel::toRoom(20);
break;
case 'level6':
Travel::toRoom(61, 'akadem.php');
break;
}
} elseif ($user->room == 2655) {
switch ($location[1]) {
default:
break;
case 'level10':
Travel::toRoom(2601);
break;
case 'level2055':
Travel::toRoom(603, 'aren_of_angels.php');
break;
}
} elseif ($user->room == 26) {
switch ($location[1]) {
default:
break;
case 'level4':
Travel::toRoom(20);
break;
case 'level3':
Travel::toRoom(2601);
break;
case 'level660':
Travel::toRoom(660, 'hostel.php');
break;
case 'level7':
Travel::toRoom(777, 'obshaga.php');
break;
case 'level56':
Travel::toRoom(401, 'hell.php');
break;
}
}
}
Template::header('city');
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 Торговая
*/
City::showStreet($user->room);
}