$dress=mysql_fetch_array(mysql_query('SELECT * FROM `shop` WHERE `id` = "'.(int)$id.'" LIMIT 1'));
}else{
$dress=mysql_fetch_array(mysql_query('SELECT * FROM `ashop` WHERE `id` = "'.(int)$id.'" LIMIT 1'));
}
if(isset($dress['id'])){
mysql_query("INSERT INTO `inventory` (`laba`, `prototype`,`owner`,`name`,`type`,`massa`,`cost`, `img`,`maxdur`,`isrep`,`gsila`,`glovk`,`ginta`,`gintel`,`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,`nalign`,`dategoden`,`goden`,`otdel`,`gmp`,`gmeshok`,`encicl`,`artefact`,`koll`) VALUES ('$type', '{$dress['id']}','{$user['id']}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}','{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron2']}','{$dress['bron3']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','".(($dress['goden'])?($dress['goden']*24*60*60+time()):"")."','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','{$dress[koll]}')");
}
}
functionmoney_add($sum){
global$user;
$user['money']+=$sum;
mysql_query('UPDATE `users` SET `money` = "'.$user['money'].'" WHERE `id` = "'.$user['id'].'" LIMIT 1');
}
if($user['room']==1052){
if($user['id']==10022){
$lab=mysql_fetch_array(mysql_query('SELECT * FROM `laba_now` WHERE `id` = "'.$user['laba'].'" LIMIT 1'));
$map=mysql_fetch_array(mysql_query('SELECT `id`,`data`,`update` FROM `laba_map` WHERE `id` = "'.$user['laba'].'" LIMIT 1'));
}else{
$lab=mysql_fetch_array(mysql_query('SELECT * FROM `laba_now` WHERE `id` = "'.$user['laba'].'" LIMIT 1'));
$map=mysql_fetch_array(mysql_query('SELECT `id`,`data`,`update` FROM `laba_map` WHERE `id` = "'.$user['laba'].'" LIMIT 1'));
}
$dies=mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `laba_act` WHERE `uid` = "'.$user['id'].'" AND `lib` = "'.$user['laba'].'" AND `vars` = "dielaba" LIMIT 1'));
$dies=$dies[0];
$map_d=json_decode($map['data']);
$usersDng=setHP($user['hp'],$user['maxhp'],0);
$errors='';
$effed='';
$mapsee='';
$varos=array();
$varos['trap1']=mysql_fetch_array(mysql_query('SELECT `id`, `vals`, `time` FROM `laba_act` WHERE `uid` = "'.$user['id'].'" AND `lib` = "'.$lab['id'].'" AND `time` > "'.time().'" ORDER BY `time` DESC LIMIT 1'));
$real_x=$user['x'];
$real_y=$user['y'];
if($real_y<6){$real_y=6;}
if($real_x<6){$real_x=6;}
if($real_y>count($map_d)-7){
$real_y=count($map_d)-7;
}
if($real_x>count($map_d)-7){
$real_x=count($map_d)-7;
}
$objs=array();
$sp=mysql_query('SELECT * FROM `laba_obj` WHERE `lib` = "'.$lab['id'].'" AND `x` > '.($real_x-7).' AND `x` < '.($real_x+7).' AND `y` > '.($real_y-12).' AND `y` < '.($real_y+12).' LIMIT 144');
$btl_pix=mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `battle` > 0 AND `laba` = "'.$lab['id'].'" AND `x` = "'.$user['x'].'" AND `y` = "'.$user['y'].'" LIMIT 1'));
$itms.='<hr /><img title="Эликсир был выпит" src="/i/sh/openHeal.gif" width="60" height="60" />';
}
}elseif($mitm['type']==4){
if($mitm['use']==0){
$var['trap1']=mysql_fetch_array(mysql_query('SELECT `id`, `vals`, `time` FROM `laba_act` WHERE `uid` = "'.$user['id'].'" AND `lib` = "'.$lab['id'].'" AND `time` > "'.time().'" ORDER BY `time` DESC LIMIT 1'));
$var['time']=rand(1,60);
if(isset($var['trap1']['id'])){
mysql_query('UPDATE `laba_act` SET `vals` = "'.($var['trap1']['vals']+$var['time']).'", `time` = "'.($var['trap1']['time']+$var['time']*60).'" WHERE `id` = "'.$var['trap1']['id'].'" LIMIT 1');
mysql_query('UPDATE `laba_obj` SET `use` = "'.$mitm['use'].'" WHERE `id` = "'.$mitm['id'].'" LIMIT 1');
$var['sex']='';
if($user['sex']==0){$var['sex']='а';}
$var['text']='<img width=40 height=25 src=/i/sh/event_timer_trap.gif /> <b>'.$user['login'].'</b> угодил'.$var['sex'].' в ловушку...';
$varos['trap1']=mysql_fetch_array(mysql_query('SELECT `vals`, `time` FROM `laba_act` WHERE `uid` = "'.$user['id'].'" AND `lib` = "'.$lab['id'].'" AND `time` > "'.time().'" ORDER BY `time` DESC LIMIT 1'));
$errors.='<img width="40" height="25" src="/i/sh/event_timer_trap.gif" /> '.$user['login'].' угодил'.$var['sex'].' в ловушку... Время перехода +3 секунды (Длительность: +'.$var['time'].' мин.)';
$errors='<font color=red><b>Предмет не найден...</b></font>';
}elseif(isset($_GET['useobj'])){
$var=array('obj'=>mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `id` = "'.mysql_real_escape_string($_GET['useobj']).'" AND `lib` = "'.$lab['id'].'" AND `x` = "'.$user['x'].'" AND `y` = "'.$user['y'].'" LIMIT 1')));
if(isset($var['obj']['id'])){
if($var['obj']['use']==0){
if($var['obj']['type']==1){
$var['sex']='';
if($user['sex']==0){$var['sex']='а';}
$var['itm']=$varsitm[rand(0,count($varsitm)-1)];
$var['itm']=$var['itm'][0];
$var['itm']=mysql_fetch_array(mysql_query('SELECT `id`, `name` FROM `shop` WHERE `id` = "'.$var['itm'].'" LIMIT 1'));
mysql_query('UPDATE `users` SET `hp` = "'.$user['hp'].'" WHERE `id` = "'.$user['id'].'" LIMIT 1');
$errors.='<img width="40" height="25" src="/i/sh/event_heal.gif" /> '.$user['login'].' пополнил'.$var['sex'].' здоровье, Уровень Жизни +'.$var['hpp'].'% (+'.$var['hp'].'HP)';
$var['obj']['use']=$user['id'];
}elseif($var['obj']['type']==6){
$var['trap1']=mysql_fetch_array(mysql_query('SELECT `id`, `vals`, `time` FROM `laba_act` WHERE `uid` = "'.$user['id'].'" AND `lib` = "'.$lab['id'].'" AND `time` > "'.time().'" ORDER BY `time` DESC LIMIT 1'));
mysql_query('DELETE FROM `laba_act` WHERE `uid` = "'.$user['id'].'" AND `lib` = "'.$lab['id'].'" AND `time` > "'.time().'" ORDER BY `time` DESC LIMIT 1');
mysql_query('UPDATE `laba_act` SET `time` = "'.$var['trap1']['time'].'" WHERE `uid` = "'.$user['id'].'" AND `lib` = "'.$lab['id'].'" AND `time` > "'.time().'" ORDER BY `time` DESC LIMIT 1');
$errors='<hr /><b style=\'color: Red;\'>Действие ловушки снижено на '.$var['time'].' мин...</b>';
if(event.button==2){// Чтобы отключить левую кнопку поставьте цифру 1
alert(message);// чтобы отключить среднюю кнопку поставьте цифру 1
returnfalse;}
}
if(document.layers){// NC
if(e.which==3){
alert(message);
returnfalse;}
}
}
if(document.layers)
{document.captureEvents(Event.MOUSEDOWN);}
document.onmousedown=click;
document.oncontextmenu=function(e){returnfalse};
//-->
</script>
<br/>
<formmethod="post">
<div>
<b><?=$user['login'];?></b> <?=$usersDng?><hr />
</div>
<inputtype="submit"name="exit"value="Выйти и потерять все найденное!"onclick="return confirmSubmit('Действительно хотите Выйти и потерять все найденное?')"/>
</form>
<br/>
<?if($effed!=''){echo$effed;}?>
<br/>
<?
if($dies>0){
echo'<b>Кол-во смертей : '.$dies.'/3</b><br />';
}
?>
Карта:#<?=$lab['id']?>. Координаты : {X = <?=$user['x']?> | Y = <?=$user['y']?>}
$qobj=mysql_fetch_array(mysql_query('SELECT * FROM `shop` WHERE `id` = "'.$q1['obj_id'].'" LIMIT 1'));
$qobj_f=mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `inventory` WHERE `owner` = "'.$user['id'].'" AND "name" = "'.$qobj['obj_id'].'" LIMIT 1'));
if($q2['val']!=$qobj[0]){
mysql_query('UPDATE `qst_user` SET `val` = "'.$qobj[0].'" WHERE `id` = "'.$q2['id'].'" LIMIT 1');
$q2['val']=$qobj[0];
}
echo'<b>'.$qobj['name'].'</b> ';
}elseif($q1['type']==2){
echo'Собрать трофеи: ';
$qobj=mysql_fetch_array(mysql_query('SELECT * FROM `shop` WHERE `id` = "'.$q1['obj_id'].'" LIMIT 1'));
$qobj_f=mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `inventory` WHERE `owner` = "'.$user['id'].'" AND "name" = "'.$qobj['obj_id'].'" LIMIT 1'));
echo'<b>'.$qobj['name'].'</b>';
$qobj=mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$q1['obj_id'].'" LIMIT 1'));
if($q2['val']!=$qobj[0]){
mysql_query('UPDATE `qst_user` SET `val` = "'.$qobj[0].'" WHERE `id` = "'.$q2['id'].'" LIMIT 1');
$q2['val']=$qobj[0];
}
echo' c монстров <b>'.$qobj['name'].'</b> ';
}elseif($q1['type']==3){
echo'Убить монстров: ';
$qobj=mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$q1['obj_id'].'" LIMIT 1'));