Изменено поле в БД, вынесены лишние функции их functions в профильные файлы. Оказывается, давно не работал логин и плохо работали сессии. Проверяется. Прочие мелкие баги и чистка самых хвостов.

This commit is contained in:
Igor Barkov (iwork)
2021-08-27 18:55:18 +03:00
parent 9c7fcda600
commit 7434f28fa6
36 changed files with 293 additions and 341 deletions
+4 -27
View File
@@ -2,7 +2,9 @@
use Battles\DressedItems;
use Battles\GameLogs;
use Battles\ShopItem;
use Battles\Template;
use Battles\User;
require_once 'functions.php';
//require_once 'cave/cave_bots.php';
@@ -301,23 +303,6 @@ function makedeath()
$loses++;
}
function pickupitem($item, $foronetrip, $notmore1, $incave = 0, $podzem = 1, $destiny = 0)
{
global $user;
if ($notmore1) {
$i = mysql_fetch_assoc(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype` = '$item' AND `owner` = '$user[id]' LIMIT 1"));
if (isset($i['id'])) {
return "Вы уже получили здесь всё необходимое.";
}
}
$flds = ['podzem' => 1, 'podzem' => $podzem];
if ($incave) {
$flds['incave'] = 1;
}
$taken = takeshopitem($item, 'shop', '', $foronetrip, $destiny, $flds);
return "Вы получили <b>$taken[name]</b>";
}
function itemtofloor($item, $foronetrip, $incave = 0, $podzem = 1, $from = 'shop', $small = 0)
{
global $user, $x, $y, $floor;
@@ -326,14 +311,6 @@ function itemtofloor($item, $foronetrip, $incave = 0, $podzem = 1, $from = 'shop
return "Вы нашли <b>$rec[name]</b>.";
}
function makeinjury()
{
global $user, $floor, $noautoexit, $loses, $x, $y, $dir;
settravma($user['id'], 20, rand(1, 600), 1, 1);
makedeath();
$noautoexit = 1;
}
function cavewall($w)
{
if ($w < 100) {
@@ -769,7 +746,7 @@ if (!$_SESSION['movetime']) {
$_SESSION['movetime'] = time();
}
if (@$_GET['takeitem']) {
if ($_GET['takeitem']) {
$_GET['takeitem'] = (int)$_GET['takeitem'];
$it = mysql_fetch_array(mysql_query("SELECT `item`, `foronetrip`, `incave`, `podzem` FROM `caveitems` WHERE `leader` = '$user[caveleader]' AND `x` = '" . ($x * 2) . "' AND `y` = '" . ($y * 2) . "' AND `floor` = '$floor' AND `id` = '$_GET[takeitem]' LIMIT 1"));
@@ -782,7 +759,7 @@ if (@$_GET['takeitem']) {
$report = "Ваш рюкзак перегружен.";
} else {
$destiny = 0;
$taken = takeshopitem($it['item'], "$shop", "", $it['foronetrip'], $destiny, ["podzem" => $it["podzem"], "incave" => $it['incave']], 0, 1, "Нашёл в пещере");
$taken = ShopItem::giveNewItem($it['item'], User::$current->getId());
if (@$taken['error']) {
$report = $taken['error'];
} else {