query('SELECT * FROM `ahero_shop` WHERE `count` > 0 AND `razdel` = ?i ORDER by `point` ASC', $_GET['otdel']); * db::c()->query('UPDATE `shop` SET `count` = `count`- ?i WHERE `id` = ?i', $_POST['count'], $set); * db::c()->query('UPDATE `users` set `doblest` = `doblest` - ?i * ?i WHERE id = ?i', $_POST['count'], $dress['point'], $user['id']); * * shop_luka.php * $data = mysql_query("SELECT * FROM `shop` WHERE `count` > 0 AND `razdel` = '{$_GET['otdel']}' AND `zeton` != '0' ORDER by `cost` ASC"); * $vsego = $zetons-$_POST['count']*$dress['zeton']; * if($vsego<='0'){ * mysql_query("DELETE FROM `inventory` WHERE `type`='200' and `name`='Жетон' and owner='".$user["id"]."'"); * }else{mysql_query("UPDATE `inventory` set `maxdur` = '$vsego' WHERE `type`='200' and `name`='Жетон' and owner='".$user["id"]."'");} * */ $saleItems = false; $shopCategoryType = $_POST['sale'] ?? ''; $shopCategoryTypeNumber = $_GET['otdel'] ?? 0; switch ($shopCategoryTypeNumber) { default: $shopCategoryType = "Предметы в инвентаре"; $saleItems = true; break; case 1: $shopCategoryType = "Кинжалы"; break; case 11: $shopCategoryType = "Топоры"; break; case 12: $shopCategoryType = "Дубины"; break; case 13: $shopCategoryType = "Мечи"; break; case 2: $shopCategoryType = "Сапоги"; break; case 21: $shopCategoryType = "Перчатки"; break; case 22: $shopCategoryType = "Легкая броня"; break; case 23: $shopCategoryType = "Тяжелая броня"; break; case 24: $shopCategoryType = "Шлемы"; break; case 3: $shopCategoryType = "Щиты"; break; case 4: $shopCategoryType = "Серьги"; break; case 41: $shopCategoryType = "Ожерелья"; break; case 42: $shopCategoryType = "Кольца"; break; case 5: $shopCategoryType = "Заклинания: нейтральные"; break; case 51: $shopCategoryType = "Заклинания: боевые и защитные"; break; case 6: $shopCategoryType = "Амуниция"; break; } if (!$saleItems) { $shopItems = db::c()->query('SELECT `shop`.*, `magic`.`name` AS `magic_name`, `magic`.`chanse` AS `magic_chanse`, `magic`.`time` AS `magic_time`, `magic`.`file` AS `magic_file`, `magic`.`targeted` AS `magic_targeted`, `magic`.`needcharge` AS `magic_needcharge`, `magic`.`img` AS `magic_img` FROM `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `count` > 0 AND `cost` > 0 AND `razdel` = ?i ORDER by `nlevel` ASC, `id` ASC', $shopCategoryTypeNumber); $iteminfo = []; while ($row = $shopItems->fetch_assoc()) { $iteminfo[] = new ShopItem($row); } } else { $inventoryItems = db::c()->query('SELECT `inventory`.*, `magic`.`name` AS `magic_name`, `magic`.`chanse` AS `magic_chanse`, `magic`.`time` AS `magic_time`, `magic`.`file` AS `magic_file`, `magic`.`targeted` AS `magic_targeted`, `magic`.`needcharge` AS `magic_needcharge`, `magic`.`img` AS `magic_img`, 0 AS `maxdur` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `dressed` = 0 AND `setsale` = 0 AND `cost` > 0 AND `present` = "?s" AND `tradesale` = 0 AND `podzem` = 0 AND `goden` = 0 AND `artefact` = 0 AND `owner` = ?i ORDER BY `update` DESC', null, $_SESSION['uid']); $iteminfo = []; while ($row = $inventoryItems->fetch_assoc()) { $iteminfo[] = new ShopItem($row); } } $sellItemId = $_GET['sell'] ?? 0; if ($sellItemId) { ShopItem::sellItem($sellItemId, $user); } if (!empty($_GET['buy'])) { ShopItem::buyItem($_GET['buy'], $user); /* $dress = db::c()->query('SELECT * FROM `shop` WHERE `id`=?i', $_GET['buy'])->fetch_assoc(); $itemWeight = db::c()->query('SELECT sum(`massa`) AS `m` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0', $_SESSION['uid'])->fetch_assoc(); if (($dress['massa'] + $itemWeight['m']) > (get_meshok())) { $status = 'Недостаточно места в рюкзаке.'; } elseif ($user['money'] >= $dress['cost'] && ($dress['count'] > 0 || $dress['count'] == -1)) { $newItem = [ 'prototype' => $dress['id'], 'owner' => $user['id'], 'name' => $dress['name'], //s 'type' => $dress['type'], 'massa' => $dress['massa'], 'cost' => $dress['cost'], 'img' => $dress['img'], //s 'maxdur' => $dress['maxdur'], 'isrep' => $dress['isrep'], 'gsila' => $dress['gsila'], 'glovk' => $dress['glovk'], 'ginta' => $dress['ginta'], 'gintel' => $dress['gintel'], 'ghp' => $dress['ghp'], 'gnoj' => $dress['gnoj'], 'gtopor' => $dress['gtopor'], 'gdubina' => $dress['gdubina'], 'gmech' => $dress['gmech'], 'gfire' => $dress['gfire'], 'gwater' => $dress['gwater'], 'gair' => $dress['gair'], 'gearth' => $dress['gearth'], 'glight' => $dress['glight'], 'ggray' => $dress['ggray'], 'gdark' => $dress['gdark'], 'needident' => $dress['needident'], 'nsila' => $dress['nsila'], 'nlovk' => $dress['nlovk'], 'ninta' => $dress['ninta'], 'nintel' => $dress['nintel'], 'nmudra' => $dress['nmudra'], 'nvinos' => $dress['nvinos'], 'nnoj' => $dress['nnoj'], 'ntopor' => $dress['ntopor'], 'ndubina' => $dress['ndubina'], 'nmech' => $dress['nmech'], 'nfire' => $dress['nfire'], 'nwater' => $dress['nwater'], 'nair' => $dress['nair'], 'nearth' => $dress['nearth'], 'nlight' => $dress['nlight'], 'ngray' => $dress['ngray'], 'ndark' => $dress['ndark'], 'mfkrit' => $dress['mfkrit'], 'mfakrit' => $dress['mfakrit'], 'mfuvorot' => $dress['mfuvorot'], 'mfauvorot' => $dress['mfauvorot'], 'bron1' => $dress['bron1'], 'bron2' => $dress['bron2'], 'bron3' => $dress['bron3'], 'bron4' => $dress['bron4'], 'minu' => $dress['minu'], 'maxu' => $dress['maxu'], 'magic' => $dress['magic'], 'nlevel' => $dress['nlevel'], 'nalign' => $dress['nalign'], 'dategoden' => $dress['dategoden'], 'goden' => $dress['goden'], 'gmp' => $dress['gmp'], '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,?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']}» за {$dress['cost']} кр."; db::c()->query('UPDATE `users` set `money` = `money` - ?i WHERE `id` = ?i', $dress['cost'], $_SESSION['uid']); $deloText = "{$user->getLogin()} купил товар «{$dress['name']}» id:({$inventoryItemId}) в магазине за {$dress['cost']} кр."; GameLogs::addUserLog($user->getId(), $deloText); // Для обновления данных о деньгах на странице $user['money'] -= $dress['cost']; } else { $status = "Недостаточно денег или нет вещей в наличии."; }*/ } Template::header('Магазин'); ?>

Государственный магазин

← выйти на Центральную площадь

Вы можете продать ваши предметы за сущие копейки.
"; echo ""; } } else { foreach ($iteminfo as $ii) { echo ""; echo ""; } } ?>
"; $ii->printImage(); $ii->printControls('sell'); echo ""; $ii->printInfo(); echo "
"; $ii->printImage(); $ii->printControls(); echo ""; $ii->printInfo(); echo "
Масса всех ваших вещей:
У вас в наличии: кр.

Отделы магазина
Продать вещи
Оружие:
кинжалы
топоры
дубины
мечи
Одежда:
шлемы
тяжелая броня
легкая броня
щиты
перчатки
сапоги
Ювелирные товары:
серьги
ожерелья
кольца
Магия:
боевые
разные
Разное:
амуниция