"' . 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 = []; $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'); while ($pl = mysql_fetch_array($sp)) { $objs[$pl['x']][$pl['y']] = $pl; } $i = 1; $goodgoo = [1 => 0, 2 => 0, 3 => 0, 4 => 0]; while ($i <= 4) { $goto = ['x' => $user['y'], 'y' => $user['x']]; if ($i == 1) { $goto['x']--; } elseif ($i == 2) { $goto['y']--; } elseif ($i == 3) { $goto['x']++; } elseif ($i == 4) { $goto['y']++; } if ($map_d[$goto['y']][$goto['x']] == 0 && $goto['x'] > 0 && $goto['x'] < count($map_d) - 1 && $user['timeGo'] <= time()) { $goodgoo[$i] = 1; } $i++; } if (isset($_GET['goto'])) { $goto = ['x' => $user['y'], 'y' => $user['x']]; if ($_GET['goto'] == 1) { $goto['x']--; } elseif ($_GET['goto'] == 2) { $goto['y']--; } elseif ($_GET['goto'] == 3) { $goto['x']++; } elseif ($_GET['goto'] == 4) { $goto['y']++; } if ($goodgoo[$_GET['goto']] == 1 && $user['timeGo'] <= time()) { $user['y'] = $goto['x']; $user['x'] = $goto['y']; $real_x = $user['x']; $real_y = $user['y']; $varos['timego'] = 0; #5 if (isset($varos['trap1']['id'])) { $varos['timego'] += 3; } if ($user['align'] == 2.99) { $varos['timego'] = 0; } $user['timeGo'] = (time() + $varos['timego']); $user['timeGoL'] = time(); if (!mysql_query('UPDATE `users` SET `x` = "' . $user['x'] . '", `y` = "' . $user['y'] . '", `timeGoL` = "' . $user['timeGoL'] . '", `timeGo` = "' . $user['timeGo'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1')) { $errors = 'Ошибка перемещения!'; } } } $tmdg = ($user['timeGo'] - time()); $tmdgl = ($user['timeGo'] - $user['timeGoL']); $tmdgp = floor(100 - $tmdg / $tmdgl * 100); if ($tmdgp < 1) { $tmdgp = 1; } elseif ($tmdgp > 100) { $tmdgp = 100; } $tmdgm = 25 * $tmdgl; $tmdg = floor(40 / 100 * $tmdgp); if ($tmdg < 1) { $tmdg = 1; } elseif ($tmdg > 40) { $tmdg = 40; } if (isset($_POST['exit'])) { if ($lab['users'] < 2) { mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); } else { $lab['users']--; mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); } $dresed = mysql_query('SELECT `id`, `type` FROM `inventory` WHERE `dressed` = 1 AND `laba` = 2 AND `owner` = "' . $user['id'] . '"'); while ($pl = mysql_fetch_array($dresed)) { dropitemid($pl['type'], $user['id']); } mysql_query('DELETE FROM `inventory` WHERE `laba` > 0 AND `owner` = "' . $user['id'] . '"'); mysql_query("UPDATE `users`, `online` SET `users`.`room` = '1051', `online`.`room` = '1051', `users`.`x` = '0', `users`.`y` = '0', `users`.`laba` = '0' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $user['id'] . "'"); mysql_query('UPDATE `qst_user` SET `val` = "0" WHERE `uid` = "' . $user['id'] . '" AND `cancel` = "0" AND `finish` = "0"'); addActions(time(), 'go_labirint', (time() + 60 * 60 * 6), $user['id']); header('Location: lab_enter.php'); } $itms = ''; if (isset($objs[$user['x']][$user['y']]['id'])) { $var = []; $mitm = $objs[$user['x']][$user['y']]; if ($mitm['type'] == 2) { if ($mitm['use'] == 0) { $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')); if (!isset($btl_pix['id'])) { $bots = [ 0 => [10025, 10026, 10027, 10028, 10031, 10032, 10033, 10034], 1 => [10111, 10112, 10113, 10114, 10115, 10116], 2 => [10111, 10112, 10113], ]; $bot_pix2 = $bots[$lab['type']]; $teams = []; $where = ''; $bot_ids = ''; $i = 0; $j = (1 + rand(0, floor($user['level'] / rand(3, 4)))); while ($i < $j) { $bot_pix = $bot_pix2[rand(0, count($bot_pix2) - 1)]; $bot_pix = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $bot_pix . '" LIMIT 1')); mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('" . $bot_pix['login'] . " (Бот #$i)', '" . $bot_pix['id'] . "', '', '" . $bot_pix['maxhp'] . "')"); $bot = mysql_insert_id(); $bot_ids .= $bot . ';'; $teams[$user['id']][$bot] = [0, 0, time()]; $teams[$bot][$user['id']] = [0, 0, time()]; $where = ' `id` = ' . $bot . ' OR'; $i++; } $bot_ids = rtrim($bot_ids, ';'); $where = rtrim($where, ' OR'); if (!mysql_query("INSERT INTO `battle` (`teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `x`, `y`) VALUES ('" . serialize($teams) . "', '3', '1', '0', '" . $user['id'] . "', '" . $bot_ids . "', '" . time() . "', '" . time() . "', '" . $user['x'] . "', '" . $user['y'] . "')")) { exit('Error #2'); } $id = mysql_insert_id(); $bts = explode(';', $bot_ids); $is = 0; while ($is <= count($bts)) { $nicks .= Nick::id($bts[$is])->full(1) . ', '; $i_d .= $bts[$is] . ', '; $is++; } $nicks = rtrim($nicks, ', '); $who = '`id` IN (' . rtrim($i_d, ', ') . ')'; if ($user1['invis'] == 1) { $rr = "невидимка и " . $nicks . ""; } else { $rr = "" . Nick::id($user['id'])->full(1) . " и " . $nicks . ""; } if (!mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE " . $who . "")) { exit('Error #1' . $who); } mysql_query("UPDATE `users` SET `battle` = {$id}, `zayavka` = 0 WHERE `id`= {$user['id']} LIMIT 1"); addlog($id, "Часы показывали " . date("Y.m.d H.i") . ", когда " . $rr . " бросили вызов друг другу.
"); } else { $bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $btl_pix['battle'] . '" LIMIT 1')); $botd = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `battle` = "' . $bd['id'] . '" LIMIT 1')); $battle = unserialize($bd['teams']); $ak = array_keys($battle[$botd['id']]); $battle[$user['id']] = $battle[$ak[0]]; foreach ($battle[$user['id']] as $k => $v) { $battle[$user['id']][$k] = [0, 0, time()]; $battle[$k][$user['id']] = [0, 0, time()]; } $t1 = explode(";", $bd['t1']); $ttt = 1; addlog($jert['battle'], '' . date("H:i") . ' ' . Nick::id($user['id'])->short() . ' вмешался в поединок!
'); mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '` = CONCAT(`t' . $ttt . '`,\';' . $user['id'] . '\') WHERE `id` = "' . $btl_pix['battle'] . '" LIMIT 1'); mysql_query("UPDATE `users` SET `battle` = '" . $bd['id'] . "', `zayavka` = 0 WHERE `id` = '" . $user['id'] . "' LIMIT 1"); header("Location: fbattle.php"); } exit(""); } } elseif ($mitm['type'] == 1) { if ($mitm['use'] == 0) { $itms .= '
'; } else { $itms .= '
'; } } elseif ($mitm['type'] == 3) { if ($mitm['use'] == 0) { $itms .= '
'; } else { $itms .= '
'; } } 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'); } else { mysql_query('INSERT INTO `laba_act` (`uid`, `time`, `lib`, `vars`, `vals`) VALUES ("' . $user['id'] . '", "' . (time() + $var['time'] * 60) . '", "' . $lab['id'] . '", "trap1", "' . $var['time'] . '")'); } $mitm['use'] = $user['id']; 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'] = ' ' . $user['login'] . ' угодил' . $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 .= ' ' . $user['login'] . ' угодил' . $var['sex'] . ' в ловушку... Время перехода +3 секунды (Длительность: +' . $var['time'] . ' мин.)'; } } elseif ($mitm['type'] == 5) { if ($mitm['use'] == 0) { $itms .= '
'; } else { $itms .= '
'; } } elseif ($mitm['type'] == 6) { if ($mitm['use'] == 0) { $itms .= '
'; } else { $itms .= '
'; } } unset($var); } if ($user['y'] >= count($map_d) - 2) { if ($lab['users'] < 2) { mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); } else { $lab['users']--; mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); } $dresed = mysql_query('SELECT `id`, `type` FROM `inventory` WHERE `dressed` = 1 AND `laba` = 2 AND `owner` = "' . $user['id'] . '"'); while ($pl = mysql_fetch_array($dresed)) { dropitemid($pl['type'], $user['id']); } mysql_query('UPDATE `inventory` SET `laba` = 0 WHERE `laba` = 1 AND `owner` = "' . $user['id'] . '"'); mysql_query('DELETE FROM `inventory` WHERE `laba` = 2 AND `owner` = "' . $user['id'] . '"'); mysql_query("UPDATE `users`, `online` SET `users`.`room` = '1051', `online`.`room` = '1051', `users`.`x` = '0', `users`.`y` = '0', `users`.`laba` = '0' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $user['id'] . "'"); addActions(time(), 'go_labirint', (time() + 60 * 60 * 6), $user['id']); header('Location: lab_enter.php'); } if (isset($_GET['takeitm'])) { $errors = 'Предмет не найден...'; } elseif (isset($_GET['useobj'])) { $var = ['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')); if (isset($var['itm']['id'])) { if ($var['itm']['id'] == 270) { $arr = [0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2]; $kr = $arr[rand(0, count($arr) - 1)]; $var['itm']['name'] = $kr . ' кр'; money_add($kr); unset($kr); } else { labaItemAdd($var['itm']['id']); } } else { $var['itm']['name'] = 'Предмет рассыпался на глазах...'; } $errors .= ' ' . $user['login'] . ' открыл' . $var['sex'] . ' сундук...и забрал "' . $var['itm']['name'] . '"'; $var['obj']['use'] = $user['id']; } elseif ($var['obj']['type'] == 5) { $var['sex'] = ''; if ($user['sex'] == 0) { $var['sex'] = 'а'; } $errors .= ' ' . $user['login'] . ' открыл' . $var['sex'] . ' Ящик Пандоры...и забрал "' . $var['itm']['name'] . '"'; $var['obj']['use'] = $user['id']; } elseif ($var['obj']['type'] == 3) { $var['sex'] = ''; if ($user['sex'] == 0) { $var['sex'] = 'а'; } $var['hpp'] = rand(2, 5) * 10; $var['hp'] = round($user['maxhp'] / 100 * $var['hpp']); $user['hp'] += $var['hp']; if ($user['hp'] > $user['maxhp']) { $user['hp'] = $user['maxhp']; } mysql_query('UPDATE `users` SET `hp` = "' . $user['hp'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); $errors .= ' ' . $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')); if (isset($var['trap1']['id'])) { $var['time'] = rand(1, 50); if ($var['trap1']['time'] <= (time() + 60 * $var['time'])) { mysql_query('DELETE FROM `laba_act` WHERE `uid` = "' . $user['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" ORDER BY `time` DESC LIMIT 1'); $errors .= '
Действие ловушки закончилось.'; unset($var['trap1'], $var['time']); } else { $var['trap1']['time'] -= 60 * $var['time']; 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 = '
Действие ловушки снижено на ' . $var['time'] . ' мин...'; } $var['obj']['use'] = $user['id']; } else { $errors .= '
Вам нечего очищать ...'; } } if ($var['obj']['use'] > 0) { mysql_query('UPDATE `laba_obj` SET `use` = "' . $var['obj']['use'] . '" WHERE `id` = "' . $var['obj']['id'] . '" LIMIT 1'); #$var['obj']['use'] = $var['obj']['use']; ?!?!?!?!?! } } else { $errors = 'Кто-то уже использовал это до Вас...'; } } else { $errors = 'Обьект не найден...'; } unset($var); } $sp = mysql_query('SELECT `x`, `y`, `level`, `login` FROM `users` WHERE `laba` = "' . $lab['id'] . '" AND `id` != "' . $user['id'] . '" LIMIT 3'); $pi = 1; while ($pl = mysql_fetch_array($sp)) { $objs[$pl['x']][$pl['y']] = [2 => '
']; $pi++; } $objs[$user['x']][$user['y']] = [2 => '
']; $i = 0; while ($i <= count($map_d)) { $j = 0; while ($j < count($map_d[$i])) { if ($i > $real_x - 6 && $i < $real_x + 6 && $j > $real_y - 6 && $j < $real_y + 6) { if ($map_d[$i][$j] == 1) { $mapsee .= '
' . $objs[$i][$j][2] . '
'; } else { if (!isset($objs[$i][$j]['id'])) { if ($j == 1) { $objs[$i][$j][2] = '
'; } elseif ($j == count($map_d) - 2) { $objs[$i][$j][2] = '
'; } } else { if ($objs[$i][$j]['use'] == 0) { $objs[$i][$j][2] = '
'; } else { $objs[$i][$j][2] = ''; } } $mapsee .= '
' . $objs[$i][$j][2] . '
'; } } $j++; } if ($i > $real_x - 6 && $i < $real_x + 6) { $mapsee .= '
'; } $i++; } $mapsee = '
' . $mapsee . '
'; if ($user['align'] == 2.99) { unset($objs); $objs[$user['x']][$user['y']] = [2 => '
']; $i = 0; while ($i <= count($map_d)) { $j = 0; while ($j < count($map_d[$i])) { if ($map_d[$i][$j] == 1) { $mapsee2 .= '
' . $objs[$i][$j][2] . '
'; } else { if (!isset($objs[$i][$j]['id'])) { if ($j == 1 && $i > 0 && $i < count($map_d) - 2) { $objs[$i][$j][2] = '
'; } elseif ($j == count($map_d) - 2 && $i > 0 && $i < count($map_d) - 2) { $objs[$i][$j][2] = '
'; } } else { if ($objs[$i][$j]['use'] == 0) { $objs[$i][$j][2] = '
'; } else { $objs[$i][$j][2] = ''; } } $mapsee2 .= '
' . $objs[$i][$j][2] . '
'; } $j++; } $mapsee2 .= '
'; $i++; } $mapsee2 = '
' . $mapsee2 . '
'; } if (isset($varos['trap1']['vals']) && $varos['trap1']['vals'] > 0) { $effed .= '
- Время перехода +3 секунды (Осталось : ' . timeOut($varos['trap1']['time'] - time()) . ')
'; } unset($varos); \Battles\Template::header('labirint'); ?>
 



0) { echo 'Кол-во смертей : ' . $dies . '/3
'; } ?> Карта : #. Координаты : {X = | Y = }
 
  Задание: ' . $q1['name'] . '
• '; if ($q1['type'] == 1) { 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')); 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 '' . $qobj['name'] . '  '; } 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 '' . $qobj['name'] . ''; $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 монстров ' . $qobj['name'] . '  '; } elseif ($q1['type'] == 3) { echo 'Убить монстров: '; $qobj = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $q1['obj_id'] . '" LIMIT 1')); echo '' . $qobj['login'] . ' [' . $qobj['level'] . ']  '; } echo '[' . $q2['val'] . '/' . $q1['obj_val'] . ']
'; echo '(Задание не засчитается, если Вы не найдёте выход.)'; } ?>
 
  '; } ?> ' . $mapsee2; } ?>  
 
     
                                                                                                                       
  
 
Вверх
Влево Обновить Вправо
Вниз