2023-01-10 19:15:53 +00:00
< ? php
2023-11-02 13:57:39 +00:00
use Core\Db ;
use Helper\Conversion ;
2023-01-10 19:15:53 +00:00
class ComissionShop
{
2023-11-02 13:57:39 +00:00
public function commisionShop ( $preview = 'full' )
2023-01-10 19:15:53 +00:00
{
2023-11-02 13:57:39 +00:00
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 ,
};
2023-01-10 19:15:53 +00:00
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` ASC , 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` ASC , 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 " ) {
2023-08-14 15:15:05 +00:00
$po = Helper\Conversion :: dataStringToArray ( $d [ 'data' ]);
2023-01-10 19:15:53 +00:00
} else {
2023-08-14 15:15:05 +00:00
$po = Helper\Conversion :: dataStringToArray ( $pl [ 'data' ]);
2023-01-10 19:15:53 +00:00
}
if (( $pl [ 'type' ] >= 18 && $pl [ 'type' ] <= 24 ) || $pl [ 'type' ] == 26 || $pl [ 'type' ] == 27 ) {
//Зоны блока +
if ( $pl [ 'inOdet' ] != 14 ) {
$po [ 'zonb' ] ++ ;
}
}
$is2 = '' ;
2023-03-31 18:30:14 +00:00
$is1 = '<img src="//img.new-combats.tech/i/items/' . $pl [ 'img' ] . '"><br>' ;
2023-01-10 19:15:53 +00:00
if ( $preview == " full " ) {
$is1 .= '<a href="?otdel=' . (( int ) $_GET [ 'otdel' ]) . '&toRent=3&itemid=' . ( int ) $_GET [ 'itemid' ] . '&buy=' . $pl [ 0 ] . '&sd4=' . $this -> info [ 'nextAct' ] . '&rnd=' . $code . ' " >купить</a> ' ;
} elseif ( $preview == " preview " ) {
$is1 .= '<a href="?otdel=' . (( int ) $_GET [ 'otdel' ]) . '&toRent=3&itemid=' . $pl [ 'item_id' ] . ' " >Просмотреть</a> ' ;
}
//название
$col = $this -> itemsX ( $pl [ 0 ]);
if ( $col > 1 && $pl [ 'inGroup' ] != 0 && $pl [ 'inGroupCount' ] > 1 ) {
$pl [ 'kolvo' ] = $col ;
$pl [ 'name' ] .= ' (x' . $col . ')' ;
}
2023-03-31 18:30:14 +00:00
$is2 .= '<a href="/item/' . $pl [ 'item_id' ] . '" target="_blank">' . $pl [ 'name' ] . '</a> ' ;
2023-01-10 19:15:53 +00:00
if ( $pl [ 'massa' ] > 0 && $preview == " full " ) {
$is2 .= '(М а с с а : ' . round ( $pl [ 'massa' ], 2 ) . ')' ;
if ( $pl [ 'gift' ] != '' ) {
$ttl = '' ;
if ( $pl [ 'gift' ] == 1 ) {
$ttl = 'Вы не можете передать этот предмет кому-либо' ;
} else {
$ttl = 'Этот предмет подарил ' . $pl [ 'gift' ] . '. Вы не сможете передать этот предмет кому-либо еще' ;
}
2023-03-31 18:30:14 +00:00
$is2 .= ' <img title="' . $ttl . '" src="//img.new-combats.tech/i/podarok.gif">' ;
2023-01-10 19:15:53 +00:00
}
if ( isset ( $po [ 'art' ])) {
2023-03-31 18:30:14 +00:00
$is2 .= ' <img title="Артефакт" src="//img.new-combats.tech/i/artefact.gif">' ;
2023-01-10 19:15:53 +00:00
}
if ( isset ( $po [ 'sudba' ])) {
if ( $po [ 'sudba' ] == '0' ) {
2023-03-31 18:30:14 +00:00
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто наденет е г о . Никто другой не сможет е г о использовать." src="//img.new-combats.tech/i/destiny0.gif">' ;
2023-01-10 19:15:53 +00:00
} elseif ( $po [ 'sudba' ] == '1' ) {
2023-03-31 18:30:14 +00:00
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто возьмет предмет. Никто другой не сможет е г о использовать." src="//img.new-combats.tech/i/destiny0.gif">' ;
2023-01-10 19:15:53 +00:00
} else {
2023-03-31 18:30:14 +00:00
$is2 .= ' <img title="Этот предмет связан общей судьбой с ' . $po [ 'sudba' ] . '. Никто другой не сможет е г о использовать." src="//img.new-combats.tech/i/desteny.gif">' ;
2023-01-10 19:15:53 +00:00
}
}
}
//цена
$is2 .= '<br><strong>Цена: ' ;
if ( $steck [ 0 ] > 1 && $preview == " preview " ) {
$is2 .= $steck [ 3 ] . '-' . $steck [ 4 ] . ' кр.</strong> ' ;
} else {
$is2 .= $pl [ '1price' ] . ' кр.</strong> ' ;
}
if ( $pl [ 'pricerep' ] > 0 ) {
$is2 .= ' <small><strong>(' . round ( $pl [ 'pricerep' ], 2 ) . ' Воинственности)</strong></small>' ;
}
//долговечность
if ( $pl [ 'iznosMAX' ] > 0 ) {
$izcol = '' ;
if ( floor ( $pl [ 'iznosNOW' ]) >= ( floor ( $pl [ 'iznosMAX' ]) - ceil ( $pl [ 'iznosMAX' ]) / 100 * 20 )) {
$izcol = 'brown' ;
}
}
if ( $preview == " preview " ) {
$is2 .= '<br>Долговечность: <font color="' . $izcol . '">' . floor ( $steck [ 1 ]) . '/' . ceil (
$steck [ 2 ]
) . '</font>' ;
} else {
if ( $pl [ 'iznosMAXi' ] == 999999999 ) {
$is2 .= '<br>Долговечность: <font color="brown">неразрушимо</font>' ;
} else {
$is2 .= '<br>Долговечность: <font color="' . $izcol . '">' . floor (
$pl [ 'iznosNOW' ]
) . '/' . ceil ( $pl [ 'iznosMAX' ]) . '</font>' ;
}
}
//Срок годности предмета
if ( $po [ 'srok' ] > 0 ) {
$pl [ 'srok' ] = $po [ 'srok' ];
}
if ( $pl [ 'srok' ] > 0 and $preview != " preview " ) {
if ( $pl [ 'time_create' ] + $pl [ 'srok' ] < time ()) {
$is2 .= '<br>Срок годности: ' . $this -> timeOut ( $pl [ 'srok' ]) . ' (испорчен)' ;
} else {
$is2 .= '<br>Срок годности: ' . $this -> timeOut ( $pl [ 'srok' ]) . ' (до ' . date (
'd.m.Y H:i' , $pl [ 'time_create' ] + $pl [ 'srok' ]
) . ')' ;
}
} elseif ( $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 ) {
$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 .= '<br>Продолжительность действия: ' . $this -> timeOut ( $efi [ 'actionTime' ]);
}
}
if ( $preview == " full " || $preview == " preview " ) {
//<strong>Требуется минимальное:</strong>
$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 .= '<font color="red">' ;
$notr ++ ;
}
unset ( $temp );
} elseif ( $n != 'align' || floor ( $this -> info [ 'align' ]) != $po [ 'tr_' . $n ]) {
$tr .= '<font color="red">' ;
$notr ++ ;
}
}
$tr .= '<br>• ' ;
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 ]) {
if ( $n != 'align' || floor ( $this -> info [ 'align' ]) != $po [ '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 ( $po [ 'add_' . $n ], $this -> is [ $n ])) {
$z = '+' ;
if ( $po [ 'add_' . $n ] < 0 ) {
$z = '' ;
}
$tr .= '<br>• ' . $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 .= '<br>• Броня ' . $bn [ $i ] . ': ' . $z . '' . $po [ 'add_mab' . $i ];
} else {
$tr .= '<br>• Броня ' . $bn [ $i ] . ': ' . $po [ 'add_mib' . $i ] . '-' . $po [ 'add_mab' . $i ] . ' (' . $this -> bronFx (
[ $po [ 'add_mib' . $i ], $po [ 'add_mab' . $i ]]
) . ')' ;
}
}
$i ++ ;
}
if ( $tr != '' ) {
$is2 .= '<br><strong>Действует на:</strong>' . $tr ;
}
//<strong>Свойства предмета:</strong>
$tr = '' ;
$t = $this -> items [ 'sv' ];
if ( isset ( $po [ 'sv_yron_min' ], $po [ 'sv_yron_max' ])) {
$tr .= '<br>• Урон: ' . $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 .= '<br>• ' . $this -> is [ $n ] . ': ' . $z . '' . $po [ 'sv_' . $n ];
}
$x ++ ;
}
if ( $pl [ '2too' ] == 1 ) {
$tr .= '<br>• Второе оружие' ;
}
if ( $pl [ '2h' ] == 1 ) {
$tr .= '<br>• Двуручное оружие' ;
}
if ( isset ( $po [ 'zonb' ])) {
$tr .= '<br>• Зоны блокирования: ' ;
if ( $po [ 'zonb' ] > 0 ) {
$x = 1 ;
while ( $x <= $po [ 'zonb' ]) {
$tr .= '+' ;
$x ++ ;
}
} else {
$tr .= '—' ;
}
}
if ( $tr != '' ) {
$is2 .= '<br><strong>Свойства предмета:</strong>' . $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 .= '<br>• <font color=' . $rnc . '>Наложены заклятия:</font> ' . $po [ 'imposed_name' ] . ' ' ;
unset ( $rnc );
}
if ( $tr != '' ) {
$is2 .= '<br><strong>Улучшения предмета:</strong>' ;
$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 .= '<br><strong>Распределение статов:</strong>' ;
$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 .= '<br><i>Дополнительная информация:</i>' ;
}
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` 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 ;
2023-08-14 15:15:05 +00:00
$i1e = Helper\Conversion :: dataStringToArray ( $plc [ 'data' ]);
2023-01-10 19:15:53 +00:00
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 ( 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' ] .= ' • <font color="green">' . $plc [ 'x' ] . '</font>: ' ;
//действие комплекта
$i1c = 0 ;
$i2c = 0 ;
2023-08-14 15:15:05 +00:00
$i1e = Helper\Conversion :: dataStringToArray ( $plc [ 'data' ]);
2023-01-10 19:15:53 +00:00
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>' ;
}
$is2 .= '<small style="">' ;
if ( isset ( $po [ 'gravi' ])) {
$is2 .= '<br>Н а поверхности выгравирована надпись: <strong>' . $po [ 'gravi' ] . '</strong>' ;
}
if ( $pl [ 'info' ] != '' ) {
$is2 .= '<div><strong>Рекомендации:</strong></div><div>' . $pl [ 'info' ] . '</div>' ;
}
if ( $po [ 'info' ] != '' ) {
$is2 .= '<div>' . $po [ 'info' ] . '</div>' ;
}
if ( $pl [ 'max_text' ] - $pl [ 'use_text' ] > 0 ) {
$is2 .= '<div>Количество символов: ' . ( $pl [ 'max_text' ] - $pl [ 'use_text' ]) . '</div>' ;
}
if ( isset ( $po [ 'noremont' ])) {
$is2 .= '<div style="color:brown;">Предмет не подлежит ремонту</div>' ;
}
if ( isset ( $po [ 'nosale' ])) {
$is2 .= '<div style="color:brown;">Предмет нельзя продать</div>' ;
}
if ( isset ( $po [ 'nomodif' ])) {
$is2 .= '<div style="color:brown;">Предмет нельзя улучшать</div>' ;
}
if ( isset ( $po [ 'nodelete' ])) {
$is2 .= '<div style="color:brown;">Предмет нельзя выбросить</div>' ;
}
if ( isset ( $po [ 'frompisher' ]) && $po [ 'frompisher' ] > 0 ) {
$is2 .= '<div style="color:brown;">Предмет из подземелья</div>' ;
}
if ( isset ( $po [ 'sleep_moroz' ]) && $po [ 'sleep_moroz' ] > 0 ) {
$is2 .= '<div style="color:brown;">Предмет не портится во время сна</div>' ;
}
if ( isset ( $po [ 'fromlaba' ]) && $po [ 'fromlaba' ] > 0 ) {
$is2 .= '<div style="color:brown;">Предмет из лабиринта</div>' ;
}
if ( isset ( $po [ 'vip_sale' ]) && $po [ 'vip_sale' ] > 0 ) {
$is2 .= '<div style="color:brown;">Предмет куплен за 10% от стоимости</div>' ;
}
if ( $pl [ 'dn_delete' ] > 0 ) {
$is2 .= '<div style="color:brown;">Предмет будет удален при выходе из подземелья</div>' ;
}
if ( isset ( $po [ 'zazuby' ]) && $po [ 'zazuby' ] > 0 ) {
$is2 .= '<div style="color:brown;">Предмет куплен за зубы</div>' ;
}
$is2 .= '</small>' ;
}
if ( $preview == " preview " ) {
$kolvoprint = " <small style= \" float:right; color:grey; \" align= \" right \" >Количество: <strong> $steck[0] </strong> шт.</small> " ;
}
echo '<tr style="background-color:#' . $cr . ';"><td width="100" style="padding:7px;" valign="middle" align="center">' . $is1 . '</td><td style="padding:7px;" valign="top">' . $kolvoprint . $is2 . '</td></tr>' ;
$i ++ ;
}
}
if ( $i == 0 ) {
echo '<tr style="background-color:#' . $cr . ';"><td style="padding:7px;" align="center" valign="top">Прилавок магазина пуст</td></tr>' ;
}
}
2023-11-02 13:57:39 +00:00
public function buyItem ( int $iid , User $u ) : string
{
$irow = Db :: getRow ( ' select items_users . id , uid , 1 price , 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 = $u -> itemsX ( $iid );
if ( $col > 1 ) {
Db :: sql ( ' update items_users set uid = ? , inGroup = inGroup + 1000 , 1 price = ? , 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 = ? , 1 price = ? , 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 кр.<br>Предмет успешно добавлен в инвентарь. " ;
}
}
return '<div>' . $r . '</div>' ;
}
public function rent ( $action , int $iid , int $price , User $u )
{
if ( $action == " Сдать в магазин " && $price > 0 ) {
$ChImtem = mysql_fetch_array (
mysql_query (
'SELECT `id`, `item_id`, `data`, `inGroup`, `uid` FROM `items_users` WHERE `id` = ' . $iid . ' LIMIT 1'
)
);
$ChSudba = Conversion :: dataStringToArray ( $ChImtem [ 'data' ]);
if ( ! isset ( $ChSudba [ 'sudba' ]) && $ChSudba [ 'sudba' ] == 0 && $ChSudba [ 'sudba' ] != 1 && ! isset ( $ChSudba [ 'toclan' ])) {
if ( isset ( $ChImtem [ 'inGroup' ]) && $ChImtem [ 'inGroup' ] > 0 ) {
$col = $u -> itemsX ( $ChImtem [ 'id' ]);
if ( $col > 1 ) {
mysql_query (
'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `item_id`="' . $ChImtem [ 'item_id' ] . '" AND `uid`="' . $ChImtem [ 'uid' ] . '" AND `inGroup` = "' . $ChImtem [ 'inGroup' ] . '" LIMIT ' . $col . ''
);
} else {
mysql_query (
'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `uid` = "' . $u -> info [ 'id' ] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
);
}
} else {
mysql_query (
'UPDATE `items_users` set `inShop` = 30, `1price` = ' . $price . ' where `uid` = "' . $u -> info [ 'id' ] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
);
}
}
} elseif ( $action == " Забрать " ) {
$i = mysql_fetch_array (
mysql_query (
' SELECT `im` . `price1` ,
`iu` .* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON ( `im` . `id` = `iu` . `item_id` ) WHERE `iu` . `id` = " ' . $iid . ' " AND `iu` . `inShop` = " 30 " AND `iu` . `delete` = " 0 " LIMIT 1 '
)
);
if ( isset ( $i [ 'inGroup' ]) and $i [ 'inGroup' ] > 0 ) {
$col = $u -> itemsX ( $i [ 'id' ]);
if ( $col > 1 ) {
mysql_query (
'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i [ 'price1' ] . ' WHERE `item_id`="' . $i [ 'item_id' ] . '" AND `inShop` = "30" AND `uid`="' . $i [ 'uid' ] . '" AND `inGroup` = "' . $i [ 'inGroup' ] . '" LIMIT ' . $col . ''
);
} else {
mysql_query (
'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i [ 'price1' ] . ' WHERE `uid` = "' . $u -> info [ 'id' ] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
);
}
} else {
mysql_query (
'UPDATE `items_users` SET `inShop` = 0, `1price` = "' . $i [ 'price1' ] . '" WHERE `id` = "' . $iid . '" and `inShop` = "30" LIMIT 1'
);
}
}
}
2023-01-10 19:15:53 +00:00
}