From 354499f8851c3bb1dd866fcc62e3679d2fa12419 Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Wed, 30 Sep 2020 17:46:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BA=D1=80=D1=83=D1=87?= =?UTF-8?q?=D0=B8=D0=B2=D0=B0=D0=B5=D0=BC=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE?= =?UTF-8?q?=D0=BD.=20=D0=A5=D0=BE=D1=80=D0=BE=D0=BD=D0=B8=D0=BC=20=D0=B8?= =?UTF-8?q?=D0=B4=D0=B8=D0=BE=D1=82=D1=81=D0=BA=D0=B8=D0=B5=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BA=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- enter_cave.php | 195 ++++++++++++++++++++++--------------------------- 1 file changed, 87 insertions(+), 108 deletions(-) diff --git a/enter_cave.php b/enter_cave.php index 2ce5cac..06d1cd7 100644 --- a/enter_cave.php +++ b/enter_cave.php @@ -74,35 +74,19 @@ if (in_array($user->room, Config::$canalenters)) { $podzemroom = $user->room + 1; $cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]]; $podzemdata = [621 => ['name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']]; + $warning = $_GET["warning"] ?? ''; + Template::header('enter_cave'); + if ($warning) { + echo sprintf('%s', $warning); + } ?> - - - - - - - - 1) { - echo "$_GET[warning]"; - } ?>

- 0 LIMIT 1"); if ($el = mysql_fetch_array($select)) { $wait_sec = $el['time']; @@ -116,15 +100,13 @@ if (in_array($user->room, Config::$canalenters)) { mysql_query("UPDATE `visit_podzem` SET `time` = 1 WHERE `login` = '$user[login]' AND `time` > 0 AND `room` = '$user->room' LIMIT 1"); } - if ($wait_sec > $new_t) { - if ($_GET['donate']) { - if ($user['money'] >= $podzemdata[$podzemroom]['passprice']) { - mysql_query("UPDATE `users` SET `money` = (`money`-" . $podzemdata[$podzemroom]['passprice'] . ") WHERE `id` = '$user[id]' LIMIT 1"); - mysql_query("INSERT INTO `delo` (`id`, `author`, `pers`, `text`, `type`, `date`) VALUES ('', '0', '{$_SESSION['uid']}', '\"" . $user['login'] . "\" пожертвовал на благоустройство пещеры \"" . $podzemdata[$podzemroom]['passprice'] . "\" кр. ($user[money]/$user[ekr]). ', 7, '" . time() . "')"); - $wait_sec = 0; - } else { - echo "У вас недостаточно денег"; - } + if ($wait_sec > $new_t && $_GET['donate']) { + if ($user['money'] >= $podzemdata[$podzemroom]['passprice']) { + mysql_query("UPDATE `users` SET `money` = (`money`-" . $podzemdata[$podzemroom]['passprice'] . ") WHERE `id` = '$user[id]' LIMIT 1"); + mysql_query("INSERT INTO `delo` (`id`, `author`, `pers`, `text`, `type`, `date`) VALUES ('', '0', '{$_SESSION['uid']}', '\"" . $user['login'] . "\" пожертвовал на благоустройство пещеры \"" . $podzemdata[$podzemroom]['passprice'] . "\" кр. ($user[money]/$user[ekr]). ', 7, '" . time() . "')"); + $wait_sec = 0; + } else { + echo "У вас недостаточно денег"; } } @@ -292,7 +274,7 @@ if (in_array($user->room, Config::$canalenters)) {
- room, Config::$canalenters)) { } } - if ($_GET['start']){ - if (in_array($user->room + 1, Config::$caverooms)) { - $nc = 1; - $locs = []; - } - $zax = mysql_query("SELECT `login`, `fee` FROM `vxodd` WHERE `glav_id` = '" . $user['id'] . "'"); - $level = 0; - while ($nana = mysql_fetch_array($zax)) { - $n_login = $nana['login']; - $rty = mysql_query("SELECT `id`, `level`, `login`, `shadow`, `money`, `hp` FROM `users` WHERE `login` = '$n_login' LIMIT 1"); - $esth = mysql_fetch_array($rty); - if ($esth['hp'] <= 0) { - $esth['hp'] = 1; - mysql_query('UPDATE `users` SET `hp` = "' . $esth['hp'] . '" WHERE `id` = "' . $esth['id'] . '" LIMIT 1'); + if ($_GET['start']) { + if (in_array($user->room + 1, Config::$caverooms)) { + $nc = 1; + $locs = []; } - if ($nana['fee']) { - if ($nana['fee'] > $esth['money']) { - continue; + $zax = mysql_query("SELECT `login`, `fee` FROM `vxodd` WHERE `glav_id` = '" . $user['id'] . "'"); + $level = 0; + while ($nana = mysql_fetch_array($zax)) { + $n_login = $nana['login']; + $rty = mysql_query("SELECT `id`, `level`, `login`, `shadow`, `money`, `hp` FROM `users` WHERE `login` = '$n_login' LIMIT 1"); + $esth = mysql_fetch_array($rty); + if ($esth['hp'] <= 0) { + $esth['hp'] = 1; + mysql_query('UPDATE `users` SET `hp` = "' . $esth['hp'] . '" WHERE `id` = "' . $esth['id'] . '" LIMIT 1'); } - mysql_query("UPDATE `users` SET `money` = (`money+$nana[fee]) WHERE `id` = '$user[id]' LIMIT 1"); - mysql_query("update `users` SET `money` = (`money-$nana[fee]) WHERE `id` = '$esth[id]' LIMIT 1"); - $user['money'] += $nana['fee']; - $esth['money'] -= $nana['fee']; - adddelo($user['id'], "Персонаж $user[login] получил $nana[fee] кр. за поход по локации \"" . $rooms[$user->room + 1] . "\" от персонажа $esth[login] ($user[money]).", 1); - adddelo($esth['id'], "Персонаж $esth[login] заплатил $nana[fee] кр. за поход по локации \"" . $rooms[$user->room + 1] . "\" персонажу $user[login] ($esth[money]).", 1); + if ($nana['fee']) { + if ($nana['fee'] > $esth['money']) { + continue; + } + mysql_query("UPDATE `users` SET `money` = (`money+$nana[fee]) WHERE `id` = '$user[id]' LIMIT 1"); + mysql_query("update `users` SET `money` = (`money-$nana[fee]) WHERE `id` = '$esth[id]' LIMIT 1"); + $user['money'] += $nana['fee']; + $esth['money'] -= $nana['fee']; + adddelo($user['id'], "Персонаж $user[login] получил $nana[fee] кр. за поход по локации \"" . $rooms[$user->room + 1] . "\" от персонажа $esth[login] ($user[money]).", 1); + adddelo($esth['id'], "Персонаж $esth[login] заплатил $nana[fee] кр. за поход по локации \"" . $rooms[$user->room + 1] . "\" персонажу $user[login] ($esth[money]).", 1); + } + if ($esth['level'] > $level) { + $level = $esth['level']; + } + $est_id = $esth['id']; + $est_login = $esth['login']; + $vremya = 60 * 60 * 6 + time(); + + mysql_query('INSERT INTO `visit_podzem` (`login`, `time`, `room`) VALUES ("' . $n_login . '", "' . $vremya . '", \'' . $podzemroom . '\')'); + $vrem = 30 * 60 + time(); + + $cavedata = Config::$cavedata ?? []; + mysql_query("INSERT INTO `caveparties` SET `user` = '$esth[id]', `leader` = '$user[id]', `login` = '$esth[login]', `shadow` = '0.png', `x` = '" . $cavedata[$user->room + 1]['x1'] . "', `y` = '" . $cavedata[$user->room + 1]['y1'] . "', `dir` = '" . $cavedata[$user->room + 1]['dir1'] . "', `floor` = 1"); + mysql_query("UPDATE `users`, `online` SET " . ($nc ? "`users`.`caveleader` = '$user[id]', " : "") . " `users`.`room` = '" . ($user->room + 1) . "', `online`.`room` = '" . ($user->room + 1) . "' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $esth['id'] . "'"); } - if ($esth['level'] > $level) { - $level = $esth['level']; - } - $est_id = $esth['id']; - $est_login = $esth['login']; - $vremya = 60 * 60 * 6 + time(); - mysql_query('INSERT INTO `visit_podzem` (`login`, `time`, `room`) VALUES ("' . $n_login . '", "' . $vremya . '", \'' . $podzemroom . '\')'); - $vrem = 30 * 60 + time(); - - $cavedata = Config::$cavedata ?? []; - mysql_query("INSERT INTO `caveparties` SET `user` = '$esth[id]', `leader` = '$user[id]', `login` = '$esth[login]', `shadow` = '0.png', `x` = '" . $cavedata[$user->room + 1]['x1'] . "', `y` = '" . $cavedata[$user->room + 1]['y1'] . "', `dir` = '" . $cavedata[$user->room + 1]['dir1'] . "', `floor` = 1"); - mysql_query("UPDATE `users`, `online` SET " . ($nc ? "`users`.`caveleader` = '$user[id]', " : "") . " `users`.`room` = '" . ($user->room + 1) . "', `online`.`room` = '" . ($user->room + 1) . "' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $esth['id'] . "'"); - } - - if ($nc) { - $r = mysql_query("SELECT * FROM `cavemaps` WHERE `room` = '$user->room'"); - while ($rec = mysql_fetch_assoc($r)) { - $map = unserialize($rec['map']); - foreach ($map as $k => $v) { - foreach ($v as $k2 => $v2) { - $obj = substr($v2, 0, 1); - if ($obj == "b" || $obj == "a" || $obj == "w") { - $tmp = explode("/", $v2); - $i = 1; - if ($obj == "b") { - $t = 0; - } elseif ($obj == "w") { - $t = 1; - } else { - $t = 2; + if ($nc) { + $r = mysql_query("SELECT * FROM `cavemaps` WHERE `room` = '$user->room'"); + while ($rec = mysql_fetch_assoc($r)) { + $map = unserialize($rec['map']); + foreach ($map as $k => $v) { + foreach ($v as $k2 => $v2) { + $obj = substr($v2, 0, 1); + if ($obj == "b" || $obj == "a" || $obj == "w") { + $tmp = explode("/", $v2); + $i = 1; + if ($obj == "b") { + $t = 0; + } elseif ($obj == "w") { + $t = 1; + } else { + $t = 2; + } + while ($tmp[$i]) { + mysql_query("INSERT INTO `cavebots` SET `leader` = '$user[id]', `x` = '$k2', `y` = '$k', `startx` = '$k2', `starty` = '$k', `bot` = '$tmp[$i]', `cnt` = '" . ($tmp[$i + 1]) . "', `floor` = '$rec[floor]', `type` = '$t'"); + $i += 2; + } + $map[$k][$k2] = 2; } - while ($tmp[$i]) { - mysql_query("INSERT INTO `cavebots` SET `leader` = '$user[id]', `x` = '$k2', `y` = '$k', `startx` = '$k2', `starty` = '$k', `bot` = '$tmp[$i]', `cnt` = '" . ($tmp[$i + 1]) . "', `floor` = '$rec[floor]', `type` = '$t'"); - $i += 2; - } - $map[$k][$k2] = 2; } } + include('cave_add_objects.php'); + mysql_query("INSERT INTO `caves` SET `leader` = '$user[id]', `map` = '" . serialize($map) . "', `level` = '$level', `floor` = '$rec[floor]'"); + savecavedata([], $user['id'], $rec['floor']); } - include('cave_add_objects.php'); - mysql_query("INSERT INTO `caves` SET `leader` = '$user[id]', `map` = '" . serialize($map) . "', `level` = '$level', `floor` = '$rec[floor]'"); - savecavedata([], $user['id'], $rec['floor']); } - } - ?> + ?> - location.href='cave.php'"; - exit(); - } + location.href='cave.php'"; + exit(); } +} ?>
- @@ -478,10 +460,7 @@ if (in_array($user->room, Config::$canalenters)) {
 


- - - \ No newline at end of file +} \ No newline at end of file