Пещеры заселились живностью.

This commit is contained in:
Ivor Barhansky 2023-09-30 04:31:32 +03:00
parent 3b4bbf3a6a
commit eb971fbc65
3 changed files with 526 additions and 694 deletions

View File

@ -28,6 +28,18 @@ class Dungeon
4 => [1 => 4, 2 => 1, 3 => 2, 4 => 3],
];
/**
* 1-9: передняя стенка, в 2-х шагах;<br>
* 10-23: растояние: 1 шаг;<br>
* 24: стена прямо слева от персонажа;<br>
* 25: стена прямо справа от персонажа;<br>
* 26: стена прямо перед персонажем;<br>
* 27: стена слева от персонажа;<br>
* 28: стена справа от персонажа;
* @var array
*/
public readonly array $walls;
public function __construct(User $user = null)
{
if (!$user) {
@ -1522,7 +1534,7 @@ class Dungeon
//Розыгрыш предмета
public function genMatix()
public function genMatix(): array
{
$r = [];
if ($this->gs == 1) {
@ -1619,101 +1631,109 @@ class Dungeon
global $u;
$this->cord['x']++;
$this->cord[($u->info['y'] + $y) . '_' . ($u->info['x'] + $x)] = $this->cord['x'];
return $this->map[0][($u->info['y'] + $y) . '_' . ($u->info['x'] + $x)];
return $this->map[0][($u->info['y'] + $y) . '_' . ($u->info['x'] + $x)] ?? [];
}
public function lookDungeon()
private function lookDungeon()
{
global $u, $c, $code, $pd;
/* Генерируем изображение карты */ /* LEVEL 1 */
$pd = array_fill(1, 28, 0);
// Исправления от 29/10/2014 относительно D5, 2 этаж, ПТП. Покрутиться и все гуд. и от 22/11/2014 для обратных стен. Если стена к нам задницей, мы её не видим.
if ($this->testSt(2, 4) > 0 /* || $this->testSt(3,2)>0 */) {
global $pd;
/* Генерируем изображение карты */
/* LEVEL 1 */
if ($this->testSt(2, 4)) {
$pd[28] = 1;
}
if (/*$this->testSt(1,4)>0 ||*/ $this->testSt(2, 2) > 0) {
if ($this->testSt(2, 2)) {
$pd[27] = 1;
}
if ($this->testSt(2, 1) > 0 /*|| $this->testSt(5,3)>0*/) {
if ($this->testSt(2, 1)) {
$pd[26] = 1;
}
if ($this->testSt(3, 1) > 0/* || $this->testSt(6,3)>0*/) {
if ($this->testSt(3, 1)) {
$pd[25] = 1;
}
if ($this->testSt(1, 1) > 0 /*|| $this->testSt(4,3)>0*/) {
if ($this->testSt(1, 1)) {
$pd[24] = 1;
}
/* LEVEL 2 */
if ($this->testSt(5, 4) > 0 /*|| $this->testSt(6,2)>0*/) {
if ($this->testSt(5, 4)) {
$pd[23] = 1;
}
if (/*$this->testSt(4,4)>0 || */ $this->testSt(5, 2) > 0) {
if ($this->testSt(5, 2)) {
$pd[22] = 1;
}
if ($this->testSt(5, 1) > 0 /*|| $this->testSt(8,3)>0*/) {
if ($this->testSt(5, 1)) {
$pd[21] = 1;
}
if ($this->testSt(6, 1) > 0 /*|| $this->testSt(7,3)>0*/) {
if ($this->testSt(6, 1)) {
$pd[20] = 1;
}
if ($this->testSt(4, 1) > 0/* || $this->testSt(9,3)>0*/) {
if ($this->testSt(4, 1)) {
$pd[19] = 1;
}
/* LEVEL 3 */
if ($this->testSt(8, 4) > 0 /*|| $this->testSt(7,2)>0*/) {
if ($this->testSt(8, 4)) {
$pd[18] = 1;
}
if (/*$this->testSt(9,4)>0 || */ $this->testSt(8, 2) > 0) {
if ($this->testSt(8, 2)) {
$pd[17] = 1;
}
if ($this->testSt(8, 1) > 0 /* || $this->testSt(12,3)>0*/) {
if ($this->testSt(8, 1)) {
$pd[16] = 1;
}
if ($this->testSt(7, 1) > 0 /* || $this->testSt(13,3)>0*/) {
if ($this->testSt(7, 1)) {
$pd[15] = 1;
}
if ($this->testSt(9, 1) > 0 /*|| $this->testSt(11,3)>0*/) {
if ($this->testSt(9, 1)) {
$pd[14] = 1;
}
/* LEVEL 4 */
if ($this->testSt(12, 4) > 0 || $this->testSt(13, 2) > 0) {
if ($this->testSt(12, 4) || $this->testSt(13, 2)) {
$pd[13] = 1;
}
if ($this->testSt(12, 2) > 0 || $this->testSt(11, 4) > 0) {
if ($this->testSt(12, 2) || $this->testSt(11, 4)) {
$pd[12] = 1;
}
if ($this->testSt(13, 1) > 0 || $this->testSt(17, 3) > 0) {
if ($this->testSt(13, 1) || $this->testSt(17, 3)) {
$pd[11] = 1;
} //8
if ($this->testSt(11, 1) > 0 || $this->testSt(16, 3) > 0) {
if ($this->testSt(11, 1) || $this->testSt(16, 3)) {
$pd[10] = 1;
} //7
if ($this->testSt(12, 1) > 0/* || $this->testSt(15,3)>0*/) {
if ($this->testSt(12, 1)) {
$pd[9] = 1;
}
if ($this->testSt(14, 1) > 0 || $this->testSt(18, 3) > 0) {
if ($this->testSt(14, 1) || $this->testSt(18, 3)) {
$pd[6] = 1;
} //2
if ($this->testSt(10, 1) > 0 || $this->testSt(19, 3) > 0) {
if ($this->testSt(10, 1) || $this->testSt(19, 3)) {
$pd[5] = 1;
} //1
if ($this->testSt(16, 4) > 0 || $this->testSt(15, 2) > 0) {
if ($this->testSt(16, 4) || $this->testSt(15, 2)) {
$pd[4] = 1;
}
if ($this->testSt(15, 4) > 0 || $this->testSt(17, 2) > 0) {
if ($this->testSt(15, 4) || $this->testSt(17, 2)) {
$pd[3] = 1;
}
$this->walls = $pd;
/* Генерируем предметы на карте */
/* Генерируем персонажей и ботов на карте */
}
public function testSt($id, $s)
/** Видим ли мы стену?
* @param int $id
* @param int $s в какую сторону смотрим
* @return bool
*/
private function testSt(int $id, int $s): bool
{
$r = 0;
//заменяем отображение стен в зависимости от угла обзора
@ -1721,7 +1741,7 @@ class Dungeon
if (isset($this->map[1][$id]['id'])) {
$r = $this->map[1][$id]['st'][($s - 1)];
}
return $r;
return $r > 0;
}
public function initPoint(int $x, int $y): void
@ -1740,8 +1760,6 @@ class Dungeon
}
$tou = 0; //какому юзеру предназначено
/* выделяем случайного юзера из команды */
$itmnm = mysql_fetch_assoc(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itm . '" LIMIT 1'));
$itmnm = $itmnm['name'];
$asex = '';
if ($u->info['sex'] == 1) {
$asex = 'а';
@ -1773,17 +1791,11 @@ class Dungeon
return true;
}
public function n_lead($who, $lead)
public function n_lead(string $who, int $lead): void
{
global $u, $c, $code;
global $u;
$to = mysql_fetch_assoc(
mysql_query(
'SELECT `u`.`id`, `u`.`login`, `st`.`id`, `st`.`dnow` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`login` = "' . mysql_real_escape_string(
$who
) . '" LIMIT 1'
)
);
$to = Db::getRow('select stats.id, dnow from users left join stats on users.id = stats.id where login = ?', [$who]);
if ($this->info['uid'] != $lead) {
$this->error = '<b>Вы не лидер...</b>';
@ -1799,29 +1811,23 @@ class Dungeon
);
if ($u->info['sex'] == 0) {
$this->sys_chat(
'<b>' . $u->info['login'] . '</b> передал лидерство в группе персонажу <b>' . $to['login'] . '</b>'
'<b>' . $u->info['login'] . '</b> передал лидерство в группе персонажу <b>' . $who . '</b>'
);
} else {
$this->sys_chat(
'<b>' . $u->info['login'] . '</b> передала лидерство в группе персонажу <b>' . $to['login'] . '</b>'
'<b>' . $u->info['login'] . '</b> передала лидерство в группе персонажу <b>' . $who . '</b>'
);
}
//header('Location: main.php');
die('<script>top.frames[\'main\'].location = "main.php";</script>');
exit("<script>top.frames['main'].location = 'main.php'</script>");
}
}
public function go_to_hell($who, $lead)
public function go_to_hell(string $who, int $lead): void
{
global $u, $c, $code;
global $u;
$to = mysql_fetch_assoc(
mysql_query(
'SELECT `u`.`id`, `u`.`login`, `st`.`id`, `st`.`dnow` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`login` = "' . mysql_real_escape_string(
$who
) . '" LIMIT 1'
)
);
$to = Db::getRow('select stats.id, dnow from users left join stats on users.id = stats.id where login = ?', [$who]);
if ($this->info['uid'] != $lead) {
$this->error = '<b>Вы не лидер...</b>';
@ -1837,8 +1843,6 @@ class Dungeon
$rb = 209; // Вход в ледяную пещеру
} elseif ($u->info['room'] == 396) {
$rb = 395; // Канализация (Ангелс)
} elseif ($u->info['room'] == 398) {
$rb = 321; // Все пещеры
} elseif ($this->info['id2'] == 3) {
$rb = 293; // Вход в Катакомбы
} elseif ($this->info['id2'] == 1) {
@ -1847,15 +1851,9 @@ class Dungeon
$rb = 275; // Гора Легиона
} elseif ($this->info['id2'] == 12) {
$rb = 372; // Вход в Пещеру Тысячи Проклятий
} elseif ($this->info['id2'] == 444) {
$rb = 321; // Вход в пещеру инкв
} elseif ($this->info['id2'] == 31) {
$rb = 321; // Вход в пещеру инкв
} elseif ($this->info['id2'] == 101) {
$rb = 321; // Вход в Бездну
}
$sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50');
while ($pl = mysql_fetch_assoc($sp)) {
$cn = mysql_fetch_assoc(
@ -1891,14 +1889,15 @@ class Dungeon
if ($u->info['sex'] == 0) {
$this->sys_chat(
'<b>' . $u->info['login'] . '</b> выгнал из похода персонажа <b>' . $to['login'] . '</b>'
'<b>' . $u->info['login'] . '</b> выгнал из похода персонажа <b>' . $who . '</b>'
);
} else {
$this->sys_chat(
'<b>' . $u->info['login'] . '</b> выгнала из похода персонажа <b>' . $to['login'] . '</b>'
'<b>' . $u->info['login'] . '</b> выгнала из похода персонажа <b>' . $who . '</b>'
);
}
header('Location: /main.php');
exit("<script>top.frames['main'].location = 'main.php'</script>");
}
}
@ -2067,7 +2066,7 @@ class Dungeon
public function genObjects()
{
global $u, $c, $code;
global $u;
////i:{id,name,mapPoint,action,img,type},
//'count':1,0:{0:1234,1:'Сундук',2:5,3:'',4:'test.gif',5:0,6:position,7:width,8:heigh,9:left,10:top},
//psition 0 - по центру , 1- сверху, 2- слева, 3- снизу, 4- справа
@ -2083,74 +2082,103 @@ class Dungeon
$i = 0;
$pos = [];
while ($pl = mysql_fetch_assoc($sp)) {
if ($pl['fix_x_y'] == 0 || ($pl['fix_x_y'] == 1 && $pl['x'] == $u->info['x']) || ($pl['fix_x_y'] == 2 && $pl['y'] == $u->info['y']) || ($pl['fix_x_y'] == 3 && $pl['x'] == $u->info['x'] && $pl['y'] == $u->info['y'])) {
if (($pl['os1'] == 0 && $pl['os2'] == 0 && $pl['os3'] == 0 && $pl['os4'] == 0) || ($this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'])) {
$i++;
if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) {
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0;
}
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++;
$r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'action\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}';
} elseif ($this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] - 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] - 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] - 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'] - 1) {
$dt2 = explode(',', ltrim(rtrim($pl['date'], '\}'), '\{'));
$da = [];
$is = 0;
while ($is < count($dt2)) {
$dt2[$is] = explode(':', $dt2[$is]);
$da[$dt2[$is][0]] = $dt2[$is][1];
$is++;
}
if (isset($da['use'])) {
unset($da['use']);
} // Справа
if (isset($da['rl2'])) {
$da['rl2'] = -round((int)$da['rl2'] * 1.55);
} // Слева
if (isset($da['rl3'])) {
$da['rl3'] = round((int)$da['rl3'] + 160);
}
if (isset($da['rl4'])) {
$da['rl4'] = round((int)$da['rl4'] - 120);
}
$pl['date'] = str_replace('"', '', json_encode($da));
if (!isset($this->cord[$pl['y'] . '_' . $pl['x']])) {
continue;
}
if (
$pl['fix_x_y'] != 0 &&
($pl['fix_x_y'] != 1 || $pl['x'] != $u->info['x']) &&
($pl['fix_x_y'] != 2 || $pl['y'] != $u->info['y']) &&
($pl['fix_x_y'] != 3 || $pl['x'] != $u->info['x'] || $pl['y'] != $u->info['y'])
) {
continue;
}
$i++;
if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) {
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0;
}
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++;
$r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}';
} elseif ($this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] + 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] + 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] + 1 || $this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'] + 1) {
$dt2 = explode(',', ltrim(rtrim($pl['date'], '\}'), '\{'));
$da = [];
$is = 0;
while ($is < count($dt2)) {
$dt2[$is] = explode(':', $dt2[$is]);
$da[$dt2[$is][0]] = $dt2[$is][1];
$is++;
}
if (isset($da['use'])) {
unset($da['use']);
} // Справа
if (isset($da['rl2'])) {
$da['rl2'] = 355 - round((int)$da['rl2'] * 0.30);
} // Справа
if (isset($da['rl3'])) {
$da['rl3'] = round((int)$da['rl3'] - 160);
}
if (isset($da['rl4'])) {
$da['rl4'] = round((int)$da['rl4'] + 120);
}
$pl['date'] = str_replace('"', '', json_encode($da));
$i++;
if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) {
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0;
}
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++;
$r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}';
if (
($pl['os1'] == 0 && $pl['os2'] == 0 && $pl['os3'] == 0 && $pl['os4'] == 0) ||
(
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] ||
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] ||
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] ||
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4']
)
) {
$i++;
if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) {
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0;
}
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++;
$r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'action\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}';
} elseif (
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] - 1 ||
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] - 1 ||
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] - 1 ||
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'] - 1
) {
$dt2 = explode(',', ltrim(rtrim($pl['date'], '\}'), '\{'));
$da = [];
$is = 0;
while ($is < count($dt2)) {
$dt2[$is] = explode(':', $dt2[$is]);
$da[$dt2[$is][0]] = $dt2[$is][1];
$is++;
}
if (isset($da['use'])) {
unset($da['use']);
} // Справа
if (isset($da['rl2'])) {
$da['rl2'] = -round((int)$da['rl2'] * 1.55);
} // Слева
if (isset($da['rl3'])) {
$da['rl3'] = round((int)$da['rl3'] + 160);
}
if (isset($da['rl4'])) {
$da['rl4'] = round((int)$da['rl4'] - 120);
}
$pl['date'] = str_replace('"', '', json_encode($da));
$i++;
if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) {
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0;
}
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++;
$r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}';
} elseif (
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os1'] + 1 ||
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os2'] + 1 ||
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os3'] + 1 ||
$this->cord[$pl['y'] . '_' . $pl['x']] == $pl['os4'] + 1
) {
$dt2 = explode(',', ltrim(rtrim($pl['date'], '\}'), '\{'));
$da = [];
$is = 0;
while ($is < count($dt2)) {
$dt2[$is] = explode(':', $dt2[$is]);
$da[$dt2[$is][0]] = $dt2[$is][1];
$is++;
}
if (isset($da['use'])) {
unset($da['use']);
} // Справа
if (isset($da['rl2'])) {
$da['rl2'] = 355 - round((int)$da['rl2'] * 0.30);
} // Справа
if (isset($da['rl3'])) {
$da['rl3'] = round((int)$da['rl3'] - 160);
}
if (isset($da['rl4'])) {
$da['rl4'] = round((int)$da['rl4'] + 120);
}
$pl['date'] = str_replace('"', '', json_encode($da));
$i++;
if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) {
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0;
}
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]]++;
$r .= ',' . ($i - 1) . ':{0:' . $pl['id'] . ',1:\'' . $pl['name'] . '\',2:' . (0 + $this->cord[$pl['y'] . '_' . $pl['x']]) . ',3:\'\',4:\'' . $pl['img'] . '\',5:' . $pl['type'] . ',6:0,7:' . $pl['w'] . ',8:' . $pl['h'] . ',9:' . $pl['left'] . ',10:' . $pl['top'] . ',11:' . $pl['date'] . '}';
}
}
return 'count:' . $i . $r;
@ -2158,15 +2186,24 @@ class Dungeon
public function genUsers()
{
global $u, $c, $code;
global $u;
////i:{id,login,mapPoint,sex,obraz,type,users_p},
//'count':1,0:{0:1015,1:'Test1',2:5,3:0,4:'1',5:'user',6:1},
$r = '';
$whr = [1 => ' ((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` >= ' . $u->info['y'] . ' && `u`.`y` <= ' . ($u->info['y'] + 4) . ')) ', //прямо
3 => ' ((`u`.`x` <= ' . ($u->info['x'] + 2) . ' && `u`.`x` >= ' . ($u->info['x'] - 2) . ') && (`u`.`y` <= ' . $u->info['y'] . ' && `u`.`y` >= ' . ($u->info['y'] - 4) . ')) ', //вниз
2 => ' ((`u`.`x` <= ' . $u->info['x'] . ' && `u`.`x` >= ' . ($u->info['x'] - 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . ')) ', //лево
4 => ' ((`u`.`x` >= ' . $u->info['x'] . ' && `u`.`x` <= ' . ($u->info['x'] + 4) . ') && (`u`.`y` <= ' . ($u->info['y'] + 2) . ' && `u`.`y` >= ' . ($u->info['y'] - 2) . ')) ', //право
$whr = [
1 => ' ((x <= ' . ($u->info['x'] + 2) . ' && x >= ' . ($u->info['x'] - 2) . ') && (y >= ' . $u->info['y'] . ' && y <= ' . ($u->info['y'] + 4) . ')) ', //прямо
2 => ' ((x <= ' . $u->info['x'] . ' && x >= ' . ($u->info['x'] - 4) . ') && (y <= ' . ($u->info['y'] + 2) . ' && y >= ' . ($u->info['y'] - 2) . ')) ', //лево
3 => ' ((x <= ' . ($u->info['x'] + 2) . ' && x >= ' . ($u->info['x'] - 2) . ') && (y <= ' . $u->info['y'] . ' && y >= ' . ($u->info['y'] - 4) . ')) ', //вниз
4 => ' ((x >= ' . $u->info['x'] . ' && x <= ' . ($u->info['x'] + 4) . ') && (y <= ' . ($u->info['y'] + 2) . ' && y >= ' . ($u->info['y'] - 2) . ')) ', //право
];
$whrVals = [ // x <= ? && x >= ? && y <= ? && y >= ?
1 => [$u->info['x'] + 2, $u->info['x'] - 2, $u->info['y'] + 4, $u->info['y'],], // прямо x< x> y< y>
2 => [$u->info['x'], $u->info['x'] - 4, $u->info['y'] + 2, $u->info['y'] - 2,], // лево x< x> y< y>
3 => [$u->info['x'] + 2, $u->info['x'] - 2, $u->info['y'], $u->info['y'] - 4,], // низ x< x> y< y>
4 => [$u->info['x'] + 4, $u->info['x'], $u->info['y'] + 2, $u->info['y'] - 2,], // право x< x> y< y>
];
//
$tmsu = mysql_fetch_assoc(
mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $u->info['id'] . '" LIMIT 1')
@ -2266,10 +2303,19 @@ class Dungeon
}
}
$sp = mysql_query(
'SELECT `u`.*,`st`.* FROM `dungeon_bots` AS `u` LEFT JOIN `test_bot` AS `st` ON (`u`.`id_bot` = `st`.`id`) WHERE `u`.`dn` = "' . $u->info['dnow'] . '" AND ' . $whr[$this->gs] . ' AND `u`.`delete` = "0" LIMIT 50'
);
while ($pl = mysql_fetch_assoc($sp)) {
$botsArr = Db::getRows('select * from dungeon_bots left join test_bot on dungeon_bots.id_bot = test_bot.id where dn = ? and x <= ? and x >= ? and y <= ? and y >= ? limit 50',[
$u->info['dnow'], $whrVals[$this->gs][0], $whrVals[$this->gs][1], $whrVals[$this->gs][2], $whrVals[$this->gs][3],
]);
foreach ($botsArr as $pl) {
// }
//
// $sp = mysql_query(
// 'SELECT `u`.*,`st`.* FROM `dungeon_bots` AS `u` LEFT JOIN `test_bot` AS `st` ON (`u`.`id_bot` = `st`.`id`) WHERE `u`.`dn` = "' . $u->info['dnow'] . '" AND ' . $whr[$this->gs] . ' AND `u`.`delete` = "0" LIMIT 50'
// );
// while ($pl = mysql_fetch_assoc($sp)) {
$i++;
if (!isset($pos[$this->cord[$pl['y'] . '_' . $pl['x']]])) {
$pos[$this->cord[$pl['y'] . '_' . $pl['x']]] = 0;

View File

@ -1,48 +1,27 @@
<?php
use Core\Config;
use Core\Db;
echo "
<script>
let elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
";
echo "<script>document.getElementById('se-pre-con').parentNode.removeChild(document.getElementById('se-pre-con'));</script>";
if (!defined('GAME')) {
die();
}
if ($u->room['file'] != 'dungeon') {
return;
}
$pd = [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, //передняя стенка, в 2-х шагах
10 => 0, 11 => 0, 12 => 0, 13 => 0, 14 => 0, 15 => 0, 16 => 0, 17 => 0, 18 => 0, 19 => 0, 20 => 0, 21 => 0, 22 => 0, 23 => 0, /* Растояние: 1 шаг */
24 => 0, //стена прямо слева от персонажа (1)
25 => 0, //стена прямо справа от персонажа (1)
26 => 0, //стена прямо перед персонажем (1)
27 => 0, //стена слева от персонажа (1)
28 => 0, //стена справа от персонажа (1)
];
if (isset($_POST['go_to_admin']) && $u->info['admin'] == 1 && $u->info['login'] == 'Crowley') {
mysql_query('UPDATE `stats` SET `x` = "' . round((int)$_POST['g__x']) . '", `y` = "' . round((int)$_POST['g__y']) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
if ($_POST['g__restorebot']) {
mysql_query('UPDATE `dungeon_bots` SET `delete` = "0" WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = 1 LIMIT 50');
}
header('Location: /main.php');
}
if (isset($_GET['back'])) {
$dp = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_now` WHERE `id` = "' . $u->info['dnow'] . '" LIMIT 1'));
$dp = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $dp['id2'] . '" AND `x` = "' . $u->info['x'] . '" AND `y` ="' . $u->info['y'] . '" LIMIT 1'));
if ($dp['file'] != '0') {
$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;
}
mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 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];
@ -57,8 +36,7 @@ if (!isset($d->info['id'])) {
$_GET['exitd'] = true;
}
$dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $u->info['id'] . '" AND `dn` = "' . $u->info['dnow'] . '" AND `vars` = "die" LIMIT 1'));
$dies = $dies[0];
$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;
@ -71,11 +49,11 @@ if (!isset($d->point['id'])) {
}
if (isset($_GET['new_leader'])) {
echo $d->n_lead($_GET['new_leader'], $u->info['id']);
$d->n_lead($_GET['new_leader'], $u->info['id']);
}
if (isset($_GET['go_from_psh'])) {
echo $d->go_to_hell($_GET['go_from_psh'], $u->info['id']);
$d->go_to_hell($_GET['go_from_psh'], $u->info['id']);
}
@ -209,7 +187,11 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
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'));
$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
@ -217,7 +199,11 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
?>
} 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'));
$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
@ -225,7 +211,11 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
?>
} 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'));
$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
@ -233,7 +223,11 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
?>
} 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'));
$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
@ -246,7 +240,11 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
}
} 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'));
<?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'];?>;
@ -330,21 +328,21 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
var objects = {};
//i:{id,login,mapPoint,sex,obraz,type,users_p},
var users = {<?= $d->genUsers(); ?>};
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'
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() {
var i = 0, m = false, mz = false;
let i = 0, m = false, mz = false;
while (i < users['count']) {
if (users[i] != undefined) {
mz = mapp[users[i][2]];
@ -355,7 +353,10 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
}
i++;
}
var i = 0, m = false, mz = false;
i = 0;
m = false;
mz = false;
while (i < objs['count']) {
if (objs[i] != undefined) {
mz = mapp[objs[i][2]];
@ -369,7 +370,7 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
}
i++;
}
var i = 5;
i = 5;
while (i >= 1) {
if (zfloor0[i] != '') {
document.getElementById('Floor0').innerHTML += zfloor0[i];
@ -691,51 +692,16 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
$tmGol = $u->info['timeGo'] - $u->info['timeGoL']; //сколько секунд идти всего
echo 'var tgo = ' . ($tmGo * 10) . '; var tgol = ' . ($tmGol * 10) . ';'; ?>
</script>
<link href="//img.new-combats.tech/css/dungeon_<?= $d->point['css']; ?>.css" rel="stylesheet"
type="text/css"/>
<style>
.hintDm {
position: absolute;
background-color: #E4E4E4;
padding: 5px;
border: 1px solid #999;
z-index: 1;
width: 70px;
}
<link rel="stylesheet" href="<?= Config::img() ?>/css/dungeon.css">
<link rel="stylesheet" href="<?= Config::img() ?>/css/dungeon_<?= $d->point['css']; ?>.css">
.dUser {
max-height: 220px;
max-width: 120px;
min-width: 30px;
min-height: 55px;
border: 0;
padding: 0;
margin: 0;
}
.dObj {
border: 0;
padding: 0;
margin: 0;
}
.test1 {
text-align: right;
}
#pline1 {
background-image: url(//img.new-combats.tech/wait3.gif);
height: 9px;
z-index: 1000;
}
</style>
<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;">&nbsp;<?php if (isset($d->error)) {
echo '<font color="red">' . $d->error . '</font><br>';
<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; ?>'; }"
@ -777,7 +743,13 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
$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'));
$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++;
@ -814,7 +786,7 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
<div style="position:relative;">
<div style="position:absolute;z-index:1;left:397px;top:0px;">
<div id="pline1" style="width:1px;"></div>
<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"/>
@ -884,7 +856,9 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
$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');
$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;
}
@ -892,18 +866,22 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
if ($u->info['admin'] > 0 || $d->id_dng == 106) {
$bxy = [];
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`
$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');
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');
$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'];
@ -946,7 +924,11 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} 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'));
$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 {
@ -976,190 +958,105 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
</script>
</div>
<div style="position:absolute; z-index:50; left: 374px; top: 110px;">
<img src="//img.new-combats.tech/podzem-map2.png"/>
<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;"/>
<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;"/>
<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;"/>
<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;"/>
<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;"/>
<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;"/>
<img src="//img.new-combats.tech/g7.jpg" width="24" height="19"
id="g7"
style="position:absolute;cursor:pointer; left: 476px; top: 28px;"/>
<div id="Dungeon" class="Dungeon" align="center"
style="width:352px;height:240px;padding:0px;margin:10px;">
<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">
<div class="<?php if ($pd[1] == 1) {
echo 'LeftSide4_1';
} ?>">
<div class="<?php if ($pd[2] == 1) {
echo 'RightSide4_1';
} ?>">
<div id="4_0r" class="<?php if ($pd[3] == 1) {
echo 'RightSide4_0';
} ?>">
<div id="4_0l" class="<?php if ($pd[4] == 1) {
echo 'LeftSide4_0';
} ?>">
<div id="3_2l"
class="<?php if ($pd[5] == 1) {
echo 'LeftFront3_2';
} ?>">
<div id="3_2r"
class="<?php if ($pd[6] == 1) {
echo 'RightFront3_2';
} ?>">
<div class="<?php if ($pd[7] == 1) {
echo 'LeftFront3_1';
} ?>">
<div class="<?php if ($pd[8] == 1) {
echo 'RightFront3_1';
} ?>">
<div id="3_1l"
class="<?php if ($pd[10] == 1) {
echo 'LeftFront3_1';
} ?>">
<div id="3_1f"
class="<?php if ($pd[9] == 1) {
echo 'LeftFront3_0';
} ?>">
<div id="3_1r"
class="<?php if ($pd[11] == 1) {
echo 'RightFront3_1';
} ?>">
<div class="<?php if ($pd[12] == 1) {
echo 'LeftSide3_0';
} ?>">
<div id="3_0l"
class="<?php if ($pd[13] == 1) {
echo 'RightSide3_0';
} ?>">
<div id="2_1l"
class="<?php if ($pd[14] == 1) {
echo 'LeftFront2_1';
} ?>">
<div id="2_1r"
class="<?php if ($pd[15] == 1) {
echo 'RightFront2_1';
} ?>">
<div id="2_1f"
class="<?php if ($pd[16] == 1) {
echo 'LeftFront2_0';
} ?>">
<div class="<?php if ($pd[17] == 1) {
echo 'LeftSide2_0';
} ?>">
<div id="2_0l"
class="<?php if ($pd[18] == 1) {
echo 'RightSide2_0';
} ?>">
<div id="1_1l"
class="<?php if ($pd[19] == 1) {
echo 'LeftFront1_1';
} ?>">
<div id="1_1r"
class="<?php if ($pd[20] == 1) {
echo 'RightFront1_1';
} ?>">
<div id="1_1f"
class="<?php if ($pd[21] == 1) {
echo 'LeftFront1_0';
} ?>">
<div class="<?php if ($pd[22] == 1) {
echo 'LeftSide1_0';
} ?>">
<div id="1_0l"
class="<?php if ($pd[23] == 1) {
echo 'RightSide1_0';
} ?>">
<div id="0_1l"
class="<?php if ($pd[24] == 1) {
echo 'LeftFront0_1';
} ?>">
<div id="0_1r"
class="<?php if ($pd[25] == 1) {
echo 'RightFront0_1';
} ?>">
<div id="0_0f"
class="<?php if ($pd[26] == 1) {
echo 'LeftFront0_0';
} ?>">
<div class="<?php if ($pd[27] == 1) {
echo 'LeftSide0_0';
} ?>">
<div id="0_0l"
class="<?php if ($pd[28] == 1) {
echo 'RightSide0_0';
} ?>">
<?php if ($u->info['admin'] == 0){ ?>
<div id="divWindowImg">
<img src="//img.new-combats.tech/i/1x1.gif"
usemap="#ObjectsMap"
border="0"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
foreach ($map as $key => $layer) {
if (!$layer) {
continue;
}
$id = !empty($mapIDs[$key]) ? " id='" . $mapIDs[$key] . "'" : '';
echo "<div class='$layer'$id></div>";
}
?>
</div>
</div>
<!-- / MAP \ -->
<span class="<?php if ($pd[28] == 1) {
echo 'RightSide0_0';
} ?>">
<?php } ?>
<span class="<?= $map[28] ?>">
</span></div>
</div>
</td>
@ -1178,46 +1075,22 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
locGoLineDng();
$("document").ready(function () {
$('#g1').click(function () {
/* $.ajax({
url: "main.php?ajax=1",
cache: false,
success: function(html) {
$("body").html(html);
}
});*/
location.href = "/main.php";
});
$('#g6').click(function () {
/* $.ajax({
url: "main.php?look=1&rnd=<?=$code;?>&ajax=1",
cache: false,
success: function(html) {
$("body").html(html);
}
});*/
location.href = "/main.php?look=1&rnd=<?=$code;?>";
location.href = "/main.php?look=1&rnd=<?=$code?>";
});
$('#g7').click(function () {
/*$.ajax({
url: "main.php?look=2&rnd=<?=$code;?>&ajax=1",
cache: false,
success: function(html) {
$("body").html(html);
}
});*/
location.href = "/main.php?look=2&rnd=<?=$code;?>";
location.href = "/main.php?look=2&rnd=<?=$code?>";
});
});
</script>
<br/><br/>
<?php
if ($u->info['admin'] == 1) {
echo '<form method="POST">X - <input type="text" name="g__x" autocomplete="off" value="' . $u->info['x'] . '" size="4" /> Y - <input type="text" name="g__y" autocomplete="off" value="' . $u->info['y'] . '" size="4" /> <input type="submit" value="Перейти" name="go_to_admin" /><br/><input id="restorbot" type="checkbox" name="g__restorebot" autocomplete="off" /> <label for="restorbot">Восстановить павших ботов </label></form><br>
S:' . $u->info['s'];
if ($u->isAdmin()) {
echo 'S:' . $u->info['s'];
}
}

View File

@ -1,6 +1,8 @@
<?php
use Core\Config;
use Core\Db;
use Helper\Conversion;
use User\StatsModel;
if (!defined('GAME')) {
@ -13,11 +15,8 @@ if ($u->room['file'] != 'dungeon_enter_all') {
$error = ''; // Собираем ошибки.
$dungeonGroupList = ''; // Сюда помещаем список Групп.
$dungeonGo = 1; // По умолчанию, мы идем в пещеру.
$dungeon = mysql_fetch_assoc(mysql_query('SELECT `id` as room, city, `dungeon_room` as d_room, city, `shop`, `dungeon_id` as id, `dungeon_name` as name, quest FROM `dungeon_room` WHERE `id`="' . $u->room['id'] . '" LIMIT 1'));
//
$dungeon['quest'] = 1;
//
$dungeon = Db::getRow('select id as room, city, dungeon_room as d_room, shop, dungeon_id as id, dungeon_name as name from dungeon_room where id = ?', [$u->room['id']]);
$zv = [];
$dunname = [
12 => ['capitalcity', 'Пещера Тысячи Проклятий'],
@ -37,19 +36,16 @@ if ($u->isAdmin()) {
$dunname[999] = ['capitalcity', 'Тестовая локация'];
}
$roomSection = isset($_GET['rz']) && $dungeon['quest'] == 1 ? 1 : 0;
$roomSection = isset($_GET['rz']) ? 1 : 0;
// Собираем группу для похода
$all_dungeon = mysql_query('SELECT `city` FROM `dungeon_room` WHERE `city` IS NOT NULL AND `active`=1 ');
while ($t = mysql_fetch_array($all_dungeon)) {
$dungeon['list'][] = $t['city'];
}
unset($all_dungeon);
// Для названий репутаций в переменных $u->rep[rp_*]...
$dungeon['list'] = Db::getColumn('select city from dungeon_room where city is not null and active = 1');
if ($u->info['dn'] > 0) {
$zv = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_zv` WHERE `id`="' . $u->info['dn'] . '" AND `delete` = "0" LIMIT 1'));
if (!isset($zv['id'])) {
mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
$zv = Db::getRow('select dungeon_zv.*, dungeon_room.dungeon_name from dungeon_zv left join dungeon_room on dungeon_room.dungeon_id = dun where dungeon_zv.id = ?', [$u->info['dn']]);
if (empty($zv['id'])) {
Db::sql('update stats set dn = 0 where id = ?', [$u->info['id']]);
$u->info['dn'] = 0;
}
}
@ -59,263 +55,142 @@ $dungeon_timeout = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` =
if ($u->isAdmin()) {
unset($dungeon_timeout);
} // $dungeon_timeout - задержка на посещение пещеры.
if (isset($dungeon_timeout['id'])) // Кто-то передумал и не пойдет в пещеру, так-как уже там был.
{
if (isset($dungeon_timeout['id'])) { // Кто-то передумал и не пойдет в пещеру, так-как уже там был.
$dungeonGo = 0;
if (isset($_GET['start'])) {
$error = 'До следующего похода осталось еще: ' . $u->timeOut(60 * 60 * 2 - time() + $dungeon_timeout['time']);
$error = 'До следующего похода осталось еще: ' . Conversion::secondsToTimeout(60 * 60 * 2 - time() + $dungeon_timeout['time']);
}
}
if (isset($_GET['start']) && $zv['uid'] == $u->info['id'] && $dungeonGo == 1) {
$ig = 1;
if ($ig > 0) { //перемещаем игроков в пещеру
//перемещаем игроков в пещеру
$dungeon['room'] = 321;
$dungeon['id'] = $zv['dun'];
//
Db::sql('insert into dungeon_now (uid, id2, name, time_start) values (?,?,?,unix_timestamp())', [$zv['uid'], $zv['dun'], $zv['dungeon_name']]);
$zid = Db::lastInsertId();
$dungeon['room'] = 321;
$dungeon['id'] = $zv['dun'];
//
$ins = mysql_query('INSERT INTO `dungeon_now` (`city`,`uid`,`id2`,`name`,`time_start`)
VALUES ("' . $zv['city'] . '","' . $zv['uid'] . '","' . $zv['dun'] . '","' . $dunname[$zv['dun']][1] . '","' . time() . '")');
if ($ins) {
$zid = mysql_insert_id();
mysql_query('UPDATE `dungeon_zv` SET `delete` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1');
//обновляем пользователей
$su = mysql_query('SELECT `u`.`id`,`st`.`dn` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="' . $zv['id'] . '" /*LIMIT ' . ($zv['team_max'] + 1) . '*/');
$ids = '';
Db::sql('delete from dungeon_zv where id = ?', [$zv['id']]);
//обновляем пользователей
$uids = Db::getColumn('select id from stats where dn = ?', [$zv['id']]);
$map_locs = [];
$spm2 = mysql_query('SELECT `id`,`x`,`y` FROM `dungeon_map` WHERE `id_dng` = "' . $zv['dun'] . '"');
while ($plm2 = mysql_fetch_array($spm2)) {
$map_locs[] = [$plm2['x'], $plm2['y']];
}
unset($spm2, $plm2);
$map_locs = [];
$pxd = 0;
while ($pu = mysql_fetch_array($su)) {
$pxd++;
$ids .= ' `id` = "' . $pu['id'] . '" OR';
if ($u->stats['silver'] >= 3) {
$u->addAction((time() - ((60 * 60 * 2) / 100 * 30)), 'psh0', $pu['id'], $pu['id']);
} else {
$u->addAction(time(), 'psh0', $pu['id'], $pu['id']);
}
if (date('w') == 0 || date('w') == 6 || date('w') == 1) {
StatsModel::addRepexpById($pu['id'], 5); //Репутация +5
}
//Добавляем квестовые обьекты для персонажей
$sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `room` = ' . $dungeon['room'] . ' AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 100');
while ($pl2 = mysql_fetch_array($sp)) {
$pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . (str_replace('start_quest', '', $pl2['vars'])) . '" AND `line` = "' . $dungeon['id'] . '" LIMIT 1'));
if (isset($pl['id'])) {
$act = explode(',', $pl['act_date']);
$i = 0;
while ($i < count($act)) {
$act_date = explode(':|:', $act[$i]);
foreach ($act_date as $key => $val) {
$val = explode(':=:', $val);
$actdate[$val[0]] = $val[1];
foreach (Db::getRows('select x, y from dungeon_map where id_dng = ?', [$zv['dun']]) as $pos) {
$map_locs[] = [$pos['x'], $pos['y']];
}
$pxd = 0;
foreach ($uids as $uid) {
$pxd++;
$u->addAction(time(), 'psh0', $uid, $uid);
if (date('w') == 0 || date('w') == 6 || date('w') == 1) {
StatsModel::addRepexpById($uid, 5); //Репутация +5
}
//Добавляем квестовые обьекты для персонажей
$sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `room` = ' . $dungeon['room'] . ' AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 100');
while ($pl2 = mysql_fetch_array($sp)) {
$pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . (str_replace('start_quest', '', $pl2['vars'])) . '" AND `line` = "' . $dungeon['id'] . '" LIMIT 1'));
if (isset($pl['id'])) {
$act = explode(',', $pl['act_date']);
$i = 0;
while ($i < count($act)) {
$act_date = explode(':|:', $act[$i]);
foreach ($act_date as $key => $val) {
$val = explode(':=:', $val);
$actdate[$val[0]] = $val[1];
}
//Сбор ресурсов
if (isset($actdate['tk_itm']) && $actdate['tk_itm'] != '') {
$xr2 = explode('=', $actdate['tk_itm']);
if ($xr2[2] == 0) {
if (isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY'])) {
$actdate['tk_itm_fromY'] = (integer)$actdate['tk_itm_fromY'];
$actdate['tk_itm_toY'] = (integer)$actdate['tk_itm_toY'];
}
//Сбор ресурсов
if (isset($actdate['tk_itm']) && $actdate['tk_itm'] != '') {
$xr2 = explode('=', $actdate['tk_itm']);
if ($xr2[2] == 0) {
if (isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY'])) {
$actdate['tk_itm_fromY'] = (integer)$actdate['tk_itm_fromY'];
$actdate['tk_itm_toY'] = (integer)$actdate['tk_itm_toY'];
}
$ml_arr = [];
foreach ($map_locs as $ml) { // tk_itm_fromY tk_itm_toY - отсеиваем позицию для дропа предметов.
if ((isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY'])) or (!isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY']))) {
if ($ml[1] > $actdate['tk_itm_fromY'] && $actdate['tk_itm_toY'] > $ml[1]) $ml_arr[] = $ml;
elseif (!isset($actdate['tk_itm_fromY']) && $actdate['tk_itm_toY'] > $ml[1]) $ml_arr[] = $ml;
} else $ml_arr[] = $ml;
}
if (isset($ml_arr) && count($ml_arr) == 0) $ml_arr = $map_locs;
//Добавляем обьект для юзера
$j = 0;
while ($j < $xr2[1]) {
$cord = $ml_arr[rand(0, count($ml_arr) - 1)];
if ($cord[0] != 0 || $cord[1] != 0) {
mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`onlyfor`,`quest`) VALUES (
"' . $zid . '","' . $u->info['id'] . '","' . $xr2[0] . '","' . time() . '","' . $cord[0] . '","' . $cord[1] . '","' . $u->info['id'] . '","' . $pl['id'] . '"
)');
}
$j++;
$ml_arr = [];
foreach ($map_locs as $ml) { // tk_itm_fromY tk_itm_toY - отсеиваем позицию для дропа предметов.
if ((isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY'])) or (!isset($actdate['tk_itm_fromY']) && isset($actdate['tk_itm_toY']))) {
if ($ml[1] > $actdate['tk_itm_fromY'] && $actdate['tk_itm_toY'] > $ml[1] || !isset($actdate['tk_itm_fromY']) && $actdate['tk_itm_toY'] > $ml[1]) {
$ml_arr[] = $ml;
}
} else {
//Предмет находится в конкретном месте
mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`onlyfor`,`quest`) VALUES (
"' . $zid . '","' . $u->info['id'] . '","' . $xr2[0] . '","' . time() . '","' . $xr2[2] . '","' . $xr2[3] . '","' . $u->info['id'] . '","' . $pl['id'] . '"
)');
$ml_arr[] = $ml;
}
}
$i++;
}
}
}
}
$ids = rtrim($ids, 'OR');
$snew = 1;
$upd1 = mysql_query('UPDATE `stats` SET `s`="' . $snew . '",`res_s`="1",`x`="0",`y`="0",`res_x`="0",`res_y`="0",`dn` = "0",`dnow` = "' . $zid . '" WHERE ' . $ids . ' LIMIT ' . ($zv['team_max'] + 1) . '');
if ($upd1) {
$upd2 = mysql_query('UPDATE `users` SET `room` = "405" WHERE ' . $ids . ' LIMIT ' . ($zv['team_max'] + 1) . '');
//Добавляем ботов и обьекты в пещеру $zid с for_dn = $dungeon['id']
//Добавляем ботов
$vls = '';
$sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "' . $zv['dun'] . '"');
while ($pl = mysql_fetch_array($sp)) {
if ($pl['id_bot'] == 0 && $pl['bot_group'] != '') {
$bots = explode(',', $pl['bot_group']);
$pl['id_bot'] = (int)$bots[rand(0, count($bots) - 1)];
}
if ($pl['id_bot'] > 0) {
$vls .= '("' . $zid . '","' . $pl['id_bot'] . '","' . $pl['colvo'] . '","' . $pl['items'] . '","' . $pl['x'] . '","' . $pl['y'] . '","' . $pl['dialog'] . '","' . $pl['items'] . '","' . $pl['go_bot'] . '","' . $pl['noatack'] . '"),';
}
unset($bots);
}
$vls = rtrim($vls, ',');
//var_dump($vls);
$ins1 = mysql_query('INSERT INTO `dungeon_bots` (`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`,`go_bot`,`noatack`) VALUES ' . $vls . '');
//Добавляем обьекты
$vls = '';
$sp = mysql_query('SELECT * FROM `dungeon_obj` WHERE `for_dn` = "' . $zv['dun'] . '"');
while ($pl = mysql_fetch_array($sp)) {
$vls .= '("' . $zid . '","' . $pl['name'] . '","' . $pl['img'] . '","' . $pl['x'] . '","' . $pl['y'] . '","' . $pl['action'] . '","' . $pl['type'] . '","' . $pl['w'] . '","' . $pl['h'] . '","' . $pl['s'] . '","' . $pl['s2'] . '","' . $pl['os1'] . '","' . $pl['os2'] . '","' . $pl['os3'] . '","' . $pl['os4'] . '","' . $pl['type2'] . '","' . $pl['top'] . '","' . $pl['left'] . '","' . $pl['date'] . '"),';
}
//Добавление обьектов (день святого валентина)
if (floor(date('m')) == 2 && floor(date('d')) >= 7 && floor(date('d')) <= 20) {
if (floor(date('m')) == 2 && floor(date('d')) >= 14 && floor(date('d')) <= 20) {
//Появляются мобы которые принимают цветы
$vlsbts = '';
$ins1bts = null;
if ($zv['dun'] == 1) {
//4 уровня (КАНАЛИЗАЦИЯ)
$vlsbts .= '("' . $zid . '","410","1","","-5","3","8","0","0"),';
//4-7 уровня
$vlsbts .= '("' . $zid . '","413","1","","8","46","9","0","0"),';
} elseif ($zv['dun'] == 12) {
//(ПТП)
//4-7 уровня
$vlsbts .= '("' . $zid . '","413","1","","-3","18","9","0","0"),';
//4-9 уровня
$vlsbts .= '("' . $zid . '","414","1","","-2","29","10","0","0"),';
} elseif ($zv['dun'] == 3) {
//(КАТАКОМБЫ)
//4-7 уровня
$vlsbts .= '("' . $zid . '","413","1","","15","8","9","0","0"),';
//4-9 уровня
$vlsbts .= '("' . $zid . '","414","1","","3","35","10","0","0"),';
} elseif ($zv['dun'] == 101) {
//(бездна)
//4-7 уровня
$vlsbts .= '("' . $zid . '","413","1","","-2","21","9","0","0"),';
//4-9 уровня
$vlsbts .= '("' . $zid . '","414","1","","2","43","10","0","0"),';
}
if ($vlsbts != '') {
$vlsbts = rtrim($vlsbts, ',');
$ins1bts = mysql_query('INSERT INTO `dungeon_bots` (`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`,`go_bot`) VALUES ' . $vlsbts . '');
}
unset($vlsbts, $ins1bts);
}
//Раскидываем предметы по пещере (Блёклый подземник)
$dcords = [];
$c_sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $zv['dun'] . '"');
while ($c_pl = mysql_fetch_array($c_sp)) {
$dcords[] = [$c_pl['x'], $c_pl['y']];
}
$fcords = [];
$i = 1;
while ($i <= $pxd) {
$j = rand(1, 10);
while ($j >= 0) {
$rndxy = rand(0, count($dcords) - 1);
$rndx = $dcords[$rndxy][0];
$rndy = $dcords[$rndxy][1];
$fcords[$rndx][$rndy] = true;
unset($dcords[$rndxy]);
$vls .= '("' . $zid . '","Блеклый подземник","vbig1.gif","' . $rndx . '","' . $rndy . '","fileact:vbig1","0","81","81","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt2:154,rl2:146,rt3:139,rl3:154,rt4:125,rl4:161}"),';
$j--;
}
$i++;
}
//Раскидываем предметы по пещере (Черепичный подземник)
$sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "' . $zv['dun'] . '"');
$test = [];
$dcords2 = [];
$dcords3 = [];
while ($pl = mysql_fetch_array($sp)) {
if (!isset($test[$pl['id_bot']])) {
$test[$pl['id_bot']] = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $pl['id_bot'] . '" LIMIT 1'));
}
if (isset($test[$pl['id_bot']]['id']) && $test[$pl['id_bot']] != 2) {
if ($test[$pl['id_bot']]['level'] > 6) {
$dcords2[] = [$pl['x'], $pl['y']];
if (empty($ml_arr)) {
$ml_arr = $map_locs;
}
if ($test[$pl['id_bot']]['level'] >= 8 && $test[$pl['id_bot']]['align'] == 9) {
$dcords3[] = [$pl['x'], $pl['y']];
//Добавляем обьект для юзера
$j = 0;
while ($j < $xr2[1]) {
$cord = $ml_arr[rand(0, count($ml_arr) - 1)];
if ($cord[0] != 0 || $cord[1] != 0) {
mysql_query(
'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`onlyfor`,`quest`) VALUES (
"' . $zid . '","' . $u->info['id'] . '","' . $xr2[0] . '","' . time(
) . '","' . $cord[0] . '","' . $cord[1] . '","' . $u->info['id'] . '","' . $pl['id'] . '"
)'
);
}
$j++;
}
} else {
$test[$pl['id_bot']] = 2;
//Предмет находится в конкретном месте
mysql_query(
'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`,`onlyfor`,`quest`) VALUES (
"' . $zid . '","' . $u->info['id'] . '","' . $xr2[0] . '","' . time() . '","' . $xr2[2] . '","' . $xr2[3] . '","' . $u->info['id'] . '","' . $pl['id'] . '"
)'
);
}
}
$i = 1;
while ($i <= $pxd) {
$j = rand(1, 5);
while ($j >= 0) {
$rndxy = rand(0, count($dcords2) - 1);
$rndx = $dcords2[$rndxy][0];
$rndy = $dcords2[$rndxy][1];
if (!isset($fcords[$rndx][$rndy]) && isset($dcords2[$rndxy][0])) {
$fcords[$rndx][$rndy] = true;
unset($dcords2[$rndxy]);
$vls .= '("' . $zid . '","Черепичный подземник","vbig2.gif","' . $rndx . '","' . $rndy . '","fileact:vbig2","0","81","81","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt2:154,rl2:146,rt3:139,rl3:154,rt4:125,rl4:161}"),';
}
$j--;
}
$i++;
}
$i = 1;
while ($i <= $pxd) {
$j = rand(1, 2);
while ($j >= 0) {
$rndxy = rand(0, count($dcords3) - 1);
$rndx = $dcords3[$rndxy][0];
$rndy = $dcords3[$rndxy][1];
if (!isset($fcords[$rndx][$rndy]) && isset($dcords3[$rndxy][0])) {
$fcords[$rndx][$rndy] = true;
unset($dcords3[$rndxy]);
$vls .= '("' . $zid . '","Кровавый подземник","vbig3.gif","' . $rndx . '","' . $rndy . '","fileact:vbig3","0","81","81","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt2:154,rl2:146,rt3:139,rl3:154,rt4:125,rl4:161}"),';
}
$j--;
}
$i++;
}
unset($test);
$i++;
}
//
$vls = rtrim($vls, ',');
if ($vls != '') {
$ins2 = mysql_query('INSERT INTO `dungeon_obj` (`dn`,`name`,`img`,`x`,`y`,`action`,`type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`) VALUES ' . $vls . '');
} else {
$ins2 = true;
}
if ($upd2 && $ins1 && $ins2) {
die('<script>location="main.php?rnd=' . $code . '";</script>');
} else {
var_dump($upd2, $ins1, $ins2);
$error = 'Ошибка перехода в подземелье... a1';
}
} else {
$error = 'Ошибка перехода в подземелье... a2';
}
} else {
$error = 'Ошибка перехода в подземелье... a3';
}
}
Db::sql('update stats left join users on users.id = stats.id set s = 1, dnow = ?, room = 405 where users.id in (?) limit ?', [$zid, implode(',', $uids), $zv['team_max'] + 1]);
//Добавляем ботов и обьекты в пещеру $zid с for_dn = $dungeon['id']
//Добавляем ботов
$botarray = [];
$dbots = Db::getRows('select * from dungeon_bots where for_dn = ?', [$zv['dun']]);
foreach ($dbots as $bot) {
if ($bot['id_bot'] == 0 && $bot['bot_group'] != '') {
$bots = explode(',', $bot['bot_group']);
$bot['id_bot'] = (int)$bots[rand(0, count($bots) - 1)];
}
if ($bot['id_bot'] > 0) {
$botarray[] = [$zid, $bot['id_bot'], $bot['colvo'], $bot['items'], $bot['x'], $bot['y'], $bot['dialog'], intval($bot['items']), $bot['go_bot'], $bot['noatack']];
}
}
$addbots = Db::prepare('insert into dungeon_bots (dn, id_bot, colvo, items, x, y, dialog, atack, go_bot, noatack) values (?,?,?,?,?,?,?,?,?,?)');
foreach ($botarray as $b) {
$addbots->execute($b);
}
//Добавляем обьекты
$objarray = [];
$dobjects = Db::getRows('select * from dungeon_obj where for_dn = ?', [$zv['dun']]);
foreach ($dobjects as $object) {
$objarray[] = [$zid, $object['name'], $object['img'], $object['x'], $object['y'], $object['action'], $object['type'], $object['w'], $object['h'], $object['s'], $object['s2'],
$object['os1'], $object['os2'], $object['os3'], $object['os4'], $object['type2'], $object['top'], $object['left'], $object['date']];
}
$addobjects = Db::prepare('insert into dungeon_obj (dn, name, img, x, y, action, type, w, h, s, s2, os1, os2, os3, os4, type2, top, `left`, date) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
foreach ($objarray as $o) {
$addobjects->execute($o);
}
exit('<script>location="main.php?rnd=' . PassGen::intCode() . '";</script>');
} elseif (isset($_POST['go'], $_POST['goid']) && $dungeonGo == 1) {
if (!isset($zv['id'])) {
$zv = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "all" AND `id`="' . mysql_real_escape_string($_POST['goid']) . '" AND `delete` = "0" LIMIT 1'));
@ -459,14 +334,16 @@ if (isset($_GET['start']) && $zv['uid'] == $u->info['id'] && $dungeonGo == 1) {
$dun5 = 12; //ПТП
}
//
$ins = mysql_query('INSERT INTO `dungeon_zv`
$ins = mysql_query(
'INSERT INTO `dungeon_zv`
(`city`,`time`,`uid`,`dun`,`pass`,`com`,`lvlmin`,`lvlmax`,`team_max`) VALUES
("all","' . time() . '","' . $u->info['id'] . '","' . $dun5 . '",
"' . mysql_real_escape_string($_POST['pass']) . '",
"' . mysql_real_escape_string($_POST['text']) . '",
"8",
"21",
"5")');
"5")'
);
if ($ins) {
$u->info['dn'] = mysql_insert_id();
$zv['id'] = $u->info['dn'];
@ -485,13 +362,17 @@ if (isset($_GET['start']) && $zv['uid'] == $u->info['id'] && $dungeonGo == 1) {
$sp = mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "all" AND `delete` = "0" AND `time` > "' . (time() - 60 * 60 * 2) . '"');
while ($pl = mysql_fetch_array($sp)) {
$dungeonGroupList .= '<div style="padding:2px;">';
if ($u->info['dn'] == 0) $dungeonGroupList .= '<input type="radio" name="goid" id="goid" value="' . $pl['id'] . '" />';
if ($u->info['dn'] == 0) {
$dungeonGroupList .= '<input type="radio" name="goid" id="goid" value="' . $pl['id'] . '" />';
}
$dungeonGroupList .= '<span class="date">' . date('H:i', $pl['time']) . '</span> ';
$dungeonGroupList .= '<span><img title="' . $dunname[$pl['dun']][1] . '" style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/' . $dunname[$pl['dun']][0] . '.gif" /></span> ';
$pus = ''; //группа
$su = mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`st`.`dn`,`u`.`city`,`u`.`room` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="' . $pl['id'] . '" LIMIT ' . ($pl['team_max'] + 1) . '');
$su = mysql_query(
'SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`st`.`dn`,`u`.`city`,`u`.`room` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="' . $pl['id'] . '" LIMIT ' . ($pl['team_max'] + 1) . ''
);
while ($pu = mysql_fetch_array($su)) {
$pus .= '<b>' . $pu['login'] . '</b> [' . $pu['level'] . ']<a href="info/' . $pu['id'] . '" target="_blank"><img src="//img.new-combats.tech/i/inf_' . $pu['city'] . '.gif" title="Инф. о ' . $pu['login'] . '"></a>';
$pus .= ', ';
@ -501,7 +382,9 @@ while ($pl = mysql_fetch_array($sp)) {
$dungeonGroupList .= $pus;
unset($pus);
if ($pl['pass'] != '' && $u->info['dn'] == 0) $dungeonGroupList .= ' <small><input type="password" name="pass_com" value=""></small>';
if ($pl['pass'] != '' && $u->info['dn'] == 0) {
$dungeonGroupList .= ' <small><input type="password" name="pass_com" value=""></small>';
}
if ($pl['com'] != '') {
$dl = '';
@ -628,7 +511,9 @@ if ($roomSection == 1) {
<form autocomplete="off" action='/main.php' method="post" name="F1" id="F1">
<?php
$qsee = '';
$hgo = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_' . $dungeon['city'] . '" LIMIT 1', 1);
$hgo = $u->testAction(
'`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_' . $dungeon['city'] . '" LIMIT 1', 1
);
$qc = 0; // Quest Count
$qcc = [];
//Генерируем список текущих квестов
@ -684,7 +569,11 @@ if ($roomSection == 1) {
$dun5 = 12; //ПТП
}
//
$hgo = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_' . mysql_real_escape_string($qst_city) . '" LIMIT 1', 1);
$hgo = $u->testAction(
'`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_' . mysql_real_escape_string(
$qst_city
) . '" LIMIT 1', 1
);
//$qcc
if ($qcc[$dun5] > 0) {
echo '<font color="red"><b>У Вас уже есть задание, завершите его или отмените для получения нового.</b></font><br>';
@ -755,7 +644,9 @@ if ($roomSection == 1) {
$hgo3 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_suncity" LIMIT 1', 1);
$hgo4 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_demonscity" LIMIT 1', 1);
$hgo5 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_dreamscity" LIMIT 1', 1);
$hgo6 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_abandonedplain" LIMIT 1', 1);
$hgo6 = $u->testAction(
'`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_abandonedplain" LIMIT 1', 1
);
$hgo7 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_izlom16" LIMIT 1', 1);
$hgo8 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_sandcity" LIMIT 1', 1);
$hgo9 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_emeraldscity" LIMIT 1', 1);
@ -860,7 +751,9 @@ if ($roomSection == 1) {
} else {
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
}
} else echo 'Недостаточно репутации.';
} else {
echo 'Недостаточно репутации.';
}
} else {
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
}
@ -945,7 +838,11 @@ if ($roomSection == 1) {
if (isset($cur_price['nu_' . $val]) && isset($u->rep['nu_' . $val]) && $rt == 1) {
$u->rep['nu_' . $val] += $cur_price['nu_' . $val];
$r = mysql_query('UPDATE `rep` SET `nu_' . $val . '` = "' . $u->rep['nu_' . $val] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
if ($r) $rt = 1; else $rt = 0;
if ($r) {
$rt = 1;
} else {
$rt = 0;
}
}
}
if ($rt == 1) {
@ -957,7 +854,9 @@ if ($roomSection == 1) {
} else {
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
}
} else echo 'Недостаточно репутации.';
} else {
echo 'Недостаточно репутации.';
}
} else {
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
@ -982,7 +881,11 @@ if ($roomSection == 1) {
if (isset($cur_price['nu_' . $val]) && isset($u->rep['nu_' . $val]) && $rt == 1) {
$u->rep['nu_' . $val] += $cur_price['nu_' . $val];
$r = mysql_query('UPDATE `rep` SET `nu_' . $val . '` = "' . $u->rep['nu_' . $val] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
if ($r) $rt = 1; else $rt = 0;
if ($r) {
$rt = 1;
} else {
$rt = 0;
}
}
}
if ($rt == 1) {
@ -997,7 +900,9 @@ if ($roomSection == 1) {
} else {
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
}
} else echo 'Недостаточно репутации.';
} else {
echo 'Недостаточно репутации.';
}
} else {
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
}
@ -1049,13 +954,19 @@ if ($roomSection == 1) {
</table>
</fieldset>
<?php
$chk = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`),SUM(`m`.`price1`) FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `u`.`item_id` = `m`.`id` WHERE `m`.`type` = "61" AND `u`.`delete` = "0" AND `u`.`inOdet` = "0" AND `u`.`inShop` = "0" AND `u`.`inTransfer` = "0" AND `u`.`uid` = "' . $u->info['id'] . '" LIMIT 1000'));
$chk = mysql_fetch_array(
mysql_query(
'SELECT COUNT(`u`.`id`),SUM(`m`.`price1`) FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `u`.`item_id` = `m`.`id` WHERE `m`.`type` = "61" AND `u`.`delete` = "0" AND `u`.`inOdet` = "0" AND `u`.`inShop` = "0" AND `u`.`inTransfer` = "0" AND `u`.`uid` = "' . $u->info['id'] . '" LIMIT 1000'
)
);
if (isset($_GET['buy777']) && $chk[0] > 0) {
?>
<fieldset style='margin-top:15px;'>
<p><span style="padding-left: 10px">
<?php
$chk_cl = mysql_query('SELECT `u`.`id`,`m`.`price1` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `u`.`item_id` = `m`.`id` WHERE `m`.`type` = "61" AND `u`.`delete` = "0" AND `u`.`inOdet` = "0" AND `u`.`inShop` = "0" AND `u`.`inTransfer` = "0" AND `u`.`uid` = "' . $u->info['id'] . '" LIMIT 1000');
$chk_cl = mysql_query(
'SELECT `u`.`id`,`m`.`price1` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `u`.`item_id` = `m`.`id` WHERE `m`.`type` = "61" AND `u`.`delete` = "0" AND `u`.`inOdet` = "0" AND `u`.`inShop` = "0" AND `u`.`inTransfer` = "0" AND `u`.`uid` = "' . $u->info['id'] . '" LIMIT 1000'
);
while ($chk_pl = mysql_fetch_array($chk_cl)) {
if (mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $chk_pl['id'] . '" LIMIT 1')) {
$x++;
@ -1167,7 +1078,9 @@ if ($roomSection == 1) {
}
}
} else {
echo 'Поход в пещеры разрешен один раз в два часа. Осталось еще: ' . $u->timeOut(60 * 60 * 2 - time() + $dungeon_timeout['time']) . '<br><small style="color:grey">Но Вы всегда можете приобрести ключ от прохода у любого &quot;копателя пещер&quot; в Торговом зале ;)</small>';
echo 'Поход в пещеры разрешен один раз в два часа. Осталось еще: ' . $u->timeOut(
60 * 60 * 2 - time() + $dungeon_timeout['time']
) . '<br><small style="color:grey">Но Вы всегда можете приобрести ключ от прохода у любого &quot;копателя пещер&quot; в Торговом зале ;)</small>';
}
}