mysql_query("DELETE FROM `lab_trap` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_bots` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_inv` WHERE `id_user` = '".$user['id']."'");
Mysql_query("update `users` set `hp`=`maxhp`,`city_mountain`=`city_mountain`+'".$u_res['nagrada']."',`doblest`=`doblest`+'".$u_res['nagrada']."' where `login`='".$user['login']."'");
mysql_query("DELETE FROM `lab_user` WHERE `id_user` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `lab`='0',`room` ='99' WHERE `id` = '".$user['id']."';");
echo"<script>location='vxod_lab.php'</script>";
}else{echo"<font color=red>Вы еще не собрали все ресурсы</font><br>";}
}
if($_GET['mobkill']==1){
If($u_res['svitok_kill']>0){
$coma=array(
"Бот яростно замахнулся, но вы <b>уклонились</b> от удара!",
"Вы <b>заблокировали</b> подлый удар в спину.",
"Ваша реакция позволила вам <b>отпрыгнуть</b> от врага.",
"Вы громко закричали, в следствии чего бот <b>промахнулся</b>.",
"Бот явно не расчитал свою силы и ударил <b>мимо вас</b>!",
if($rand_bot_atack==1){$user['hp']=$user['hp']-$rand_bot_hpkol;echo"<font color=red>*** Бот атаковал вас на -<b>".$rand_bot_hpkol."</b> HP!</font><br>";mysql_query("update `users` set `hp`=`hp`-'".$rand_bot_hpkol."' where `id`='".$user['id']."'");}
$bot=mysql_fetch_array(mysql_query("select * from `lab_bots` where `id_bot`='".$id."' AND `id_user`='".$user['id']."' AND `id_room`='".$user['room']."' LIMIT 1"));
$hels=$bot['bot_hp']-$rand_hp;
if($hels<0){
echo"<b>Вы убили моба!</b><br>";
///Если нужно выбить записки
if($u_res['zadanie']==7){
$zapis=rand(1,4);
if($zapis==1){
echo"Вы получили 1 записку!<br>";
Mysql_query("update `lab_user` set `zad".$u_res['zadanie']."_kol`=`zad".$u_res['zadanie']."_kol`+'1' where `id_user`='".$user['id']."'");
}
mysql_query("delete from `lab_bots` where `id_bot`='".$id."' AND `id_user`='".$user['id']."' AND `id_room`='".$user['room']."' LIMIT 1");
//если просто убивалка
}else{
Mysql_query("update `lab_user` set `zad".$u_res['zadanie']."_kol`=`zad".$u_res['zadanie']."_kol`+'1' where `id_user`='".$user['id']."'");
mysql_query("delete from `lab_bots` where `id_bot`='".$id."' AND `id_user`='".$user['id']."' AND `id_room`='".$user['room']."' LIMIT 1");
}}
else{echo"Вы отняли у моба -<b>".$rand_hp."</b> HP!<br>";mysql_query("update `lab_bots` set `bot_hp`=`bot_hp`-'".$rand_hp."' where `id`='".$bot['id']."'");}
Mysql_query("update `lab_user` set `svitok_kill`=`svitok_kill`-'1' where `id_user`='".$user['id']."'");
}else{echo"<font color=red>У вас нет свитков атаки!</font><br>";}
}
if($_GET['svitexit']==1){
If($u_res['exit_teleport']>=1){
mysql_query("DELETE FROM `lab_trap` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_bots` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_inv` WHERE `id_user` = '".$user['id']."'");
Mysql_query("update `users` set `hp`=`maxhp` where `login`='".$user['login']."'");
Mysql_query("update `lab_user` set `exit_teleport`=`exit_teleport`-'1' where `id_user`='".$user['id']."'");
mysql_query("UPDATE `users` SET `lab`='0',`room` ='99' WHERE `id` = '".$user['id']."';");
echo"<script>location='vxod_lab.php'</script>";
}else{echo"<font color=red>У вас нет свитков возрата!</font><br>";}
}
if($_GET['exit']&&$room['exit']==1){
mysql_query("DELETE FROM `lab_trap` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_bots` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_inv` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".$user['id']."'");
Mysql_query("update `users` set `hp`=`maxhp` where `login`='".$user['login']."'");
mysql_query("UPDATE `users` SET `lab`='0',`room` ='99' WHERE `id` = '".$user['id']."';");
echo"<script>location='vxod_lab.php'</script>";
}
if($_GET['get']){
$data=mysql_fetch_array(mysql_query("SELECT * FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($_GET['get'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room']==$user['room']){
switch($data['type']){
case1:
$d=mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."';"));
if($user['sila']*4>$d[0]){
mysql_query("INSERT INTO `lab_tmp` (`id_user`,`type`,`value`) values ('".mysql_real_escape_string($user['id'])."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."');");
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
}
break;
case2:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
mysql_query("UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user['hp']=$user['maxhp'];
break;
case6:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
Mysql_query("update `lab_user` set `zad3_kol`=`zad3_kol`+'1' where `id_user`='".$user['id']."'");
echo"<script>location='lab.php'</script>";
break;
case5:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
Mysql_query("update `lab_user` set `zad2_kol`=`zad2_kol`+'1' where `id_user`='".$user['id']."'");
echo"<script>location='lab.php'</script>";
break;
case7:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
Mysql_query("update `lab_user` set `zad8_kol`=`zad8_kol`+'1' where `id_user`='".$user['id']."'");
echo"<script>location='lab.php'</script>";
break;
case4:
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
Mysql_query("update `lab_user` set `zad1_kol`=`zad1_kol`+'1' where `id_user`='".$user['id']."'");
echo"<script>location='lab.php'</script>";
break;
case3:
$d=mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `id_user`='".$user['id']."';"));
if($user['sila']*4>$d[0]){
mysql_query("INSERT INTO `lab_tmp` (`id_user`,`type`,`value`) values ('".mysql_real_escape_string($user['id'])."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."');");
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
}
break;
case9:
$d=mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `id_user`='".$user['id']."';"));
if($user['sila']*4>$d[0]){
mysql_query("INSERT INTO `lab_tmp` (`id_user`,`type`,`value`) values ('".mysql_real_escape_string($user['id'])."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."');");
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
}
break;
case8:
$d=mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `id_user`='".$user['id']."';"));
if($user['sila']*4>$d[0]){
mysql_query("INSERT INTO `lab_tmp` (`id_user`,`type`,`value`) values ('".mysql_real_escape_string($user['id'])."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."');");
mysql_query("DELETE FROM `lab_inv` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
}
break;
}
}
unset($data);
}
if($_GET['drop']){
$data=mysql_fetch_array(mysql_query("SELECT * FROM `lab_tmp` WHERE `id` = '".mysql_real_escape_string($_GET['drop'])."' AND `id_user`='".$user['id']."';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id` = '".mysql_real_escape_string($data['id'])."' AND `id_user`='".$user['id']."' LIMIT 1;");
mysql_query("INSERT INTO `lab_inv` (`id_room`,`type`,`value`,`id_user`) values ('".mysql_real_escape_string($user['room'])."','".mysql_real_escape_string($data['type'])."','".mysql_real_escape_string($data['value'])."','".mysql_real_escape_string($user['id'])."');");
unset($data);
}
if($_GET['nal1']){
$data=mysql_fetch_array(mysql_query("SELECT * FROM `lab_bots` WHERE `id` = '".mysql_real_escape_string($_GET['nal1'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room']==$user['room']){
$sum=mysql_fetch_array(mysql_query("SELECT SUM(`value`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='1';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='1';");
mysql_query("UPDATE `users` SET `money` = `money`+'".mysql_real_escape_string($sum[0])."' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
err('Вы обналичили у Архивариуса чек на <b>'.round($sum[0],2).'</b> кр!<br>');
}
unset($data);
}
if($_GET['nal2']){
$data=mysql_fetch_array(mysql_query("SELECT * FROM `lab_bots` WHERE `id` = '".mysql_real_escape_string($_GET['nal2'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room']==$user['room']){
$sum=mysql_fetch_array(mysql_query("SELECT SUM(`value`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='3';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='3';");
mysql_query("UPDATE `users` SET `doblest` = `doblest`+'".mysql_real_escape_string($sum[0])."' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
err('Вы обналичили у Архивариуса чек на <b>'.round($sum[0],2).'</b> доблести!<br>');
}
unset($data);
}
if($_GET['nal3']){
$data=mysql_fetch_array(mysql_query("SELECT * FROM `lab_bots` WHERE `id` = '".mysql_real_escape_string($_GET['nal3'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room']==$user['room']){
$sum=mysql_fetch_array(mysql_query("SELECT SUM(`value`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='8';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='8';");
err('Вы обналичили у Архивариуса чек на <b>'.round($sum[0],2).'</b> екр!<br>');
}
unset($data);
}
if($_GET['nal4']){
$data=mysql_fetch_array(mysql_query("SELECT * FROM `lab_bots` WHERE `id` = '".mysql_real_escape_string($_GET['nal4'])."' AND `id_user`='".$user['id']."';"));
if($data['id_room']==$user['room']){
$sum=mysql_fetch_array(mysql_query("SELECT SUM(`value`) FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='9';"));
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."' AND `type`='9';");
mysql_query("UPDATE `users` SET `exp` = `exp`+'".mysql_real_escape_string($sum[0])."' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
err('Вы обналичили у Архивариуса чек на <b>'.round($sum[0],2).'</b> опыта!<br>');
}
unset($data);
}
if($_GET['go']){
if(time()-$_SESSION['time']<=3){
echo"<font color=red>Не так быстро</font>";
}
else
switch($_GET['go']){
case"p1":
mysql_query("UPDATE `users` SET `room` = '".mysql_real_escape_string($room['p1'])."', `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user['room']=$room['p1'];
$_SESSION['time']=time();
break;
case"p2":
mysql_query("UPDATE `users` SET `room` = '".mysql_real_escape_string($room['p2'])."', `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user['room']=$room['p2'];
$_SESSION['time']=time();
break;
case"p3":
mysql_query("UPDATE `users` SET `room` = '".mysql_real_escape_string($room['p3'])."', `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user['room']=$room['p3'];
$_SESSION['time']=time();
break;
case"p4":
mysql_query("UPDATE `users` SET `room` = '".mysql_real_escape_string($room['p4'])."', `fullhptime` = ".time()." WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
$user['room']=$room['p4'];
$_SESSION['time']=time();
break;
}
}
$room=mysql_fetch_array(mysql_query("SELECT * FROM `lab_rooms` WHERE `id` = '".mysql_real_escape_string($user['room'])."';"));
if($user['hp']<=0){
mysql_query("DELETE FROM `lab_trap` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_bots` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_inv` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_tmp` WHERE `id_user` = '".$user['id']."'");
mysql_query("DELETE FROM `lab_user` WHERE `id_user` = '".$user['id']."'");
Mysql_query("update `users` set `hp`=`maxhp` where `login`='".$user['login']."'");
$msg.='К сожалению, Вы умерли!<br>';
mysql_query("UPDATE `users` SET `lab` = 0 , `room` = '99' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
echo"<script>location='vxod_lab.php'</script>";
}
$data=mysql_query("SELECT * FROM `lab_inv` WHERE `id_room` = '".mysql_real_escape_string($user['room'])."' AND `id_user`='".$user['id']."';");
$data2=mysql_query("SELECT * FROM `lab_tmp` WHERE `id_user` = '".mysql_real_escape_string($user['id'])."';");
$data3=mysql_query("SELECT * FROM `users` WHERE `lab` = 1 AND `room` = '".mysql_real_escape_string($room['id'])."';");
$data4=mysql_query("SELECT * FROM `lab_bots` WHERE `id_room` = '".mysql_real_escape_string($room['id'])."' AND `id_user`='".$user['id']."';");
$roow=mysql_fetch_array(mysql_query("SELECT * FROM `lab_trap` WHERE `id_room` = '".mysql_real_escape_string($user['room'])."' AND `id_user`='".$user['id']."';"));
if($roow[0]){
$msg.='В комнате была установлена ловушка...<br>';
switch($roow[3]){
case1:
mysql_query("UPDATE `users` SET `hp` = '1' WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
break;
case2:
mysql_query("UPDATE `users` SET `hp` = `hp`/2+1 WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
break;
case3:
mysql_query("UPDATE `users` SET `hp` = `hp`/3+1 WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
break;
case4:
mysql_query("UPDATE `users` SET `hp` = `hp`/4+1 WHERE `id` = '".mysql_real_escape_string($user['id'])."';");
break;
}
$user=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".mysql_real_escape_string($_SESSION['uid'])."' LIMIT 1;"));
mysql_query("DELETE FROM `lab_trap` WHERE `id` = '".mysql_real_escape_string($roow['id'])."' AND `id_user`='".$user['id']."';");
echo" <a href=\"#\" onclick=\"javascript:if (confirm('Желаете выбраться из квестового лабиринта? Теряете все, что здесь нашли.')){ location.href='lab.php?eexit=1';}\">Выйти?</a>";
$u_lab=mysql_query("select `login` from `users` where `lab`='1' and `bot`!='1'");
$u_lab_kol=mysql_num_rows($u_lab);
$heal_all=(($u_lab_kol/2)+1);
echo"Всего в Квестовом Лабиринте: <b>".$u_lab_kol."</b> чел. <small><a href=\"#\" onclick=\"javascript:if (confirm('Излечить всех за $heal_all кр?')){ location.href='lab.php?healall=1&cost=$heal_all';}\">[излечить]</a></small><br>";
if(($u_res['zadanie_mob_id']==$items['id_bot']&&$u_res['svitok_kill']>0)||($u_res['zadanie']==7&&$u_res['svitok_kill']>0)){echo" <a href=\"#\" onclick=\"javascript:if (confirm('Атаковать с помощью свитка?')){ location.href='lab.php?mobkill=1&idbot=$items[id_bot]';}\">[атака]</a>";}
if($items['id_bot']==4){
echo"<br><center><a href='?nal1=".$items['id']."'>[Обналичить чеки на <font color=green>кр</font>]</a></center>";
}
elseif($items['id_bot']==5){
echo"<br><center><a href='?nal2=".$items['id']."'>[Обналичить чеки на <font color=blue>добл.</font>]</a></center>";
}
elseif($items['id_bot']==6){
echo"<br><center><a href='?nal3=".$items['id']."'>[Обналичить чеки на <font color=red>екры</font>]</a></center>";
}
elseif($items['id_bot']==7){
echo"<br><center><a href='?nal4=".$items['id']."'>[Обналичить чеки на <font color=gray>опыт</font>]</a></center>";
}
}
echo"<br><li><u>Ресурсы:</u>";
while($items=mysql_fetch_array($data)){
switch($items['type']){
case1:
echo"<BR><a href='?get=".$items['id']."'><img src='i/INV_Scroll_03.gif' width=16>Чек на <font color=green><b>".$items['value']."</b> кр.</font></a>";