new-travel #11
70
city.php
70
city.php
@ -63,31 +63,31 @@ switch ($location[0]) {
|
|||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
case 'level7':
|
case 'level7':
|
||||||
Travel::toRoom(21);
|
Travel::toRoom(21,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level8':
|
case 'level8':
|
||||||
Travel::toRoom(26);
|
Travel::toRoom(26,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level13':
|
case 'level13':
|
||||||
header('location: quest_room.php');
|
header('location: quest_room.php');
|
||||||
break;
|
break;
|
||||||
case 'level222':
|
case 'level222':
|
||||||
Travel::toRoom(2702);
|
Travel::toRoom(2702,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level17':
|
case 'level17':
|
||||||
Travel::toRoom(50, 'ashop.php');
|
Travel::toRoom(50,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level2':
|
case 'level2':
|
||||||
Travel::toRoom(22, 'shop.php');
|
Travel::toRoom(22,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level4':
|
case 'level4':
|
||||||
Travel::toRoom(23, 'repair.php');
|
Travel::toRoom(23,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level6':
|
case 'level6':
|
||||||
Travel::toRoom(27, 'post.php');
|
Travel::toRoom(27,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level3':
|
case 'level3':
|
||||||
Travel::toRoom(25, 'comission.php');
|
Travel::toRoom(25,$user->room);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} elseif ($user->room == 21) {
|
} elseif ($user->room == 21) {
|
||||||
@ -95,25 +95,25 @@ switch ($location[0]) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case 'level4':
|
case 'level4':
|
||||||
Travel::toRoom(20);
|
Travel::toRoom(20,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level3':
|
case 'level3':
|
||||||
Travel::toRoom(2111);
|
Travel::toRoom(2111,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level13':
|
case 'level13':
|
||||||
Travel::toRoom(34, 'fshop.php');
|
Travel::toRoom(34,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level5':
|
case 'level5':
|
||||||
Travel::toRoom(29, 'bank.php');
|
Travel::toRoom(29,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level16':
|
case 'level16':
|
||||||
Travel::toRoom(31, 'tower.php');
|
Travel::toRoom(31,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level14':
|
case 'level14':
|
||||||
Travel::toRoom(30, 'clan_create.php');
|
Travel::toRoom(30,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level650':
|
case 'level650':
|
||||||
Travel::toRoom(650, 'ul_clans.php');
|
Travel::toRoom(650,$user->room);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} elseif ($user->room == 2111) {
|
} elseif ($user->room == 2111) {
|
||||||
@ -121,19 +121,19 @@ switch ($location[0]) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case 'level1':
|
case 'level1':
|
||||||
Travel::toRoom(21);
|
Travel::toRoom(21,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level2':
|
case 'level2':
|
||||||
header('location: city.php?haos');
|
header('location: city.php?haos');
|
||||||
break;
|
break;
|
||||||
case 'level203':
|
case 'level203':
|
||||||
Travel::toRoom(1055, 'group_arena.php');
|
Travel::toRoom(1055,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level1000':
|
case 'level1000':
|
||||||
Travel::toRoom(620, 'enter_cave.php');
|
Travel::toRoom(620,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'room666':
|
case 'room666':
|
||||||
Travel::toRoom(666, 'jail.php');
|
Travel::toRoom(666,$user->room);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} elseif ($user->room == 2601) {
|
} elseif ($user->room == 2601) {
|
||||||
@ -141,19 +141,19 @@ switch ($location[0]) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case 'level4':
|
case 'level4':
|
||||||
Travel::toRoom(26);
|
Travel::toRoom(26,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level55':
|
case 'level55':
|
||||||
Travel::toRoom(2655);
|
Travel::toRoom(2655,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level1':
|
case 'level1':
|
||||||
Travel::toRoom(37, 'gotzamok.php');
|
Travel::toRoom(37,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level1051':
|
case 'level1051':
|
||||||
Travel::toRoom(1051, 'lab_enter.php');
|
Travel::toRoom(1051,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level5':
|
case 'level5':
|
||||||
Travel::toRoom(404, 'vxod.php');
|
Travel::toRoom(404,$user->room);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} elseif ($user->room == 2701) {
|
} elseif ($user->room == 2701) {
|
||||||
@ -161,10 +161,10 @@ switch ($location[0]) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case 'level1':
|
case 'level1':
|
||||||
Travel::toRoom(2111);
|
Travel::toRoom(2111,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level2':
|
case 'level2':
|
||||||
Travel::toRoom(402, 'lab_chaos_enter.php');
|
Travel::toRoom(402,$user->room);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} elseif ($user->room == 2702) {
|
} elseif ($user->room == 2702) {
|
||||||
@ -172,10 +172,10 @@ switch ($location[0]) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case 'level10':
|
case 'level10':
|
||||||
Travel::toRoom(20);
|
Travel::toRoom(20,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level6':
|
case 'level6':
|
||||||
Travel::toRoom(61, 'akadem.php');
|
Travel::toRoom(61,$user->room);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} elseif ($user->room == 2655) {
|
} elseif ($user->room == 2655) {
|
||||||
@ -183,10 +183,10 @@ switch ($location[0]) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case 'level10':
|
case 'level10':
|
||||||
Travel::toRoom(2601);
|
Travel::toRoom(2601,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level2055':
|
case 'level2055':
|
||||||
Travel::toRoom(603, 'aren_of_angels.php');
|
Travel::toRoom(603,$user->room);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} elseif ($user->room == 26) {
|
} elseif ($user->room == 26) {
|
||||||
@ -194,19 +194,19 @@ switch ($location[0]) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case 'level4':
|
case 'level4':
|
||||||
Travel::toRoom(20);
|
Travel::toRoom(20,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level3':
|
case 'level3':
|
||||||
Travel::toRoom(2601);
|
Travel::toRoom(2601,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level660':
|
case 'level660':
|
||||||
Travel::toRoom(660, 'hostel.php');
|
Travel::toRoom(660,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level7':
|
case 'level7':
|
||||||
Travel::toRoom(777, 'obshaga.php');
|
Travel::toRoom(777,$user->room);
|
||||||
break;
|
break;
|
||||||
case 'level56':
|
case 'level56':
|
||||||
Travel::toRoom(401, 'hell.php');
|
Travel::toRoom(401,$user->room);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,51 @@
|
|||||||
|
|
||||||
class Travel
|
class Travel
|
||||||
{
|
{
|
||||||
public static function toRoom(int $roomId, string $redirectToFile = 'city.php'): void
|
/**
|
||||||
|
* Соответствие ID комнаты игровому файлу.
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
private static $roomFileName = [
|
||||||
|
20 => 'city.php',
|
||||||
|
21 => 'city.php',
|
||||||
|
22 => 'shop.php',
|
||||||
|
23 => 'repair.php',
|
||||||
|
25 => 'comission.php',
|
||||||
|
26 => 'city.php',
|
||||||
|
27 => 'post.php',
|
||||||
|
29 => 'bank.php',
|
||||||
|
30 => 'clan_create.php',
|
||||||
|
31 => 'tower.php',
|
||||||
|
34 => 'fshop.php',
|
||||||
|
37 => 'gotzamok.php',
|
||||||
|
50 => 'ashop.php',
|
||||||
|
51 => 'city.php',
|
||||||
|
61 => 'akadem.php',
|
||||||
|
401 => 'hell.php',
|
||||||
|
402 => 'lab_chaos_enter.php',
|
||||||
|
404 => 'vxod.php',
|
||||||
|
603 => 'aren_of_angels.php',
|
||||||
|
620 => 'enter_cave.php',
|
||||||
|
650 => 'ul_clans.php',
|
||||||
|
660 => 'hostel.php',
|
||||||
|
666 => 'jail.php',
|
||||||
|
777 => 'obshaga.php',
|
||||||
|
1051 => 'lab_enter.php',
|
||||||
|
1055 => 'group_arena.php',
|
||||||
|
2111 => 'city.php',
|
||||||
|
2601 => 'city.php',
|
||||||
|
2655 => 'city.php',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Перемещение по комнатам.
|
||||||
|
* @param int $roomId ID куда идём.
|
||||||
|
* @param int $roomIdCurrent ID откуда идём.
|
||||||
|
* @throws \Krugozor\Database\Mysql\Exception
|
||||||
|
*/
|
||||||
|
public static function toRoom(int $roomId, int $roomIdCurrent = 0): void
|
||||||
{
|
{
|
||||||
$itemsWeight = db::c()->query('SELECT SUM(weight) AS all_weight FROM `inventory` WHERE owner_id = ?i AND `setsale` = 0', $_SESSION['uid'])->fetch_assoc();
|
$itemsWeight = db::c()->query('SELECT SUM(weight) AS all_weight FROM `inventory` WHERE owner_id = ?i AND on_sale = 0', $_SESSION['uid'])->fetch_assoc();
|
||||||
$eff = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND (`type` = 10 OR `type` = 13 OR `type` = 14)', $_SESSION['uid'])->fetch_assoc();
|
$eff = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND (`type` = 10 OR `type` = 13 OR `type` = 14)', $_SESSION['uid'])->fetch_assoc();
|
||||||
$errors = [];
|
$errors = [];
|
||||||
if ($itemsWeight['all_weight'] > get_meshok()) {
|
if ($itemsWeight['all_weight'] > get_meshok()) {
|
||||||
@ -21,9 +63,10 @@ class Travel
|
|||||||
foreach ($errors as $error) {
|
foreach ($errors as $error) {
|
||||||
echo sprintf('<span class="error">%s</span>', $error);
|
echo sprintf('<span class="error">%s</span>', $error);
|
||||||
}
|
}
|
||||||
} elseif (in_array($roomId, self::allowedRoomMoves($roomId))) {
|
} elseif (in_array($roomId, self::allowedRoomMoves($roomIdCurrent))) {
|
||||||
db::c()->query('UPDATE users, online SET users.room = ?i, online.room = ?i WHERE `online`.`user_id` = `users`.`id` AND `online`.`id` = ?i', $roomId, $roomId, $_SESSION['uid']);
|
echo 111;
|
||||||
header('location: ' . $redirectToFile);
|
db::c()->query('UPDATE users, online SET users.room = ?i, online.room = ?i WHERE `online`.`user_id` = `users`.`id` AND `online`.`user_id` = ?i', $roomId, $roomId, $_SESSION['uid']);
|
||||||
|
header('location: ' . self::$roomFileName[$roomId]);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,7 +90,7 @@ class Travel
|
|||||||
* 17 Room 50 ashop.php
|
* 17 Room 50 ashop.php
|
||||||
* 222 Room 2702 [STREET]
|
* 222 Room 2702 [STREET]
|
||||||
*/
|
*/
|
||||||
$room[20] = [1, 2, 3, 4, 6, 7, 8, 9, 13, 14, 17, 222]; // level+n
|
$room[20] = [20, 401, 660, 777, 2601];
|
||||||
/*
|
/*
|
||||||
* 3 Room 2111 [STREET]
|
* 3 Room 2111 [STREET]
|
||||||
* 4 Room 20 [STREET]
|
* 4 Room 20 [STREET]
|
||||||
@ -57,11 +100,11 @@ class Travel
|
|||||||
* 16 Room 31 tower.php
|
* 16 Room 31 tower.php
|
||||||
* 650 Room 650 ul_clans.php
|
* 650 Room 650 ul_clans.php
|
||||||
*/
|
*/
|
||||||
$room[21] = [3, 4, 5, 13, 14, 16, 16555];
|
$room[21] = [20, 29, 30, 31, 34, 650, 2111];
|
||||||
|
|
||||||
$room[26] = [3, 4, 6, 660];
|
$room[26] = [3, 4, 6, 660];
|
||||||
$room[2601] = [1, 4, 10, 55, 1051, 1052];
|
$room[2601] = [26, 37, 404, 1051, 2655];
|
||||||
$room[2655] = [10, 2055];
|
$room[2655] = [603, 2601];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1 Room 21 [STREET]
|
* 1 Room 21 [STREET]
|
||||||
@ -72,10 +115,12 @@ class Travel
|
|||||||
* [!not on map]666 Room 666 jail.php
|
* [!not on map]666 Room 666 jail.php
|
||||||
* 1000
|
* 1000
|
||||||
*/
|
*/
|
||||||
$room[2111] = [1, 2, 14, 21, 203, 1000];
|
$room[2111] = [21, 620, 666, 1055];
|
||||||
$room[2701] = [1, 2];
|
$room[2701] = [402, 2111];
|
||||||
$room[2702] = [6, 10, 16, 21, 16555];
|
$room[2702] = [20, 61];
|
||||||
if (empty($room[$roomId])) {
|
// Улицы
|
||||||
|
$room[0] = [20, 21, 26, 51, 2111, 2601, 2655, 2702];
|
||||||
|
if ($room[$roomId] === null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return $room[$roomId];
|
return $room[$roomId];
|
||||||
|
@ -1083,8 +1083,8 @@ function telegraph($userId, $text)
|
|||||||
function get_meshok()
|
function get_meshok()
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
$d = db::c()->query('SELECT SUM(`gmeshok`) AS `ves` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0 AND `gmeshok` > 0', $_SESSION['uid'])->fetch_assoc();
|
$itemsWeight = db::c()->query('SELECT SUM(weight) AS all_weight FROM `inventory` WHERE owner_id = ?i AND on_sale = 0', $_SESSION['uid'])->fetch_assoc();
|
||||||
return ($user->strength * 4 + $d['ves']);
|
return ($user->strength * 4 + $itemsWeight['all_weight']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?= Template::header('top_menu', 1) ?>
|
<?php
|
||||||
|
require_once 'classes/Template.php';
|
||||||
|
Template::header('top_menu') ?>
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user