проверки переходов между локациями

This commit is contained in:
lopar 2018-03-09 16:53:10 +02:00
parent fc7c320d3b
commit 9190a7566e

346
city.php
View File

@ -27,26 +27,24 @@ if ($user['zayavka'] != 0) {
/**
* Проверяем можем ли мы двигаться.
* @param $getparam - имя переменной в GET запросе, который вызывает эту проверку
*/
function can_i_move($getparam)
function can_i_move()
{
$d = db::c()->query('SELECT SUM(`massa`) AS `mass` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0', $user['id'])->fetch_assoc();
$eff = db::c()->query('SELECT `type` FROM `effects` WHERE `owner` = ?i AND (`type` = 10 OR `type` = 13 OR `type` = 14)', $user['id'])->fetch_assoc();
if ($d['mass'] > get_meshok()) {
err('У вас переполнен рюкзак, вы не можете передвигаться...');
$_GET[$getparam] = 0;
$location[0] = NULL;
}
$entangle = db::c()->query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND `type` = 10', $user['id'])->fetch_assoc();
if ($entangle['id'] > 0) {
if ($eff['type'] == 10) {
err('Вы парализованы и не можете передвигаться...');
$_GET[$getparam] = 0;
$location[0] = NULL;
}
$eff = db::c()->query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND (`type` = 14 OR `type` = 13)', $user['id'])->fetch_assoc();
if ($eff['id'] > 0) {
if ($eff['type'] == 13 OR $eff['type'] == 14) {
err('У вас тяжелая травма, вы не можете передвигаться...');
$_GET[$getparam] = 0;
$location[0] = NULL;
}
}
@ -96,119 +94,221 @@ if ($dig_raw["finish_dig"] > $tm || $dig_raw["finish_guard"] > $tm) {
}
header("Cache-Control: no-cache");
if ($_GET['strah']){
can_i_move('strah');
move_to_inside(21, 'Страшилкину Улицу');
}
if ($_GET['cp']) {
can_i_move('cp');
$location = explode('/', filter_input(INPUT_SERVER, 'QUERY_STRING'));
can_i_move();
switch ($location[0]) {
case 'cp':
move_to_inside(20, 'Центральную площадь');
}
if ($_GET['bps']) {
can_i_move('bps');
break;
case 'strah':
move_to_inside(21, 'Страшилкину Улицу');
break;
case 'bps':
move_to_inside(26, 'Большую Парковую улицу');
}
if ($_GET['zamk']) {
can_i_move('zamk');
move_to_inside(2601, 'Замковую площадь');
}
if ($_GET['zaliv']) {
can_i_move('zaliv');
move_to_inside(2111, 'Ристалище');
}
if ($_GET['ps']) {
can_i_move('ps');
break;
case 'ps':
move_to_inside(51, 'Парковую улицу');
}
if ($_GET['torg']) {
can_i_move('torg');
move_to_inside(2702, 'Торговую улицу');
}
if ($_GET['abog']) {
can_i_move('abog');
break;
case 'zaliv':
move_to_inside(2111, 'Ристалище');
break
case 'zamk':
move_to_inside(2601, 'Замковую площадь');
break;
case 'abog':
move_to_inside(2655, 'Арену Богов');
}
if ($_GET['got']) {
can_i_move('got');
break;
case 'torg':
move_to_inside(2702, 'Торговую улицу');
break;
case 'got':
if ($user['room'] == 20) {
if ($_GET['level1']) { header('location: main.php?setch=1'); die(); }
if ($_GET['level13']) { header('location: quest_room.php'); }
if ($_GET['level7']) { header('location: city.php?strah=1'); }
if ($_GET['level8']) { header('location: city.php?bps=1'); }
if ($_GET['level222']) { header('location: city.php?torg=1'); }
if ($_GET['level17']) { move_to_outside(50,'ashop.php'); }
if ($_GET['level2']) { move_to_outside(22, 'shop.php'); }
if ($_GET['level4']) { move_to_outside(23, 'repair.php'); }
if ($_GET['level10']) { move_to_outside(35, 'krshop.php'); }
if ($_GET['level9']) { move_to_outside(24, 'elka.php'); }
if ($_GET['level6']) { move_to_outside(27, 'post.php'); }
if ($_GET['level3']) { move_to_outside(26, 'comission.php'); }
switch ($location[1]) {
case 'level1':
header('location: main.php?setch=1');
die();
break;
case 'level7':
header('location: city.php?strah');
break;
case 'level8':
header('location: city.php?bps');
break;
case 'level13':
header('location: quest_room.php');
break;
case 'level222':
header('location: city.php?torg');
break;
case 'level17':
move_to_outside(50, 'ashop.php');
break;
case 'level2':
move_to_outside(22, 'shop.php');
break;
case 'level4':
move_to_outside(23, 'repair.php');
break;
case 'level10':
move_to_outside(35, 'krshop.php');
break;
case 'level9':
move_to_outside(24, 'elka.php');
break;
case 'level6':
move_to_outside(27, 'post.php');
break;
case 'level3':
move_to_outside(26, 'comission.php');
break;
}
elseif ($user['room'] == 21) {
if ($_GET['level4']) { header('location: city.php?cp=1'); }
if ($_GET['level3']) { header('location: city.php?zaliv=1'); }
if ($_GET['level13']) { move_to_outside(34, 'fshop.php'); }
if ($_GET['level5']) { move_to_outside(29, 'bank.php'); }
if ($_GET['level16']) { move_to_outside(31, 'tower.php'); }
if ($_GET['level14']) { move_to_outside(30, 'klanedit.php'); }
if ($_GET['level650']) { move_to_outside(650, 'ul_clans.php'); }
} elseif ($user['room'] == 21) {
switch ($location[1]) {
case 'level4':
header('location: city.php?cp');
break;
case 'level3':
header('location: city.php?zaliv');
break;
case 'level13':
move_to_outside(34, 'fshop.php');
break;
case 'level5':
move_to_outside(29, 'bank.php');
break;
case 'level16':
move_to_outside(31, 'tower.php');
break;
case 'level14':
move_to_outside(30, 'klanedit.php');
break;
case 'level650':
move_to_outside(650, 'ul_clans.php');
break;
}
elseif ($user['room'] == 2111) {
if ($_GET['level1']) { header('location: city.php?strah=1'); }
if ($_GET['level2']) { header('location: city.php?haos=1'); }
if ($_GET['level203']) { move_to_outside(1055, 'group_arena.php'); }
if ($_GET['level1000']) { move_to_outside(620, 'enter_cave.php'); }
if ($_GET['room666']) { move_to_outside(666, 'jail.php'); }
if ($_GET['level5']) { move_to_outside(203, 'church.php'); }
} elseif ($user['room'] == 2111) {
switch ($location[1]) {
case 'level1':
header('location: city.php?strah');
break;
case 'level2':
header('location: city.php?haos');
break;
case 'level203':
move_to_outside(1055, 'group_arena.php');
break;
case 'level1000':
move_to_outside(620, 'enter_cave.php');
break;
case 'room666':
move_to_outside(666, 'jail.php');
break;
case 'level5':
move_to_outside(203, 'church.php');
break;
}
elseif ($user['room'] == 2601) {
if ($_GET['level4']) { header('location: city.php?bps=1'); }
if ($_GET['level55']) { header('location: city.php?abog=1'); }
if ($_GET['level21']) { move_to_outside(87, 'dshop.php'); }
if ($_GET['level10']) { move_to_outside(35, 'krshop.php'); }
if ($_GET['level44']) { move_to_outside(203, 'church.php'); } /*FIXME Второй вход в церковь?*/
if ($_GET['level1']) { move_to_outside(37, 'gotzamok.php'); }
if ($_GET['level1052']) { move_to_outside(1053, 'repshop.php'); }
if ($_GET['level1051']) { move_to_outside(1051, 'lab_enter.php'); }
if ($_GET['level5']) { move_to_outside(404, 'vxod.php'); }
} elseif ($user['room'] == 2601) {
switch ($location[1]) {
case 'level4':
header('location: city.php?bps');
break;
case 'level55':
header('location: city.php?abog');
break;
case 'level21':
move_to_outside(87, 'dshop.php');
break;
case 'level10':
move_to_outside(35, 'krshop.php');
break;
case 'level44':
move_to_outside(203, 'church.php');
break; /*FIXME Второй вход в церковь?*/
case 'level1':
move_to_outside(37, 'gotzamok.php');
break;
case 'level1052':
move_to_outside(1053, 'repshop.php');
break;
case 'level1051':
move_to_outside(1051, 'lab_enter.php');
break;
case 'level5':
move_to_outside(404, 'vxod.php');
break;
}
elseif ($user['room'] == 2701) {
if ($_GET['level1']) { header('location: city.php?zaliv=1'); }
if ($_GET['level2']) { move_to_outside(402, 'lab_chaos_enter.php'); }
} elseif ($user['room'] == 2701) {
switch ($location[1]) {
case 'level1':
header('location: city.php?zaliv');
break;
case 'level2':
move_to_outside(402, 'lab_chaos_enter.php');
break;
}
elseif ($user['room'] == 2702) {
if ($_GET['level10']) { header('location: city.php?cp=1'); }
if ($_GET['level5'] || $_GET['level202']) { move_to_outside(1054, 'fontan_luck.php'); }
if ($_GET['level6']) { move_to_outside(61, 'akadem.php'); }
} elseif ($user['room'] == 2702) {
switch ($location[1]) {
case 'level10':
header('location: city.php?cp');
break;
case 'level5':
move_to_outside(1054, 'fontan_luck.php');
break;
case 'level202':
move_to_outside(1054, 'fontan_luck.php');
break;
case 'level6':
move_to_outside(61, 'akadem.php');
break;
}
elseif ($user['room'] == 2655) {
if ($_GET['level10']) { header('location: city.php?zamk=1'); }
if ($_GET['level2055']) { move_to_outside(603, 'aren_of_angels.php'); }
} elseif ($user['room'] == 2655) {
switch ($location[1]) {
case 'level10':
header('location: city.php?zamk');
break;
case 'level2055':
move_to_outside(603, 'aren_of_angels.php');
break;
}
elseif ($user['room'] == 26) {
if ($_GET['level4']) {header('location: city.php?cp=1');}
if ($_GET['level3']) {header('location: city.php?zamk=1');}
if ($_GET['level5']) {move_to_outside(43, 'znahar.php');}
if ($_GET['level660']) {move_to_outside(660, 'hostel.php');}
if ($_GET['level20']) {move_to_outside(223, 'bench.php');}
if ($_GET['level21']) {move_to_outside(222, 'bench_s.php');}
if ($_GET['level22']) {move_to_outside(224, 'bench_m.php');}
if ($_GET['level7']) {move_to_outside(777, 'obshaga.php');}
if ($_GET['level11']) {move_to_outside(42, 'lotery.php');}
// if ($_GET['level5']) {/*move_to_outside(401, 'hell.php');}
if ($_GET['level6']) {/*move_to_outside(110, 'jackill.php');*/ print "<script>alert('110: Закрыто.')</script>";}
} elseif ($user['room'] == 26) {
switch ($location[1]) {
case 'level4':
header('location: city.php?cp');
break;
case 'level3':
header('location: city.php?zamk');
break;
case 'level5':
move_to_outside(43, 'znahar.php');
break;
case 'level660':
move_to_outside(660, 'hostel.php');
break;
case 'level20':
move_to_outside(223, 'bench.php');
break;
case 'level21':
move_to_outside(222, 'bench_s.php');
break;
case 'level22':
move_to_outside(224, 'bench_m.php');
break;
case 'level7':
move_to_outside(777, 'obshaga.php');
break;
case 'level11':
move_to_outside(42, 'lotery.php');
break;
// case 'level5':
// move_to_outside(401, 'hell.php');
// break;
// case 'level6':
// move_to_outside(110, 'jackill.php');
// break;
}
}
break;
}
$online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60));
?>
@ -221,12 +321,13 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
<script type="text/javascript">
function solo(n) {
top.changeroom = n;
window.location.href = 'city.php?got=1&level' + n + '=1';
window.location.href = 'city.php?got/level' + n;
}
function Down() {
top.CtrlPress = window.event.ctrlKey
}
document.onmousedown = Down;
</script>
</HEAD>
@ -253,8 +354,10 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
if (!$noSeason) $img = getSeason() . $img;
?>
<div style="position:absolute; left:<?= $left ?>px; top:<?= $top ?>px; z-index:90;">
<img src="i/city/sub/<?=$img?>.png" alt="<?=$des?>" title="<?=$des?>" class="aFilter2" id="<?=$id?>"
onmouseover="this.src='i/city/sub/<?=$img?>2.png'" onmouseout="this.src='i/city/sub/<?=$img?>.png'" onclick="solo(<?=$id?>)" />
<img src="i/city/sub/<?= $img ?>.png" alt="<?= $des ?>" title="<?= $des ?>" class="aFilter2"
id="<?= $id ?>"
onmouseover="this.src='i/city/sub/<?= $img ?>2.png'"
onmouseout="this.src='i/city/sub/<?= $img ?>.png'" onclick="solo(<?= $id ?>)"/>
</div>
<?php
}
@ -288,8 +391,7 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
buildset(9, "tree2", 260, 530, "Новогодняя елка");
buildset(14, "sneg_3", 210, 390, "Снеговик");
echo "</div>";
}
elseif ($user['room'] == 21) {
} elseif ($user['room'] == 21) {
bgset('cap_strash');
buildset(5, "cap_bank", 180, 485, "Банк");;
buildset(14, "cap_registratura", 170, 113, "Регистратура кланов");
@ -299,8 +401,7 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
buildset(13, "cap_flowershop", 220, 613, "Цветочный магазин");
buildset(4, "cap_arr_left", 258, 21, "Центральная площадь", 1);
echo "</div>";
}
elseif ($user['room'] == 26) {
} elseif ($user['room'] == 26) {
bgset('cap_park');
buildset(6, "cap_gate", 170, 340, "Городские ворота");
buildset(660, "cap_vokzal", 163, 43, "Общежитие");
@ -311,8 +412,7 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
buildset(3, "cap_arr_left", 259, 27, "Замковая площадь", 1);
buildset(4, "cap_arr_right", 259, 715, "Центральная площадь", 1);
echo "</div>";
}
elseif ($user['room'] == 2601) {
} elseif ($user['room'] == 2601) {
bgset('cap_zamk');
buildset(1052, "cap_lavka", 240, 425, "Храмовая лавка");
buildset(10, "ava_post", 240, 300, "Сувенирный магазинчик");
@ -322,15 +422,13 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
buildset(55, "cap_arr_left", 258, 21, "Арена Богов", 1);
buildset(4, "arr_right_png", 260, 710, "Большая парковая улица", 1);
echo "</div>";
}
elseif ($user['room'] == 2655) {
} elseif ($user['room'] == 2655) {
bgset('ar_e_n');
buildset(2055, "altr_g", 230, 340, "Арена Ангелов");
buildset(2222, "cap_stop", 258, 21, "Проход закрыт", 1);
buildset(10, "arr_right_png", 260, 710, "Замковая площадь", 1);
echo "</div>";
}
elseif ($user['room'] == 2111) {
} elseif ($user['room'] == 2111) {
bgset('rist_bg');
buildset(1, "cap_arr_uleft", 240, 30, "Страшилкина Улица", 1);
buildset(2, "cap_arr_right", 245, 708, "Секретный Лабиринт", 1);
@ -340,15 +438,13 @@ $online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time
buildset(203, "cap_rist_monstr", 145, 570, "Вход в Груповые сражения");
buildset(21, "angelscastle", 131, 628, "Замок Мэра Города");
echo "</div>";
}
elseif ($user['room'] == 2701) {
} elseif ($user['room'] == 2701) {
bgset('arena_bg1');
buildset(1, "3strelka", 260, 30, "Берег Залива");
buildset(2, "shar_dark", 234, 356, "Лабиринт Хаоса");
buildset(3, "stop_png", 260, 720, "Проход закрыт");
echo "</div>";
}
elseif ($user['room'] == 2702) {
} elseif ($user['room'] == 2702) {
bgset('cap_torg');
buildset(6, "cap_arenda", 175, 70, "Академия");
buildset(202, "cap_fontan", 210, 350, "Фонтан удачи");