room['file'] != 'dragopsh') {
return;
}
$d = new Dungeon;
function sendSysChat(string $message, bool $hasDn = false, bool $hasReceiver = false) {
global $u;
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setText($message);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
if ($hasDn) {
$cmsg->setDn($u->info['dnow']);
}
if ($hasReceiver) {
$cmsg->setTo($u->info['login']);
}
(new Chat())->sendMsg($cmsg);
}
$lab = mysql_fetch_array(mysql_query('SELECT * FROM `laba_now` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1'));
if (!isset($lab['id'])) {
die('Поход в подземелье не найден...');
}
$varsitmsund = [//Вещи в сундуках
[4391, 1], [1043, 1], [3106, 1], [2544, 2], //array(2545,1),
[724, 1], [1187, 1], [1043, 1], [3106, 1], [2544, 2], //array(2545,1),
[724, 1], [1187, 1], [1043, 1], [3106, 1], [2544, 2], //array(2545,1),
[724, 1], [1187, 1], [1043, 1], [3106, 1], [2544, 2], //array(2545,1),
[724, 1], [1187, 1]];
$varsitm = [//Слабые ресурсы
[4373, 1], [4374, 1], [4375, 1], [4376, 1], [4377, 1], [4378, 1], [4379, 1], [4380, 1], [4381, 1], [4382, 1], [4383, 1], [4384, 1], [4385, 1], //
[4373, 1], [4374, 1], [4375, 1], [4376, 1], [4377, 1], [4378, 1], [4379, 1], [4380, 1], [4381, 1], [4382, 1], [4383, 1], [4384, 1], [4385, 1], //
[4373, 1], [4374, 1], [4375, 1], [4376, 1], [4377, 1], [4378, 1], [4379, 1], [4380, 1], [4381, 1], [4382, 1], [4383, 1], [4384, 1], [4385, 1]];
$varsitmart = [//Артефакты
[2109, 1], [2111, 1], [2099, 1], [2105, 1], [2122, 1], [2101, 1], [2114, 1], [2107, 1], [2108, 1]];
$map = mysql_fetch_array(mysql_query('SELECT `id`,`data`,`update` FROM `laba_map` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1'));
if (!isset($map['id'])) {
die('Карта подземелий не найдена...');
}
$dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $u->info['dnow'] . '" AND `vars` = "dielaba" LIMIT 1'));
$dies = $dies[0];
$map_d = json_decode($map['data']);
$varos = [];
$varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `vals`,`time` FROM `laba_act` WHERE `uid` = "' . $u->info['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" AND `vars` = "trap1" ORDER BY `time` DESC LIMIT 1'));
$errors = '';
$effed = '';
if (isset($_GET['takeitm'])) {
$var = ['obj' => mysql_fetch_array(mysql_query('SELECT `i`.*,`m`.`name`,`m`.`inslot` FROM `laba_itm` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`itm` WHERE `i`.`id` = "' . mysql_real_escape_string($_GET['takeitm']) . '" AND `i`.`lib` = "' . $lab['id'] . '" AND `i`.`x` = "' . $u->info['x'] . '" AND `i`.`y` = "' . $u->info['y'] . '" LIMIT 1'))];
if (isset($var['obj']['id'])) {
if ($var['obj']['take'] == 0) {
$var['sex'] = '';
if ($u->info['sex'] == 1) {
$var['sex'] = 'а';
}
$var['text'] = '' . $u->info['login'] . ' поднял' . $var['sex'] . ' предмет "' . $var['obj']['name'] . '"';
$errors .= 'Вы подняли предмет "' . $var['obj']['name'] . '"';
mysql_query('UPDATE `laba_itm` SET `take` = "' . $u->info['id'] . '" WHERE `id` = "' . $var['obj']['id'] . '" LIMIT 1');
if ($var['obj']['inslot'] > 0) {
\User\ItemsModel::addItem($var['obj']['itm'], $u->info['id'], '|fromlaba=1|nosavelaba=1|nosale=1');
} else {
\User\ItemsModel::addItem($var['obj']['itm'], $u->info['id'], '|fromlaba=1');
}
sendSysChat($var['text'], true);
} else {
$errors .= 'Предмет кто-то поднял раньше Вас...';
}
} else {
$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` = "' . $u->info['x'] . '" AND `y` = "' . $u->info['y'] . '" LIMIT 1'))];
if (isset($var['obj']['id'])) {
if ($var['obj']['use'] == 0) {
if ($var['obj']['type'] == 1) {
//сунудук
$var['sex'] = '';
if ($u->info['sex'] == 1) {
$var['sex'] = 'а';
}
//Выдаем ресурсы, свитки
if (rand(0, 100) < 25) {
//Выдаем арт varsitmart
$var['itm'] = $varsitm[mt_rand(0, count($varsitm) - 1)];
$var['itm'] = $var['itm'][0];
$var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $var['itm'] . '" LIMIT 1'));
if (isset($var['itm']['id'])) {
mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES (
"' . $u->info['id'] . '","' . $lab['id'] . '","' . time() . '","' . $var['itm']['id'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","0"
)');
} else {
$var['itm']['name'] = 'Предмет рассыпался на глазах...';
}
}
//Выдаем ресурсы, свитки
$var['itm'] = $varsitmsund[rand(0, count($varsitmsund) - 1)];
$var['itm'] = $var['itm'][0];
$var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $var['itm'] . '" LIMIT 1'));
if (isset($var['itm']['id'])) {
\User\ItemsModel::addItem($var['itm']['id'], $u->info['id'], '|fromlaba=1');
} else {
$var['itm']['name'] = 'Предмет рассыпался на глазах...';
}
$var['text'] = ' ' . $u->info['login'] . ' открыл' . $var['sex'] . ' сундук...и забрал "' . $var['itm']['name'] . '"';
sendSysChat($var['text'], true);
$errors .= ' ' . $u->info['login'] . ' открыл' . $var['sex'] . ' сундук...и забрал "' . $var['itm']['name'] . '"';
$var['obj']['use'] = $u->info['id'];
} elseif ($var['obj']['type'] == 5) {
//Пандору
$var['sex'] = '';
if ($u->info['sex'] == 1) {
$var['sex'] = 'а';
}
//Выдаем ресурсы, свитки
if (rand(0, 100) < 70) {
//Выдаем арт varsitmart
$var['itm'] = $varsitmart[rand(0, count($varsitmart) - 1)];
$var['itm'] = $var['itm'][0];
$var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $var['itm'] . '" LIMIT 1'));
if (isset($var['itm']['id'])) {
mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES (
"' . $u->info['id'] . '","' . $lab['id'] . '","' . time() . '","' . $var['itm']['id'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","0"
)');
} else {
$var['itm']['name'] = 'Предмет рассыпался на глазах...';
}
}
$var['itm'] = $varsitm[rand(0, count($varsitm) - 1)];
$var['itm'] = $var['itm'][0];
$var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $var['itm'] . '" LIMIT 1'));
if (isset($var['itm']['id'])) {
mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES (
"' . $u->info['id'] . '","' . $lab['id'] . '","' . time() . '","' . $var['itm']['id'] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","0"
)');
} else {
$var['itm']['name'] = 'Предмет рассыпался на глазах...';
}
$var['text'] = ' ' . $u->info['login'] . ' открыл' . $var['sex'] . ' Ящик Пандоры...';
sendSysChat($var['text'], true);
$errors .= ' ' . $u->info['login'] . ' открыл' . $var['sex'] . ' Ящик Пандоры...';
$var['obj']['use'] = $u->info['id'];
} elseif ($var['obj']['type'] == 3) {
//Хилка
$var['sex'] = '';
if ($u->info['sex'] == 1) {
$var['sex'] = 'а';
}
$var['hpp'] = rand(2, 5) * 10;
$var['hp'] = round($u->stats['hpAll'] / 100 * $var['hpp']);
$u->stats['hpNow'] += $var['hp'];
if ($u->stats['hpNow'] > $u->stats['hpAll']) {
$u->stats['hpNow'] = $u->stats['hpAll'];
}
$var['text'] = ' ' . $u->info['login'] . ' пополнил' . $var['sex'] . ' здоровье, Уровень Жизни +' . $var['hpp'] . '% (+' . $var['hp'] . 'HP)';
mysql_query('UPDATE `stats` SET `hpNow` = "' . $u->stats['hpNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
sendSysChat($var['text'], true);
$errors .= ' ' . $u->info['login'] . ' пополнил' . $var['sex'] . ' здоровье, Уровень Жизни +' . $var['hpp'] . '% (+' . $var['hp'] . 'HP)';
$var['obj']['use'] = $u->info['id'];
}
if ($var['obj']['use'] > 0) {
mysql_query('UPDATE `laba_obj` SET `use` = "' . $var['obj']['use'] . '" WHERE `id` = "' . $var['obj']['id'] . '" LIMIT 1');
}
} else {
$errors = 'Кто-то уже использовал это до Вас...';
}
} else {
$errors = 'Обьект не найден...';
}
unset($var);
}
//Генирация карты
$mapsee = '';
$real_x = $u->info['x'];
$real_y = $u->info['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' => $u->info['y'], 'y' => $u->info['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 && $u->info['timeGo'] <= time()) {
$goodgoo[$i] = 1;
}
$i++;
}
if (isset($_GET['goto'])) {
$goto = ['x' => $u->info['y'], 'y' => $u->info['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 && $u->info['timeGo'] <= time()) {
//переходим
$u->info['y'] = $goto['x'];
$u->info['x'] = $goto['y'];
$real_x = $u->info['x'];
$real_y = $u->info['y'];
$varos['timego'] = 5;
if (isset($varos['trap1']['time'])) {
$varos['timego'] += 3;
}
if (isset($u->stats['speed_dungeon'])) {
$varos['timego'] = $varos['timego'] - floor($varos['timego'] / 100 * $u->stats['speed_dungeon']);
if ($varos['timego'] < 1) {
$varos['timego'] = 1;
}
}
$u->info['timeGo'] = time() + $varos['timego'];
$u->info['timeGoL'] = time();
mysql_query('UPDATE `stats` SET `x` = "' . $u->info['x'] . '" ,`y` = "' . $u->info['y'] . '",`timeGoL` = "' . $u->info['timeGoL'] . '",`timeGo` = "' . $u->info['timeGo'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
}
}
$tmdg = ($u->info['timeGo'] - time());
$tmdgl = ($u->info['timeGo'] - $u->info['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 ($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;
}
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');
}
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%fromlaba=1%"');
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%nosavelaba=1%"');
mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `dnow` = "0",`x`="0",`y`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
//Выбрасываем предметы которые из подземелья
die('');
}
//Предметы в локации
$itms = '';
if (isset($objs[$u->info['x']][$u->info['y']]['id'])) {
$var = [];
$mitm = $objs[$u->info['x']][$u->info['y']];
if ($mitm['type'] == 6) {
//Случайный предмет
if ($mitm['vars'] < 25) {
$i = 0;
while ($i < $mitm['vars']) {
$var['add'] = $varsitm[rand(0, count($varsitm) - 1)];
if ($var['add'][1] > 0) {
$j = 0;
while ($j < $var['add'][1]) {
mysql_query('INSERT INTO `laba_itm` (`uid`,`lib`,`time`,`itm`,`x`,`y`,`take`) VALUES (
"' . $u->info['id'] . '","' . $lab['id'] . '","' . time() . '","' . $var['add'][0] . '","' . $u->info['x'] . '","' . $u->info['y'] . '","0"
)');
$j++;
}
}
$i++;
}
} else {
//Конкретный предмет
}
mysql_query('DELETE FROM `laba_obj` WHERE `id` = "' . $mitm['id'] . '" LIMIT 1');
} elseif ($mitm['type'] == 2) {
if ($mitm['use'] == 0) {
$tbtl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `team_win` = -1 AND `dn_id` = "' . $lab['id'] . '" AND `x` = "' . $u->info['x'] . '" AND `y` = "' . $u->info['y'] . '" LIMIT 1'));
if (isset($tbtl['id'])) {
//вступаем в поединок
mysql_query('UPDATE `users` SET `battle` = "' . $tbtl['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
$u->error = 'Нападаем ... ';
} else {
$var['bots'] = [[357, 5], [358, 5], [359, 5], [360, 5], [361, 3], [362, 3], [363, 3], [364, 2], [365, 5], [366, 5], [367, 3]];
//Создаем новый бой
if ($mitm['vars'] != null) {
//Боты уже есть
} else {
//Новый список составляем
$i = 0;
while ($i <= $u->info['level']) {
$var['ab'] = $var['bots'][rand(0, count($var['bots']) - 1)];
$mitm['vars'] .= '|' . $var['ab'][0];
$i += $var['ab'][1];
}
//
$mitm['vars'] = ltrim($mitm['vars'], '|');
//
mysql_query('UPDATE `laba_obj` SET `vars` = "' . $mitm['vars'] . '" WHERE `id` = "' . $mitm['id'] . '" LIMIT 1');
}
//
$mitm['vars'] = explode('|', $mitm['vars']);
//
if (count($mitm['vars']) > 0) {
$btl_id = 0;
$expB = 0;
$btld = ['players' => '', 'timeout' => 180, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0];
$ins = mysql_query('INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
"102",
"' . $lab['id'] . '",
"' . $u->info['x'] . '",
"' . $u->info['y'] . '",
"' . $u->info['city'] . '",
"' . time() . '",
"' . $btld['players'] . '",
"' . $btld['timeout'] . '",
"' . $btld['type'] . '",
"' . $btld['invis'] . '",
"' . $btld['noinc'] . '",
"' . $btld['travmChance'] . '",
"' . $btld['typeBattle'] . '",
"' . $btld['addExp'] . '",
"' . $btld['money'] . '")');
$btl_id = mysql_insert_id();
}
if ($btl_id > 0) {
//
$i = 0;
while ($i < count($mitm['vars'])) {
$k = $u->addNewbot($mitm['vars'][$i], null, null, $logins_bot);
$logins_bot = $k['logins_bot'];
if ($k != false) {
$upd = mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '",`room` = "-100" WHERE `id` = "' . $k['id'] . '" LIMIT 1');
if ($upd) {
$upd = mysql_query('UPDATE `stats` SET `x`="' . $u->info['x'] . '",`y`="' . $u->info['y'] . '",`team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1');
if ($upd) {
$j++;
}
}
}
$i++;
}
unset($logins_bot);
if ($j > 0) {
mysql_query('UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
$u->error = 'Нападаем ... ';
} else {
$u->error = 'Не удалось напасть, ошибка обьекта нападения ...';
}
}
//
}
}
} 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` = "' . $u->info['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" AND `vars` = "trap1" 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 (
"' . $u->info['id'] . '","' . (time() + $var['time'] * 60) . '","' . $lab['id'] . '","trap1","' . $var['time'] . '"
)');
}
mysql_query('UPDATE `laba_obj` SET `use` = "' . $u->info['id'] . '" WHERE `id` = "' . $mitm['id'] . '" LIMIT 1');
$var['sex'] = '';
if ($u->info['sex'] == 1) {
$var['sex'] = 'а';
}
$var['text'] = ' ' . $u->info['login'] . ' угодил' . $var['sex'] . ' в ловушку...';
$varos['trap1'] = mysql_fetch_array(mysql_query('SELECT `vals`,`time` FROM `laba_act` WHERE `uid` = "' . $u->info['id'] . '" AND `lib` = "' . $lab['id'] . '" AND `time` > "' . time() . '" AND `vars` = "trap1" ORDER BY `time` DESC LIMIT 1'));
sendSysChat($var['text'], true);
$errors .= ' ' . $u->info['login'] . ' угодил' . $var['sex'] . ' в ловушку... Время перехода +3 секунды (Длительность: +' . $var['time'] . ' мин.)';
}
} elseif ($mitm['type'] == 5) {
//Пандора
if ($mitm['use'] == 0) {
$itms .= '';
} else {
$itms .= '';
}
}
unset($var);
}
$sp = mysql_query('SELECT `i`.*,`m`.`name`,`m`.`img` FROM `laba_itm` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`itm` WHERE `i`.`lib` = "' . $lab['id'] . '" AND `i`.`x` = "' . $u->info['x'] . '" AND `i`.`y` = "' . $u->info['y'] . '" AND `i`.`take` = "0"');
while ($pl = mysql_fetch_array($sp)) {
$itms .= ' ';
}
if ($itms != '') {
$itms = 'В этой комнате находится:
' . $itms . '
';
} elseif ($u->info['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');
}
\User\ItemsModel::addItem(4392, $u->info['id'], '|fromlaba=1|nosale=1');
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%fromlaba=1%" AND `data` LIKE "%nosavelaba=1%"');
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND `data` LIKE "%nosavelaba=1%"');
mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `dnow` = "0",`x`="0",`y`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
$r = ' Вы получили награду "Чек на предъявителя (50кр.)"';
sendSysChat($r, false, true);
$r = ' Вы прошли лабиринт "Подземелья Драконов" и сохранили предметы из лабиринта!';
sendSysChat($r, false, true);
//Выбрасываем предметы которые из подземелья
die('');
}
$sp = mysql_query('SELECT `s`.`x`,`s`.`y`,`u`.`id`,`u`.`login`,`u`.`level` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`dnow` = "' . $lab['id'] . '" AND `s`.`id` != "' . $u->info['id'] . '" LIMIT 5');
$pi = 1;
while ($pl = mysql_fetch_array($sp)) {
$objs[$pl['x']][$pl['y']] = [2 => '
']; //Персонаж 1
$pi++;
}
$objs[$u->info['x']][$u->info['y']] = [2 => '']; //Персонаж 1
$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 (isset($objs[$i][$j][2])) {
//
} elseif ($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 (isset($varos['trap1']['vals']) && $varos['trap1']['vals'] > 0) {
$effed .= ' - Время перехода +3 секунды (Осталось: ' . $u->timeOut($varos['trap1']['time'] - time()) . ')
';
}
unset($varos);
?>
|
|
|
|
= $u->error ?>
Карта: = $lab['id'] ?>
0) {
echo 'Кол-во смертей: ' . $dies . '/3 ';
}
?>
координаты : X== $u->info['y'] ?> Y== $u->info['x'] ?>
|
|
|
|
|
|
';
} ?>
= $itms ?>
|
|
|
|
|