Заработали кнопки в окне персонажа. Строгая типизация всё ломает. О_о

This commit is contained in:
lopar 2020-10-27 01:07:27 +02:00
parent 4b569ab765
commit f4fb3b11a8
1 changed files with 24 additions and 18 deletions

View File

@ -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("<i>Топ-топ-топ...</i>");
} 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("<i>Топ-топ-топ...</i>");
@ -544,17 +556,11 @@ Template::header('Игра');
<?php endif; ?>
<div class="button-group">
<input class="button primary" type="submit" name="battlefield" value="Поединки">
<button class="button" onclick="window.location.href='module_quest.php';">Активные задания
</button>
<?php if ($user->room === 20): ?>
<button class="button icon move"
onclick="parent.frames[´main´].location.href='main.php?goto=arena';">Войти
внутрь
</button>
<input class="button" type="submit" name="module_quest" value="Активные задания">
<?php if ($user->room == 20): ?>
<input class="button icon move" type="submit" name="move_inside" value="Войти внутрь">
<?php else: ?>
<button class="button icon move" onclick="window.location.href='main.php?goto=plo';">Выйти
на улицу
</button>
<input class="button icon move" type="submit" name="move_outside" value="Выйти на улицу">
<?php endif; ?>
<button class="button icon loop" onclick="window.location.href='main.php';">Обновить страницу
</button>