Проверки с перенаправлениями переехали в functions.php. Глобальный выход если нет сессии в config.php.

This commit is contained in:
lopar
2020-10-30 01:30:05 +02:00
parent 2024a6fac7
commit 32c72e3413
143 changed files with 6986 additions and 7329 deletions
+6 -6
View File
@@ -25,15 +25,15 @@ class DressedItems
private function getDressedItems()
{
try {
$this->DB = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->USERID);
} catch (Exception $e) {
$this->DB = \db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->USERID);
} catch (\Exception $e) {
echo '<div class="debug">Не прогрузилась таблица inventory (*) для класса DressedItems.</div>';
}
}
private function getDressedItemById($item_id)
{
return db::c()->query('SELECT * FROM inventory WHERE item_id = ?i AND dressed_slot > 0', $item_id)->fetch_assoc();
return \db::c()->query('SELECT * FROM inventory WHERE item_id = ?i AND dressed_slot > 0', $item_id)->fetch_assoc();
}
private function getBonusesFromDressedItems()
@@ -53,8 +53,8 @@ SELECT SUM(add_strength) as sum_strength,
SUM(add_max_physical_damage) as sum_max_phys_damage
FROM inventory WHERE owner_id = ?i AND dressed_slot > 0
SQL;
$this->DBSUM = db::c()->query($query, $this->USERID)->fetch_assoc();
} catch (Exception $e) {
$this->DBSUM = \db::c()->query($query, $this->USERID)->fetch_assoc();
} catch (\Exception $e) {
echo '<div class="debug">Не прогрузилась таблица inventory (SUM) для класса DressedItems:' . $e . '</div>';
}
}
@@ -134,7 +134,7 @@ SQL;
self::getItemsInSlots();
// Проверяем, что используется один из 12 слотов и наличие предмета в слоте.
if (in_array($slot_id, Item::ITEM_TYPES_ALLOWED_IN_SLOTS) && $this->dressedItem[$slot_id]) {
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i AND owner_id = ?i', $slot_id, $this->USERID);
\db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i AND owner_id = ?i', $slot_id, $this->USERID);
}
}
-3
View File
@@ -15,9 +15,6 @@ class PresentsModel
{
if (!$this->DB) {
$this->DB = \db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
if ($this->DB->getNumRows() == 0) {
throw new GameException("<div class='debug'>class PresentsModel: Не прогрузилась база!</div>");
}
}
}
+16 -3
View File
@@ -7,7 +7,7 @@ class Travel
* Соответствие ID комнаты игровому файлу.
* @var string[]
*/
private static $roomFileName = [
public static $roomFileName = [
1 => 'main.php',
20 => 'city.php',
21 => 'city.php',
@@ -21,18 +21,31 @@ class Travel
31 => 'tower.php',
34 => 'fshop.php',
37 => 'gotzamok.php',
38 => 'gotzamok.php',
39 => 'gotzamok.php',
40 => 'gotzamok.php',
41 => 'gotzamok.php',
51 => 'city.php',
61 => 'akadem.php',
401 => 'hell.php',
402 => 'lab_chaos_enter.php',
404 => 'vxod.php',
402 => 'vxod.php',
403 => 'canalizaciya.php',
//404 => 'vxod.php',
600 => 'c_haos.php',
601 => 'c_haos_in.php',
602 => 'c_park.php',
603 => 'aren_of_angels.php',
620 => 'enter_cave.php',
621 => 'cave.php',
650 => 'ul_clans.php',
660 => 'hostel.php',
661 => 'hostel_room.php',
662 => 'quest_room.php',
666 => 'jail.php',
760 => 'c_forest.php',
777 => 'obshaga.php',
1051 => 'lab_enter.php',
1052 => 'labirint.php',
1055 => 'group_arena.php',
2111 => 'city.php',
2601 => 'city.php',
+1 -4
View File
@@ -20,8 +20,6 @@ class UserInfo extends User
*/
private function UserInfoDoll($isBattle = 0, $isMain = 0)
{
//https://jsfiddle.net/ngx0yvhc
//TODO переверстать grid, чтобы он касался только куклы.
$di = new DressedItems($this->id);
$dressedItems = $di->getItemsInSlots();
for ($i = 1; $i <= 12; $i++) {
@@ -103,7 +101,6 @@ class UserInfo extends User
echo $variables;
echo '</div><!-- column -->';
echo '</div><!-- stats-container -->';
echo '<div class="debug">TODO: Сделать рассчёт модификаторов. Вывести полоску здоровья когда будет от чего отталкиваться.</div>';
echo '</div><!-- user-info -->';
}
@@ -172,7 +169,7 @@ class UserInfo extends User
private function WatcherStatus()
{
$query = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $this->watcher_id)->fetch_assoc();
$query = \db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $this->watcher_id)->fetch_assoc();
if ($query['admin']) {
$this->watcherIsAdmin = 1;
}