document.getElementById('se-pre-con').parentNode.removeChild(document.getElementById('se-pre-con'));";
if (!defined('GAME')) {
die();
}
if ($u->room['file'] != 'dungeon') {
return;
}
if (isset($_GET['back'])) {
$dp = Db::getValue('select file from dungeon_map where id_dng = (select id2 from dungeon_now where id = ?) and x = ? and y = ?', [$u->info['dnow'], $u->info['x'], $u->info['y']]);
if ($dp != '0') {
$file = explode('=', $dp['file']);
if (isset($file[1])) {
if ($file[3] < 1 || $file[3] > 4) {
$file[3] = 1;
}
Db::sql('update stats set x = ?, y = ?, s = ? where id = ?', [$file[1], $file[2], $file[3], $u->info['id']]);
$u->info['x'] = $file[1];
$u->info['y'] = $file[2];
$u->info['s'] = $file[3];
}
}
unset($dp);
}
$d = new Dungeon;
if (!isset($d->info['id'])) {
$_GET['exitd'] = true;
}
$dies = Db::getValue('select count(id) from dungeon_actions where uid = ? and dn = ? and vars = ?', [$u->info['id'], $u->info['dnow'], 'die']);
if ($dies >= 3) {
$_GET['exitd'] = true;
}
$d->initPoint($u->info['x'], $u->info['y']);
if (!isset($d->point['id'])) {
$d->point['css'] = 'css';
}
if (isset($_GET['new_leader'])) {
$d->n_lead($_GET['new_leader'], $u->info['id']);
}
if (isset($_GET['go_from_psh'])) {
$d->go_to_hell($_GET['go_from_psh'], $u->info['id']);
}
if ($u->info['dnow'] == 0) {
//выкидываем из пещеры
die('Ошибки инициализации');
} else {
if ($d->info['bsid'] == 0 && $d->info['id2'] != 106 && isset($_GET['exitd'])) {
//Удаляем обьекты и т.д. из старых пещер
$rb = 321; // Магический портал
$sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50');
while ($pl = mysql_fetch_array($sp)) {
$cn = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $pl['id'] . '" LIMIT 1'));
if (!isset($cn['id'])) {
mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"');
mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"');
mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"');
mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"');
mysql_query('DELETE FROM `dungeon_actions` WHERE `dn` = "' . $pl['id'] . '"');
mysql_query('UPDATE `dungeon_now` SET `time_finish` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
}
}
$cn = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $d->info['id'] . '" AND `id` != "' . $u->info['id'] . '" ORDER BY `exp` DESC LIMIT 1'));
if (isset($cn['id'])) {
if ($d->info['uid'] == $u->info['id']) {
$cn = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`sex` FROM `users` WHERE `id` = "' . $cn['id'] . '" LIMIT 1'));
mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $cn['id'] . '" WHERE `id` = "' . $d->info['id'] . '" LIMIT 1');
if ($cn['sex'] == 0) {
if ($u->info['sex'] == 0) {
$d->sys_chat('' . $u->info['login'] . ' покинул подземелье, новым лидером группы стал ' . $cn['login'] . '');
} else {
$d->sys_chat('' . $u->info['login'] . ' покинула подземелье, новым лидером группы стал ' . $cn['login'] . '');
}
} else {
if ($u->info['sex'] == 0) {
$d->sys_chat('' . $u->info['login'] . ' покинул подземелье, новым лидером группы стала ' . $cn['login'] . '');
} else {
$d->sys_chat('' . $u->info['login'] . ' покинула подземелье, новым лидером группы стала ' . $cn['login'] . '');
}
}
} else {
if ($u->info['sex'] == 0) {
$d->sys_chat('' . $u->info['login'] . ' покинул подземелье!');
} else {
$d->sys_chat('' . $u->info['login'] . ' покинула подземелье!');
}
}
}
$city = mysql_fetch_assoc(mysql_query('SELECT `id`, `city` FROM `room` WHERE `id` = "' . $rb . '" LIMIT 1'));
mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `users` SET `room` = "' . $rb . '", `city`="' . $city['city'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
//удаляем все предметы которые пропадают после выхода из пещеры
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `dn_delete` = "1" LIMIT 1000');
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "1189" OR `item_id` = "4447" OR `item_id` = "1174") LIMIT 1000');
//header("Location: main.php");
echo '';
die();
}
}
if ($d->point['fileadd'] == 1 && $d->point['file'] != '0' && $d->point['file'] != '') {
$file = explode('=', $d->point['file']);
if (file_exists('modules_data/location/' . $file[0])) {
$information = '';
include_once('modules_data/location/' . $file[0]);
#header('Location: /main.php');
} else {
if ($file[3] < 1 || $file[3] > 4) {
$file[3] = 1;
}
echo '
error)) {
echo $d->error . ' |
|||||
|