info = User::start()->info; $this->rep = User::start()->rep; $this->stats = User::start()->stats; $this->is = User::start()->is; $this->align_nm = User::start()->align_nm; $itemStatNames = new Stat(); $itemStatNames->getBonus(); $itemStatNames->getRequirement(); $this->items['tr'] = $itemStatNames->sysRequirementNames; } public function commisionShop($preview = 'full'): void { global $code; $typeOtdel = match ((int)$_GET['otdel']) { 2 => 19, 3 => 20, 4 => 21, 5 => 22, 6 => 15, 7 => 12, 8 => 4, 9 => 5, 10 => 6, 11 => 1, 12 => 3, 13 => 8, 14 => 14, 15 => 13, 16 => 9, 17 => 10, 18 => 11, 19 => 29, 20 => 30, 1050 => 1050, default => 18, }; if ($typeOtdel != 1050) { if ($preview == "full") { $cl = mysql_query( 'SELECT `items_users`.`id`,`items_users`.`item_id`,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id`,`items_main`.`name`,`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,`items_main`.`lvl_aexp`, count(`items_users`.`id`) as inGroupCount FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` = "' . mysql_real_escape_string( $typeOtdel ) . '" and `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" GROUP BY `items_users`.`inGroup`, `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup > 0 UNION ALL SELECT `items_users`.`id`,`items_users`.`item_id`,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id`,`items_main`.`name`,`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,`items_main`.`lvl_aexp`, count(`items_users`.`id`) as inGroupCount FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` = "' . mysql_real_escape_string( $typeOtdel ) . '" and `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" GROUP BY `items_users`.`uid`, `items_users`.`1price` HAVING `items_users`.inGroup = 0 ORDER BY `1price`, inGroupCount DESC' ); } else { $cl = mysql_query( 'SELECT `items_users`.`id`,`items_users`.`item_id`,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id`,`items_main`.`name`,`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,`items_main`.`lvl_aexp` FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` = "' . mysql_real_escape_string( $typeOtdel ) . '" GROUP BY `items_users`.`item_id` ORDER BY `items_main`.`id` DESC' ); } } else { if ($preview == "full") { $cl = mysql_query( 'SELECT `items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item_id` as item_id,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`, `items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`, `items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`, `items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`, `items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id` as item_id,`items_main`.`name`, `items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`, `items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`, `items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`, `items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`, `items_main`.`lvl_aexp` , count(`items_users`.`id`) as inGroupCount FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30" GROUP BY `items_users`.`inGroup`, `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup > 0 UNION ALL SELECT `items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item_id` as item_id,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`, `items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`, `items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`, `items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`, `items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id` as item_id,`items_main`.`name`, `items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`, `items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`, `items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`, `items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`, `items_main`.`lvl_aexp`, count(`items_users`.`id`) as inGroupCount FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp() OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30" GROUP BY `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup = 0 ORDER BY `1price`, inGroupCount DESC' ); } else { $cl = mysql_query( 'select items_users.id, items_users.id as idu,items_users.item_id,items_users.`1price`,items_users.`2price`,items_users.uid,items_users.use_text,items_users.data,items_users.inOdet,items_users.inShop,items_users.`delete`,items_users.iznosNOW,items_users.iznosMAX,items_users.gift,items_users.gtxt1,items_users.gtxt2,items_users.kolvo,items_users.geniration,items_users.magic_inc,items_users.maidin,items_users.lastUPD,items_users.timeOver,items_users.overType,items_users.secret_id,items_users.time_create,items_users.inGroup,items_users.dn_delete,items_users.inTransfer,items_users.post_delivery,items_users.lbtl_,items_users.bexp,items_users.so,items_users.blvl,items_main.id,items_main.name,items_main.img,items_main.type,items_main.inslot,items_main.`2h`,items_main.`2too`,items_main.iznosMAXi,items_main.inRazdel,items_main.price1,items_main.price2,items_main.magic_chance,items_main.info,items_main.massa,items_main.level,items_main.magic_inci,items_main.overTypei,items_main.`group`,items_main.group_max,items_main.geni,items_main.ts,items_main.srok,items_main.class,items_main.class_point,items_main.anti_class,items_main.anti_class_point,items_main.max_text,items_main.useInBattle,items_main.lbtl,items_main.lvl_itm,items_main.lvl_exp,items_main.lvl_aexp from items_users left join items_main on (items_main.id = items_users.item_id) where (( items_users.time_create + items_main.srok) > unix_timestamp() or items_main.srok = "0") and items_users.`delete`="0" and items_users.inOdet="0" and items_users.inShop="30" and items_main.type != "18" and items_main.type != "19" and items_main.type != "20" and items_main.type != "21" and items_main.type != "22" and items_main.type != "15" and items_main.type != "12" and items_main.type != "4" and items_main.type != "5" and items_main.type != "6" and items_main.type != "1" and items_main.type != "3" and items_main.type != "8" and items_main.type != "14" and items_main.type != "13" and items_main.type != "9" and items_main.type != "10" and items_main.type != "11" and items_main.type != "29" and items_main.type != "30" group by items_users.item_id order by items_main.id desc' ); } } $cr = 'c8c8c8'; $i = 0; $steckCikl = 1; while ($pl = mysql_fetch_array($cl)) { // количетсво одинаковых предметов в комке if ($preview == "preview") { $steck = ['--', '--', '--', '--']; } if ($cr == 'd4d4d4') { $cr = 'c8c8c8'; } else { $cr = 'd4d4d4'; } if ($preview == "preview" && ($steck[0] > 1 && $steck[0] > $steckCikl)) { ++$steckCikl; } else { $steckCikl = 1; $d = mysql_fetch_array( mysql_query( 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $pl['item_id'] . '" LIMIT 1' ) ); if ($steck[0] > 1 && $preview == "preview") { $po = Helper\Conversion::dataStringToArray($d['data']); } else { $po = Helper\Conversion::dataStringToArray($pl['data']); } if ((($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) && $pl['inOdet'] != 14) { //Зоны блока + $po['zonb']++; } $is2 = ''; $is1 = '
'; if ($preview == "full") { $is1 .= 'купить '; } elseif ($preview == "preview") { $is1 .= 'Просмотреть '; } //название $col = ItemsModel::itemsX($pl[0]); if ($col > 1 && $pl['inGroup'] != 0 && $pl['inGroupCount'] > 1) { $pl['kolvo'] = $col; $pl['name'] .= ' (x' . $col . ')'; } $is2 .= '' . $pl['name'] . '    '; if ($pl['massa'] > 0 && $preview == "full") { $is2 .= '(Масса: ' . round($pl['massa'], 2) . ')'; if ($pl['gift'] != '') { if ($pl['gift'] == 1) { $ttl = 'Вы не можете передать этот предмет кому-либо'; } else { $ttl = 'Этот предмет подарил ' . $pl['gift'] . '. Вы не сможете передать этот предмет кому-либо еще'; } $is2 .= ' '; } if (isset($po['art'])) { $is2 .= ' Артефакт'; } if (isset($po['sudba'])) { $is2 .= match ($po['sudba']) { '0' => ' ', '1' => ' ', default => ' ', }; } } //цена $is2 .= '
Цена: '; if ($steck[0] > 1 && $preview == "preview") { $is2 .= $steck[3] . '-' . $steck[4] . ' кр. '; } else { $is2 .= $pl['1price'] . ' кр. '; } if ($pl['pricerep'] > 0) { $is2 .= ' (' . round($pl['pricerep'], 2) . ' Воинственности)'; } //долговечность $is2 .= '
Долговечность: '; if ($preview == "preview") { $durability = floor($steck[1]) . '/' . ceil($steck[2]); } else { if ($pl['iznosMAXi'] == 999999999) { $durability = 'неразрушимо'; } else { $durability = floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']); } } if ($pl['iznosMAX'] > 0 && floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) { $durability = "$durability"; } $is2 .= $durability; //Срок годности предмета if ($po['srok'] > 0) { $pl['srok'] = $po['srok']; $is2 .= '
Срок годности: '; } if ($pl['srok'] > 0 && $preview != "preview") { if ($pl['time_create'] + $pl['srok'] < time()) { $is2 .= $this->timeOut($pl['srok']) . ' (испорчен)'; } else { $is2 .= $this->timeOut($pl['srok']) . ' (до ' . date('d.m.Y H:i', $pl['time_create'] + $pl['srok']) . ')'; } } elseif ($pl['srok'] > 0) { $is2 .= $this->timeOut($pl['srok']); } if ($pl['magic_chance'] > 0) { $is2 .= '
Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%'; } //Продолжительность действия магии: if ((int)$pl['magic_inci'] > 0) { $efi = mysql_fetch_array( mysql_query( 'SELECT `id2`,`mname`,`type1`,`img`,`mdata`,`actionTime`,`type2`,`type3`,`onlyOne`,`oneType`,`noAce`,`see`,`info`,`overch`,`bp`,`noch` FROM `eff_main` WHERE `id2` = "' . ((int)$pl['magic_inci']) . '" LIMIT 1' ) ); if (isset($efi['id2']) && $efi['actionTime'] > 0) { $is2 .= '
Продолжительность действия: ' . $this->timeOut($efi['actionTime']); } } if ($preview == "full" || $preview == "preview") { //Требуется минимальное: $tr = ''; $t = $this->items['tr']; $x = 0; while ($x < count($t)) { $n = $t[$x]; if (isset($po['tr_' . $n]) && $po['tr_' . $n] != 0) { if ($po['tr_' . $n] > $this->stats[$n]) { if ($n == 'rep') { $temp = explode('::', $po['tr_' . $n]); if ($this->rep['rep' . $temp[1]] < $temp[0]) { $tr .= ''; $notr++; } unset($temp); } elseif ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) { $tr .= ''; $notr++; } } $tr .= '
• '; if ($n == 'rep') { $temp = explode('::', $po['tr_' . $n]); $tr .= $this->is[$n] . ' ' . ucfirst( str_replace('city', ' city', $temp[1]) ) . ': ' . $temp[0]; unset($temp); } elseif ($n != 'align') { if ($n == 'sex') { if ($po['tr_' . $n] == 1) { $tr .= $this->is[$n] . ': Женский'; } else { $tr .= $this->is[$n] . ': Мужской'; } } else { $tr .= $this->is[$n] . ': ' . $po['tr_' . $n]; } } else { $tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]]; } if ($po['tr_' . $n] > $this->stats[$n] && ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n])) { $tr .= '
'; } } $x++; } if ($tr != '') { $is2 .= '
Требуется минимальное:' . $tr; } //Действует на: $tr = ''; $t = $this->items['add']; $x = 0; while ($x < count($t)) { $n = $t[$x]; if (isset($po['add_' . $n], $this->is[$n])) { $z = '+'; if ($po['add_' . $n] < 0) { $z = ''; } $tr .= '
• ' . $this->is[$n] . ': ' . $z . $po['add_' . $n]; } $x++; } //действует на (броня) $i = 1; $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног']; while ($i <= 4) { if (isset($po['add_mab' . $i])) { if ($po['add_mab' . $i] == $po['add_mib' . $i] && $pl['geniration'] == 1) { $z = '+'; if ($po['add_mab' . $i] < 0) { $z = ''; } $tr .= '
• Броня ' . $bn[$i] . ': ' . $z . $po['add_mab' . $i]; } else { $tr .= '
• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i] . ' (' . $this->bronFx( [$po['add_mib' . $i], $po['add_mab' . $i]] ) . ')'; } } $i++; } if ($tr != '') { $is2 .= '
Действует на:' . $tr; } //Свойства предмета: $tr = ''; $t = $this->items['sv']; if (isset($po['sv_yron_min'], $po['sv_yron_max'])) { $tr .= '
• Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max']; } $x = 0; while ($x < count($t)) { $n = $t[$x]; if (isset($po['sv_' . $n])) { $z = '+'; if ($po['sv_' . $n] < 0) { $z = ''; } $tr .= '
• ' . $this->is[$n] . ': ' . $z . $po['sv_' . $n]; } $x++; } if ($pl['2too'] == 1) { $tr .= '
• Второе оружие'; } if ($pl['2h'] == 1) { $tr .= '
• Двуручное оружие'; } if (isset($po['zonb'])) { $tr .= '
• Зоны блокирования: '; if ($po['zonb'] > 0) { $x = 1; while ($x <= $po['zonb']) { $tr .= '+'; $x++; } } else { $tr .= '—'; } } if ($tr != '') { $is2 .= '
Свойства предмета:' . $tr; } $tr = ''; if (isset($po['imposed']) && $po['imposed'] > 0) { if ($po['imposed_lvl'] == 0) { $rnc = 'maroon'; } elseif ($po['imposed_lvl'] == 1) { $rnc = '#624542'; } elseif ($po['imposed_lvl'] == 2) { $rnc = '#77090b'; } elseif ($po['imposed_lvl'] == 3) { $rnc = '#d99800'; } else { $rnc = '#282828'; } $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']); $tr .= '
Наложены заклятия: ' . $po['imposed_name'] . ' '; unset($rnc); } if ($tr != '') { $is2 .= '
Улучшения предмета:'; $is2 .= $tr; } if ($notr == 0) { $d[0] = 1; if ($pl['magic_inc'] != '') { $d[2] = 1; } } if (isset($po['free_stats']) && $po['free_stats'] > 0) { $is2 .= '
Распределение статов:'; $is2 .= '• Возможных распределений: ' . $po['free_stats']; } if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) { $d[0] = 0; $d[2] = 0; } if (isset($po['complect']) || isset($po['complect2'])) { $is2 .= '
Дополнительная информация:'; } if (isset($po['complect'])) { //не отображается $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; $spc = mysql_query( 'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` LIMIT 20' ); while ($plc = mysql_fetch_array($spc)) { $com1['name'] = $plc['name']; $com1['text'] .= '    • ' . $plc['x'] . ': '; //действие комплекта $i1c = 0; $i2c = 0; $i1e = Helper\Conversion::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'] .= '
'; $i2c++; } $i1c++; } unset($i1c, $i2c, $i3c); $com1['x']++; } $is2 .= '
• Часть комплекта: ' . $com1['name'] . '
'; $is2 .= $com1['text']; $is2 .= ''; } if (isset($po['complect2'])) { //не отображается $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => '']; $spc = mysql_query( 'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect2'] . '" ORDER BY `x` ASC LIMIT 20' ); while ($plc = mysql_fetch_array($spc)) { $com1['name'] = $plc['name']; $com1['text'] .= '    • ' . $plc['x'] . ': '; //действие комплекта $i1c = 0; $i2c = 0; $i1e = Helper\Conversion::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'] .= '
'; $i2c++; } $i1c++; } unset($i1c, $i2c, $i3c); $com1['x']++; } $is2 .= '
• Часть комплекта (подгонка): ' . $com1['name'] . '
'; $is2 .= $com1['text']; $is2 .= ''; } $is2 .= ''; if (isset($po['gravi'])) { $is2 .= '
На поверхности выгравирована надпись: ' . $po['gravi'] . ''; } if ($pl['info'] != '') { $is2 .= '
Рекомендации:
' . $pl['info'] . '
'; } if ($po['info'] != '') { $is2 .= '
' . $po['info'] . '
'; } if ($pl['max_text'] - $pl['use_text'] > 0) { $is2 .= '
Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
'; } if (isset($po['noremont'])) { $is2 .= '
Предмет не подлежит ремонту
'; } if (isset($po['nosale'])) { $is2 .= '
Предмет нельзя продать
'; } if (isset($po['nomodif'])) { $is2 .= '
Предмет нельзя улучшать
'; } if (isset($po['nodelete'])) { $is2 .= '
Предмет нельзя выбросить
'; } if (isset($po['frompisher']) && $po['frompisher'] > 0) { $is2 .= '
Предмет из подземелья
'; } if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) { $is2 .= '
Предмет не портится во время сна
'; } if (isset($po['fromlaba']) && $po['fromlaba'] > 0) { $is2 .= '
Предмет из лабиринта
'; } if (isset($po['vip_sale']) && $po['vip_sale'] > 0) { $is2 .= '
Предмет куплен за 10% от стоимости
'; } if ($pl['dn_delete'] > 0) { $is2 .= '
Предмет будет удален при выходе из подземелья
'; } $is2 .= '
'; } if ($preview == "preview") { $kolvoprint = "Количество: $steck[0] шт."; } echo '' . $is1 . '' . $kolvoprint . $is2 . ''; $i++; } } if ($i == 0) { echo 'Прилавок магазина пуст'; } } private function timeOut(int|string $seconds): string { return Conversion::secondsToTimeout($seconds); } private function bronFx($br): string { $r = ''; if ($br[0] > 0) { $r .= $br[0] - 1; } else { $r .= 0; } $r .= 'd'; if ($br[0] > 0) { $r .= $br[1] - $br[0]; } else { $r .= 0; } return $r; } public function buyItem(int $iid, User $u): string { $irow = Db::getRow('select items_users.id, uid, 1price, inGroup, inShop, data, item_id, login, items_main.name, price1 from items_users left join users on users.id = uid left join items_main on items_main.id = item_id where items_users.id = ? and inShop = 30', [$iid]); $price = $irow['1price']; if (!isset($irow['id']) || !isset($iid) || $irow['inShop'] != 30) { $r = 'Предмет не найден на прилавке'; } else { if ($price > $u->info['money']) { $r = 'У вас недостаточно денег (не хватает ' . ($price - $u->info['money']) . ' кр.)'; } else { $u->addKr(-$price); $u->addKr($price, $irow['uid']); $col = ItemsModel::itemsX($iid); if ($col > 1) { Db::sql('update items_users set uid = ?, inGroup = inGroup + 1000, 1price = ?, lastUPD = unix_timestamp(), inShop = 0 where inShop = 30 and inOdet = 0 and item_id = ? and uid = ? and inGroup = ? limit ?', [$u->info['id'], $irow['price1'], $irow['item_id'], $irow['uid'], $irow['inGroup'], $col]); $irow['name'] .= "(x$col)"; } else { Db::sql('update items_users set uid = ?, 1price = ?, lastUPD = unix_timestamp(), inShop = 0 where id = ? and uid = ? and inOdet = 0', [$iid, $irow['uid']]); } Delo::add(1, 'comShop', $u->info['id'], "Купил предмет «{$irow['name']}» у игрока {$irow['login']} за $price кр.", $price); Delo::add(1, 'comShop', $irow['uid'], "Продал предмет «{$irow['name']}» игроку {$irow['login']} за $price кр."); $r = "Вы купили предмет «{$irow['name']}» у игрока {$irow['login']} за $price кр.
Предмет успешно добавлен в инвентарь."; } } return '
' . $r . '
'; } public function rent($action, int $iid, int $price): void { if ($action == "Сдать в магазин" && $price > 0) { $this->rentPut($iid, $price); } elseif ($action == "Забрать") { $this->rentTake($iid); } } private function rentPut(int $id, int $price): void { $item = Db::getRow('select id, item_id, data, ingroup, uid from items_users where id = ?', [$id]); $data = Conversion::dataStringToArray($item['data']); $col = ItemsModel::itemsX($item['id']); if (isset($data['sudba']) || $data['sudba'] != 0 || isset($data['toclan'])) { return; } if (!isset($item['ingroup']) || $item['ingroup'] <= 0 || $col < 2) { Db::sql('update items_users set inShop = 30, 1price = ? where id = ? and uid = ? and inOdet = 0', [$price, $id, $item['uid']]); return; } Db::sql('update items_users set inShop = 30, 1price = ? where item_id = ? and uid = ? and inGroup = ? limit ?', [$price, $item['id'], $item['uid'], $item['ingroup'], (int)$col]); } private function rentTake(int $id): void { $item = Db::getRow('select items_users.*, price1, inGroup from items_users inner join items_main on items_main.id = item_id where items_users.id = ? and inShop = 30 limit 1', [$id]); if (!isset($item['inGroup']) || $item['inGroup'] <= 0) { Db::sql('update items_users set inShop = 0, 1price = ? where id = ? and inShop = 30', [$item['price1'], $id]); return; } $col = ItemsModel::itemsX($item['id']); if ($col > 1) { Db::sql('update items_users set inShop = 0, 1price = ? where item_id = ? and uid = ? and inGroup = ? and inShop = 30 limit ?', [$item['price1'], $item['item_id'], $item['uid'], $item['ingroup'], (int)$col]); } else { Db::sql('update items_users set inShop = 0, 1price = ? where id = ? and uid = ? and inOdet = 0', [$item['price1'], $id, $item['uid']]); } } }