Куча мелочей, в том числе по #42.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Battles\Database\DBPDO;
|
||||
use Battles\DressedItems;
|
||||
use Battles\GameLogs;
|
||||
use Battles\InventoryItem;
|
||||
@@ -6,8 +8,8 @@ use Battles\Template;
|
||||
use Battles\Travel;
|
||||
use Battles\UserInfo;
|
||||
use Battles\UserStats;
|
||||
use Battles\User;
|
||||
|
||||
ob_start("ob_gzhandler");
|
||||
session_start();
|
||||
$get = filter_input(INPUT_SERVER, 'QUERY_STRING');
|
||||
if ($get == 'exit') {
|
||||
@@ -16,7 +18,7 @@ if ($get == 'exit') {
|
||||
}
|
||||
require_once 'functions.php';
|
||||
|
||||
$user->setOnline();
|
||||
User::$current->setOnline();
|
||||
|
||||
// Инициализируем входящие GET\POST переменные.
|
||||
$goto = $_GET['goto'] ?? null;
|
||||
@@ -40,7 +42,7 @@ if ($edit) {
|
||||
$destruct = $_GET['destruct'] ?? null;
|
||||
|
||||
if ($ups) {
|
||||
$user->addOnePointToStat($ups);
|
||||
User::$current->addOnePointToStat($ups);
|
||||
}
|
||||
if ($drop) {
|
||||
$items = new DressedItems($_SESSION['uid']);
|
||||
@@ -49,16 +51,16 @@ if ($edit) {
|
||||
}
|
||||
//Пока что одеваем предмет отсюда.
|
||||
if ($dress) {
|
||||
$dressing = new InventoryItem($db->ofetch('select * from inventory where item_id = ? ', $dress));
|
||||
$dressing = new InventoryItem(DBPDO::$db->ofetch('select * from inventory where item_id = ? ', $dress));
|
||||
$dressing->dressItem();
|
||||
unset($dressing);
|
||||
}
|
||||
if ($destruct) {
|
||||
$q = $db->ofetch('select name,dressed_slot from inventory where owner_id = ? and item_id = ?', [$user->getId(), $destruct]);
|
||||
$q = DBPDO::$db->ofetch('select name,dressed_slot from inventory where owner_id = ? and item_id = ?', [User::$current->getId(), $destruct]);
|
||||
if ($q) {
|
||||
if (empty($q->dressed_slot)) {
|
||||
InventoryItem::destroyItem($destruct);
|
||||
GameLogs::addUserLog($user->getId(), $user->getLogin() . ' выбросил предмет ' . $q->name . ' id:(cap' . $destruct . ')');
|
||||
GameLogs::addUserLog(User::$current->getId(), User::$current->getLogin() . ' выбросил предмет ' . $q->name . ' id:(cap' . $destruct . ')');
|
||||
err('Предмет ' . $q->name . ' выброшен.');
|
||||
} else {
|
||||
err('Ошибка: нельзя выбросить одетый предмет!');
|
||||
@@ -77,16 +79,16 @@ if ($edit) {
|
||||
|
||||
|
||||
// Подготавливаем отображение инфы и предметов.
|
||||
$userInfo = new UserInfo($user->getId());
|
||||
$userStats = new UserStats($user->getId());
|
||||
$data = $db->ofetchAll('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot = 0 AND on_sale = 0', $user->getId());
|
||||
$userInfo = new UserInfo(User::$current->getId());
|
||||
$userStats = new UserStats(User::$current->getId());
|
||||
$data = DBPDO::$db->ofetchAll('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot = 0 AND on_sale = 0', User::$current->getId());
|
||||
$iteminfo = [];
|
||||
foreach ($data as $row) {
|
||||
$iteminfo = new InventoryItem($row);
|
||||
}
|
||||
|
||||
//Обработчики нажатий на кнопки.
|
||||
if ($_POST['battlefield'] ?? 0 && $user->getRoom() == 1) {
|
||||
if ($_POST['battlefield'] ?? 0 && User::$current->getRoom() == 1) {
|
||||
header('Location: zayavka.php');
|
||||
exit();
|
||||
}
|
||||
@@ -94,11 +96,11 @@ if ($_POST['module_quest'] ?? 0) {
|
||||
header('Location: module_quest.php');
|
||||
exit();
|
||||
}
|
||||
if ($_POST['move_inside'] ?? 0 && $user->getRoom() == 20) {
|
||||
if ($_POST['move_inside'] ?? 0 && User::$current->getRoom() == 20) {
|
||||
header('Location: main.php?goto=arena');
|
||||
exit();
|
||||
}
|
||||
if ($_POST['move_outside'] ?? 0 && $user->getRoom() == 1) {
|
||||
if ($_POST['move_outside'] ?? 0 && User::$current->getRoom() == 1) {
|
||||
header('Location: main.php?goto=plo');
|
||||
exit();
|
||||
}
|
||||
@@ -109,12 +111,12 @@ if ($_POST['main_page'] ?? 0) {
|
||||
|
||||
if ($edit === null) {
|
||||
/* === проверяем соответствие комнаты и скрипта === */
|
||||
if (in_array($user->getRoom(), [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111])) {
|
||||
if (in_array(User::$current->getRoom(), [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111])) {
|
||||
header('Location: city.php');
|
||||
exit();
|
||||
}
|
||||
if (in_array($user->getRoom(), [22, 23, 25, 27, 29, 30, 31, 34, 45, 53, 61, 402, 403, 600, 601, 602, 603, 620, 621, 650, 660, 661, 662, 666, 760, 1051, 1052, 1055])) {
|
||||
header('location: ' . Travel::$roomFileName[$user->getRoom()]);
|
||||
if (in_array(User::$current->getRoom(), [22, 23, 25, 27, 29, 30, 31, 34, 45, 53, 61, 402, 403, 600, 601, 602, 603, 620, 621, 650, 660, 661, 662, 666, 760, 1051, 1052, 1055])) {
|
||||
header('location: ' . Travel::$roomFileName[User::$current->getRoom()]);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -134,9 +136,9 @@ function del_efs($id, $type)
|
||||
// Входим и выходим если можем.
|
||||
if ($goto) {
|
||||
$imove = true;
|
||||
$d = db::c()->query('SELECT SUM(weight) AS sum_weight FROM inventory WHERE owner_id = ?i AND on_sale = 0', $user->getId())->fetch_assoc();
|
||||
$eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user->getId());
|
||||
//(масса: <?= $getItemsBonuses->getItemsWeight() . '/' . $user->strength * 4
|
||||
$d = db::c()->query('SELECT SUM(weight) AS sum_weight FROM inventory WHERE owner_id = ?i AND on_sale = 0', User::$current->getId())->fetch_assoc();
|
||||
$eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', User::$current->getId());
|
||||
//(масса: <?= $getItemsBonuses->getItemsWeight() . '/' . User::$current->strength * 4
|
||||
|
||||
if ($d['sum_weight'] > $userStats->getStrength() * 4 && $goto) {
|
||||
err('У вас переполнен рюкзак, вы не можете передвигаться...');
|
||||
@@ -146,15 +148,15 @@ if ($goto) {
|
||||
err('У вас тяжелая травма, вы не можете передвигатся...');
|
||||
$imove = false;
|
||||
}
|
||||
if ($goto == 'plo' && !$user->getZayavka() && $imove && $user->getRoom() != 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', $user->getId());
|
||||
if ($goto == 'plo' && !User::$current->getZayavka() && $imove && User::$current->getRoom() != 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', User::$current->getId());
|
||||
header('Location: city.php');
|
||||
exit("<i>Топ-топ-топ...</i>");
|
||||
} else {
|
||||
err('Подали заявку на бой и убегаете из клуба? Нехорошо...');
|
||||
}
|
||||
if ($goto == 'arena' && $user->getRoom() == 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', $user->getId());
|
||||
if ($goto == 'arena' && User::$current->getRoom() == 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', User::$current->getId());
|
||||
header('Location: main.php');
|
||||
exit("<i>Топ-топ-топ...</i>");
|
||||
}
|
||||
@@ -165,8 +167,8 @@ if (isset($_GET['use'])) {
|
||||
}
|
||||
|
||||
if ($obraz) {
|
||||
$user->setShadow($obraz);
|
||||
$user->saveShadow();
|
||||
User::$current->setShadow($obraz);
|
||||
User::$current->saveShadow();
|
||||
}
|
||||
|
||||
if ($setShadow) {
|
||||
@@ -277,12 +279,12 @@ Template::header('Игра');
|
||||
</td>
|
||||
<td style="vertical-align: top; width: 250px"> <!-- Второй столбец -->
|
||||
<div>
|
||||
<br>Уровень: <strong><?= $user->getLevel() ?></strong>
|
||||
<br>Опыт: <strong><?= $user->getExperience() ?></strong>
|
||||
<br>Уровень: <strong><?= User::$current->getLevel() ?></strong>
|
||||
<br>Опыт: <strong><?= User::$current->getExperience() ?></strong>
|
||||
<br>Побед: <strong>??</strong>
|
||||
<br>Поражений: <strong>??</strong>
|
||||
<br>Ничьих: <strong>??</strong>
|
||||
<br>Деньги: <strong><?= $user->getMoney() ?></strong> кр.
|
||||
<br>Деньги: <strong><?= User::$current->getMoney() ?></strong> кр.
|
||||
<HR>
|
||||
</div>
|
||||
<!--Параметры-->
|
||||
@@ -305,8 +307,9 @@ Template::header('Игра');
|
||||
увеличений: <?= $userStats->getFreeStatPoints() ?></small><br>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
Здоровье: <?= $userStats->getHealth() ?><br>
|
||||
Пыль: <?= $userStats->getMana() ?><br>
|
||||
<!-- #18 Разобраться в прогрессбарах -->
|
||||
Здоровье: <progress max="<?= $userStats->getMaxHealth() ?>" value="<?= $userStats->getHealth() ?>"><?= $userStats->getHealth() ?></progress><br>
|
||||
Пыль: <progress max="<?= $userStats->getMaxMana() ?>" value="<?= $userStats->getMana() ?>"><?= $userStats->getMana() ?></progress><br>
|
||||
Уворот: <?= $userStats->getFullStats()->evasion ?><br>
|
||||
Точность: <?= $userStats->getFullStats()->accuracy ?><br>
|
||||
Шанс крита: <?= $userStats->getFullStats()->criticals ?><br>
|
||||
@@ -327,14 +330,14 @@ Template::header('Игра');
|
||||
<td style="vertical-align: top;">
|
||||
<div class="button-container"> <!--Меню-кнопки-->
|
||||
<FORM METHOD=POST ACTION="?edit=1" name=f1>
|
||||
<?php if ($user->getShadow() == '0.gif' || $user->getAdmin() == 1): ?>
|
||||
<?php if (User::$current->getShadow() == '0.gif' || User::$current->getAdmin() == 1): ?>
|
||||
<INPUT class="button primary icon user" TYPE="submit" name="setshadow" value="Образы"
|
||||
title="Образы">
|
||||
<?php endif; ?>
|
||||
<div class="button-group">
|
||||
<?php if ($user->getRoom() == 20): ?>
|
||||
<?php if (User::$current->getRoom() == 20): ?>
|
||||
<input class="button icon move" type="submit" name="move_inside" value="Войти внутрь">
|
||||
<?php elseif ($user->getRoom() == 1): ?>
|
||||
<?php elseif (User::$current->getRoom() == 1): ?>
|
||||
<input class="button primary" type="submit" name="battlefield" value="Поединки">
|
||||
<input class="button icon move" type="submit" name="move_outside" value="Выйти на улицу">
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user