info['admin']) { die(''); } if (isset($_GET['id'])) { $_POST['id'] = (int)$_GET['id']; } if (isset($_POST['id_dng'])) { $id = (int)$_POST['id_dng']; if ($id > 0) { $test_id = mysql_fetch_array( mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string($id) . '" LIMIT 1') ); if (!isset($test_id['id'])) { unset($test_id); } } else { $id = 0; } } elseif (isset($_POST['id'])) { $id = (int)$_POST['id']; if ($id > 0) { $test_id = mysql_fetch_array( mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string($id) . '" LIMIT 1') ); if (!isset($test_id['id'])) { unset($test_id); } } else { $id = 0; } } $u->info['psevdo_x'] = 0; $u->info['psevdo_y'] = 0; $u->info['psevdo_s'] = 1; if (isset($_POST['x'])) { $u->info['psevdo_x'] = (int)$_POST['x']; $u->info['psevdo_y'] = (int)$_POST['y']; $u->info['psevdo_s'] = (int)$_POST['s']; } if (isset($_GET['x'])) { $u->info['psevdo_x'] = (int)$_GET['x']; $u->info['psevdo_y'] = (int)$_GET['y']; $u->info['psevdo_s'] = (int)$_GET['s']; } if (isset($_POST['saveObjPosition'])) { echo 'START#'; $_POST['saveObjPosition'] = str_replace('obj_true_', '', $_POST['saveObjPosition']); $_POST['saveObjPosition'] = floor((int)$_POST['saveObjPosition']); $obj = mysql_fetch_array( mysql_query( 'SELECT * FROM `dungeon_obj` WHERE `id` = "' . mysql_real_escape_string( $_POST['saveObjPosition'] ) . '" LIMIT 1' ) ); if (isset($obj['id'])) { $cor = [0, 0]; $data = explode(',', ltrim(rtrim($obj['date'], '\}'), '\{')); $da = []; $i = 0; while ($i < count($data)) { $data[$i] = explode(':', $data[$i]); $da[$data[$i][0]] = $data[$i][1]; echo '[' . $data[$i][0] . ' = ' . $data[$i][1] . ']'; $i++; } $obj['top'] = 0; $obj['left'] = 0; $rs = (int)$_POST['rz']; $da['rt' . $rs] = 0 + $_POST['objy']; $da['rl' . $rs] = 0 + $_POST['objx']; $dak = array_keys($da); $dav = $da; $da = ''; $i = 0; while ($i < count($dak)) { $da .= $dak[$i] . ':' . $dav[$dak[$i]] . ','; $i++; } $da = rtrim($da, ','); $da = '{' . $da . '}'; $upd = mysql_query( 'UPDATE `dungeon_obj` SET `top` = "' . mysql_real_escape_string( $obj['top'] ) . '", `left` = "' . mysql_real_escape_string($obj['left']) . '", `date` = "' . mysql_real_escape_string( $da ) . '" WHERE `id` = "' . $obj['id'] . '" LIMIT 1' ); if ($upd) { echo 'Данные успешно сохранены ' . $da; } else { echo '#!Ошибка'; } } else { echo '#Ошибка'; } die('#END'); } elseif (isset($_POST['ore_id'])) { $id = (int)$_POST['id_dng']; echo '[START# '; $_POST['ore_id'] = floor((int)$_POST['ore_id']); $obj = mysql_fetch_array( mysql_query( 'SELECT * FROM `dungeon_obj` WHERE `id` = "' . mysql_real_escape_string($_POST['ore_id']) . '" LIMIT 1' ) ); if (isset($obj['id'])) { mysql_query( 'UPDATE `dungeon_obj` SET `name` = "' . mysql_real_escape_string($_POST['ore_name']) . '", `img` = "' . mysql_real_escape_string($_POST['ore_img']) . '", `w` = "' . mysql_real_escape_string($_POST['ore_w']) . '", `h` = "' . mysql_real_escape_string($_POST['ore_h']) . '", `x` = "' . mysql_real_escape_string($_POST['ore_x']) . '", `y` = "' . mysql_real_escape_string($_POST['ore_y']) . '", `type2` = "' . mysql_real_escape_string($_POST['ore_type2']) . '", `s` = "' . mysql_real_escape_string($_POST['ore_s']) . '", `s2` = "' . mysql_real_escape_string($_POST['ore_s2']) . '", `os1` = "' . mysql_real_escape_string($_POST['ore_os1']) . '", `os2` = "' . mysql_real_escape_string($_POST['ore_os2']) . '", `os3` = "' . mysql_real_escape_string($_POST['ore_os3']) . '", `os4` = "' . mysql_real_escape_string($_POST['ore_os4']) . '", `fix_x_y` = "' . mysql_real_escape_string($_POST['ore_fix_x_y']) . '", `type` = "' . mysql_real_escape_string($_POST['ore_type']) . '" WHERE `id` = "' . $obj['id'] . '" LIMIT 1 ' ); echo 'Данные сохранены'; } else { if (isset($_POST['ore_img'])) { echo 'Объект создан'; if (mysql_query( 'INSERT INTO `dungeon_obj` (`for_dn`,`name`,`img`,`w`,`h`,`x`,`y`,`type2`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`fix_x_y`,`type`,`date`) VALUES ( "' . mysql_real_escape_string($id) . '", "' . mysql_real_escape_string($_POST['ore_name']) . '", "' . mysql_real_escape_string($_POST['ore_img']) . '", "' . mysql_real_escape_string($_POST['ore_w']) . '", "' . mysql_real_escape_string($_POST['ore_h']) . '", "' . mysql_real_escape_string($_POST['ore_x']) . '", "' . mysql_real_escape_string($_POST['ore_y']) . '", "' . mysql_real_escape_string($_POST['ore_type2']) . '", "' . mysql_real_escape_string($_POST['ore_s']) . '", "' . mysql_real_escape_string($_POST['ore_s2']) . '", "' . mysql_real_escape_string($_POST['ore_os1']) . '", "' . mysql_real_escape_string($_POST['ore_os2']) . '", "' . mysql_real_escape_string($_POST['ore_os3']) . '", "' . mysql_real_escape_string($_POST['ore_os4']) . '", "' . mysql_real_escape_string($_POST['ore_fix_x_y']) . '", "' . mysql_real_escape_string($_POST['ore_type']) . '", "{use:\'takeit\'}" )' )) { echo '+'; } else { echo '-'; } } } die(' #END]'); } elseif (isset($_POST['ore_delete_id'])) { mysql_query( 'UPDATE `dungeon_obj` SET `delete` = "' . $u->info['id'] . '",`for_dn` = "' . time( ) . '" WHERE `id` = "' . mysql_real_escape_string($_POST['ore_delete_id']) . '" LIMIT 1' ); die('[START# Объект удален #END]'); } if ($id > 0) { //работа с пещерой $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) ]; $d = new DungeonEditor(); $d->start(); $d->point = mysql_fetch_array( mysql_query( 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $d->info['id2'] . '" AND `x` = "' . $u->info['x'] . '" AND `y` ="' . $u->info['y'] . '" LIMIT 1' ) ); if (!isset($d->point['id'])) { $d->point['css'] = 'css'; } } if (!isset($_GET['look'])) { ?> Визуальный редактор Лабиринтов © new-combats.com '; }else{ ?> function genMap() { var 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++; } var 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, i) + m.innerHTML; } } i++; } var i = 5; while (i >= 1) { if (zfloor0[i] != '') { document.getElementById('Floor0').innerHTML += zfloor0[i]; } i--; } } var dConfig = { 2: { 1: {'top': 50, 'left': 140, 'w': 80, 'h': 147}, 2: {'top': 45, 'left': 87, 'w': 80, 'h': 147}, 3: {'top': 45, 'left': 192, 'w': 80, 'h': 147}, 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, iii) { var r = ''; //355*245 window 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 (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]; } } ////i:{0:id,1:name,2:mapPoint,3:action,4:img,5:type}, 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 = 'location=\'main.php?take_obj=' + v[0] + '&rnd=' + 0.28626200682069150 + '\';'; } } zfloor0[rz] = '' + zfloor0[rz]; } else { zfloor0[rz] = '' + zfloor0[rz]; } r = ''; } 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' || 0 > 0) { action = 'dialogMenu(' + v[0] + ',1,' + v[7] + ',0,0,event);'; } zfloor0[rz] += ''; } else { zfloor0[rz] += ''; } r = ''; } return r; } 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 = 'main.php?go=' + id; } else { gotoup777 = id; gotext777 = ttl; } } 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 = "main.php?go=" + gotoup777; } } if (gotoup777 > 0 && gotext777 != '' && document.getElementById('gotext777').innerHTML != 'Вы перейдете ' + gotext777 + ' (отмена)') { //document.getElementById('gotext777').style.display = 'block'; document.getElementById('gotext777').innerHTML = 'Вы перейдете ' + gotext777 + ' (отмена)'; } else if (document.getElementById('gotext777').innerHTML != '' && gotoup777 == 0 && gotext777 == '') { //document.getElementById('gotext777').style.display = 'none'; document.getElementById('gotext777').innerHTML = ''; } } }
  Пещера#  
Редактировать ботов
info['admin'] == 0){ ?>




Пещера не существует
'; } else { //Пещера существует $min_x = mysql_fetch_array( mysql_query( 'SELECT `x` FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( $id ) . '" ORDER BY `x` ASC LIMIT 1' ) ); $max_x = mysql_fetch_array( mysql_query( 'SELECT `x` FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( $id ) . '" ORDER BY `x` DESC LIMIT 1' ) ); $min_y = mysql_fetch_array( mysql_query( 'SELECT `y` FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( $id ) . '" ORDER BY `y` ASC LIMIT 1' ) ); $max_y = mysql_fetch_array( mysql_query( 'SELECT `y` FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( $id ) . '" ORDER BY `y` DESC LIMIT 1' ) ); $min_x = $min_x[0]; $max_x = $max_x[0]; $min_y = $min_y[0]; $max_y = $max_y[0]; $map = []; $stl = []; $sp = mysql_query( 'SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . mysql_real_escape_string( $id ) . '" AND `x` >= ' . $min_x . ' AND `x` <= ' . $max_x . ' AND `y` >= ' . $min_y . ' AND `y` <= ' . $max_y . '' ); while ($pl = mysql_fetch_array($sp)) { $style = 'vertical-align:bottom;'; if ($pl['st'][2] == 1) { $style .= 'border-bottom:1px solid #6e6e6e;'; } else { $style .= 'padding-bottom:1px;'; } if ($pl['st'][1] == 1) { $style .= 'border-left:1px solid #6e6e6e;'; } else { $style .= 'padding-left:1px;'; } if ($pl['st'][0] == 1) { $style .= 'border-top:1px solid #6e6e6e;'; } else { $style .= 'padding-top:1px;'; } if ($pl['st'][3] == 1) { $style .= 'border-right:1px solid #6e6e6e;'; } else { $style .= 'padding-right:1px;'; } $map[$pl['x']][$pl['y']] = ''; } echo '
Карта пещеры (X: [' . $min_x . '] - [' . $max_x . '] , Y: [' . $min_y . '] - [' . $max_y . '])


'; $r = ''; $i = $max_y; while ($i >= $min_y) { $j = $min_x; $r .= ''; while ($j <= $max_x) { if (isset($map[$j][$i])) { $r .= ''; } else { $r .= ''; } $j++; } $r .= ''; $i--; } $r .= '
' . $map[$j][$i] . '
'; echo $r; } ?>