game/modules_data/location/dungeon.php

1097 lines
62 KiB
PHP
Raw Normal View History

2023-03-31 18:42:06 +00:00
<?php
use Core\Config;
use Core\Db;
echo "<script>document.getElementById('se-pre-con').parentNode.removeChild(document.getElementById('se-pre-con'));</script>";
if (!defined('GAME')) {
die();
2022-06-06 21:30:34 +00:00
}
if ($u->room['file'] != 'dungeon') {
return;
}
2022-06-06 21:30:34 +00:00
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);
}
2022-06-06 21:30:34 +00:00
$d = new Dungeon;
2022-06-06 21:30:34 +00:00
if (!isset($d->info['id'])) {
$_GET['exitd'] = true;
}
2022-06-06 21:30:34 +00:00
$dies = Db::getValue('select count(id) from dungeon_actions where uid = ? and dn = ? and vars = ?', [$u->info['id'], $u->info['dnow'], 'die']);
2022-06-06 21:30:34 +00:00
if ($dies >= 3) {
$_GET['exitd'] = true;
}
2022-06-06 21:30:34 +00:00
$d->initPoint($u->info['x'], $u->info['y']);
2022-06-06 21:30:34 +00:00
if (!isset($d->point['id'])) {
$d->point['css'] = 'css';
}
if (isset($_GET['new_leader'])) {
$d->n_lead($_GET['new_leader'], $u->info['id']);
}
2022-06-06 21:30:34 +00:00
if (isset($_GET['go_from_psh'])) {
$d->go_to_hell($_GET['go_from_psh'], $u->info['id']);
}
2022-06-06 21:30:34 +00:00
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('<b>' . $u->info['login'] . '</b> покинул подземелье, новым лидером группы стал <b>' . $cn['login'] . '</b>');
} else {
$d->sys_chat('<b>' . $u->info['login'] . '</b> покинула подземелье, новым лидером группы стал <b>' . $cn['login'] . '</b>');
}
} else {
if ($u->info['sex'] == 0) {
$d->sys_chat('<b>' . $u->info['login'] . '</b> покинул подземелье, новым лидером группы стала <b>' . $cn['login'] . '</b>');
} else {
$d->sys_chat('<b>' . $u->info['login'] . '</b> покинула подземелье, новым лидером группы стала <b>' . $cn['login'] . '</b>');
}
}
} else {
if ($u->info['sex'] == 0) {
$d->sys_chat('<b>' . $u->info['login'] . '</b> покинул подземелье!');
} else {
$d->sys_chat('<b>' . $u->info['login'] . '</b> покинула подземелье!');
}
}
}
$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');
2022-06-06 21:30:34 +00:00
//header("Location: main.php");
echo '<script type="text/javascript">window.location.href="main.php";</script>';
die();
}
}
2022-06-06 21:30:34 +00:00
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 '<br><br><center>Локация &quot;' . str_replace('.php', '', $file[0]) . '&quot; не определена, вернуться <a href="main.php?rnd=' . $code . '">назад</a></center>';
mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
}
}
if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] != '') {
$file = explode('=', $d->point['file']);
if (file_exists('modules_data/location/' . $file[0])) {
require_once('modules_data/location/' . $file[0]);
} else {
if ($file[3] < 1 || $file[3] > 4) {
$file[3] = 1;
}
echo '<br><br><center>Локация &quot;' . str_replace('.php', '', $file[0]) . '&quot; не определена, вернуться <a href="main.php?rnd=' . $code . '">назад</a></center>';
mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
}
} else {
?>
<script type="text/javascript" src="js/jquery.js"></script>
<script>
<?php if(!isset($_GET['ajax'])) { ?> //ТУТ передвижение
// тут проверить
setInterval('top.c.noEr = 0;', 1000);
$('body').keydown(function (event) {
if ((event.which == 38 || event.which == 87) && top.c.noEr == 0) {
goToLoca(1, 'вперед');
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
} else if ((event.which == 37 || event.which == 65) && top.c.noEr == 0) {
goToLoca(4, 'налево');
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
} else if ((event.which == 39 || event.which == 68) && top.c.noEr == 0) {
goToLoca(3, 'направо');
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
} else if ((event.which == 40 || event.which == 83) && top.c.noEr == 0) {
goToLoca(2, 'вниз');
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
} else if (event.which == 70 || event.which == 13) {
/* //ТУТ $u->info['x'] $u->info['y'] $u->info['dnow']
$u->info['s'] = 1(вперед)
$u->info['s'] = 2(влево)
$u->info['s'] = 3(назад)
$u->info['s'] = 4(право)
*/
stor = <?= $u->info['s'];?>;
bott = 0;
if (stor == 1) {
<?php
$bottem = mysql_fetch_assoc(
mysql_query(
'SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x']) . '" AND `y` = "' . ($u->info['y'] + 1) . '" LIMIT 1'
)
);
if (isset($bottem['id2']))
{
?> bott = <?= $bottem['id2'];?>;<?php
}
?>
} else if (stor == 2) {
<?php
$bottem = mysql_fetch_assoc(
mysql_query(
'SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x'] - 1) . '" AND `y` = "' . ($u->info['y']) . '" LIMIT 1'
)
);
if (isset($bottem['id2']))
{
?> bott = <?= $bottem['id2'];?>;<?php
}
?>
} else if (stor == 3) {
<?php
$bottem = mysql_fetch_assoc(
mysql_query(
'SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x']) . '" AND `y` = "' . ($u->info['y'] - 1) . '" LIMIT 1'
)
);
if (isset($bottem['id2']))
{
?> bott = <?= $bottem['id2'];?>;<?php
}
?>
} else if (stor == 4) {
<?php
$bottem = mysql_fetch_assoc(
mysql_query(
'SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x'] + 1) . '" AND `y` = "' . ($u->info['y']) . '" LIMIT 1'
)
);
if (isset($bottem['id2']))
{
?> bott = <?= $bottem['id2'];?>;<?php
}
?>
}
2022-06-06 21:30:34 +00:00
if (bott != 0) {
window.location.href = "/main.php?atack=" + bott + "&rnd=<?= $code; ?>";
}
} else if (event.which == 32 || event.which == 90) {
itemtake = 0;
<?php $sp = mysql_fetch_assoc(
mysql_query(
'SELECT `ish`.* FROM `dungeon_items` AS `ish` WHERE `ish`.`dn` = "' . $u->info['dnow'] . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" AND ( `ish`.`onlyfor` = "0" OR `ish`.`onlyfor` = "' . $u->info['id'] . '" ) AND `ish`.`x` = "' . $u->info['x'] . '" AND `ish`.`y` = "' . $u->info['y'] . '" LIMIT 1'
)
);
if (isset($sp['id']))
{ ?>
itemtake = <?= $sp['id'];?>;
<?php }?>
if (itemtake != 0) {
takeItem(itemtake);
}
2022-06-06 21:30:34 +00:00
}
if (event.which == 81) {
Fast(1);
2022-06-06 21:30:34 +00:00
} else if (event.which == 69) {
Fast(2);
2022-06-06 21:30:34 +00:00
}
});
<?php } ?>
function dialogMenu(id, atk, talk, look, take, e, tmkt) {
var d = document.getElementById('deMenu');
if (d != undefined) {
if (e == undefined) {
e = window.e;
}
d.innerHTML = '';
var t = '';
if (talk > 0) {
t += '<a href="main.php?talk=' + talk + '&rnd=<?= $code; ?>">Диалог</a><br>';
}
if (atk == 1) {
if (tmkt == 0) {
t += '<a href="main.php?atack=' + id + '&rnd=<?= $code; ?>">Напасть</a><br>';
} else {
if (tmkt == 1) {
//кенты
<?php if(isset($sb['id'])) { ?>
t += '<a href="main.php?addpuck=' + id + '&rnd=<?= $code; ?>">Передача шайбы</a><br>';
<?php }else{ ?>
t += '<i>Нет действий</i>';
<?php } ?>
} else {
//фраера
t += '<a href="main.php?atack=' + id + '&rnd=<?= $code; ?>">Напасть</a><br>';
}
}
}
if (look == 1) {
t += 'Просмотр<br>';
}
if (take == 1) {
t += 'Поднять<br>';
}
d.innerHTML = t + '<small style="float:right;"><button style="border: solid 1pt #B0B0B0; font-family: MS Sans Serif; font-size: 10px; color: #191970; MARGIN-BOTTOM: 2px; MARGIN-TOP: 1px;" type="button" onClick="exitDem();">x</button></center>';
d.style.display = '';
if (e.x == undefined) {
e.x = e.clientX;
e.y = e.clientY;
}
d.style.top = e.y + 'px';
if (e.x > 320) {
d.style.right = (document.body.offsetWidth - e.x) + 'px';
} else {
d.style.right = (-e.x + 540) + 'px';
}
}
}
function exitDem() {
var d = document.getElementById('deMenu');
if (d != undefined) {
d.innerHTML = '';
d.style.display = 'none';
d.style.top = '0px';
d.style.right = '0px';
}
}
var objects = {};
//i:{id,login,mapPoint,sex,obraz,type,users_p},
const users = {<?= $d->genUsers(); ?>};
var objs = {<?= $d->genObjects(); ?>};
var items = {};
var actions = {};
var dsee = <?= 0 + $d->gs; ?>;
var mapp = {
1: '0_0f', 2: '0_0f', 3: '0_0f', 4: '1_1f',
5: '1_1f', 6: '1_1f', 7: '2_1f', 8: '2_1f',
9: '2_1f', 11: '3_1l', 12: '3_1f', 13: '3_1r'
}
var zmap = {5: 894, 8: 0, 12: 0}
var zfloor0 = {1: '', 2: '', 3: '', 4: '', 5: ''};
function genMap() {
let i = 0, m = false, mz = false;
while (i < users['count']) {
if (users[i] != undefined) {
mz = mapp[users[i][2]];
if (document.getElementById(mz) != undefined) {
m = document.getElementById(mz);
m.innerHTML = addUser(users[i], mz) + m.innerHTML;
}
}
i++;
}
i = 0;
m = false;
mz = false;
while (i < objs['count']) {
if (objs[i] != undefined) {
mz = mapp[objs[i][2]];
if (objs[i][5] == dsee && (objs[i][2] == 5 || objs[i][2] == 2 || objs[i][2] == 8 || objs[i][2] == 12 || objs[i][2] == 15)) {
mz = mapp[objs[i][2] - 3];
}
if (document.getElementById(mz) != undefined) {
m = document.getElementById(mz);
m.innerHTML = addObj(objs[i], mz) + m.innerHTML;
}
}
i++;
}
i = 5;
while (i >= 1) {
if (zfloor0[i] != '') {
document.getElementById('Floor0').innerHTML += zfloor0[i];
}
i--;
}
}
var dConfig = {
2: {
1: {'top': 54, 'left': 140, 'w': 80, 'h': 147},
2: {'top': 56, 'left': 92, 'w': 75, 'h': 137},
3: {'top': 51, 'left': 186, 'w': 75, 'h': 137},
4: {'top': 49, 'left': 165, 'w': 80, 'h': 147},
5: {'top': 49, 'left': 105, 'w': 80, 'h': 147},
6: {'top': 53, 'left': 140, 'w': 80, 'h': 147},
7: {'top': 53, 'left': 87, 'w': 80, 'h': 147},
8: {'top': 53, 'left': 190, 'w': 80, 'h': 147}
},
3: {
1: {'top': 60, 'left': 152, 'w': 53, 'h': 97},
2: {'top': 58, 'left': 110, 'w': 53, 'h': 97},
3: {'top': 58, 'left': 188, 'w': 53, 'h': 97},
4: {'top': 61, 'left': 168, 'w': 53, 'h': 97},
5: {'top': 61, 'left': 128, 'w': 53, 'h': 97},
6: {'top': 62, 'left': 153, 'w': 53, 'h': 97},
7: {'top': 62, 'left': 113, 'w': 53, 'h': 97},
8: {'top': 62, 'left': 193, 'w': 53, 'h': 97}
},
4: {
1: {'top': 70, 'left': 158, 'w': 35, 'h': 64},
2: {'top': 68, 'left': 125, 'w': 35, 'h': 64},
3: {'top': 68, 'left': 193, 'w': 35, 'h': 64},
4: {'top': 71, 'left': 173, 'w': 35, 'h': 64},
5: {'top': 71, 'left': 137, 'w': 35, 'h': 64},
6: {'top': 73, 'left': 158, 'w': 35, 'h': 64},
7: {'top': 73, 'left': 129, 'w': 35, 'h': 64},
8: {'top': 73, 'left': 193, 'w': 35, 'h': 64}
}
}
var dConfigObj = {
1: {
0: {
'top': 65,
'left': 110,
'w': 1,
'h': 1
}
}
, 2: {
0: {
'top': 65,
'left': 110,
'w': 0.65,
'h': 0.65
}
},
3: {
0: {
'top': 65,
'left': 110,
'w': 0.48,
'h': 0.48
}
},
4: {
0: {
'top': 65,
'left': 110,
'w': 0.35,
'h': 0.35
}
}
}
var prob = {0: {1: 1, 2: 0.25, 3: -0.10, 4: -0.38}, 1: {1: 0.90, 2: 0.50, 3: 0.23, 4: 0.05}};
function addObj(v, mz) {
var r = '', rz = 0;
if (v[2] >= 1 && v[2] <= 3) {
rz = 1;
}
if (v[2] >= 4 && v[2] <= 6) {
rz = 2;
}
if (v[2] >= 7 && v[2] <= 9) {
rz = 3;
}
if (v[2] >= 10 && v[2] <= 14) {
rz = 4;
}
if (v[2] >= 15 && v[2] <= 19) {
rz = 5;
}
if (v[5] == dsee) {
rz -= 1;
}
if (dConfigObj[rz] != undefined && dConfigObj[rz][v[6]] != undefined) {
new_w = v[7] * dConfigObj[rz][v[6]]['w'];
new_h = v[8] * dConfigObj[rz][v[6]]['h'];
new_left = dConfigObj[rz][v[6]]['left'] - Math.round((v[7] * prob[0][rz]) / 4);
new_top = dConfigObj[rz][v[6]]['top'] - Math.round((v[8] * prob[1][rz]) / 4);
if (v[2] == 6) {
new_left += 195;
new_top -= 5;
}
if (v[2] == 4) {
new_left -= 195;
new_top -= 5;
}
if (v[2] == 9) {
new_left -= 140;
new_top -= 2;
}
if (v[2] == 7) {
new_left += 140;
new_top -= 2;
}
if (v[2] == 13) {
new_left += 100;
new_top -= 1;
}
if (v[2] == 11) {
new_left -= 100;
new_top -= 0;
}
if (v[9] != 0) {
new_left += Math.round(new_left / (100 + (rz - 1) * 10) * v[9] + rz * 0.25);
}
if (v[10] != 0) {
new_top += Math.round(new_h / 2 + new_top / (100 + (rz - 1) * 50) * v[10] - rz * 3.3);
}
if (rz == 4) {
new_top += 3;
}
if (v[11] != 0) {
if (v[11]['t' + rz] != undefined) {
new_top += v[11]['t' + rz];
}
if (v[11]['l' + rz] != undefined) {
new_left += v[11]['l' + rz];
}
if (v[11]['w' + rz] != undefined) {
new_w += v[11]['w' + rz];
}
if (v[11]['h' + rz] != undefined) {
new_h += v[11]['h' + rz];
}
if (v[11]['rt' + rz] != undefined) {
new_top = v[11]['rt' + rz];
}
if (v[11]['rl' + rz] != undefined) {
new_left = v[11]['rl' + rz];
}
}
if (rz >= 1 && rz <= 2) {
actionNow = '';
if (v[11]['use'] != undefined) {
if (v[11]['use'] == 'exit') {
actionNow = 'alert(\'Выход из подземелья\');';
} else if (v[11]['use'] == 'takeit') {
actionNow = 'takeObj(' + v[0] + ')';
}
}
zfloor0[rz] = '<img title="' + v[1] + '" onclick="' + actionNow + '" src="//img.new-combats.tech/1x1.gif" style="cursor: pointer; position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />' + zfloor0[rz];
} else {
zfloor0[rz] = '<img title="' + v[1] + '" src="//img.new-combats.tech/1x1.gif" style="position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />' + zfloor0[rz];
}
r = '<img title="obj" src="//img.new-combats.tech/i/sprites/' + v[4] + '" class="dObj" style="position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />';
}
return r;
}
function addUser(v, mz) {
var r = '';
var rz = 0; //растояние до пользователя
if (v[2] >= 1 && v[2] <= 3) {
rz = 1;
}
if (v[2] >= 4 && v[2] <= 6) {
rz = 2;
}
if (v[2] >= 7 && v[2] <= 9) {
rz = 3;
}
if (v[2] >= 10 && v[2] <= 14) {
rz = 4;
}
if (v[2] >= 15 && v[2] <= 19) {
rz = 5;
}
if (dConfig[rz] != undefined && dConfig[rz][v[6]] != undefined) {
new_w = dConfig[rz][v[6]]['w'];
new_h = dConfig[rz][v[6]]['h'];
new_left = dConfig[rz][v[6]]['left'];
new_top = dConfig[rz][v[6]]['top'];
if (v[2] == 6) {
new_left += 215;
new_top -= 5;
}
if (v[2] == 4) {
new_left -= 215;
new_top -= 5;
}
if (v[2] == 9) {
new_left -= 155;
new_top -= 2;
}
if (v[2] == 7) {
new_left += 155;
new_top -= 2;
}
if (v[2] == 13) {
new_left += 115;
new_top -= 1;
}
if (v[2] == 11) {
new_left -= 115;
new_top -= 1;
}
if (v[2] >= 11 && v[2] <= 13) {
new_top += 5;
}
if (rz >= 1 && rz <= 2) {
action = '';
if (v[5] == 'bot' || <?=$d->info['bsid'];?> > 0) {
action = 'dialogMenu(' + v[0] + ',' + v[8] + ',' + v[7] + ',0,0,event,' + v[9] + ');';
}
zfloor0[rz] += '<img title="' + v[1] + '" onClick="' + action + '" src="//img.new-combats.tech/1x1.gif" style="cursor:pointer;position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
} else {
zfloor0[rz] += '<img title="' + v[1] + '" src="//img.new-combats.tech/1x1.gif" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
}
r = '<img title="user" src="//img.new-combats.tech/chars/' + v[3] + '/' + v[4] + '.gif" class="dUser" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
}
return r;
}
2022-06-06 21:30:34 +00:00
var speedLoc = 0, sLoc1 = 0, sLoc2 = 0, tgo = 0, tgol = 0, gotoup777 = 0, gotext777 = '';
function cancelgoto() {
document.getElementById('gotext777').innerHTML = '';
gotoup777 = 0;
gotext777 = '';
}
function goToLoca(id, ttl) {
if (tgo < 1) {
location.href = `/main.php?go=${id}&rnd=<?=$code;?>`;
} else {
// здесь тогда, когда нажал повторно на кнопку вперед/назад во время загрузки
gotoup777 = id;
gotext777 = ttl;
}
}
2022-06-06 21:30:34 +00:00
function takeObj(objId) {
location.href = "/main.php?take_obj=" + objId + "&rnd=<?=$code;?>";
}
2022-06-06 21:30:34 +00:00
function takeItem(itemId) {
location.href = "/main.php?take=" + itemId + "&rnd=<?=$code;?>";
}
2022-06-06 21:30:34 +00:00
function Fast(look) {
location.href = "/main.php?look=" + look + "&rnd=<?=$code;?>";
}
2022-06-06 21:30:34 +00:00
function locGoLineDng() {
var line = document.getElementById('pline1');
if (line != undefined) {
prc = 100 - Math.floor(tgo / tgol * 100);
sLoc1 = 108 / 100 * prc;
if (sLoc1 < 1) {
sLoc1 = 1;
}
if (sLoc1 > 108) {
sLoc1 = 108;
}
line.style.width = `${sLoc1}px`;
if (tgo > 0) {
tgo -= 1;
setTimeout('locGoLineDng()', 100);
} else {
if (gotoup777 > 0) {
// нажал на кнопку, идёт загрузка, нажал ещё раз и начнется другая
// именно в момент перехода на второй круг появляется этот код
location.href = `/main.php?go=${gotoup777}&rnd=<?=$code;?>`;
}
}
var $DomGotext777 = document.getElementById('gotext777')
if (gotoup777 > 0 && gotext777 != '' && $DomGotext777.innerHTML != `Вы перейдете <b>${gotext777}</b> (<a href="javascript:void(0)" onclick="cancelgoto()">отмена</a>)`) {
$DomGotext777.innerHTML = `Вы перейдете <b>${gotext777}</b> (<a href="javascript:void(0)" onclick="cancelgoto()">отмена</a>)`;
} else if ($DomGotext777.innerHTML != '' && gotoup777 == 0 && gotext777 == '') {
$DomGotext777.innerHTML = '';
}
}
}
<?php
$tmGo = $u->info['timeGo'] - time(); //сколько секунд осталось
$tmGol = $u->info['timeGo'] - $u->info['timeGoL']; //сколько секунд идти всего
echo 'var tgo = ' . ($tmGo * 10) . '; var tgol = ' . ($tmGol * 10) . ';'; ?>
</script>
<link rel="stylesheet" href="<?= Config::img() ?>/css/dungeon.css">
<link rel="stylesheet" href="<?= Config::img() ?>/css/dungeon_<?= $d->point['css']; ?>.css">
<div id="deMenu" class="hintDm" style="display:none;z-index:5000;"></div>
<div style="margin-right:1px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<p style="float:left; color: red;">&nbsp;<?php if (isset($d->error)) {
echo $d->error . '<br>';
} ?></p>
<?php if ($d->info['bsid'] == 0 && $d->info['id2'] != 106) { ?><p style="float:right;"><a
onClick="if(confirm('Выйти из пещеры?')){ location.href = '/main.php?exitd=<?= $code; ?>'; }"
href="javascript:void(0)">Выйти</a></p><?php } ?>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<div align="left">
<div id="users"><?php if ($d->info['bsid'] == 0) {
echo $d->usersDng();
if ($dies > 0) {
echo '<H4>Кол-во смертей: ' . $dies . '</H4>';
}
} else {
if ($d->info['id2'] != 15) {
//Живые участники и архивариусы
echo '<H4>Живые участники:</H4>';
echo $d->usersDng();
} else {
echo '<H4>Игровой счет. Красные: <font color=red>' . (0 + $tm1win) . '</font> - Синие: <font color=blue>' . (0 + $tm2win) . '</font></H4>';
if ($dies > 0) {
2023-01-10 16:29:32 +00:00
echo '<H4>Кол-во смертей: ' . $dies . '</H4>';
}
if (isset($sb['id'])) {
echo '<H4><font color=blue>Шайба у вас, забейте её в ворота противника!</font></h4>';
}
}
}
//Генерируем список текущих квестов
$qsee = '';
$dungeon_enter = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_room` WHERE `dungeon_room` = "' . $u->info['room'] . '" LIMIT 1'));
$sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 1000');
while ($pl = mysql_fetch_array($sp)) {
$pq = mysql_fetch_array(
mysql_query(
'SELECT * FROM `quests` WHERE `id` = "' . str_replace(
'start_quest', '', $pl['vars']
) . '" AND (`tr_date` LIKE "%tr_dn:=:' . $d->info['id2'] . '" OR `tr_date` LIKE "%tr_dn:=:' . $d->info['id2'] . '|%" OR `tr_date` NOT LIKE "%tr_dn:=:%") LIMIT 1'
)
);
if (isset($pq['id'])) {
$qsee .= '<small>Задание: &nbsp; ' . $pq['name'] . ' ' . $q->infoDng($pq) . '</small><br>';
$qx++;
}
}
$sp = mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "' . $u->info['id'] . '" AND `val` = 0 AND `info` != ""');
while ($pl = mysql_fetch_array($sp)) {
$xrz = $pl['now'];
$r = $pl['max'];
if ($xrz > $r) {
$xrz = $r;
}
$r = '<table style="display:inline-block;" border="0" cellspacing="0" cellpadding="0" height="10"><tr><td valign="middle" width="120" style="padding-top:12px">
<div style="position:relative;"><div id="vhp-1234600000' . $pl['id'] . '" title="Выполнение задания" align="left" class="seehp" style="position:absolute; top:-10px; width:120px; height:10px; z-index:12;"> ' . $xrz . '/' . $r . '</div>
<div title="Выполнение задания" class="hpborder" style="position:absolute; top:-10px; width:120px; height:9px; z-index:13;"><img src="//img.new-combats.tech/1x1.gif" height="9" width="1"></div>
<div class="hp_3 senohp" style="height:9px; width:120px; position:absolute; top:-10px; z-index:11;" id="lhp-1234600000' . $pl['id'] . '"><img src="//img.new-combats.tech/1x1.gif" height="9" width="1"></div>
<div title="Выполнение задания" class="hp_none" style="position:absolute; top:-10px; width:120px; height:10px; z-index:10;"><img src="//img.new-combats.tech/1x1.gif" height="10"></div>
</div></td></tr></table><br><script>top.startHpRegen("main",-1234600000' . $pl['id'] . ',' . $xrz . ',' . $r . ',0,0,0,0,0,0,1)</script>';
$qsee .= '<small>Задание: &nbsp; ' . $pl['info'] . ' ' . $r . '</small><br>';
}
if ($qsee != '') {
echo '<br><br>' . $qsee;
}
?></div>
<div id="items"><?= $d->itemsMap(); ?></div>
<div id="information"><?php if (isset($d->information)) {
echo $d->information;
} ?></div>
</div>
</td>
<td width="530" height="260" valign="top"
style="background-image:url(//img.new-combats.tech/maze_layer.jpg); background-repeat:no-repeat;">
<div style="position:relative;">
<div style="position:absolute;z-index:1;left:397px;top:0px;">
<div id="pline1"></div>
</div>
<div style="position:absolute; z-index:50; left: 374px; top: 110px;">
<img src="//img.new-combats.tech/podzem-map.png"/>
</div>
<div id="minimap"
style="position:absolute; left: 374px; top: 110px;">
<table border="0" align="center" cellpadding="0" cellspacing="0"
style="border:1px solid #333333">
<?php
$i = 1;
$htmlv = '';
while ($i <= 8) {
$htmlv .= '<tr>';
$j = 1;
$htmlv2 = '';
while ($j <= 9) {
$htmlv2 = '<td width="15" height="15" align="center" valign="middle" align="center" style="margin:1px;" id="min_' . ($u->info['x'] + (4 - $j)) . '_' . ($u->info['y'] + (4 - $i)) . '"></td>' . $htmlv2;
$j++;
}
$htmlv .= $htmlv2 . '</tr>';
$i++;
}
echo $htmlv;
unset($htmlv, $htmlv2);
?>
<style>
.u_rot1 {
-webkit-transform: rotate(-180deg);
-moz-transform: rotate(-180deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=6);
-o-transform: rotate(60deg);
}
.u_rot4 {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
-o-transform: rotate(30deg);
}
.u_rot3 {
}
.u_rot2 {
-webkit-transform: rotate(-270deg);
-moz-transform: rotate(-270deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=9);
-o-transform: rotate(90deg);
}
.dBot {
display: inline-block;
height: 18px;
width: 10px;
z-index: 99;
position: absolute;
top: -8px;
left: -6px;
/ / background-image: url("//img.new-combats.tech/drgn/bg/r.gif");
}
</style>
</table>
<script>
<?php
//выводим мини-карту
$i = 0;
$uxy = [];
if ($u->room['name'] != 'Башня Смерти') {
$sp = mysql_query(
'SELECT `u`.`login`,`u`.`id`,`s`.`x`,`s`.`y`,`s`.`s` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`dnow` = "' . $u->info['dnow'] . '" AND `u`.`id` != "' . $u->info['id'] . '" LIMIT 10'
);
while ($pl = mysql_fetch_array($sp)) {
$uxy[$pl['x'] . '_' . $pl['y']] = $pl;
}
}
if ($u->info['admin'] > 0 || $d->id_dng == 106) {
$bxy = [];
2023-01-10 16:29:32 +00:00
if ($u->room['name'] != 'Башня Смерти') {
$sp = mysql_query(
'SELECT `db`.*, `tb`.`login`, `tb`.`obraz`, `tb`.`sex` FROM `dungeon_bots` as `db` LEFT JOIN `test_bot` as `tb` ON `tb`.`id`=`db`.`id_bot`
WHERE `db`.`dn` = "' . $u->info['dnow'] . '" AND `db`.`delete`=0 AND
(`db`.`x` >= ' . ($u->info['x'] - 5) . ' AND `db`.`x` <= ' . ($u->info['x'] + 5) . ') AND
(`db`.`y` >= ' . ($u->info['y'] - 5) . ' AND `db`.`y` <= ' . ($u->info['y'] + 5) . ')
LIMIT 100'
);
while ($pl = mysql_fetch_array($sp)) {
$bxy[$pl['x'] . '_' . $pl['y']] = $pl;
}
}
}
$sp = mysql_query(
'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $d->id_dng . '" AND (`x` >= ' . ($u->info['x'] - 5) . ' AND `x` <= ' . ($u->info['x'] + 5) . ') AND (`y` >= ' . ($u->info['y'] - 5) . ' AND `y` <= ' . ($u->info['y'] + 5) . ') ORDER BY `y` ASC , `x` ASC LIMIT 100'
);
$rzn = [0 => 'top', 3 => 'right', 2 => 'bottom', 1 => 'left'];
$sb1 = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_obj` WHERE `name` LIKE "%Шайба%" AND `dn` = "' . $d->info['id'] . '" LIMIT 1'));
$sb1 = Db::getRow('select x, y from dungeon_obj where name like ? and dn = ? limit 1', ['%Шайба%', $d->info['id']]);
while($pl = mysql_fetch_array($sp)) {
$css = '"background-image":"url(//img.new-combats.tech/fon555.png)",';
$j = 0;
while ($j < 4) {
if ($pl['st'][$j] == 1) {
$css .= '"border-' . $rzn[$j] . '":"1px solid #303030",';
} else {
$css .= '"margin-' . $rzn[$j] . '":"1px",';
}
$j++;
}
if(!empty($sb1) && $sb1['x'] == $pl['x'] && $sb1['y'] == $pl['y'] ) {
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url(//img.new-combats.tech/i/move/shb.gif)\" src=\"//img.new-combats.tech/1x1.gif\" width=\"7\" height=\"7\">");';
}elseif ($u->info['x'] == $pl['x'] && $u->info['y'] == $pl['y']) {
if ($d->info['id2'] == 15) {
$tmbth = 4;
$tm = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $u->info['id'] . '" LIMIT 1'));
if ($tm['team'] == 1) {
$tmbth = 1;
} elseif ($tm['team'] == 2) {
$tmbth = 2;
}
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url(//img.new-combats.tech/i/move/p' . $tmbth . '/d0.gif)\" src=\"//img.new-combats.tech/1x1.gif\" width=\"7\" height=\"7\">");';
} else {
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url(//img.new-combats.tech/i/move/p1/d0.gif)\" src=\"//img.new-combats.tech/1x1.gif\" width=\"7\" height=\"7\">");';
}
} elseif ($d->info['id2'] == 15) {
$tmbth = 4;
$tm = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $uxy[$pl['x'] . '_' . $pl['y']]['id'] . '" LIMIT 1'));
if ($tm['team'] == 1) {
$tmbth = 1;
} elseif ($tm['team'] == 2) {
$tmbth = 2;
}
$tbshin = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `items_users` WHERE `uid` = "' . $uxy[$pl['x'] . '_' . $pl['y']]['id'] . '" AND `item_id` = 4910 AND `delete` = 0 LIMIT 1'
)
);
if (isset($tbshin['id'])) {
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url(//img.new-combats.tech/i/move/shb.gif)\" src=\"//img.new-combats.tech/1x1.gif\" width=\"7\" height=\"7\">");';
} else {
echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(//img.new-combats.tech/i/move/p' . $tmbth . '/d0.gif)\" src=\"//img.new-combats.tech/1x1.gif\" width=\"7\" height=\"7\">");';
}
}elseif (isset($uxy[$pl['x'] . '_' . $pl['y']])) {
echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(//img.new-combats.tech/i/move/p4/d0.gif)\" src=\"//img.new-combats.tech/1x1.gif\" width=\"7\" height=\"7\">");';
} elseif( isset($bxy[$pl['x'] . '_' . $pl['y']]) ) {
$bobrz = $bxy[$pl['x'] . '_' . $pl['y']]['obraz'];
if (file_exists('img.new-combats.com/chars/' . $bxy[$pl['x'] . '_' . $pl['y']]['sex'] . '/' . $bxy[$pl['x'] . '_' . $pl['y']]['obraz'] . '')) {
$bobrz = str_replace('.png', '.gif', $bobrz);
} else {
$bobrz = str_replace('.gif', '.png', $bobrz);
}
?>
$("#min_<?=$bxy[$pl['x'] . '_' . $pl['y']]['x']?>_<?=$bxy[$pl['x'] . '_' . $pl['y']]['y']?>").html("<div style='position:relative; display:inline-block; width:1px; height:1px;'><img class='dBot' title='<?=$bxy[$pl['x'] . '_' . $pl['y']]['login']?>' src='//img.new-combats.tech/chars/<?=$bxy[$pl['x'] . '_' . $pl['y']]['sex']?>/<?=$bobrz?>'></div>");
<?php
}
$css = rtrim($css, ',');
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").css({' . $css . '});';
$i++;
}
?>
</script>
</div>
<div style="position:absolute; z-index:50; left: 374px; top: 110px;">
<img src="//img.new-combats.tech/podzem-map2.png" alt=""/>
</div>
<img src="//img.new-combats.tech/g1.jpg" title="Обновить, X:<?= $u->info['x'] ?> ,Y:<?= $u->info['y'] ?>" width="31" height="18" id="g1" style="position: absolute; cursor:pointer; left: 435px; top: 53px;" alt=""/>
<?php if ($d->testGone(3) > 0) { ?>
<img src="//img.new-combats.tech/g2.jpg" onclick="goToLoca(3,'направо');" width="27" height="48" id="g2" style="position:absolute;cursor:pointer; left: 492px; top: 40px;" alt=""/>
<?php }
if ($d->testGone(4) > 0) { ?>
<img src="//img.new-combats.tech/g3.jpg" onclick="goToLoca(4,'налево');" width="28" height="46" id="g3" style="position:absolute;cursor:pointer; left: 382px; top: 40px;" alt=""/>
<?php }
if ($d->testGone(2) > 0) { ?>
<img src="//img.new-combats.tech/g4.jpg" onclick="goToLoca(2,'назад');" width="45" height="25" id="g4" style="position:absolute;cursor:pointer; left: 428px; top: 72px;" alt=""/>
<?php }
if ($d->testGone(1) > 0) { ?>
<img src="//img.new-combats.tech/g5.jpg" onclick="goToLoca(1,'вперед');" width="46" height="26" id="g5" style="position:absolute;cursor:pointer; left: 428px; top: 26px;" alt=""/>
<?php } ?>
<img src="//img.new-combats.tech/g6.jpg" width="30" height="19" id="g6" style="position:absolute;cursor:pointer; left: 399px; top: 28px;" alt=""/>
<img src="//img.new-combats.tech/g7.jpg" width="24" height="19" id="g7" style="position:absolute;cursor:pointer; left: 476px; top: 28px;" alt=""/>
<div id="Dungeon" class="Dungeon" style="width:352px;height:240px;padding:0;margin:10px;text-align:center;">
<!-- / MAP \ -->
<?php
$mapIDs = [ // к этой хереборе вяжется javascript
3 => '4_0r',
4 => '4_0l',
5 => '3_2l',
6 => '3_2r',
9 => '3_1f',
10 => '3_1l',
11 => '3_1r',
13 => '3_0l',
14 => '2_1l',
15 => '2_1r',
16 => '2_1f',
18 => '2_0l',
19 => '1_1l',
20 => '1_1r',
21 => '1_1f',
23 => '1_0l',
24 => '0_1l',
25 => '0_1r',
26 => '0_0f',
28 => '0_0l',
];
$map = [
1 => 'LeftSide4_1',
2 => 'RightSide4_1',
3 => 'RightSide4_0',
4 => 'LeftSide4_0',
5 => 'LeftFront3_2',
6 => 'RightFront3_2',
7 => 'LeftFront3_1',
8 => 'RightFront3_1',
9 => 'LeftFront3_0',
10 => 'LeftFront3_1',
11 => 'RightFront3_1',
12 => 'LeftSide3_0',
13 => 'RightSide3_0',
14 => 'LeftFront2_1',
15 => 'RightFront2_1',
16 => 'LeftFront2_0',
17 => 'LeftSide2_0',
18 => 'RightSide2_0',
19 => 'LeftFront1_1',
20 => 'RightFront1_1',
21 => 'LeftFront1_0',
22 => 'LeftSide1_0',
23 => 'RightSide1_0',
24 => 'LeftFront0_1',
25 => 'RightFront0_1',
26 => 'LeftFront0_0',
27 => 'LeftSide0_0',
28 => 'RightSide0_0',
];
foreach ($map as $k => $v) {
if ($d->walls[$k] === 1) {
continue;
}
$map[$k] = '';
}
?>
<div id="Floor0" class="Floor0">
<div class="Floor1">
<?php
foreach ($map as $key => $layer) {
if (!$layer) {
continue;
}
$id = !empty($mapIDs[$key]) ? " id='" . $mapIDs[$key] . "'" : '';
echo "<div class='$layer'$id></div>";
}
?>
2022-06-06 21:30:34 +00:00
</div>
</div>
<!-- / MAP \ -->
<span class="<?= $map[28] ?>">
</span></div>
</div>
</td>
</tr>
</table>
<div id="gotext777" style="padding-top:5px;float:right;">&nbsp;</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<script>
genMap();
locGoLineDng();
$("document").ready(function () {
$('#g1').click(function () {
location.href = "/main.php";
});
$('#g6').click(function () {
location.href = "/main.php?look=1&rnd=<?=$code?>";
});
$('#g7').click(function () {
location.href = "/main.php?look=2&rnd=<?=$code?>";
});
});
</script>
<br/><br/>
<?php
if ($u->isAdmin()) {
echo 'S:' . $u->info['s'];
}
}