Актуальная БД для effects

This commit is contained in:
lopar 2020-07-06 22:02:04 +03:00
parent cc4732a971
commit 69b3fa5ab3
2 changed files with 8 additions and 7 deletions

View File

@ -464,7 +464,7 @@ function show_eff_inf($u, $type)
if ($type == 1) {
$and = " AND `type` != 1022";
}
$effs = db::c()->query('SELECT * FROM `effects` WHERE `type` <> 20 AND `owner` = ?i' . $and, $u)->fetch_assoc();
$effs = db::c()->query('SELECT * FROM `users_effects` WHERE `type` <> 20 AND `owner_id` = ?i' . $and, $u)->fetch_assoc();
/* FIXME Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 132644820 bytes) in /home/combats/web/combats.loc/public_html/functions.php on line 873
* Если на человеке стоит type=20
*

View File

@ -304,13 +304,14 @@ function unstack($it_id, $it_count)
}
}
//FIXME id and uid together???
function del_efs($uid, $id, $type)
{
global $user;
$arr = [2, 3, 4, 5, 8, 10, 11, 12, 13, 14, 20];
if ($uid == $user['id'] && $id != null) {
if (!in_array($type, $arr)) {
db::c()->query('DELETE FROM `effects` WHERE `owner` = ?i AND `id` = ?i', $uid, $id);
db::c()->query('DELETE FROM `users_effects` WHERE `owner_id` = ?i AND `id` = ?i', $uid, $id);
if ($type == 1022) {
db::c()->query('UPDATE `users` SET `invis` = ?i WHERE `id` = ?i', 0, $uid);
$user['invis'] = 0;
@ -348,8 +349,8 @@ function countmf()
return $type;
}
$zo = db::c()->query('SELECT 1 FROM `effects` WHERE `type` = 201 AND `owner` = ?i', $user['id'])->getNumRows();
$sokr = db::c()->query('SELECT 1 FROM `effects` WHERE `type` = 202 AND `owner` = ?i', $user['id'])->getNumRows();
$zo = db::c()->query('SELECT 1 FROM `users_effects` WHERE `type` = 201 AND `owner_id` = ?i', $user['id'])->getNumRows();
$sokr = db::c()->query('SELECT 1 FROM `users_effects` WHERE `type` = 202 AND `owner_id` = ?i', $user['id'])->getNumRows();
$bmfud = $bmfbron = 0;
@ -514,12 +515,12 @@ function dressitem($id)
if (isset($_GET['goto'])) {
$imove = true;
$d = db::c()->query('SELECT SUM(`massa`) AS `summ` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0', $user['id'])->fetch_assoc();
$eff = db::c()->query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND (`type` = 14 OR `type` = 13) LIMIT 1', $user['id'])->fetch_assoc();
$eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user['id']);
if ($d['summ'] > get_meshok() && $_GET['got']) {
err('У вас переполнен рюкзак, вы не можете передвигаться...');
$imove = false;
}
if (isset($eff['id']) && $_GET['got']) {
if ($eff->getNumRows() && $_GET['got']) {
err('У вас тяжелая травма, вы не можете передвигатся...');
$imove = false;
}
@ -590,7 +591,7 @@ if ($obraz && ($user['shadow'] == 'g0.gif' || $user['shadow'] == 'man0.gif')) {
}
if (isset($_GET['del']) && $_GET['del'] == 1 && $_GET['efid'] > 0) {
$pl = db::c()->query('SELECT `id`, `type` FROM `effects` WHERE `owner` = ?i AND `id` = ?i', $user['id'], (int)$_GET['efid'])->fetch_assoc();
$pl = db::c()->query('SELECT `id`, `type` FROM `users_effects` WHERE `owner_id` = ?i AND `id` = ?i', $user['id'], (int)$_GET['efid'])->fetch_assoc();
if (isset($pl['id'])) {
del_efs($user['id'], $pl['id'], $pl['type']);
} else {