3502904656
Singleton в некоторых местах вместо решения #42. Новые шаги для решения #16 и #52. Closes #42. Closes #32. Closes #31.
213 lines
7.9 KiB
PHP
213 lines
7.9 KiB
PHP
<?php
|
||
/**
|
||
* Центральная площадь
|
||
*/
|
||
|
||
use Battles\Database\Db;
|
||
use Battles\Template;
|
||
use Battles\User;
|
||
|
||
require_once "functions.php";
|
||
|
||
if (User::getInstance()->getZayavka()) {
|
||
exit;
|
||
}
|
||
|
||
$online = Db::getInstance()->fetchColumn('select count(*) from online where real_time >= ?', time()-60);
|
||
$location = explode('/', filter_input(INPUT_SERVER, 'QUERY_STRING'));
|
||
|
||
switch ($location[0]) {
|
||
default:
|
||
break;
|
||
case 'cp':
|
||
Battles\Travel::toRoom(20,User::getInstance()->getRoom());
|
||
break;
|
||
case 'strah':
|
||
Battles\Travel::toRoom(21,User::getInstance()->getRoom());
|
||
break;
|
||
case 'bps':
|
||
Battles\Travel::toRoom(26,User::getInstance()->getRoom());
|
||
break;
|
||
case 'ps':
|
||
Battles\Travel::toRoom(51,User::getInstance()->getRoom());
|
||
break;
|
||
case 'zaliv':
|
||
Battles\Travel::toRoom(2111,User::getInstance()->getRoom());
|
||
break;
|
||
case 'zamk':
|
||
Battles\Travel::toRoom(2601,User::getInstance()->getRoom());
|
||
break;
|
||
case 'abog':
|
||
Battles\Travel::toRoom(2655,User::getInstance()->getRoom());
|
||
break;
|
||
case 'torg':
|
||
Battles\Travel::toRoom(2702,User::getInstance()->getRoom());
|
||
break;
|
||
case 'got':
|
||
if (User::getInstance()->getRoom() == 20) {
|
||
switch ($location[1]) {
|
||
default:
|
||
break;
|
||
case 'level1':
|
||
Battles\Travel::toRoom(1,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level7':
|
||
Battles\Travel::toRoom(21,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level8':
|
||
Battles\Travel::toRoom(26,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level13':
|
||
header('location: quest_room.php');
|
||
break;
|
||
case 'level222':
|
||
Battles\Travel::toRoom(2702,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level17':
|
||
Battles\Travel::toRoom(50,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level2':
|
||
Battles\Travel::toRoom(22,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level4':
|
||
Battles\Travel::toRoom(23,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level6':
|
||
Battles\Travel::toRoom(27,User::getInstance()->getRoom());
|
||
break;
|
||
}
|
||
} elseif (User::getInstance()->getRoom() == 21) {
|
||
switch ($location[1]) {
|
||
default:
|
||
break;
|
||
case 'level4':
|
||
Battles\Travel::toRoom(20,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level3':
|
||
Battles\Travel::toRoom(2111,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level13':
|
||
Battles\Travel::toRoom(34,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level5':
|
||
Battles\Travel::toRoom(29,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level16':
|
||
Battles\Travel::toRoom(31,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level14':
|
||
Battles\Travel::toRoom(30,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level650':
|
||
Battles\Travel::toRoom(650,User::getInstance()->getRoom());
|
||
break;
|
||
}
|
||
} elseif (User::getInstance()->getRoom() == 2111) {
|
||
switch ($location[1]) {
|
||
default:
|
||
break;
|
||
case 'level1':
|
||
Battles\Travel::toRoom(21,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level203':
|
||
Battles\Travel::toRoom(1055,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level1000':
|
||
Battles\Travel::toRoom(620,User::getInstance()->getRoom());
|
||
break;
|
||
case 'room666':
|
||
//Нет на карте
|
||
//Battles\Travel::toRoom(666,User::getInstance()->getRoom());
|
||
break;
|
||
}
|
||
} elseif (User::getInstance()->getRoom() == 2601) {
|
||
switch ($location[1]) {
|
||
default:
|
||
break;
|
||
case 'level4':
|
||
Battles\Travel::toRoom(26,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level55':
|
||
Battles\Travel::toRoom(2655,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level1':
|
||
Battles\Travel::toRoom(37,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level1051':
|
||
Battles\Travel::toRoom(1051,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level5':
|
||
Battles\Travel::toRoom(404,User::getInstance()->getRoom());
|
||
break;
|
||
}
|
||
} elseif (User::getInstance()->getRoom() == 2701) {
|
||
switch ($location[1]) {
|
||
default:
|
||
break;
|
||
case 'level1':
|
||
Battles\Travel::toRoom(2111,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level2':
|
||
Battles\Travel::toRoom(402,User::getInstance()->getRoom());
|
||
break;
|
||
}
|
||
} elseif (User::getInstance()->getRoom() == 2702) {
|
||
switch ($location[1]) {
|
||
default:
|
||
break;
|
||
case 'level10':
|
||
Battles\Travel::toRoom(20,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level6':
|
||
Battles\Travel::toRoom(61,User::getInstance()->getRoom());
|
||
break;
|
||
}
|
||
} elseif (User::getInstance()->getRoom() == 2655) {
|
||
switch ($location[1]) {
|
||
default:
|
||
break;
|
||
case 'level10':
|
||
Battles\Travel::toRoom(2601,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level2055':
|
||
Battles\Travel::toRoom(603,User::getInstance()->getRoom());
|
||
break;
|
||
}
|
||
} elseif (User::getInstance()->getRoom() == 26) {
|
||
switch ($location[1]) {
|
||
default:
|
||
break;
|
||
case 'level4':
|
||
Battles\Travel::toRoom(20,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level3':
|
||
Battles\Travel::toRoom(2601,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level660':
|
||
Battles\Travel::toRoom(660,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level7':
|
||
Battles\Travel::toRoom(777,User::getInstance()->getRoom());
|
||
break;
|
||
case 'level56':
|
||
Battles\Travel::toRoom(401,User::getInstance()->getRoom());
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
Template::header('city');
|
||
echo sprintf('<div style="text-align: right;">Сейчас в игре: %s игроков.></div>', $online);
|
||
if (in_array(User::getInstance()->getRoom(), [20, 21, 26, 2601, 2655, 2111, 2701, 2702])) {
|
||
/* Улицы:
|
||
* 20 Центральная
|
||
* 21 Страшилкина
|
||
* 26 Парковая
|
||
* 2601 Замковая
|
||
* 2655 С ареной
|
||
* 2111 С ристалищем
|
||
* 2701 С ещё одним ристалищем?
|
||
* 2702 Торговая
|
||
*/
|
||
Battles\City::showStreet(User::getInstance()->getRoom());
|
||
} |