more buy item fixes

This commit is contained in:
Igor Barkov [iwork] 2019-01-14 19:48:36 +02:00
parent 872e200ac8
commit 6566f7e725

View File

@ -100,23 +100,18 @@ if (!empty($_GET['buy'])) {
'nalign' => $dress['nalign'],
'dategoden' => $dress['dategoden'],
'goden' => $dress['goden'],
'otdel' => $dress['otdel'],//s
'gmp' => $dress['gmp'],
'gmeshok' => $dress['gmeshok'],
'encicl' => $dress['encicl'],//s
'artefact' => $dress['artefact'],
'koll' => $dress['koll']
];
db::c()->query('INSERT INTO `inventory` SET ?A[?i,?i,"?s",?i,?i,?i,"?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,"?s",?i,?i,"?s",?i,?i]', $newItem);
db::c()->query('INSERT INTO `inventory` SET ?A[?i,?i,"?s",?i,?i,?i,"?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i]', $newItem);
$inventoryItemId = db::c()->getLastInsertId();
if ($dress['count'] != -1) db::c()->query('UPDATE `shop` SET `count` = `count` - 1 WHERE `id` = ?i', $_GET['buy']);
$status = "Вы купили \"{$dress['name']}\".";
db::c()->query('UPDATE `users` set `money` = ?i WHERE `id` = ?i', $dress['cost'], $_SESSION['uid']);
$deloText = "\"" . $user['login'] . "\" купил товар : \"" . $dress['name'] . " id:(" . $inventoryItemId . ") [0/" . $dress['maxdur'] . "] за " . $dress['cost'] . " кр.";
db::c()->query('INSERT INTO `delo` (`pers`, `text`, `type`, `date`) VALUES (?i, "?s", 1, ?i', $user['id'], $deloText, time());
$deloText = "{$user['login']} купил товар «{$dress['name']}» id:({$inventoryItemId}) в магазине за {$dress['cost']} кр.";
addToDelo($deloText);
} else {
$status = "Недостаточно денег или нет вещей в наличии.";