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; // Магический портал
$dungeonIds = Db::getColumn('select id from dungeon_now where time_finish = 0');
$dnowIds = Db::getColumn('select id from stats where dnow in (?)', [implode(',', $dungeonIds)]);
$diff = implode(',', array_diff($dungeonIds, $dnowIds));
Db::sql('delete from dungeon_bots where dn in (?) and for_dn = 0', [$diff]);
Db::sql('delete from dungeon_obj where dn in (?) and for_dn = 0', [$diff]);
Db::sql('delete from dungeon_items where dn in (?) and for_dn = 0', [$diff]);
Db::sql('delete from dungeon_actions where dn in (?)', [$diff]);
Db::sql('update dungeon_now set time_finish = unix_timestamp() where id in (?)', [$diff]);
unset($dungeonIds, $dnowIds, $diff);
$cn1 = Db::getValue('select id from stats where dnow = ? and id != ? order by exp desc limit 1', [$d->info['id'], $u->info['id']]);
if ($cn1) {
if ($d->info['uid'] == $u->info['id']) {
$cn = Db::getRow('select id, login, sex from users where id = ?', [$cn1]);
Db::sql('update dungeon_now set uid = ? where id = ?', [$cn['id'], $d->info['id']]);
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'] . ' покинула подземелье!');
}
}
}
unset($cn, $cn1);
Db::sql('update users left join stats on users.id = stats.id set dnow = 0, room = ? where users.id = ?', [$rb, $u->info['id']]);
//удаляем все предметы которые пропадают после выхода из пещеры
Db::sql('delete from items_users where uid = ? and (dn_delete = 1 or item_id in (1174,1189,4447))', [$u->info['id']]);
exit('');
}
}
if (!empty($d->point['file']) && $d->point['fileadd'] == 1) {
$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 . ' |
|||||
|