647 lines
28 KiB
PHP
647 lines
28 KiB
PHP
<?php
|
||
|
||
namespace Location;
|
||
|
||
use Core\Config;
|
||
use Core\ConversionHelper;
|
||
use Core\Db;
|
||
use User;
|
||
|
||
class Shop
|
||
{
|
||
private int $shopId;
|
||
private array $wares;
|
||
private int $otdel;
|
||
private int $itemId;
|
||
private $buyer;
|
||
private const ITEM_GENERATION_CURRENT = 2;
|
||
public const MAIN = 1;
|
||
public const BEREZKA = 2;
|
||
public const CRYSTALS = 1050; //магазин самоцветов
|
||
public const REFERALS = 27; //магазин рефералов
|
||
public const TEMPLE = 14; // храм?!
|
||
public const IZLOM = 10; // излом?!
|
||
public const LABORATORY = 45; //лаборатория?!?!
|
||
public const ARTEFACTS = 777;
|
||
public const BOOKS = 7;
|
||
public const KNIGHTS_MAIN = 400; // общий рыцарский
|
||
public const DUNGEON_BEZDNA = 801; // бездна
|
||
public const DUNGEON_PTP = 802; // пещера тысячи проклятий
|
||
public const DUNGEON_CATACOMBS = 803; // катакомбы
|
||
public const DUNGEON_MISTY = 804; // пещера мглы
|
||
public const FLOWER = 6;
|
||
public const MUSHROOMS = 17; // магазин грибоеда??
|
||
public const RULF_HRUNT = 33; // магазин рульфа хрунта, а ты что такое?
|
||
public const LUKA = 5; // каморка Луки
|
||
public const BLOOD_ALTAR = 11; //алтарь крови
|
||
public const ANVIL = 700; // наковальня
|
||
public const NEWBIE = 106; // магазин новичка
|
||
public const SHOP_2 = 609; // неизвестный магазин
|
||
public const SHOP_KAT = 44; // неизвестный магазин
|
||
public const SHOP_PRIZ = 404; // неизвестный магазин
|
||
public const TAVERN = 9;
|
||
public const ANIMALS = 8;
|
||
public function __construct(int $shopId)
|
||
{
|
||
$this->otdel = intval($_GET['otdel']);
|
||
$this->itemId = intval($_GET['itmid']);
|
||
$this->shopId = $shopId;
|
||
$this->wares = Db::getRows('select * from
|
||
items_shop
|
||
left join items_main on items_shop.item_id = items_main.id
|
||
left join items_main_data on items_main_data.items_id = items_main.id
|
||
where sid = ? and r = ? and kolvo > 0 order by pos', [$this->shopId, $this->otdel]);
|
||
|
||
$this->buyer = new class {
|
||
private User $user;
|
||
|
||
public function __construct()
|
||
{
|
||
$this->user = User::start();
|
||
}
|
||
|
||
public function getId()
|
||
{
|
||
return $this->user->info['id'];
|
||
}
|
||
|
||
public function getCredits()
|
||
{
|
||
return $this->user->info['money1'];
|
||
}
|
||
|
||
public function getEuroCredits()
|
||
{
|
||
return $this->user->info['money2'];
|
||
}
|
||
|
||
public function getMoney3()
|
||
{
|
||
return $this->user->info['money3'];
|
||
}
|
||
|
||
public function getVoinstvennost()
|
||
{
|
||
return $this->user->rep['rep3'] - $this->user->rep['rep3_buy'];
|
||
}
|
||
|
||
public function getAlign()
|
||
{
|
||
return $this->user->info['align'];
|
||
}
|
||
|
||
public function getNextAct()
|
||
{
|
||
return $this->user->info['nextAct']; // что ты такое?!
|
||
}
|
||
|
||
public function isAdmin(): bool
|
||
{
|
||
return $this->user->info['admin'] > 0;
|
||
}
|
||
};
|
||
|
||
}
|
||
|
||
private function changeItemPositionByInt(int $modificator)
|
||
{
|
||
Db::sql('update items_shop set pos = pos + ? where sid = ? and r = ? and item_id = ? and kolvo > 0',
|
||
[$modificator, $this->shopId, $this->otdel, $this->itemId]);
|
||
}
|
||
|
||
private function itemUp()
|
||
{
|
||
$this->changeItemPositionByInt(-1);
|
||
}
|
||
|
||
private function itemDown()
|
||
{
|
||
$this->changeItemPositionByInt(1);
|
||
}
|
||
|
||
private function calculateMinimalPrice($basePrice, $shopPrice, $needItems)
|
||
{
|
||
if ($shopPrice < 0.01 && !$needItems) {
|
||
$shopPrice = $basePrice;
|
||
}
|
||
if ($shopPrice < 0) {
|
||
$shopPrice = 0;
|
||
}
|
||
return $shopPrice;
|
||
}
|
||
|
||
/**
|
||
* Если в первом параметре передаётся false, строка во втором параметре красится в красный цвет.
|
||
* @param bool $check
|
||
* @param $value
|
||
* @return string
|
||
*/
|
||
private function printColoredValue(bool $check, $value): string
|
||
{
|
||
$color = $check ? 'inherit' : 'red';
|
||
return sprintf('<span style="color:%s;">%s</span>', $color, $value);
|
||
}
|
||
|
||
private function align($needAlign, $needAlignBs): string
|
||
{
|
||
if ($needAlignBs == '1') {
|
||
$align = '1.75';
|
||
} elseif ($needAlignBs == '3') {
|
||
$align = '3.01';
|
||
} elseif (!empty($needAlign) && empty($needAlignBs)) {
|
||
$align = $needAlign;
|
||
}
|
||
|
||
return !empty($align) ?
|
||
'<img src="' . Config::img() . '/i/align/align' . $align . '.gif" alt="Требуется склонность">' : '';
|
||
}
|
||
|
||
private function destiny($d): string
|
||
{
|
||
if (empty($d)) {
|
||
return '';
|
||
}
|
||
if ($d == 0) {
|
||
$str = 'первым, кто наденет его';
|
||
} elseif ($d == 1) {
|
||
$str = 'первым, кто возьмёт его';
|
||
} else {
|
||
$str = $d;
|
||
}
|
||
return '<img
|
||
title="Этот предмет будет связан общей судьбой с ' . $str . '. Никто другой не сможет его использовать."
|
||
src="' . Config::img() . '/i/destiny0.gif"
|
||
alt="Общая судьба">';
|
||
}
|
||
|
||
private function needItems(string $items): string
|
||
{
|
||
if (!$items || Config::get('noitembuy')) {
|
||
return '';
|
||
}
|
||
$result = '';
|
||
$trn = true;
|
||
|
||
$itemsArray = explode(',', $items);
|
||
foreach ($itemsArray as $keyvalue) {
|
||
list($key, $value) = explode('=', $keyvalue);
|
||
if (!empty($key) && !empty($value)) {
|
||
$neededItemName = Db::getValue('select name from items_main where id = ?', [$key]);
|
||
if ($neededItemName) {
|
||
$neededItemsInInventoryCount = Db::getValue(
|
||
'select count(*) from items_users where item_id = ? and inShop = 0 and inOdet = 0 and `delete` in (0,1000) and uid = ?',
|
||
[$key, $this->buyer->getId()]);
|
||
if ($neededItemsInInventoryCount < (int)$value) {
|
||
$trn = false;
|
||
}
|
||
$result .= '[<strong>' . $neededItemName . '</strong>] x' . $value . ', ';
|
||
}
|
||
}
|
||
}
|
||
|
||
return $this->printColoredValue($trn, '<br>Требует предмет: ' . rtrim($result, ', ') . ' ') . '<br>';
|
||
}
|
||
|
||
public function printWares(string $plu = '')
|
||
{
|
||
if ($this->buyer->isAdmin()) {
|
||
if (isset($_GET['itmup'])) {
|
||
$this->itemUp();
|
||
} elseif (isset($_GET['itmdown'])) {
|
||
$this->itemDown();
|
||
}
|
||
}
|
||
|
||
$cr = 'c8c8c8';
|
||
|
||
foreach ($this->wares as $pl) {
|
||
$cr = $cr == 'd4d4d4' ? 'c8c8c8' : 'd4d4d4';
|
||
$pl['price_1'] = $this->calculateMinimalPrice($pl['price1'], $pl['price_1'], $pl['tr_items']);
|
||
$pl['price_2'] = $this->calculateMinimalPrice($pl['price2'], $pl['price_2'], $pl['tr_items']);
|
||
|
||
if (empty($pl['data'])) {
|
||
$pl['data'] = '';
|
||
}
|
||
|
||
$itemData = ConversionHelper::dataStringToArray($pl['data']);
|
||
|
||
if ($this->shopId == self::SHOP_2) {
|
||
$itemData['icos'] = 'WL';
|
||
}
|
||
|
||
if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) {
|
||
//Зоны блока +
|
||
$itemData['zonb']++;
|
||
}
|
||
|
||
$is2 = '';
|
||
if ($pl['type'] == 71) {
|
||
$is1 = '<img width="80" src="' . Config::img() . '/i/items/' . $pl['img'] . '"><br>';
|
||
} else {
|
||
$is1 = '<img src="' . Config::img() . '/i/items/' . $pl['img'] . '"><br>';
|
||
}
|
||
if ($this->shopId == self::SHOP_2) {
|
||
$is1 .= '<span id="shopPlus' . $pl['id'] . '"></span>
|
||
<a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . $this->otdel . '&buy=' . $pl['id'] . '&sd4=' . $this->buyer->getNextAct() . '\',\'' . $pl['name'] . '\',\'??\',\' ??.\');">купить</a>';
|
||
} else {
|
||
if ($this->shopId == self::BEREZKA || $this->shopId == self::ARTEFACTS) {
|
||
$is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . $this->otdel . '&buy=' . $pl['id'] . '&sd4=' . $this->buyer->getNextAct() . '\',\'' . $pl['name'] . '\',\'' . $pl['price_2'] . '\',\' екр.\');">купить</a> <a href="javascript:void(0);" onClick="top.payPlus(' . $pl['id'] . ');"><img style="width:11px; height:11px;" src="' . Config::img() . '/i/up.gif" title="Купить несколько предметов"></a>';
|
||
} else {
|
||
$is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . $this->otdel . '&buy=' . $pl['id'] . '&sd4=' . $this->buyer->getNextAct() . '\',\'' . $pl['name'] . '\',\'' . $pl['price_1'] . '\',\' кр.\');">купить</a> <a href="javascript:void(0);" onClick="top.payPlus(' . $pl['id'] . ');"><img style="width:11px; height:11px;" src="' . Config::img() . '/i/up.gif" title="Купить несколько предметов"></a>';
|
||
}
|
||
}
|
||
|
||
//название
|
||
$pl['name'] = $this->align($itemData['tr_align'], $itemData['tr_align_bs']);
|
||
|
||
if (!empty($itemData['renameadd'])) {
|
||
$pl['name'] .= ' (Предмет: ' . $itemData['renameadd'] . ')';
|
||
}
|
||
if (!empty($itemData['icos'])) {
|
||
$pl['name'] = '<span class="icos_' . $itemData['icos'] . '">' . $pl['name'] . ' <span><small> ' . $itemData['icos'] . ' </small></span></span>';
|
||
}
|
||
$is2 .= '<a name="sit_' . $pl['id'] . '" href="/item/' . $pl['item_id'] . '" target="_blank">' . $pl['name'] . '</a> ';
|
||
|
||
|
||
if ($pl['massa'] > 0) {
|
||
$is2 .= '(Масса: ' . round($pl['massa'], 2) . ')';
|
||
}
|
||
|
||
if (isset($itemData['art'])) {
|
||
$is2 .= ' <img title="Артефакт" src="' . Config::img() . '/i/artefact.gif">';
|
||
}
|
||
|
||
$is2 .= $this->destiny($itemData['sudba']);
|
||
|
||
//цена
|
||
if ($this->buyer->isAdmin()) {
|
||
$is2 .= '<div style="float:right"><a href="?otdel=' . $this->otdel . '&itmid=' . $pl['id'] . '&itmup=1#itmdown' . $pl['id'] . '">↑</a> ' . $pl['pos'] . ' <a name="itmdown' . $pl['id'] . '" id="itmdown' . $pl['id'] . '" href="?otdel=' . $this->otdel . '&itmid=' . $pl['id'] . '&itmdown=1#itmdown' . $pl['id'] . '">↓</a></div>';
|
||
}
|
||
|
||
$is2 .= '<br><strong>Цена: ';
|
||
|
||
if ($this->shopId == self::SHOP_2) {
|
||
$is2 .= $this->printColoredValue($this->buyer->getVoinstvennost() >= $pl['price_4'], $pl['price_4']);
|
||
$is2 .= '</strong> <strong></strong> Воинственности ';
|
||
} elseif ($pl['price_3'] > 0) {
|
||
$is2 .= $this->printColoredValue($this->buyer->getMoney3() >= $pl['price_3'], $pl['price_3']);
|
||
$is2 .= ' $ </strong> ';
|
||
} elseif ($this->shopId == self::BEREZKA || $this->shopId == self::ARTEFACTS) {
|
||
$is2 .= '<span style="color:#f93737">';
|
||
$is2 .= $this->printColoredValue($this->buyer->getEuroCredits() >= $pl['price_2'], $pl['price_2']);
|
||
$is2 .= ' екр.</strong></span> ';
|
||
} else {
|
||
$is2 .= $this->printColoredValue($this->buyer->getCredits() >= $pl['price_1'], $pl['price_1']);
|
||
$is2 .= ' кр.</strong> ';
|
||
}
|
||
|
||
if ($pl['pricerep'] > 0) {
|
||
$is2 .= ' <small><strong>(' . round($pl['pricerep'], 2) . ' Воинственности)</strong></small>';
|
||
}
|
||
|
||
if ($pl['kolvo'] < 100000) {
|
||
$is2 .= ' <small>(количество: <strong>' . $pl['kolvo'] . '</strong>)</small>';
|
||
}
|
||
|
||
$is2 .= $this->needItems($pl['tr_items']);
|
||
|
||
//долговечность
|
||
if ($pl['iznos'] > 0) {
|
||
$pl['iznosMAXi'] = $pl['iznos'];
|
||
}
|
||
if ($pl['iznosMAXi'] > 0) {
|
||
if ($pl['iznosMAXi'] == 999999999) {
|
||
$is2 .= 'Долговечность: <span style="color: brown;">неразрушимо</span ><br>';
|
||
} else {
|
||
$is2 .= 'Долговечность: 0/' . $pl['iznosMAXi'] . '<br>';
|
||
}
|
||
}
|
||
|
||
if ($itemData['battleUseZd'] > 0) {
|
||
$is2 .= 'Задержка использования: ' . $this->timeOut($itemData['battleUseZd']) . '<br>';
|
||
}
|
||
|
||
$is2 = rtrim($is2, '<br>');
|
||
|
||
//Срок годности предмета
|
||
if ($itemData['srok'] > 0) {
|
||
$pl['srok'] = $itemData['srok'];
|
||
}
|
||
if ($pl['srok'] > 0) {
|
||
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']);
|
||
}
|
||
if ($pl['magic_chance'] > 0) {
|
||
$is2 .= '<br>Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
|
||
}
|
||
|
||
//Продолжительность действия магии:
|
||
if ((int)$pl['magic_inci'] > 0) {
|
||
$magicDuration = Db::getValue('select actiontime from eff_main where id2 = ?', [(int)$pl['magic_inci']]);
|
||
|
||
if ($magicDuration > 0) {
|
||
$is2 .= '<br>Продолжительность действия: ' . ConversionHelper::secondsToTimeout($magicDuration);
|
||
}
|
||
}
|
||
|
||
//<strong>Требуется минимальное:</strong>
|
||
$tr = '';
|
||
$t = $this->items['tr'];
|
||
$x = 0;
|
||
while ($x < count($t)) {
|
||
$n = $t[$x];
|
||
if (isset($itemData['tr_' . $n]) && $itemData['tr_' . $n] != 0) {
|
||
if ($itemData['tr_' . $n] > $this->stats[$n]) {
|
||
if ($n == 'rep') {
|
||
$temp = explode('::', $itemData['tr_' . $n]);
|
||
if ($this->rep['rep' . $temp[1]] < $temp[0]) {
|
||
$tr .= '<font color="red">';
|
||
$notr++;
|
||
}
|
||
unset($temp);
|
||
} elseif ($n != 'align' || floor($this->buyer->getAlign()) != $itemData['tr_' . $n]) {
|
||
$tr .= '<font color="red">';
|
||
$notr++;
|
||
}
|
||
}
|
||
$tr .= '<br>• ';
|
||
if ($n == 'rep') {
|
||
$temp = explode('::', $itemData['tr_' . $n]);
|
||
$tr .= $this->is[$n] . ' ' . ucfirst(
|
||
str_replace('city', ' city', $temp[1])
|
||
) . ': ' . $temp[0];
|
||
unset($temp);
|
||
} elseif ($n != 'align') {
|
||
if ($n == 'sex') {
|
||
if ($itemData['tr_' . $n] == 1) {
|
||
$tr .= $this->is[$n] . ': Женский';
|
||
} else {
|
||
$tr .= $this->is[$n] . ': Мужской';
|
||
}
|
||
} else {
|
||
$tr .= $this->is[$n] . ': ' . $itemData['tr_' . $n];
|
||
}
|
||
} else {
|
||
$tr .= $this->is[$n] . ': ' . $this->align_nm[$itemData['tr_' . $n]];
|
||
}
|
||
if ($itemData['tr_' . $n] > $this->stats[$n]) {
|
||
if ($n != 'align' || floor($this->buyer->getAlign()) != $itemData['tr_' . $n]) {
|
||
$tr .= '</font>';
|
||
}
|
||
}
|
||
}
|
||
$x++;
|
||
}
|
||
if ($tr != '') {
|
||
$is2 .= '<br><strong>Требуется минимальное:</strong>' . $tr;
|
||
}
|
||
//<strong>Действует на:</strong>
|
||
$tr = '';
|
||
$t = $this->items['add'];
|
||
$x = 0;
|
||
while ($x < count($t)) {
|
||
$n = $t[$x];
|
||
if (isset($itemData['add_' . $n], $this->is[$n])) {
|
||
$z = '+';
|
||
if ($itemData['add_' . $n] < 0) {
|
||
$z = '';
|
||
}
|
||
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $itemData['add_' . $n];
|
||
}
|
||
$x++;
|
||
}
|
||
//действует на (броня)
|
||
$i = 1;
|
||
$bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног'];
|
||
while ($i <= 4) {
|
||
if (isset($itemData['add_mab' . $i])) {
|
||
if ($itemData['add_mab' . $i] == $itemData['add_mib' . $i] && $pl['geniration'] == 1) {
|
||
$z = '+';
|
||
if ($itemData['add_mab' . $i] < 0) {
|
||
$z = '';
|
||
}
|
||
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $z . '' . $itemData['add_mab' . $i];
|
||
} else {
|
||
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $itemData['add_mib' . $i] . '-' . $itemData['add_mab' . $i];
|
||
}
|
||
}
|
||
$i++;
|
||
}
|
||
|
||
if ($tr != '') {
|
||
$is2 .= '<br><strong>Действует на:</strong>' . $tr;
|
||
}
|
||
//<strong>Свойства предмета:</strong>
|
||
$tr = '';
|
||
$t = $this->items['sv'];
|
||
if (isset($itemData['sv_yron_min'], $itemData['sv_yron_max'])) {
|
||
$tr .= '<br>• Урон: ' . $itemData['sv_yron_min'] . ' - ' . $itemData['sv_yron_max'];
|
||
}
|
||
$x = 0;
|
||
while ($x < count($t)) {
|
||
$n = $t[$x];
|
||
if (isset($itemData['sv_' . $n])) {
|
||
$z = '+';
|
||
if ($itemData['sv_' . $n] < 0) {
|
||
$z = '';
|
||
}
|
||
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $itemData['sv_' . $n];
|
||
}
|
||
$x++;
|
||
}
|
||
if ($pl['2too'] == 1) {
|
||
$tr .= '<br>• Второе оружие';
|
||
}
|
||
if ($pl['2h'] == 1) {
|
||
$tr .= '<br>• Двуручное оружие';
|
||
}
|
||
if (isset($itemData['zonb'])) {
|
||
$tr .= '<br>• Зоны блокирования: ';
|
||
if ($itemData['zonb'] > 0) {
|
||
$x = 1;
|
||
while ($x <= $itemData['zonb']) {
|
||
$tr .= '+';
|
||
$x++;
|
||
}
|
||
} else {
|
||
$tr .= '—';
|
||
}
|
||
}
|
||
if ($tr != '') {
|
||
$is2 .= '<br><strong>Свойства предмета:</strong>' . $tr;
|
||
}
|
||
|
||
//Особенности
|
||
|
||
$tr = '';
|
||
|
||
if (isset($itemData['imposed']) && $itemData['imposed'] > 0) {
|
||
if ($itemData['imposed_lvl'] == 0) {
|
||
$rnc = 'maroon';
|
||
} elseif ($itemData['imposed_lvl'] == 1) {
|
||
$rnc = '#624542';
|
||
} elseif ($itemData['imposed_lvl'] == 2) {
|
||
$rnc = '#77090b';
|
||
} elseif ($itemData['imposed_lvl'] == 3) {
|
||
$rnc = '#d99800';
|
||
} else {
|
||
$rnc = '#282828';
|
||
}
|
||
$itemData['imposed_name'] = str_replace('Чары ', '', $itemData['imposed_name']);
|
||
$tr .= '<br>• <span style="color:' . $rnc . ';">Наложены заклятия:</span> ' . $itemData['imposed_name'] . ' ';
|
||
unset($rnc);
|
||
}
|
||
if ($tr != '') {
|
||
$is2 .= '<br><strong>Улучшения предмета:</strong>';
|
||
$is2 .= $tr;
|
||
}
|
||
|
||
|
||
if ($notr == 0 && $pl['magic_inc'] != '') {
|
||
$pl['data'] = 1;
|
||
}
|
||
|
||
if (isset($itemData['free_stats']) && $itemData['free_stats'] > 0) {
|
||
$is2 .= '<br><strong>Распределение статов:</strong><br>';
|
||
$is2 .= '• Возможных распределений: +' . $itemData['free_stats'] . ' характеристик';
|
||
}
|
||
|
||
//Встроенная магия
|
||
if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') {
|
||
if ($pl['magic_inc'] == '') {
|
||
$pl['magic_inc'] = $pl['magic_inci'];
|
||
}
|
||
$mgi = mysql_fetch_array(
|
||
mysql_query(
|
||
'SELECT * FROM `eff_main` WHERE `id2` = "' . $pl['magic_inc'] . '" AND `type1` = "12345" LIMIT 1'
|
||
)
|
||
);
|
||
if (isset($mgi['id2'])) {
|
||
$is2 .= '<div> Встроено заклятие <img height=18 title="' . $mgi['mname'] . '" src="' . Config::img() . '/i/eff/' . $mgi['img'] . '"> ' . $mgi['minfo'] . '</div>';
|
||
}
|
||
}
|
||
|
||
if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
|
||
$pl['data'] = 0;
|
||
}
|
||
if (isset($itemData['complect'])) {
|
||
$is2 .= '<br><i>Дополнительная информация:</i>';
|
||
}
|
||
if (isset($itemData['complect'])) {
|
||
//не отображается
|
||
$com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
|
||
$spc = mysql_query(
|
||
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $itemData['complect'] . '" ORDER BY `x` ASC LIMIT 20'
|
||
);
|
||
while ($plc = mysql_fetch_array($spc)) {
|
||
$com1['name'] = $plc['name'];
|
||
$com1['text'] .= ' • <font color="green">' . $plc['x'] . '</font>: ';
|
||
//действие комплекта
|
||
$i1c = 0;
|
||
$i2c = 0;
|
||
$i1e = ConversionHelper::dataStringToArray($plc['data']);
|
||
while ($i1c < count($this->items['add'])) {
|
||
if (isset($i1e[$this->items['add'][$i1c]])) {
|
||
$i3c = $i1e[$this->items['add'][$i1c]];
|
||
if ($i3c > 0) {
|
||
$i3c = '+' . $i3c;
|
||
}
|
||
if ($i2c > 0) {
|
||
$com1['text'] .= ' ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
|
||
} else {
|
||
$com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
|
||
}
|
||
$com1['text'] .= '<br>';
|
||
$i2c++;
|
||
}
|
||
$i1c++;
|
||
}
|
||
unset($i1c, $i2c, $i3c);
|
||
$com1['x']++;
|
||
}
|
||
$is2 .= '<br>• Часть комплекта: <strong>' . $com1['name'] . '</strong><br><small>';
|
||
$is2 .= $com1['text'];
|
||
$is2 .= '</small>';
|
||
}
|
||
|
||
if ($pl['max_text'] - $pl['use_text'] > 0) {
|
||
$is2 .= '<div>Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '</div>';
|
||
}
|
||
|
||
$is2 .= '<small style="">';
|
||
|
||
if (isset($itemData['gravi'])) {
|
||
$is2 .= '<br>На поверхности выгравирована надпись: <strong>' . $itemData['gravi'] . '</strong>';
|
||
}
|
||
|
||
if ($pl['info'] != '') {
|
||
$is2 .= '<div><strong>Рекомендации:</strong></div><div>' . $pl['info'] . '</div>';
|
||
}
|
||
|
||
if ($itemData['info'] != '') {
|
||
$is2 .= '<div>' . $itemData['info'] . '</div>';
|
||
}
|
||
|
||
if (isset($itemData['noremont'])) {
|
||
$is2 .= '<div style="color:brown;">Предмет не подлежит ремонту</div>';
|
||
}
|
||
|
||
if (isset($itemData['nosale'])) {
|
||
$is2 .= '<div style="color:brown;">Предмет нельзя продать</div>';
|
||
}
|
||
|
||
if (isset($itemData['nomodif'])) {
|
||
$is2 .= '<div style="color:brown;">Предмет нельзя улучшать</div>';
|
||
}
|
||
|
||
if (isset($itemData['nodelete'])) {
|
||
$is2 .= '<div style="color:brown;">Предмет нельзя выбросить</div>';
|
||
}
|
||
|
||
if (isset($itemData['frompisher']) && $itemData['frompisher'] > 0) {
|
||
$is2 .= '<div style="color:brown;">Предмет из подземелья</div>';
|
||
}
|
||
|
||
if (isset($itemData['sleep_moroz']) && $itemData['sleep_moroz'] > 0) {
|
||
$is2 .= '<div style="color:brown;">Предмет не портится во время сна</div>';
|
||
}
|
||
|
||
if (isset($itemData['fromlaba']) && $itemData['fromlaba'] > 0) {
|
||
$is2 .= '<div style="color:brown;">Предмет из лабиринта</div>';
|
||
}
|
||
|
||
if (isset($itemData['vip_sale']) && $itemData['vip_sale'] > 0) {
|
||
$is2 .= '<div style="color:brown;">Предмет куплен за 10% от стоимости</div>';
|
||
}
|
||
|
||
if ($pl['dn_delete'] > 0) {
|
||
$is2 .= '<div style="color:brown;">Предмет будет удален при выходе из подземелья</div>';
|
||
}
|
||
|
||
if (self::ITEM_GENERATION_CURRENT > $pl['geni']) {
|
||
$is2 .= '<div style="color:brown">Предмет устарел</div>';
|
||
}
|
||
|
||
$is2 .= '</small>';
|
||
|
||
$crd = '';
|
||
|
||
if ($this->buyer->isAdmin()) {
|
||
$crd = '<small>
|
||
<a href="javascript:window.open(\'/item_edit_data.php?edit_item_data=' . $pl['id'] . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" target="_blank">Редактировать предмет</a> <a href="/main.php?timeWorld=' . microtime() . '&otdel=' . $this->otdel . '#itmShop' . $pl['id'] . '" name="itmShop' . $pl['id'] . '">обновить</a>
|
||
</small><br>';
|
||
}
|
||
|
||
echo '<tr style="background-color:#' . $cr . ';">
|
||
<td style="padding:7px; text-align: center; vertical-align: middle; width: 100px;">' . $is1 . '</td>
|
||
<td style="padding:7px; vertical-align: top;"><span style="float:right"> ' . $crd . '</span>' . $is2 . '</td>
|
||
</tr>';
|
||
}
|
||
|
||
if (empty($this->wares)) {
|
||
echo '<tr style="background-color:#' . $cr . ';">
|
||
<td style="padding:7px; text-align: center; vertical-align: top;">Прилавок магазина пуст</td>
|
||
</tr>';
|
||
}
|
||
}
|
||
}
|