2022-06-06 21:30:34 +00:00
< ? php
if ( ! defined ( 'GAME' ))
{
die ();
}
if ( isset ( $file ) && $file [ 0 ] == 'shop_kat.php' )
{
if ( ! isset ( $_GET [ 'otdel' ])) {
$_GET [ 'otdel' ] = 1 ;
}
$sid = 44 ;
$error = '' ;
if ( isset ( $_GET [ 'buy' ])){
if ( $u -> newAct ( $_GET [ 'sd4' ]) == true ){
$re = $u -> buyItem ( $sid ,( int ) $_GET [ 'buy' ],( int ) $_GET [ 'x' ], 'frompisher=' . $d -> info [ 'id2' ] . '|nosale=1' );
} else {
2023-01-10 16:29:32 +00:00
$re = 'Вы уверены что хотите купить этот предмет?' ;
2022-06-06 21:30:34 +00:00
}
} elseif ( isset ( $_GET [ 'sale' ]) && isset ( $_GET [ 'item' ]) && $u -> newAct ( $_GET [ 'sd4' ])){
$id = ( int ) $_GET [ 'item' ];
$itm = mysql_fetch_array ( mysql_query ( ' SELECT `im` .* , `iu` .* , count ( `iuu` . id ) as inGroupCount
FROM `items_users` AS `iu`
LEFT JOIN `items_main` AS `im` ON ( `im` . `id` = `iu` . `item_id` )
LEFT JOIN `items_users` as `iuu` ON ( `iuu` . inGroup = `iu` . inGroup AND `iuu` . item_id = `im` . id )
WHERE `iuu` . `uid` = " '. $u->info ['id'].' " AND `iu` . `uid` = " '. $u->info ['id'].' " AND `iu` . `delete` = " 0 " AND `iu` . `inOdet` = " 0 " AND `iu` . `inShop` = " 0 " AND `iu` . `id` = " '.mysql_real_escape_string( $id ).' " LIMIT 1 ' ));
$po = $u -> lookStats ( $itm [ 'data' ]);
if ( $u -> info [ 'allLock' ] > time ()) {
$po [ 'nosale' ] = 1 ;
}
if ( ( $itm [ 'gift' ] != '' && $itm [ 'gift' ] != '0' ) && ( $itm [ 'type' ] == 37 || $itm [ 'type' ] == 38 || $itm [ 'type' ] == 39 || $itm [ 'type' ] == 63 ) ) {
2023-01-10 16:29:32 +00:00
$error = 'Нельзя продавать подарки, они должны оставаться на память! :)' ;
2022-06-06 21:30:34 +00:00
} elseif ( isset ( $po [ 'nosale' ])){
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось продать предмет, запрет продажи данного предмета ...' ;
2022-06-06 21:30:34 +00:00
} elseif ( $pl [ 'type' ] < 29 && ( $po [ 'srok' ] > 0 || $pl [ 'srok' ] > 0 ) && $pl [ 'type' ] != 28 ){
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось продать предмет, вышел срок годности ...' ;
2022-06-06 21:30:34 +00:00
} elseif ( isset ( $po [ 'frompisher' ])){
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось продать предмет, предмет из подземелья ...' ;
2022-06-06 21:30:34 +00:00
} elseif ( isset ( $po [ 'fromlaba' ])){
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось продать предмет, предмет из лабиринта продается за воинственность ...' ;
2022-06-06 21:30:34 +00:00
} elseif ( isset ( $itm [ 'id' ])){
if ( $itm [ '1price' ] > 0 ){
$itm [ 'price1' ] = $itm [ '1price' ];
}
$shpCena = $itm [ 'price1' ];
$plmx = 0 ;
if ( $itm [ 'iznosMAXi' ] != $itm [ 'iznosMAX' ] && $itm [ 'iznosMAX' ] != 0 ){
$plmx = $itm [ 'iznosMAX' ];
} else {
$plmx = $itm [ 'iznosMAXi' ];
}
if ( $itm [ 'iznosNOW' ] > 0 ){
$prc1 = floor ( $itm [ 'iznosNOW' ]) / ceil ( $plmx ) * 100 ;
} else {
$prc1 = 0 ;
}
$shpCena = $u -> shopSaleM ( $shpCena , $itm );
$shpCena = $shpCena / 100 * ( 100 - $prc1 );
if ( $itm [ 'iznosMAXi' ] < 999999999 ) {
if ( $itm [ 'iznosMAX' ] > 0 && $itm [ 'iznosMAXi' ] > 0 && $itm [ 'iznosMAXi' ] > ceil ( $itm [ 'iznosMAX' ])){
$shpCena = $shpCena / 100 * ( ceil ( $itm [ 'iznosMAX' ]) / $itm [ 'iznosMAXi' ] * 100 );
}
}
$shpCena = $u -> round2 ( $shpCena / 100 * ( 100 - $shopProcent ));
if ( $shpCena < 0 ){
$shpCena = 0 ;
}
$col = $u -> itemsX ( $itm [ 'id' ]);
if ( $col > 0 ){
$shpCena = $shpCena * $col ;
}
if ( $shpCena < 0 ){
$shpCena = 0 ;
}
$upd2 = mysql_query ( 'UPDATE `items_users` SET `delete` = "' . time () . '" WHERE `id` = "' . $itm [ 'id' ] . '" LIMIT 1' );
if ( $upd2 ){
if ( $col > 1 ){
mysql_query ( 'UPDATE `items_users` SET `delete` = "' . time () . '" WHERE `item_id`="' . $itm [ 'item_id' ] . '" AND `uid`="' . $itm [ 'uid' ] . '" AND `inGroup` = "' . $itm [ 'inGroup' ] . '" LIMIT ' . $col . '' );
}
$u -> info [ 'money' ] += $shpCena ;
$upd = mysql_query ( 'UPDATE `users` SET `money` = "' . $u -> info [ 'money' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1' );
if ( $upd ) {
2023-01-10 16:29:32 +00:00
$error = 'Вы успешно продали предмет "' . $itm [ 'name' ] . ' (x' . $col . ')" за ' . $shpCena . ' кр.' ;
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `items_users` SET `inGroup` = "0",`delete` = "' . time () . '" WHERE `inGroup` = "' . $itm [ 'id' ] . '" AND `uid` = "' . $u -> info [ 'id' ] . '" LIMIT ' . $itm [ 'group_max' ] . '' );
2023-01-10 16:29:32 +00:00
$u -> addDelo ( 2 , $u -> info [ 'id' ], '"<font color="green">System.shop</font>": Предмет "' . $itm [ 'name' ] . ' (x' . $col . ')" [itm:' . $itm [ 'id' ] . '] был продан в магазин за <B>' . $shpCena . ' кр.</B>.' , time (), $u -> info [ 'city' ], 'System.shop' , 0 , 0 );
2022-06-06 21:30:34 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u -> addDelo ( 2 , $u -> info [ 'id' ], '"<font color="green">System.shop</font>": Предмет "' . $itm [ 'name' ] . ' (x' . $col . ')" [itm:' . $itm [ 'id' ] . '] был продан в магазин за <B>' . $shpCena . ' кр.</B> (кредиты не переведены).' , time (), $u -> info [ 'city' ], 'System.shop' , 0 , 0 );
$error = 'Н е удалось продать предмет...' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось продать предмет...' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$error = 'Предмет не найден в инвентаре.' ;
2022-06-06 21:30:34 +00:00
}
} elseif ( isset ( $_GET [ 'sale' ]) && isset ( $_GET [ 'item_rep' ]) && $u -> newAct ( $_GET [ 'sd4' ]) ) {
$id = ( int ) $_GET [ 'item_rep' ];
$itm = mysql_fetch_array ( mysql_query ( 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $u -> info [ 'id' ] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `im`.`pricerep` > 0 AND `iu`.`inShop`="0" AND `iu`.`id` = "' . mysql_real_escape_string ( $id ) . '" LIMIT 1' ));
$po = $u -> lookStats ( $itm [ 'data' ]);
if ( $u -> info [ 'allLock' ] > time ()) {
$po [ 'nosale' ] = 1 ;
}
if ( isset ( $po [ 'nosale' ])){
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось продать предмет, запрет продажи данного предмета ...' ;
2022-06-06 21:30:34 +00:00
} elseif ( $pl [ 'type' ] < 29 && ( $po [ 'srok' ] > 0 || $pl [ 'srok' ] > 0 )){
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось продать предмет, вышел срок годности ...' ;
2022-06-06 21:30:34 +00:00
} elseif ( isset ( $po [ 'frompisher' ])){
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось продать предмет, предмет из подземелья ...' ;
2022-06-06 21:30:34 +00:00
} elseif ( isset ( $itm [ 'id' ])){
$shpCena = $itm [ 'pricerep' ];
$plmx = 0 ;
if ( $itm [ 'iznosMAXi' ] != $itm [ 'iznosMAX' ] && $itm [ 'iznosMAX' ] != 0 ){
$plmx = $itm [ 'iznosMAX' ];
} else {
$plmx = $itm [ 'iznosMAXi' ];
}
if ( $itm [ 'iznosNOW' ] > 0 ){
$prc1 = floor ( $itm [ 'iznosNOW' ]) / ceil ( $plmx ) * 100 ;
} else {
$prc1 = 0 ;
}
$shpCena = $shpCena / 100 * ( 100 - $prc1 );
if ( $itm [ 'iznosMAX' ] > 0 && $itm [ 'iznosMAXi' ] > 0 && $itm [ 'iznosMAXi' ] > ceil ( $itm [ 'iznosMAX' ])){
$shpCena = $shpCena / 100 * ( ceil ( $itm [ 'iznosMAX' ]) / $itm [ 'iznosMAXi' ] * 100 );
}
//$shpCena = $u->round2($shpCena/100*(100-$shopProcent));
if ( $shpCena < 0 ){
$shpCena = 0 ;
}
$col = $u -> itemsX ( $itm [ 'id' ]);
if ( $col > 0 ){
$shpCena = $shpCena * $col ;
}
$shpCena = floor ( $shpCena );
if ( $shpCena < 0 ){
$shpCena = 0 ;
}
$upd2 = mysql_query ( 'UPDATE `items_users` SET `delete` = "' . time () . '" WHERE `id` = "' . $itm [ 'id' ] . '" LIMIT 1' );
if ( $upd2 ){
if ( $col > 1 ){
mysql_query ( 'UPDATE `items_users` SET `delete` = "' . time () . '" WHERE `item_id`="' . $itm [ 'item_id' ] . '" AND `uid`="' . $itm [ 'uid' ] . '" AND `inGroup` = "' . $itm [ 'inGroup' ] . '" LIMIT ' . $col . '' );
}
$u -> rep [ 'rep3' ] += $shpCena ;
$upd = mysql_query ( 'UPDATE `rep` SET `rep3` = "' . $u -> rep [ 'rep3' ] . '" WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1' );
if ( $upd ){
2023-01-10 16:29:32 +00:00
$error = 'Вы успешно обменяли предмет "' . $itm [ 'name' ] . ' (x' . $col . ')" на +' . $shpCena . ' воинственности .< br >
Ваша воинственность : '.($u->rep[' rep3 ']-$u->rep[' rep3_buy ']).' ' ;
2022-06-06 21:30:34 +00:00
mysql_query ( 'UPDATE `items_users` SET `inGroup` = "0",`delete` = "' . time () . '" WHERE `inGroup` = "' . $itm [ 'id' ] . '" AND `uid` = "' . $u -> info [ 'id' ] . '" LIMIT ' . $itm [ 'group_max' ] . '' );
2023-01-10 16:29:32 +00:00
$u -> addDelo ( 2 , $u -> info [ 'id' ], '"<font color="green">System.shop</font>": Предмет "' . $itm [ 'name' ] . ' (x' . $col . ')" [itm:' . $itm [ 'id' ] . '] был продан в магазин за <B>' . $shpCena . ' воинственность.</B>.' , time (), $u -> info [ 'city' ], 'System.shop' , 0 , 0 );
2022-06-06 21:30:34 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u -> addDelo ( 2 , $u -> info [ 'id' ], '"<font color="green">System.shop</font>": Предмет "' . $itm [ 'name' ] . ' (x' . $col . ')" [itm:' . $itm [ 'id' ] . '] был продан в магазин за <B>' . $shpCena . ' воинственность.</B> (Репутация не переведена).' , time (), $u -> info [ 'city' ], 'System.shop' , 0 , 0 );
$error = 'Н е удалось обменять предмет...' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$error = 'Н е удалось обменять предмет...' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$error = 'Подходящий предмет не найден в инвентаре.' ;
2022-06-06 21:30:34 +00:00
}
}
if ( $re != '' ){ echo '<div align="right"><font color="red"><b>' . $re . '</b></font></div>' ; } ?>
< script type = " text/javascript " >
function AddCount ( name , txt )
{
2023-01-10 16:29:32 +00:00
document . getElementById ( " hint4 " ) . innerHTML = '<table border=0 width=100% cellspacing=1 cellpadding=0 bgcolor="#CCC3AA"><tr><td align=center><B>Купить неск. штук</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</TD></tr><tr><td colspan=2>' +
2022-06-06 21:30:34 +00:00
'<form method=post><table border=0 width=100% cellspacing=0 cellpadding=0 bgcolor="#FFF6DD"><tr><INPUT TYPE="hidden" name="set" value="' + name + '"><td colspan=2 align=center><B><I>' + txt + '</td></tr><tr><td width=80% align=right>' +
2023-01-10 16:29:32 +00:00
'Количество (шт.) <INPUT TYPE="text" NAME="count" id=count size=4></td><td width=20%> <INPUT TYPE="submit" value=" »» ">' +
2022-06-06 21:30:34 +00:00
'</TD></TR></form></TABLE></td></tr></table>' ;
document . getElementById ( " hint4 " ) . style . visibility = 'visible' ;
document . getElementById ( " hint4 " ) . style . left = '100px' ;
document . getElementById ( " hint4 " ) . style . top = '100px' ;
document . getElementById ( " count " ) . focus ();
}
function closehint3 () {
document . getElementById ( 'hint4' ) . style . visibility = 'hidden' ;
Hint3Name = '' ;
}
</ script >
< style type = " text/css " >
. pH3 { COLOR : #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 12pt; FONT-WEIGHT: bold; }
. class_ {
font - weight : bold ;
color : #C5C5C5;
cursor : pointer ;
}
. class_st {
font - weight : bold ;
color : #659BA3;
cursor : pointer ;
}
. class__ {
font - weight : bold ;
color : #FFFFFF;
cursor : pointer ;
background - color : #659BA3;
}
. class__st {
font - weight : bold ;
color : #FFFFFF;
cursor : pointer ;
background - color : #659BA3;
font - size : 10 px ;
}
. class_old {
font - weight : bold ;
color : #919191;
cursor : pointer ;
}
. class__old {
font - weight : bold ;
color : #FFFFFF;
cursor : pointer ;
background - color : #838383;
font - size : 10 px ;
}
</ style >
< TABLE width = " 100% " cellspacing = " 0 " cellpadding = " 0 " >
< tr >< td valign = " top " >< ? php
echo '<b style="color:red">' . $error . '</b>' ;
?>
< br />
< TABLE width = " 100% " cellspacing = " 0 " cellpadding = " 4 " >
< TR >
< form name = " F1 " method = " post " >
< TD valign = " top " align = " left " >
2023-01-10 16:29:32 +00:00
<!-- Магазин -->
2022-06-06 21:30:34 +00:00
< table width = " 100% " cellspacing = " 0 " cellpadding = " 0 " bgcolor = " #a5a5a5 " >
< div id = " hint3 " style = " visibility:hidden " ></ div >
< tr >
< td align = " center " height = " 21 " >
< ? php
2023-01-10 16:29:32 +00:00
/*названия разделов (сверху)*/
2022-06-06 21:30:34 +00:00
if ( ! isset ( $_GET [ 'sale' ]) && ! isset ( $_GET [ 'gifts' ]) && isset ( $_GET [ 'otdel' ])) {
$otdels_small_array = array (
'' ,
2023-01-10 16:29:32 +00:00
'<b>Отдел "Заклятия"</b>' ,
'<b>Отдел "Боевый и защитные"</b>' ,
2022-06-06 21:30:34 +00:00
);
if ( isset ( $otdels_small_array [ $_GET [ 'otdel' ]])){
echo $otdels_small_array [ $_GET [ 'otdel' ]];
}
}
?>
</ tr >
< tr >< td >
2023-01-10 16:29:32 +00:00
<!-- Рюкзак / Прилавок -->
2022-06-06 21:30:34 +00:00
< table width = " 100% " CELLSPACING = " 1 " CELLPADDING = " 1 " bgcolor = " #a5a5a5 " >
< ? php
if ( ! isset ( $_GET [ 'sale' ])){
2023-01-10 16:29:32 +00:00
//Выводим вещи в магазине для покупки
2022-06-06 21:30:34 +00:00
$u -> shopItems ( $sid );
} else {
2023-01-10 16:29:32 +00:00
//Выводим вещи в инвентаре для продажи
2022-06-06 21:30:34 +00:00
$itmAll = $u -> genInv ( 2 , '`iu`.`uid`="' . $u -> info [ 'id' ] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `lastUPD` DESC' );
if ( $itmAll [ 0 ] == 0 ){
2023-01-10 16:29:32 +00:00
$itmAllSee = '<tr><td align="center" bgcolor="#e2e0e0">ПУСТО</td></tr>' ;
2022-06-06 21:30:34 +00:00
} else {
$itmAllSee = $itmAll [ 2 ];
}
echo $itmAllSee ;
}
?>
</ TABLE >
</ TD ></ TR >
</ TABLE >
</ TD >
</ FORM >
</ TR >
</ TABLE >
< td width = " 280 " valign = " top " >
< TABLE cellspacing = " 0 " cellpadding = " 0 " >< TD width = " 100% " >& nbsp ; </ TD >< TD >
< table border = " 0 " cellpadding = " 0 " cellspacing = " 0 " >
< tr align = " right " valign = " top " >
< td >
<!-- -->
2023-03-31 16:54:33 +00:00
< ? = $goLis ; ?>
2022-06-06 21:30:34 +00:00
<!-- -->
< table border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td nowrap = " nowrap " >
< table width = " 100% " border = " 0 " cellpadding = " 0 " cellspacing = " 1 " bgcolor = " #DEDEDE " >
< tr >
2023-03-31 18:30:14 +00:00
< td bgcolor = " #D3D3D3 " >< img src = " //img.new-combats.tech/i/move/links.gif " width = " 9 " height = " 7 " /></ td >
2023-01-10 16:29:32 +00:00
< td bgcolor = " #D3D3D3 " nowrap >< a href = " # " id = " greyText " class = " menutop " onclick = " location='main.php?back=1&rnd=<?= $code ?>'; " > Вернуться назад </ a ></ td >
2022-06-06 21:30:34 +00:00
</ tr >
</ table >
</ td >
</ tr >
</ table >
</ td ></ table >
</ td ></ table >
< div >< br />
< div align = " right " >
< small >
2023-01-10 16:29:32 +00:00
М а с с а : < ? = $u -> aves [ 'now' ] ?> /<?=$u->aves['max']?> <br />
2023-03-31 16:54:33 +00:00
У вас в наличии : < b style = " color:#339900; " >< ? = round ( $u -> info [ 'money' ], 2 ); ?> кр.</b>
2022-06-06 21:30:34 +00:00
< ?
if ( $u -> info [ 'level' ] < 8 && $c [ 'zuby' ] == true ) {
?>
2023-01-10 16:29:32 +00:00
< br /> Зубов : < ? = $u -> zuby ( $u -> info [ 'money4' ]) ?>
2022-06-06 21:30:34 +00:00
< ?
}
?>
</ small >
</ div >
< br />
2023-03-31 16:54:33 +00:00
< INPUT class = " btn " TYPE = " button " value = " Обновить " onclick = " location = '<?= str_replace('item','',str_replace('buy','', $_SERVER['REQUEST_URI'] )); ?>'; " >< BR >
2022-06-06 21:30:34 +00:00
</ div >
2023-01-10 16:29:32 +00:00
< div style = " background-color:#A5A5A5;padding:1 " >< center >< B > Отделы магазина </ B ></ center ></ div >
2022-06-06 21:30:34 +00:00
< div style = " line-height:17px; " >
< style >. shop_menu_txt { background - color : #d5d5d5; }</style>
< ? php
2023-01-10 16:29:32 +00:00
/*названия разделов (справа)*/
2022-06-06 21:30:34 +00:00
$otdels_array = array (
'' ,
2023-01-10 16:29:32 +00:00
' Заклятия' ,
' Боевые и защитные' ,
2022-06-06 21:30:34 +00:00
'' );
$i = 1 ;
while ( $i !=- 1 )
{
if ( isset ( $otdels_array [ $i ]))
{
if ( isset ( $_GET [ 'otdel' ]) && $_GET [ 'otdel' ] == $i )
{
$color = 'C7C7C7' ;
} else {
$color = 'e2e0e0' ;
}
if ( $i == 1 ) {
2023-01-10 16:29:32 +00:00
echo '<div class="shop_menu_txt"><b>Карманные предметы:</b></div>' ;
2022-06-06 21:30:34 +00:00
} elseif ( $i == 2 ) {
2023-01-10 16:29:32 +00:00
echo '<div class="shop_menu_txt"><b>Боевые и защитные:</b></div>' ;
2022-06-06 21:30:34 +00:00
}
echo '
< A HREF = " ?otdel='. $i .' " >< DIV style = " background-color: #'. $color .' " >
'.$otdels_array[$i].'
</ A ></ DIV >
' ;
} else {
$i = - 2 ;
}
$i ++ ;
}
?>
</ div >
</ td >
</ table >
< br >
< div id = " textgo " style = " visibility:hidden; " ></ div >
< ?
}
?>