From f4fb3b11a841436a62ceffda9c9a2ee569c4a38d Mon Sep 17 00:00:00 2001 From: lopar Date: Tue, 27 Oct 2020 01:07:27 +0200 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D0=BB=D0=B8=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B2=20=D0=BE=D0=BA=D0=BD=D0=B5=20=D0=BF=D0=B5=D1=80=D1=81?= =?UTF-8?q?=D0=BE=D0=BD=D0=B0=D0=B6=D0=B0.=20=D0=A1=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B3=D0=B0=D1=8F=20=D1=82=D0=B8=D0=BF=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B2=D1=81=D1=91=20=D0=BB=D0=BE=D0=BC=D0=B0?= =?UTF-8?q?=D0=B5=D1=82.=20=D0=9E=5F=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.php | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/main.php b/main.php index 46dcaae..8dc7a43 100644 --- a/main.php +++ b/main.php @@ -2,7 +2,7 @@ ob_start("ob_gzhandler"); session_start(); $get = filter_input(INPUT_SERVER, 'QUERY_STRING'); -if ($get === 'exit') { +if ($get == 'exit') { session_destroy(); header("Location: fight.php"); } @@ -50,10 +50,22 @@ while ($row = $data->fetch_assoc()) { } //Обработчики нажатий на кнопки. -if (isset($_POST['battlefield'])) { +if ($_POST['battlefield'] ?? 0) { header('Location: zayavka.php'); 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 != 20) { + header('Location: main.php?goto=plo'); + exit(); +} /* === проверяем соответствие комнаты и скрипта === */ if (in_array($user->room, [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) { @@ -202,7 +214,7 @@ function del_efs($id, $type) // одеть предмет function dressitem($id) { - //FIXME Предметы не должны одеваться, если не соответствуют требованиям! + //FIXME bug #7 define('HELMET', 1); define('ARMOR', 2); define('LEGS', 3); @@ -234,7 +246,7 @@ function dressitem($id) if (!$itemInSlotQuantity) { // просто одеваем предмет 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 = item_type WHERE item_id = ?i', $id); @@ -252,7 +264,7 @@ function dressitem($id) sort($emptyRingSlots); // Одеваем предмет в первый свободный слот. 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 = 11 WHERE item_id = ?i', $id); // снимаем предмет из слота 11 и одеваем вместо @@ -292,14 +304,14 @@ if ($goto) { err('У вас тяжелая травма, вы не можете передвигатся...'); $imove = false; } - if ($goto == 'plo' && !$user->zayavka && $imove === true) { - 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']); + if ($goto == 'plo' && !$user->zayavka && $imove == true && $user->room != 20) { + 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'); exit("Топ-топ-топ..."); } else { err('Подали заявку на бой и убегаете из клуба? Нехорошо...'); } - if ($goto == 'arena' && $user->room === 20 && $imove === true) { + if ($goto == 'arena' && $user->room == 20 && $imove == true) { 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'); exit("Топ-топ-топ..."); @@ -544,17 +556,11 @@ Template::header('Игра');
- - room === 20): ?> - + + room == 20): ?> + - +