game/modules_data/location/shop_.php
2022-06-07 00:30:34 +03:00

715 lines
32 KiB
PHP

<?php
if(!defined('GAME'))
{
die();
}
if($u->room['file']=='shop_')
{
$shopProcent = 100-$c['shop_type1'];
if(isset($_POST['itemgift']))
{
$to = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['to_login']).'" ORDER BY `id` ASC LIMIT 1'));
if(isset($to['id']))
{
if($u->info['align'] == 2 || $u->info['haos'] > time()) {
$re = '<div align="left">Õàîñíèêàì çàïðåùàåòñÿ äåëàòü ïîäàðêè äðóãèì èãðîêàì</div>';
}elseif($to['id']==$u->info['id'])
{
$re = '<div align="left">Î÷åíü ùåäðî äàðèòü ÷òî-òî ñàìîìó ñåáå ;)</div>';
}elseif($u->info['level']<4)
{
$re = '<div align="left">Äàðèòü ïîäàðêè ìîæíî íà÷èíàÿ ñ 4-ãî óðîâíÿ</div>';
}else{
if( $_POST['itemgift'] > 1000000000000 ) {
$itm_l = mysql_fetch_array(mysql_query('SELECT * FROM `users_gifts` WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.mysql_real_escape_string((int)$_POST['itemgift']-1000000000000).'" LIMIT 1'));
if( isset($itm_l['id']) && $itm_l['money'] > $u->info['money'] ) {
$re = '<div align="left">Íåäîñòàòî÷íî äåíåã</div>';
}elseif( isset($itm_l['id']) ) {
$itm = $u->addItem(4533,1,'|gift_id='.$itm_l['id'].'');
if( $itm > 0 ) {
$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 (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "63" OR `im`.`type` = "64" OR `im`.`type` = "37") AND `iu`.`id` = "'.mysql_real_escape_string($itm).'" AND `iu`.`uid` = "1" AND `iu`.`gift` = "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" LIMIT 1'));
if(isset($itm['id'])) {
$u->info['money'] -= $itm_l['money'];
mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
$itm['gtxt1'] = $_POST['podarok2'];
$itm['gtxt2'] = $_POST['txt'];
$itm['gtxt1'] = str_replace('\x3C','<',$itm['gtxt1']);
$itm['gtxt1'] = str_replace('\x3','>',$itm['gtxt1']);
$itm['gtxt1'] = htmlspecialchars($itm['gtxt1'],NULL,'cp1251');
$itm['gtxt2'] = str_replace('\x3C','<',$itm['gtxt2']);
$itm['gtxt2'] = str_replace('\x3','>',$itm['gtxt2']);
$itm['gtxt2'] = htmlspecialchars($itm['gtxt2'],NULL,'cp1251');
$giftlogin = $u->info['login'];
if( $_POST['from'] == 1 ) {
//Àíîíèìíî
$giftlogin = '<i>Àíîíèìà</i>';
}elseif( $_POST['from'] == 2 && $u->info['clan'] > 0 ) {
//Îò êëàíà
$cln = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$u->info['clan'].'" LIMIT 1'));
if(isset($cln['id'])) {
$giftlogin = 'êëàíà <img src=https://new-combats.com/i/clan/'.$cln['id'].'.gif> <b>'.$cln['name'].'</b>';
}
}
$fspam = $filter->spamFiltr(str_replace('òî÷êà','.',str_replace('ðó','ru',$itm['gtxt1'])));
if( $fspam != '0' ) {
$itm['gtxt1'] = '<font color=red><b>&lt;ÐÂÑ&gt;</b></font>';
$itm['gtxt2'] = '<font color=red><b>&lt;ÐÂÑ&gt;</b></font>';
}
$upd = mysql_query('UPDATE `items_users` SET `data` = "'.$itm['data'].'",`gtxt1` = "'.mysql_real_escape_string($itm['gtxt1']).'",`gtxt2` = "'.mysql_real_escape_string($itm['gtxt2']).'", `uid` = "'.$to['id'].'", `gift` = "'.$giftlogin.'",`time_create` = "'.time().'" WHERE `id` = "'.$itm['id'].'" LIMIT 1');
$whos = mysql_fetch_array(mysql_query('SELECT `login` FROM `users` WHERE `id` = "'.$to['id'].'" LIMIT 1'));
$ld = $u->addDelo(1, $to['id'],'&quot;<font color=#C65F00>Shop.'.$u->info['city'].'</font>&quot;: Ïîëó÷åí ïîäàðîê îò [id="'.$u->info['id'].'"/ Ëîãèí : "'.$u->info['login'].'"]. Ïðåäìåò [id="'.$itm['id'].'"/ Íàçâàíèå : "'.$itm['name'].'"] ñîäåðæûèò: "'.$itm['data'].'"',time(),$u->info['city'],'Shop.gift',0,0);
$ld = $u->addDelo(1, $u->info['id'],'&quot;<font color=#C65F00>Shop.'.$u->info['city'].'</font>&quot;: Ñäåëàë ïîäàðîê ïåðñîíàæó [id="'.$to['id'].'"/ Ëîãèí : "'.$whos['login'].'"]. Ïðåäìåò [id="'.$itm['id'].'"/ Íàçâàíèå : "'.$itm['name'].'"] ñîäåðæûèò: "'.$itm['data'].'"',time(),$u->info['city'],'Shop.gift',0,0);
if($upd)
{
$re = '<div align="left">Ïîäàðîê áûë óñïåøíî îòïðàâëåí ê &quot;'.$to['login'].'&quot; çà '.$itm_l['money'].' êð.</div>';
if( $giftlogin == $u->info['login'] ) {
$text = ' Ïîëó÷åí ïîäàðîê <b>'.$itm_l['name'].'</b>. Îò ïåðñîíàæà [login:'.$u->info['login'].'] .';
}else{
$text = ' Ïîëó÷åí ïîäàðîê <b>'.$itm_l['name'].'</b>. Îò ïåðñîíàæà '.$giftlogin.' .';
}
mysql_query("INSERT INTO `chat` (`new`, `city`, `room`, `login`, `to`, `text`, `time`, `type`, `toChat`) VALUES ('1','".$u->info['city']."', '', '', '".$to['login']."', '".$text."', '".time()."', '6', '0')");
}else{
$re = '<div align="left">Íå óäàëîñü ñäåëàòü ïîäàðîê</div>';
}
}else{
$re = '<div align="left">Íå óäàëîñü ñäåëàòü ïîäàðîê, îí èñïîðòèëñÿ...</div>';
}
}else{
$re = '<div align="left">Íå óäàëîñü ñäåëàòü ïîäàðîê, êóðüåð ñëó÷àéíî ñëîìàë åãî...</div>';
}
}else{
$re = '<div align="left">Ïðåäìåò íå íàéäåí</div>';
}
}else{
$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 (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "63" OR `im`.`type` = "64" OR `im`.`type` = "37") AND `iu`.`id` = "'.mysql_real_escape_string($_POST['itemgift']).'" AND `iu`.`uid` = "'.$u->info['id'].'" AND (`iu`.`gift` = "" OR (`iu`.`data` LIKE "%|zazuby=%" AND `iu`.`gift` = 1)) AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" LIMIT 1'));
$po = $u->lookStats($itm['data']);
if(isset($itm['id']) && $itm['type'] != 37) {
$re = '<div align="left">Äàðèòü ïîäàðêè âîçìîæíî òîëüêî â óïàêîâêå!</div>';
}elseif(!isset($po['item_inbox'])) {
$re = '<div align="left">Âû íè÷åãî íå çàïîêîâàëè â óïàêîâêó!</div>';
}elseif(isset($itm['id']))
{
//$itm['data'] = '';
$itm['gtxt1'] = $_POST['podarok2'];
$itm['gtxt2'] = $_POST['txt'];
$itm['gtxt1'] = str_replace('\x3C','<',$itm['gtxt1']);
$itm['gtxt1'] = str_replace('\x3','>',$itm['gtxt1']);
$itm['gtxt1'] = htmlspecialchars($itm['gtxt1'],NULL,'cp1251');
$itm['gtxt2'] = str_replace('\x3C','<',$itm['gtxt2']);
$itm['gtxt2'] = str_replace('\x3','>',$itm['gtxt2']);
$itm['gtxt2'] = htmlspecialchars($itm['gtxt2'],NULL,'cp1251');
$fspam = $filter->spamFiltr(str_replace('òî÷êà','.',str_replace('ðó','ru',$itm['gtxt1'])));
if( $fspam != '0' ) {
$itm['gtxt1'] = '<font color=red><b>&lt;ÐÂÑ&gt;</b></font>';
$itm['gtxt2'] = '<font color=red><b>&lt;ÐÂÑ&gt;</b></font>';
}
$giftlogin = $u->info['login'];
if( $fspam != '0' ) {
//Åñëè ñïàì òî õóé àíîíèìíî!
}elseif( $_POST['from'] == 1 ) {
//Àíîíèìíî
$giftlogin = '<i>Àíîíèìà</i>';
}elseif( $_POST['from'] == 2 && $u->info['clan'] > 0 ) {
//Îò êëàíà
$cln = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$u->info['clan'].'" LIMIT 1'));
if(isset($cln['id'])) {
$giftlogin = 'êëàíà <img src=https://new-combats.com/i/clan/'.$cln['id'].'.gif> <b>'.$cln['name'].'</b>';
}
}
$items = $u->lookStats($itm['data']);
$iteminc = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `id` = "'.intval($items['item_inbox']).'" LIMIT 1'));
$iteminctru = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$iteminc['item_id'].'" LIMIT 1'));
$upd = mysql_query('UPDATE `items_users` SET `data` = "'.$itm['data'].'",`gtxt1` = "'.mysql_real_escape_string($itm['gtxt1']).'",`gtxt2` = "'.mysql_real_escape_string($itm['gtxt2']).'", `uid` = "'.$to['id'].'", `gift` = "'.$giftlogin.'",`time_create` = "'.time().'" WHERE `id` = "'.$itm['id'].'" LIMIT 1');
$whos = mysql_fetch_array(mysql_query('SELECT `login` FROM `users` WHERE `id` = "'.$to['id'].'" LIMIT 1'));
$ld = $u->addDelo(1, $to['id'],'&quot;<font color=#C65F00>Shop.'.$u->info['city'].'</font>&quot;: Ïîëó÷åí ïîäàðîê îò [id="'.$u->info['id'].'"/ Ëîãèí : "'.$u->info['login'].'"]. Ïðåäìåò [id="'.$itm['id'].'"/ Íàçâàíèå : "'.$itm['name'].'"] ('.$giftlogin.') ñîäåðæèò: ["'.$iteminc['item_id'].'" / "'.$iteminctru['name'].'"]',time(),$u->info['city'],'Shop.gift',0,0);
$ld = $u->addDelo(1, $u->info['id'],'&quot;<font color=#C65F00>Shop.'.$u->info['city'].'</font>&quot;: Ñäåëàë ïîäàðîê ïåðñîíàæó [id="'.$to['id'].'"/ Ëîãèí : "'.$whos['login'].'"]. Ïðåäìåò [id="'.$itm['id'].'"/ Íàçâàíèå : "'.$itm['name'].'" ('.$giftlogin.')] ñîäåðæèò: ["'.$iteminc['item_id'].'" / "'.$iteminctru['name'].'"]',time(),$u->info['city'],'Shop.gift',0,0);
if($upd)
{
$re = '<div align="left">Ïîäàðîê áûë óñïåøíî îòïðàâëåí ê &quot;'.$to['login'].'&quot;</div>';
if( $giftlogin == $u->info['login'] ) {
$text = ' Ïîëó÷åí ïîäàðîê <b>'.$itm['name'].'</b>. Îò ïåðñîíàæà [login:'.$u->info['login'].'] .';
}else{
$text = ' Ïîëó÷åí ïîäàðîê <b>'.$itm['name'].'</b>. Îò ïåðñîíàæà '.$giftlogin.' .';
}
mysql_query("INSERT INTO `chat` (`new`, `city`, `room`, `login`, `to`, `text`, `time`, `type`, `toChat`) VALUES ('1','".$u->info['city']."', '', '', '".$to['login']."', '".$text."', '".time()."', '6', '0')");
}else{
$re = '<div align="left">Íå óäàëîñü ñäåëàòü ïîäàðîê</div>';
}
}else{
$re = '<div align="left">Ïðåäìåò íå íàéäåí</div>';
}
}
}
}else{
$re = '<div align="left">Ïåðñîíàæ ñ òàêèì ëîãèíîì íå íàéäåí</div>';
}
}
if(isset($u->stats['shopSale'],$_GET['sale'])){
$bns = 0+$u->stats['shopSale'];
if($bns!=0){
if($bns>0){
$bns = '+'.$bns;
}
$shopProcent = $u->shopSaleM( $shopProcent , $itm );
$shopProcent -= $bns;
if($shopProcent>99){ $shopProcent = 99; }
if($shopProcent<1){ $shopProcent = 1; }
echo '<div style="color:grey;"><b>Ó Âàñ äåéñòâóåò áîíóñ ïðè ïðîäàæå: '.$bns.'%</b><br><small>Âû ñìîæåòå ïðîäàâàòü ïðåäìåòû çà '.$shopProcent.'% îò èõ ñòîèìîñòè</small></div>';
}
}
if(!isset($_GET['otdel'])) {
$_GET['otdel'] = 1;
}
$sid = 1;
$error = '';
if(isset($_GET['buy'])){
if($u->newAct($_GET['sd4'])==true){
$re = $u->buyItem($sid,(int)$_GET['buy'],(int)$_GET['x']);
}else{
$re = 'Âû óâåðåíû ÷òî õîòèòå êóïèòü ýòîò ïðåäìåò?';
}
}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 ) ) {
$error = 'Íåëüçÿ ïðîäàâàòü ïîäàðêè, îíè äîëæíû îñòàâàòüñÿ íà ïàìÿòü! :)';
}elseif(isset($po['nosale'])){
$error = 'Íå óäàëîñü ïðîäàòü ïðåäìåò, çàïðåò ïðîäàæè äàííîãî ïðåäìåòà ...';
}elseif($pl['type']<29 && ($po['srok'] > 0 || $pl['srok'] > 0) && $pl['type'] != 28){
$error = 'Íå óäàëîñü ïðîäàòü ïðåäìåò, âûøåë ñðîê ãîäíîñòè ...';
//}elseif(isset($po['frompisher'])){
//$error = 'Íå óäàëîñü ïðîäàòü ïðåäìåò, ïðåäìåò èç ïîäçåìåëüÿ ...';
}elseif(isset($po['fromlaba'])){
$error = 'Íå óäàëîñü ïðîäàòü ïðåäìåò, ïðåäìåò èç ëàáèðèíòà ïðîäàåòñÿ çà âîèíñòâåííîñòü ...';
}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) {
$error = 'Âû óñïåøíî ïðîäàëè ïðåäìåò &quot;'.$itm['name'].' (x'.$col.')&quot; çà '.$shpCena.' êð.';
mysql_query('UPDATE `items_users` SET `inGroup` = "0",`delete` = "'.time().'" WHERE `inGroup` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT '.$itm['group_max'].'');
$u->addDelo(2,$u->info['id'],'&quot;<font color="green">System.shop</font>&quot;: Ïðåäìåò &quot;'.$itm['name'].' (x'.$col.')&quot; [itm:'.$itm['id'].'] áûë ïðîäàí â ìàãàçèí çà <B>'.$shpCena.' êð.</B>.',time(),$u->info['city'],'System.shop',0,0);
} else {
$u->addDelo(2,$u->info['id'],'&quot;<font color="green">System.shop</font>&quot;: Ïðåäìåò &quot;'.$itm['name'].' (x'.$col.')&quot; [itm:'.$itm['id'].'] áûë ïðîäàí â ìàãàçèí çà <B>'.$shpCena.' êð.</B> (êðåäèòû íå ïåðåâåäåíû).',time(),$u->info['city'],'System.shop',0,0);
$error = 'Íå óäàëîñü ïðîäàòü ïðåäìåò...';
}
} else {
$error = 'Íå óäàëîñü ïðîäàòü ïðåäìåò...';
}
} else {
$error = 'Ïðåäìåò íå íàéäåí â èíâåíòàðå.';
}
} 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'])){
$error = 'Íå óäàëîñü ïðîäàòü ïðåäìåò, çàïðåò ïðîäàæè äàííîãî ïðåäìåòà ...';
}elseif($pl['type']<29 && ($po['srok'] > 0 || $pl['srok'] > 0)){
$error = 'Íå óäàëîñü ïðîäàòü ïðåäìåò, âûøåë ñðîê ãîäíîñòè ...';
}elseif(isset($po['frompisher'])){
$error = 'Íå óäàëîñü ïðîäàòü ïðåäìåò, ïðåäìåò èç ïîäçåìåëüÿ ...';
}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 = floor($shpCena/2);
//$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){
$error = 'Âû óñïåøíî îáìåíÿëè ïðåäìåò &quot;'.$itm['name'].' (x'.$col.')&quot; íà +'.$shpCena.' âîèíñòâåííîñòè.<br>
Âàøà âîèíñòâåííîñòü: '.($u->rep['rep3']-$u->rep['rep3_buy']).'';
mysql_query('UPDATE `items_users` SET `inGroup` = "0",`delete` = "'.time().'" WHERE `inGroup` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT '.$itm['group_max'].'');
$u->addDelo(2,$u->info['id'],'&quot;<font color="green">System.shop</font>&quot;: Ïðåäìåò &quot;'.$itm['name'].' (x'.$col.')&quot; [itm:'.$itm['id'].'] áûë ïðîäàí â ìàãàçèí çà <B>'.$shpCena.' âîèíñòâåííîñòü.</B>.',time(),$u->info['city'],'System.shop',0,0);
}else{
$u->addDelo(2,$u->info['id'],'&quot;<font color="green">System.shop</font>&quot;: Ïðåäìåò &quot;'.$itm['name'].' (x'.$col.')&quot; [itm:'.$itm['id'].'] áûë ïðîäàí â ìàãàçèí çà <B>'.$shpCena.' âîèíñòâåííîñòü.</B> (Ðåïóòàöèÿ íå ïåðåâåäåíà).',time(),$u->info['city'],'System.shop',0,0);
$error = 'Íå óäàëîñü îáìåíÿòü ïðåäìåò...';
}
}else{
$error = 'Íå óäàëîñü îáìåíÿòü ïðåäìåò...';
}
}else{
$error = 'Ïîäõîäÿùèé ïðåäìåò íå íàéäåí â èíâåíòàðå.';
}
}
if($re!=''){ echo '<div align="right"><font color="red"><b>'.$re.'</b></font></div>'; } ?>
<script type="text/javascript">
function AddCount(name, txt)
{
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>'+
'<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>'+
'Êîëè÷åñòâî (øò.) <INPUT TYPE="text" NAME="count" id=count size=4></td><td width=20%>&nbsp;<INPUT TYPE="submit" value=" »» ">'+
'</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: 10px;
}
.class_old {
font-weight: bold;
color: #919191;
cursor:pointer;
}
.class__old {
font-weight: bold;
color: #FFFFFF;
cursor:pointer;
background-color: #838383;
font-size: 10px;
}
</style>
<TABLE width="100%" cellspacing="0" cellpadding="0">
<tr><td valign="top">
<div align="center" class="pH3">Ìàãàçèí</div><center><br><b>Ìàãàçèí ïðèíèìàåò âåùè 0-7 óðîâíåé ïîä 100%, âåùè 8-ãî óðîâíÿ ïîä 95%, âåùè 9-ãî óðîâíÿ, à òàêæå ñâèòêè è ýëèêñèðû ìîæíî ñäàòü â ìàãàçèí ïîä 70%.</b></div></center>
<?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">
<!--Ìàãàçèí-->
<table width="100%" cellspacing="0" cellpadding="0" bgcolor="#a5a5a5">
<div id="hint3" style="visibility:hidden"></div>
<tr>
<td align="center" height="21">
<?php
/*íàçâàíèÿ ðàçäåëîâ (ñâåðõó)*/
if(!isset($_GET['sale']) && !isset($_GET['gifts']) && isset($_GET['otdel'])) {
$otdels_small_array = array (
'',
'<b>Îòäåë&nbsp;&quot;Îðóæèå: êàñòåòû,íîæè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îðóæèå: òîïîðû&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îðóæèå: äóáèíû,áóëàâû&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îðóæèå: ìå÷è&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îðóæèå: ìàãè÷åñêèå ïîñîõè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îäåæäà: ñàïîãè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îäåæäà: ïåð÷àòêè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îäåæäà: ðóáàõè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îäåæäà: ëåãêàÿ áðîíÿ&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îäåæäà: òÿæåëàÿ áðîíÿ&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îäåæäà: øëåìû&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îäåæäà: íàðó÷è&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îäåæäà: ïîÿñà&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Îäåæäà: ïîíîæè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Ùèòû&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Þâåëèðíûå òîâàðû: ñåðüãè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Þâåëèðíûå òîâàðû: îæåðåëüÿ&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Þâåëèðíûå òîâàðû: êîëüöà&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Çàêëèíàíèÿ: íåéòðàëüíûå&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Çàêëèíàíèÿ: áîåâûå è çàùèòíûå&quot;</b>'
,'<b>Îòäåë&nbsp;&quot;Çàêëèíàíèÿ: ïèðîæêè&quot;</b>'
,'<b>Îòäåë&nbsp;&quot;Çàêëèíàíèÿ: èñöåëÿþùèå&quot;</b>'
,'<b>Îòäåë&nbsp;&quot;Çàêëèíàíèÿ: ìàíÿùèå&quot;</b>'
,'<b>Îòäåë&nbsp;&quot;Çàêëèíàíèÿ: ñòðàòåãè÷åñêèå&quot;</b>'
,'<b>Îòäåë&nbsp;&quot;Çàêëèíàíèÿ: òàêòè÷åñêèå&quot;</b>'
,'<b>Îòäåë&nbsp;&quot;Çàêëèíàíèÿ: ñåðâèñíûå&quot;</b>'
,'<b>Îòäåë&nbsp;&quot;Àìóíèöèÿ&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Ýëèêñèðû&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Åäà&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Ïîäàðêè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Ïîäàðêè: íåäîáðûå&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Ïîäàðêè: óïàêîâêà&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Ïîäàðêè: îòêðûòêè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Ïîäàðêè: ôåéåðâåðêè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Óñèëåíèå îðóæèÿ: Çàòî÷êè&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Ïëàùè è Íàêèäêè:&quot;</b>',
'<b>Îòäåë&nbsp;&quot;Ãîòîâûå Êîìïëåêòû:&quot;</b>');
if(isset($otdels_small_array[$_GET['otdel']])){
echo $otdels_small_array[$_GET['otdel']];
}
//echo '<br><b>Ìàãàçèí ïðèíèìàåò âåùè 0-7 óðîâíåé ïîä 100%, âåùè 8-ãî óðîâíÿ ïîä 95%, âåùè 9-ãî óðîâíÿ, à òàê æå ñâèòêè è ýëèêñèðû ìîæíî ñäàòü â ìàãàçèí ïîä 70%.</b>';
} elseif (isset($_GET['sale']) && $_GET['sale']) {
echo '
<B>Îòäåë&nbsp;&quot;Ñêóïêà&quot;</B><br>
Çäåñü âû ìîæåòå ïðîäàòü ñâîè âåùè, çà æàëêèå ãðîøè...<br>'.
//<b>Ìàãàçèí ïðèíèìàåò âåùè 0-7 óðîâíåé ïîä 99%, âåùè 8-ãî óðîâíÿ ïîä 95%, âåùè 9-ãî óðîâíÿ, à òàê æå ñâèòêè è ýëèêñèðû ìîæíî ñäàòü â ìàãàçèí ïîä 70%.</b><br>
'Ó âàñ â íàëè÷èè:
';
} elseif (isset($_GET['gifts'])) {
echo '
<B>Îòäåë&nbsp;&quot;Ñäåëàòü ïîäàðêè&quot;</B>';
}
?>
</tr>
<tr><td>
<!--Ðþêçàê / Ïðèëàâîê-->
<table width="100%" CELLSPACING="1" CELLPADDING="1" bgcolor="#a5a5a5">
<?php
if(isset($_GET['gifts']))
{
?>
<tr><td bgcolor="#D5D5D5">
Âû ìîæåòå ñäåëàòü ïîäàðîê äîðîãîìó ÷åëîâåêó. Âàø ïîäàðîê áóäåò îòîáðàæàòüñÿ â èíôîðìàöèè î ïåðñîíàæå.
<OL>
<LI>Óêàæèòå ëîãèí ïåðñîíàæà, êîòîðîìó õîòèòå ñäåëàòü ïîäàðîê<BR>
Ëîãèí
<INPUT TYPE=text NAME=to_login value="">
<LI>Öåëü ïîäàðêà. Áóäåò îòîáðàæàòüñÿ â èíôîðìàöèè î ïåðñîíàæå (íå áîëåå 60 ñèìâîëîâ)<BR>
<? if($u->info['exp'] >= 500000) { ?>
<INPUT TYPE=text NAME=podarok2 value="" maxlength=60 size=50>
<? }else{ ?>
<INPUT disabled TYPE=text NAME=podarok2 value="Ñ óâàæåíèåì!" maxlength=60 size=50>
<BR><small><span>Äëÿ ðåäàêòèðîâàíèÿ òåêñòà íóæíî 500000 Îïûòà!</span></small>
<?}?>
<LI>Íàïèøèòå òåêñò ñîïðîâîäèòåëüíîé çàïèñêè (â èíôîðìàöèè î ïåðñîíàæå íå îòîáðàæàåòñÿ)<BR>
<? if($u->info['exp'] >= 500000) { ?>
<TEXTAREA NAME=txt ROWS=6 COLS=80></TEXTAREA>
<? }else{ ?>
<TEXTAREA NAME=txt ROWS=6 COLS=80 disabled>Ñ óâàæåíèåì!</TEXTAREA>
<BR><small><span>Äëÿ ðåäàêòèðîâàíèÿ òåêñòà íóæíî 500000 Îïûòà!</span></small>
<?}?>
<LI>Âûáåðèòå, îò ÷üåãî èìåíè ïîäàðîê:<BR>
<INPUT TYPE=radio NAME=from value=0 checked> <B><?=$u->info['login']?></B> [<?=$u->info['level']?>]<BR>
<INPUT TYPE=radio NAME=from value=1 > àíîíèìíî<BR>
<? if($u->info['clan']>0){ ?><INPUT TYPE=radio NAME=from value=2 > îò èìåíè êëàíà<BR><? } ?>
<LI>Íàæìèòå êíîïêó <B>Ïîäàðèòü</B> ïîä ïðåäìåòîì, êîòîðûé õîòèòå ïðåïîäíåñòè â ïîäàðîê:<BR>
</OL>
<input name="itemgift" id="itemgift" type="hidden" value="0" />
</td></tr>
<?php
}
if(isset($_GET['gifts']))
{
$htmlg2 = '';
$sp = mysql_query('SELECT * FROM `users_gifts` WHERE `uid` = "'.$u->info['id'].'"');
while( $pl = mysql_fetch_array($sp) ) {
$itmg2 = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="160" align="center" style="border-right:#A5A5A5 1px solid; padding:5px;">'.
//
'<img style="padding-bottom:5px;" src="https://img.new-combats.com/i/items/'.$pl['img'].'"><br>'.
'<input onClick="document.getElementById(\'itemgift\').value='.(1000000000000+$pl['id']).';document.F1.submit();" type="button" value="Ïîäàðèòü çà '.$pl['money'].' êð.">'.
//
'</td><td align="left" valign="top" style="border-right:#A5A5A5 1px solid; padding:5px;">'.
//
'<a href="https://new-combats.com/item/0">'.$pl['name'].'</a> &nbsp; (Ìàññà: 1)<br>Äîëãîâå÷íîñòü: 0/1<br>'.
'<small><b>Îïèñàíèå:</b><br>Ýòî èìåííîé ïîäàðîê, åãî ìîæåòå ïîäàðèòü òîëüêî Âû.<br>Ñäåëàíî â Capital city</small>'.
//
'</td></tr></table>';
$htmlg2 .= '<tr><td align="center" bgcolor="#e2e0e0">'.$itmg2.'</td></tr>';
}
if( $htmlg2 != '' ) {
echo '<tr><td align="center" bgcolor="#e2e0e0"><h3>Óíèêàëüíûå ïîäàðêè</h3>' . $htmlg2 . '</td></tr>';
echo '<tr><td align="center" bgcolor="#e2e0e0"><h3>Ñòàíäàðòíûå ïîäàðêè</h3></td></tr>';
}
unset($htmlg2,$itmg2);
//
$itmAll = $u->genInv(3,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND (`im`.`type` = "28" OR `im`.`type` = "38" OR `im`.`type` = "63" OR `im`.`type` = "64" OR `im`.`type` = "37") AND (`iu`.`gift` = "" OR (`iu`.`data` LIKE "%|zazuby=%" AND `iu`.`gift` = 1)) ORDER BY `lastUPD` DESC');
if($itmAll[0]==0){
$itmAllSee = '<tr><td align="center" bgcolor="#e2e0e0">Ó âàñ íåò ïîäõîäÿùèõ ïðåäìåòîâ</td></tr>';
}else{
$itmAllSee = $itmAll[2];
}
echo $itmAllSee;
}elseif(!isset($_GET['sale'])){
//Âûâîäèì âåùè â ìàãàçèíå äëÿ ïîêóïêè
$u->shopItems($sid);
}else{
//Âûâîäèì âåùè â èíâåíòàðå äëÿ ïðîäàæè
$itmAll = $u->genInv(2,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`data` NOT LIKE "%fromshop=2%" ORDER BY `lastUPD` DESC');
if($itmAll[0]==0){
$itmAllSee = '<tr><td align="center" bgcolor="#e2e0e0">ÏÓÑÒÎ</td></tr>';
}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>
<!-- -->
<? echo $goLis; ?>
<!-- -->
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap="nowrap">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEDEDE">
<tr>
<td bgcolor="#D3D3D3"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" /></td>
<td bgcolor="#D3D3D3" nowrap><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.9&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.9',1); ?>">Öåíòðàëüíàÿ Ïëîùàäü</a></td>
</tr>
<tr>
<td bgcolor="#D3D3D3"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" /></td>
<td bgcolor="#D3D3D3" nowrap><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.368&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.368',1); ?>">Ïîäïîëüíàÿ ëàâêà</a></td>
</tr>
</table>
</td>
</tr>
</table>
</td></table>
</td></table>
<div><br />
<div align="right">
<small>
Ìàññà: <b><?=$u->aves['now']?>/<?=$u->aves['max']?></b> &nbsp;<br />
Ó âàñ â íàëè÷èè: <b style="color:#339900;"><?php echo round($u->info['money'],2); ?> êð.</b> &nbsp;
<?
if($u->info['level'] < 8 && $c['zuby'] == true) {
?>
<br />Çóáîâ: <?=$u->zuby($u->info['money4'])?> &nbsp; &nbsp;
<?
}
?>
</small>
</div>
<br />
<center>
<?php
/*êíîïî÷êè*/
if( !isset($_GET['sale']) ) {
echo '<INPUT class="btn" TYPE="button" value="Ïðîäàòü âåùè" onclick="location=\'?otdel='.$_GET['otdel'].'&sale=1\'">&nbsp;';
} else {
echo '<INPUT class="btn" TYPE="button" value="Êóïèòü âåùè" onclick="location=\'?otdel='.$_GET['otdel'].'\'">&nbsp;';
}
?>
<INPUT class="btn" TYPE="button" value="Îáíîâèòü" onclick="location = '<? echo str_replace('item','',str_replace('buy','',$_SERVER['REQUEST_URI'])); ?>';">
</center>
<BR>
</div>
<div style="background-color:#A5A5A5;padding:1"><center><B>Îòäåëû ìàãàçèíà</B></center></div>
<div style="line-height:17px;">
<style>.shop_menu_txt { background-color: #d5d5d5; }</style>
<?php
/*íàçâàíèÿ ðàçäåëîâ (ñïðàâà)*/
$otdels_array = array (
'',
'&nbsp;&nbsp;Êàñòåòû,íîæè',
'&nbsp;&nbsp;Òîïîðû',
'&nbsp;&nbsp;Äóáèíû,áóëàâû',
'&nbsp;&nbsp;Ìå÷è',
'&nbsp;&nbsp;Ìàãè÷åñêèå ïîñîõè',
'&nbsp;&nbsp;Ñàïîãè',
'&nbsp;&nbsp;Ïåð÷àòêè',
'&nbsp;&nbsp;Ðóáàõè',
'&nbsp;&nbsp;Ëåãêàÿ áðîíÿ',
'&nbsp;&nbsp;Òÿæåëàÿ áðîíÿ',
'&nbsp;&nbsp;Øëåìû',
'&nbsp;&nbsp;Íàðó÷è',
'&nbsp;&nbsp;Ïîÿñà',
'&nbsp;&nbsp;Ïîíîæè',
'&nbsp;&nbsp;Ùèòû',
'&nbsp;&nbsp;Ñåðüãè',
'&nbsp;&nbsp;Îæåðåëüÿ',
'&nbsp;&nbsp;Êîëüöà',
'&nbsp;&nbsp;Íåéòðàëüíûå',
'&nbsp;&nbsp;Áîåâûå è çàùèòíûå',
'&nbsp;&nbsp;Ïèðîæêè',
'&nbsp;&nbsp;Èñöåëÿþùèå',
'&nbsp;&nbsp;Ìàíÿùèå',
'&nbsp;&nbsp;Ñòðàòåãè÷åñêèå',
'&nbsp;&nbsp;Òàêòè÷åñêèå',
'&nbsp;&nbsp;Ñåðâèñíûå',
'&nbsp;&nbsp;Àìóíèöèÿ',
'&nbsp;&nbsp;Ýëèêñèðû',
'&nbsp;&nbsp;Åäà',
'&nbsp;&nbsp;Ïîäàðêè',
'&nbsp;&nbsp;Íåäîáðûå',
'&nbsp;&nbsp;Óïàêîâêà',
'&nbsp;&nbsp;Îòêðûòêè',
'&nbsp;&nbsp;Ôåéåðâåðêè',
'&nbsp;&nbsp;Óñèëåíèå îðóæèÿ: Çàòî÷êè',
'&nbsp;&nbsp;Îäåæäà: Ïëàùè è Íàêèäêè',
"<span style='color: #ff0000'>&nbsp;&nbsp;Îäåæäà: Ãîòîâûå Êîìïëåêòû</span>",
'');
$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) {
echo '<div class="shop_menu_txt"><img height="12" width="12" src="i/shop_ico/1.png"> <b>Îðóæèå:</b></div>';
} elseif($i == 6) {
echo '<div class="shop_menu_txt"><img height="12" width="12" src="i/shop_ico/2.png"> <b>Îäåæäà:</b></div>';
} elseif($i == 15) {
echo '<div class="shop_menu_txt"><img height="12" width="12" src="i/shop_ico/3.png"> <b>Ùèòû:</b></div>';
} elseif($i == 16) {
echo '<div class="shop_menu_txt"><img height="12" width="12" src="i/shop_ico/4.png"> <b>Þâåëèðíûå òîâàðû:</b></div>';
} elseif($i == 19) {
echo '<div class="shop_menu_txt"><img height="12" width="12" src="i/shop_ico/6.png"> <b>Çàêëèíàíèÿ:</b></div>';
} elseif($i == 27) {
echo '<div class="shop_menu_txt"><img height="12" width="12" src="i/shop_ico/7.png"> <b>Àìóíèöèÿ:</b></div>';
} elseif($i == 28) {
echo '<div class="shop_menu_txt"><img height="12" width="12" src="i/shop_ico/5.png"> <b>Ýëèêñèðû:</b></div>';
} elseif($i == 30) {
echo '<div class="shop_menu_txt"><img height="12" width="12" src="i/shop_ico/8.png"> <b>Ïîäàðêè:</b></div>';
} elseif($i == 35) {
echo '<div class="shop_menu_txt"><img height="12" width="12" src="i/shop_ico/9.png"> <b>Ïðî÷åå:</b></div>';
}
echo '
<A HREF="?otdel='.$i.'"><DIV style="background-color: #'.$color.'">
'.$otdels_array[$i].'
</A></DIV>
';
} else {
$i = -2;
}
$i++;
}
if(isset($_GET['gifts']))
{
$color = 'C7C7C7';
}else{
$color = 'e2e0e0';
}
echo '<div class="shop_menu_txt"><b>Âîçìîæíîñòè:</b></div>';
echo '<A HREF="?otdel=32&gifts=1"><DIV style="background-color: #'.$color.'">&nbsp;&nbsp;Ñäåëàòü ïîäàðêè</A>';
?>
</div>
</td>
</table>
<br>
<div id="textgo" style="visibility:hidden;"></div>
<?
}
?>