Фикс функции продажи товара.

This commit is contained in:
lopar 2018-06-23 19:22:20 +03:00
parent d5a3fefdc1
commit 4da8580e08
2 changed files with 31 additions and 8 deletions

View File

@ -4645,8 +4645,9 @@ function dressitemkomplekt($id, $idd)
// убить предмет // убить предмет
function destructitem($id) function destructitem($id)
{ {
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); global $user;
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `id` = '{$id}' LIMIT 1;")); $slot1 = '';
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $user['id'], $id)->fetch_assoc();
switch ($dress['type']) { switch ($dress['type']) {
case 1: case 1:
$slot1 = 'sergi'; $slot1 = 'sergi';
@ -4740,12 +4741,8 @@ function destructitem($id)
} }
} }
if (($dress['owner'] == $user['id'])) { if (($dress['owner'] == $user['id'])) {
mysql_query("DELETE FROM `inventory` WHERE `id` = '{$id}' LIMIT 1;"); if ($dress['dressed'] == 1) db::c()->query('UPDATE `users` SET ?f = 0 WHERE `id` = ?i', $slot1, $user['id']);
//mysql_query("INSERT INTO `delo`(`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','Выброшен предмент {$dress['name']}. Цена:{$dress['cost']} кр.',1,'".time()."');"); db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $id);
//echo "<font color=red><b>Предмет \"{$dress['name']}\" утерян.</b></font>";
if ($dress['dressed'] == 1) {
mysql_query("UPDATE `users` SET `" . $slot1 . "` = 0 WHERE `id` = '{$user['id']}';");
}
} }
} }

View File

@ -59,6 +59,32 @@ if (isset($_GET['set']) OR isset($_POST['set'])) {
} else $count_ok = 1; } else $count_ok = 1;
$dress = db::c()->query('SELECT * FROM `shop` WHERE `id`=?i', $set)->fetch_assoc(); $dress = db::c()->query('SELECT * FROM `shop` WHERE `id`=?i', $set)->fetch_assoc();
// db::c()->query('
// INSERT INTO `inventory` (
// name, maxdur, cost, img, goden, dategoden, massa, prototype, owner,
// nlevel, nsila, nlovk, ninta, nvinos, nintel, nmudra,
// nnoj, ntopor, ndubina, nmech, nalign, nfire, nwater, nair, nearth, nlight, ngray, ndark,
// minu, maxu,
// gsila, glovk, ginta, gintel, ghp, gfire, gwater, gair, gearth, glight, ggray, gdark,
// mfkrit, mfakrit, mfuvorot, mfauvorot,
// gnoj, gtopor, gdubina, gmech,
// bron1, bron2, bron3, bron4, magic, needident,
// gmp, gmeshok, artefact, encicl, koll)
// SELECT
// name, maxdur, cost, img, goden, dategoden, massa, id, ?i,
// nlevel, nsila, nlovk, ninta, nvinos, nintel, nmudra,
// nnoj, ntopor, ndubina, nmech, nalign, nfire, nwater, nair, nearth, nlight, ngray, ndark,
// minu, maxu,
// gsila, glovk, ginta, gintel, ghp, gfire, gwater, gair, gearth, glight, ggray, gdark,
// mfkrit, mfakrit, mfuvorot, mfauvorot,
// gnoj, gtopor, gdubina, gmech,
// bron1, bron2, bron3, bron4, magic, needident,
// gmp, gmeshok, artefact, encicl, koll
// FROM shop WHERE id = inventory.prototype;
//
// ', $user['id']);
if ($count_ok == 0) { if ($count_ok == 0) {
err('Неправильно введено количество.'); err('Неправильно введено количество.');
} elseif (($dress['massa'] * $count + $itemWeight['m']) > (get_meshok())) { } elseif (($dress['massa'] * $count + $itemWeight['m']) > (get_meshok())) {