Compare commits

...

3 Commits

2 changed files with 163 additions and 153 deletions

View File

@ -90,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] = [21, 401, 660, 777, 2601]; $room[20] = [21, 22, 23, 25, 26, 27, 50, 2702];
/* /*
* 3 Room 2111 [STREET] * 3 Room 2111 [STREET]
* 4 Room 20 [STREET] * 4 Room 20 [STREET]
@ -102,7 +102,7 @@ class Travel
*/ */
$room[21] = [20, 29, 30, 31, 34, 650, 2111]; $room[21] = [20, 29, 30, 31, 34, 650, 2111];
$room[26] = [3, 4, 6, 660]; $room[26] = [20, 401, 660, 777, 2601];
$room[2601] = [26, 37, 404, 1051, 2655]; $room[2601] = [26, 37, 404, 1051, 2655];
$room[2655] = [603, 2601]; $room[2655] = [603, 2601];

182
main.php
View File

@ -2,7 +2,7 @@
ob_start("ob_gzhandler"); ob_start("ob_gzhandler");
session_start(); session_start();
$get = filter_input(INPUT_SERVER, 'QUERY_STRING'); $get = filter_input(INPUT_SERVER, 'QUERY_STRING');
if ($get === 'exit') { if ($get == 'exit') {
session_destroy(); session_destroy();
header("Location: fight.php"); header("Location: fight.php");
} }
@ -50,142 +50,159 @@ while ($row = $data->fetch_assoc()) {
} }
//Обработчики нажатий на кнопки. //Обработчики нажатий на кнопки.
if (isset($_POST['battlefield'])) { if ($_POST['battlefield'] ?? 0 && $user->room == 1) {
header('Location: zayavka.php'); header('Location: zayavka.php');
exit(); exit();
} }
if ($_POST['module_quest'] ?? 0) {
header('Location: module_quest.php');
exit();
}
if ($_POST['move_inside'] ?? 0 && $user->room == 20) {
header('Location: main.php?goto=arena');
exit();
}
if ($_POST['move_outside'] ?? 0 && $user->room == 1) {
header('Location: main.php?goto=plo');
exit();
}
if ($_POST['main_page'] ?? 0) {
header('Location: main.php');
exit();
}
/* === проверяем соответствие комнаты и скрипта === */ if ($edit === null) {
if (in_array($user->room, [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) { /* === проверяем соответствие комнаты и скрипта === */
if (in_array($user->room, [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111])) {
header('Location: city.php'); header('Location: city.php');
exit(); exit();
} }
if ($user->room == 22) { if ($user->room == 22) {
header('Location: shop.php'); header('Location: shop.php');
exit(); exit();
} }
if ($user->room == 23) { if ($user->room == 23) {
header('Location: repair.php'); header('Location: repair.php');
exit(); exit();
} }
if ($user->room == 25) { if ($user->room == 25) {
header('Location: comission.php'); header('Location: comission.php');
exit(); exit();
} }
if ($user->room == 27) { if ($user->room == 27) {
header('Location: post.php'); header('Location: post.php');
exit(); exit();
} }
if ($user->room == 29) { if ($user->room == 29) {
header('Location: bank.php'); header('Location: bank.php');
exit(); exit();
} }
if ($user->room == 31) { if ($user->room == 31) {
header('Location: tower.php'); header('Location: tower.php');
exit(); exit();
} }
if ($user->room == 30) { if ($user->room == 30) {
header('Location: clan_create.php'); header('Location: clan_create.php');
exit(); exit();
} }
if ($user->room == 34) { if ($user->room == 34) {
header('Location: fshop.php'); header('Location: fshop.php');
exit(); exit();
} }
if ($user->room == 45) { if ($user->room == 45) {
header('Location: clan_castle.php'); header('Location: clan_castle.php');
exit(); exit();
} }
if ($user->room == 50) { if ($user->room == 50) {
header('Location: ashop.php'); header('Location: ashop.php');
exit(); exit();
} }
if ($user->room == 53) { if ($user->room == 53) {
header('Location: library.php'); header('Location: library.php');
exit(); exit();
} }
if ($user->room == 61) { if ($user->room == 61) {
header('Location: akadem.php'); header('Location: akadem.php');
exit(); exit();
} }
if ($user->room == 650) { if ($user->room == 650) {
header('Location: ul_clans.php'); header('Location: ul_clans.php');
exit(); exit();
} }
//ЦХ //ЦХ
if ($user->room == 600) { if ($user->room == 600) {
header('Location: c_haos.php'); header('Location: c_haos.php');
exit(); exit();
} }
if ($user->room == 601) { if ($user->room == 601) {
header('Location: c_haos_in.php'); header('Location: c_haos_in.php');
exit(); exit();
} }
if ($user->room == 602) { if ($user->room == 602) {
header('Location: c_park.php'); header('Location: c_park.php');
exit(); exit();
} }
if ($user->room == 603) { if ($user->room == 603) {
header('Location: aren_of_angels.php'); header('Location: aren_of_angels.php');
exit(); exit();
} }
if ($user->room == 620) { if ($user->room == 620) {
header('Location: enter_cave.php'); header('Location: enter_cave.php');
exit(); exit();
} }
if ($user->room == 621) { if ($user->room == 621) {
header('Location: cave.php'); header('Location: cave.php');
exit(); exit();
} }
if ($user->room == 660) { if ($user->room == 660) {
header('Location: hostel.php'); header('Location: hostel.php');
exit(); exit();
} }
if ($user->room == 661) { if ($user->room == 661) {
header('Location: hostel_room.php'); header('Location: hostel_room.php');
exit(); exit();
} }
if ($user->room == 662) { if ($user->room == 662) {
header('Location: quest_room.php'); header('Location: quest_room.php');
exit(); exit();
} }
if ($user->room == 760) { if ($user->room == 760) {
header('Location: c_forest.php'); header('Location: c_forest.php');
exit(); exit();
} }
if ($user->room == 1000) { if ($user->room == 1000) {
header('Location: solib/enterbezdna.php'); header('Location: solib/enterbezdna.php');
exit(); exit();
} }
if ($user->room == 1001) { if ($user->room == 1001) {
header('Location: solib/dungeon.php'); header('Location: solib/dungeon.php');
exit(); exit();
} }
if ($user->room == 1051) { if ($user->room == 1051) {
header('Location: lab_enter.php'); header('Location: lab_enter.php');
exit(); exit();
} }
if ($user->room == 1052) { if ($user->room == 1052) {
header('Location: labirint.php'); header('Location: labirint.php');
exit(); exit();
} }
if ($user->room == 402) { if ($user->room == 402) {
header('Location: vxod.php'); header('Location: vxod.php');
exit(); exit();
} }
if ($user->room == 403) { if ($user->room == 403) {
header('Location: canalizaciya.php'); header('Location: canalizaciya.php');
exit(); exit();
} }
if ($user->room == 1055) { if ($user->room == 1055) {
header('Location: group_arena.php'); header('Location: group_arena.php');
exit(); exit();
} }
if ($user->room == 666) { if ($user->room == 666) {
header('Location: jail.php'); header('Location: jail.php');
exit(); exit();
}
} }
function del_efs($id, $type) function del_efs($id, $type)
{ {
if ($id && !in_array($type, [2, 3, 4, 5, 8, 10, 11, 12, 13, 14, 20])) { if ($id && !in_array($type, [2, 3, 4, 5, 8, 10, 11, 12, 13, 14, 20])) {
@ -202,7 +219,7 @@ function del_efs($id, $type)
// одеть предмет // одеть предмет
function dressitem($id) function dressitem($id)
{ {
//FIXME Предметы не должны одеваться, если не соответствуют требованиям! //FIXME bug #7
define('HELMET', 1); define('HELMET', 1);
define('ARMOR', 2); define('ARMOR', 2);
define('LEGS', 3); define('LEGS', 3);
@ -234,7 +251,7 @@ function dressitem($id)
if (!$itemInSlotQuantity) { if (!$itemInSlotQuantity) {
// просто одеваем предмет // просто одеваем предмет
db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id); db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id);
} elseif ($itemInSlotQuantity === 1) { } elseif ($itemInSlotQuantity == 1) {
// снимаем предмет и одеваем вместо // снимаем предмет и одеваем вместо
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i', $itemInSlot[0]); db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i', $itemInSlot[0]);
db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id); db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id);
@ -252,7 +269,7 @@ function dressitem($id)
sort($emptyRingSlots); sort($emptyRingSlots);
// Одеваем предмет в первый свободный слот. // Одеваем предмет в первый свободный слот.
db::c()->query('UPDATE inventory SET dressed_slot = ?i WHERE item_id = ?i', $emptyRingSlots[0], $id); db::c()->query('UPDATE inventory SET dressed_slot = ?i WHERE item_id = ?i', $emptyRingSlots[0], $id);
} elseif ($itemInSlotQuantity === 3) { } elseif ($itemInSlotQuantity == 3) {
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = 11'); db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = 11');
db::c()->query('UPDATE inventory SET dressed_slot = 11 WHERE item_id = ?i', $id); db::c()->query('UPDATE inventory SET dressed_slot = 11 WHERE item_id = ?i', $id);
// снимаем предмет из слота 11 и одеваем вместо // снимаем предмет из слота 11 и одеваем вместо
@ -292,14 +309,14 @@ if ($goto) {
err('У вас тяжелая травма, вы не можете передвигатся...'); err('У вас тяжелая травма, вы не можете передвигатся...');
$imove = false; $imove = false;
} }
if ($goto == 'plo' && !$user->zayavka && $imove === true) { if ($goto == 'plo' && !$user->zayavka && $imove && $user->room != 20) {
db::c()->query('UPDATE users, online SET users.room = 20, online.room = 20 WHERE online.user_id = users.id AND online.users_id = ?i', $_SESSION['uid']); db::c()->query('UPDATE users, online SET users.room = 20, online.room = 20 WHERE online.user_id = users.id AND online.user_id = ?i', $_SESSION['uid']);
header('Location: city.php'); header('Location: city.php');
exit("<i>Топ-топ-топ...</i>"); exit("<i>Топ-топ-топ...</i>");
} else { } else {
err('Подали заявку на бой и убегаете из клуба? Нехорошо...'); err('Подали заявку на бой и убегаете из клуба? Нехорошо...');
} }
if ($goto == 'arena' && $user->room === 20 && $imove === true) { if ($goto == 'arena' && $user->room == 20 && $imove) {
db::c()->query('UPDATE users, online SET users.room = 1, online.room = 1 WHERE online.user_id = users.id AND online.user_id = ?i', $_SESSION['uid']); db::c()->query('UPDATE users, online SET users.room = 1, online.room = 1 WHERE online.user_id = users.id AND online.user_id = ?i', $_SESSION['uid']);
header('Location: main.php'); header('Location: main.php');
exit("<i>Топ-топ-топ...</i>"); exit("<i>Топ-топ-топ...</i>");
@ -543,21 +560,14 @@ Template::header('Игра');
title="Образы"> title="Образы">
<?php endif; ?> <?php endif; ?>
<div class="button-group"> <div class="button-group">
<?php if ($user->room == 20): ?>
<input class="button icon move" type="submit" name="move_inside" value="Войти внутрь">
<?php elseif ($user->room == 1): ?>
<input class="button primary" type="submit" name="battlefield" value="Поединки"> <input class="button primary" type="submit" name="battlefield" value="Поединки">
<button class="button" onclick="window.location.href='module_quest.php';">Активные задания <input class="button icon move" type="submit" name="move_outside" value="Выйти на улицу">
</button>
<?php if ($user->room === 20): ?>
<button class="button icon move"
onclick="parent.frames[´main´].location.href='main.php?goto=arena';">Войти
внутрь
</button>
<?php else: ?>
<button class="button icon move" onclick="window.location.href='main.php?goto=plo';">Выйти
на улицу
</button>
<?php endif; ?> <?php endif; ?>
<button class="button icon loop" onclick="window.location.href='main.php';">Обновить страницу <input class="button" type="submit" name="module_quest" value="Активные задания">
</button> <input class="button" type="submit" name="main_page" value="На главную">
</div> </div>
</div> </div>
<div> <!--рюкзак--> <div> <!--рюкзак-->