diff --git a/classes/ShopItem.php b/classes/ShopItem.php index ab9746c..34a87b2 100644 --- a/classes/ShopItem.php +++ b/classes/ShopItem.php @@ -28,6 +28,6 @@ class ShopItem extends Item
BTN;
- if ($this->count > 0) echo "
(Осталось: {$this->count} штук)";
+ if ($this->count > 0) echo "
В наличии: {$this->count} штук";
}
}
\ No newline at end of file
diff --git a/shop.php b/shop.php
index e6515ff..60c1ea2 100644
--- a/shop.php
+++ b/shop.php
@@ -16,178 +16,6 @@ if ($user['battle'] != 0) {
$sellItemId = filter_input(INPUT_GET, 'sellitem');
$saleItems = false;
-/**
- * Показать предмет в магазине
- *
- * @param $it
- * @param string $from
- *
- * @return string
- */
-function show_shop_items($it, $from = 'shop')
-{
- global $user;
- $r = '';
- $item = db::c()->query('SELECT * FROM ?f WHERE `id` = ?i', $from, $it);
- if ($item->getNumRows()) {
- $item = $item->fetch_assoc();
-
- if (!empty($item['magic'])) $magic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $item['magic'])->fetch_assoc();
- if (!empty($item['includemagic'])) {
- $incmagic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $item['includemagic'])->fetch_assoc();
- $incmagic['name'] = $item['includemagicname'];
- $incmagic['cur'] = $item['includemagicdex'];
- $incmagic['max'] = $item['includemagicmax'];
- if (empty($magic)) {
- $magic['chanse'] = $incmagic['chanse'];
- $magic['time'] = $incmagic['time'];
- $magic['targeted'] = $incmagic['targeted'];
- }
- }
-
- $r .= $item['name'];
- $r .= " (Масса: {$item['massa']})";
- if (!empty($item['nalign']))
- $r .= " ";
- if (!empty($item['artefact']))
- $r .= "
";
-
- $r .= "
Цена: {$item['cost']} кр.";
-
- if ($item['count']) {
- $r .= "
(количество: {$item['count']})";
- }
-
- $r .= "
Долговечность: {$item['maxdur']}";
- $r .= "
";
-
- if (!$item['needident']) {
-
- $r .= ((!empty($magic['chanse'])) ? "Вероятность срабатывания: " . $magic['chanse'] . "%
" : "") . "
- " . ((!empty($magic['time'])) ? "Продолжительность действия магии: " . $magic['time'] . " мин.
" : "") . "
- " . (($item['goden']) ? "Срок годности: {$item['goden']} дн. " . ((!$item['count']) ? "(до " . date("Y.m.d H:i", $item['dategoden']) . ")" : "") . "
" : "") . "
- " . (($item['nsila'] || $item['nlovk'] || $item['ninta'] || $item['nvinos'] || $item['nlevel'] || $item['nintel'] || $item['nmudra'] || $item['nnoj'] || $item['ntopor'] || $item['ndubina'] || $item['nmech'] || $item['nfire'] || $item['nwater'] || $item['nair'] || $item['nearth'] || $item['nearth'] || $item['nlight'] || $item['ngray'] || $item['ndark']) ? "Требуется минимальное:
" : "") . "
- " . (($item['nsila'] > 0) ? "• " . (($item['nsila'] > $user['sila']) ? "" : "") . "Сила: {$item['nsila']}
" : "") . "
- " . (($item['nlovk'] > 0) ? "• " . (($item['nlovk'] > $user['lovk']) ? "" : "") . "Ловкость: {$item['nlovk']}
" : "") . "
- " . (($item['ninta'] > 0) ? "• " . (($item['ninta'] > $user['inta']) ? "" : "") . "Интуиция: {$item['ninta']}
" : "") . "
- " . (($item['nvinos'] > 0) ? "• " . (($item['nvinos'] > $user['vinos']) ? "" : "") . "Выносливость: {$item['nvinos']}
" : "") . "
- " . (($item['nlevel'] > 0) ? "• " . (($item['nlevel'] > $user['level']) ? "" : "") . "Уровень: {$item['nlevel']}
" : "") . "
- " . (($item['nintel'] > 0) ? "• " . (($item['nintel'] > $user['intel']) ? "" : "") . "Интеллект: {$item['nintel']}
" : "") . "
- " . (($item['nnoj'] > 0) ? "• " . (($item['nnoj'] > $user['noj']) ? "" : "") . "Мастерство владения ножами и кастетами: {$item['nnoj']}
" : "") . "
- " . (($item['ntopor'] > 0) ? "• " . (($item['ntopor'] > $user['topor']) ? "" : "") . "Мастерство владения топорами и секирами: {$item['ntopor']}
" : "") . "
- " . (($item['ndubina'] > 0) ? "• " . (($item['ndubina'] > $user['dubina']) ? "" : "") . "Мастерство владения дубинами и булавами: {$item['ndubina']}
" : "") . "
- " . (($item['nmech'] > 0) ? "• " . (($item['nmech'] > $user['mec']) ? "" : "") . "Мастерство владения мечами: {$item['nmech']}
" : "") . "
- " . (($item['nfire'] > 0) ? "• " . (($item['nfire'] > $user['mfire']) ? "" : "") . "Мастерство владения стихией Огня: {$item['nfire']}
" : "") . "
- " . (($item['nwater'] > 0) ? "• " . (($item['nwater'] > $user['mwater']) ? "" : "") . "Мастерство владения стихией Воды: {$item['nwater']}
" : "") . "
- " . (($item['nair'] > 0) ? "• " . (($item['nair'] > $user['mair']) ? "" : "") . "Мастерство владения стихией Воздуха: {$item['nair']}
" : "") . "
- " . (($item['nearth'] > 0) ? "• " . (($item['nearth'] > $user['mearth']) ? "" : "") . "Мастерство владения стихией Земли: {$item['nearth']}
" : "") . "
- " . (($item['nlight'] > 0) ? "• " . (($item['nlight'] > $user['mlight']) ? "" : "") . "Мастерство владения магией Света: {$item['nlight']}
" : "") . "
- " . (($item['ngray'] > 0) ? "• " . (($item['ngray'] > $user['mgray']) ? "" : "") . "Мастерство владения серой магией: {$item['ngray']}
" : "") . "
- " . (($item['ndark'] > 0) ? "• " . (($item['ndark'] > $user['mdark']) ? "" : "") . "Мастерство владения магией Тьмы: {$item['ndark']}
" : "") . "
- " . (($item['gsila'] || $item['mfkrit'] || $item['mfakrit'] || $item['mfuvorot'] || $item['mfauvorot'] || $item['glovk'] || $item['ghp'] || $item['ginta'] || $item['gintel'] || $item['gnoj'] || $item['gtopor'] || $item['gdubina'] || $item['gmech'] || $item['gfire'] || $item['gwater'] || $item['gair'] || $item['gearth'] || $item['gearth'] || $item['glight'] || $item['ggray'] || $item['gdark'] || $item['minu'] || $item['maxu'] || $item['bron1'] || $item['bron2'] || $item['bron3'] || $item['bron4']) ? "Действует на:
" : "") . "
- " . (($item['minu']) ? "• Минимальное наносимое повреждение: +{$item['minu']}
" : "") . "
- " . (($item['maxu']) ? "• Максимальное наносимое повреждение: +{$item['maxu']}
" : "");
-
- if ($item['gsila']) {
- $r .= "• Сила: +" . $item['gsila'];
- $r .= "
";
- }
-
- if ($item['glovk']) {
- $r .= "• Ловкость: " . plusorminus($item['glovk']);
- $r .= "
";
- }
-
- if ($item['ginta']) {
- $r .= "• Интуиция: " . plusorminus($item['ginta']);
- $r .= "
";
- }
-
- if ($item['gintel']) {
- $r .= "• Интеллект: " . plusorminus($item['gintel']);
- $r .= "
";
- }
-
- $r .= (($item['ghp']) ? "• Уровень жизни: " . plusorminus($item['ghp']) . "
" : "");
-
- if ($item['mfkrit'] > 0) {
- $r .= "• Мф. критических ударов: " . plusorminus($item['mfkrit']) . "%";
- $r .= "
";
- }
-
- if ($item['mfakrit'] > 0) {
- $r .= "• Мф. против крит. ударов: " . plusorminus($item['mfakrit']) . "%";
- $r .= "
";
- }
-
- if ($item['mfuvorot'] > 0) {
- $r .= "• Мф. увертливости: " . plusorminus($item['mfuvorot']) . "%";
- $r .= "
";
- }
-
- if ($item['mfauvorot'] > 0) {
- $r .= "• Мф. против увертлив.: " . plusorminus($item['mfauvorot']) . "%";
- $r .= "
";
- }
-
- $r .= (($item['gnoj']) ? "• Мастерство владения ножами и кастетами: +{$item['gnoj']}
" : "") . "
- " . (($item['gtopor']) ? "• Мастерство владения топорами и секирами: +{$item['gtopor']}
" : "") . "
- " . (($item['gdubina']) ? "• Мастерство владения дубинами и булавами: +{$item['gdubina']}
" : "") . "
- " . (($item['gmech']) ? "• Мастерство владения мечами: +{$item['gmech']}
" : "") . "
- " . (($item['gfire']) ? "• Мастерство владения стихией Огня: +{$item['gfire']}
" : "") . "
- " . (($item['gwater']) ? "• Мастерство владения стихией Воды: +{$item['gwater']}
" : "") . "
- " . (($item['gair']) ? "• Мастерство владения стихией Воздуха: +{$item['gair']}
" : "") . "
- " . (($item['gearth']) ? "• Мастерство владения стихией Земли: +{$item['gearth']}
" : "") . "
- " . (($item['glight']) ? "• Мастерство владения магией Света: +{$item['glight']}
" : "") . "
- " . (($item['ggray']) ? "• Мастерство владения серой магией: +{$item['ggray']}
" : "") . "
- " . (($item['gdark']) ? "• Мастерство владения магией Тьмы: +{$item['gdark']}
" : "");
-
- if ($item['bron1'] > 0) {
- $r .= "• Броня головы: " . $item['bron1'];
- $r .= "
";
- }
-
- if ($item['bron2'] > 0) {
- $r .= "• Броня корпуса: " . $item['bron2'];
- $r .= "
";
- }
-
- if ($item['bron3'] > 0) {
- $r .= "• Броня пояса: " . $item['bron3'];
- $r .= "
";
- }
-
- if ($item['bron4'] > 0) {
- $r .= "• Броня ног: " . $item['bron4'];
- $r .= "
";
- }
-
- $r .= ((!empty($magic['name']) && $item['type'] != 50) ? "Наложены заклятия: " . $magic['name'] . "
" : "") . "
- " . ((!empty($incmagic['max'])) ? " Встроено заклятие " . $incmagic['cur'] . " шт.
" : "") . "
- " . ((!$item['isrep']) ? "Предмет не подлежит ремонту
" : "");
-
-
- } else {
- $r .= "Свойства предмета не идентифицированы.
";
- }
- $osob = [22, 23];
- if (in_array($item['type'], $osob)) {
- $r .= 'Особенности:
';
- if ($item['type'] == 22) {
- $r .= '• может одеваться под броню
';
- } elseif ($item['type'] == 23) {
- $r .= '• может одеваться на броню
';
- }
- }
- $r .= "
";
-
- } else {
- $r = 'Предмет не найден : {' . $it . '}';
- }
- return $r;
-}
-
-
if ($sellItemId && is_numeric($sellItemId)) {
$dress = db::c()->query('SELECT `id`, `name`, `cost`, `type`, `duration`, `maxdur`, `goden`, `dategoden`, `koll` FROM `inventory` WHERE `dressed` = 0 AND `id` = ?i AND `owner` = ?i', $sellItemId, $user['id'])->fetch_assoc();
$price = $dress['cost'] * 1;
@@ -398,21 +226,6 @@ while ($row = $shopItems->fetch_assoc()) {
}