room['file'] == 'enterdrago') {
if (isset($_GET['rz'])) {
$roomSection = 1;
} // Получаем Задание
else {
$roomSection = 0;
} // Собираем группу для похода
$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 FROM `dungeon_room` WHERE `id`="' . $u->room['id'] . '" LIMIT 1')
);
//var_info($dungeon);
$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);
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');
$u->info['dn'] = 0;
}
}
$dungeon_timeout = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "psh' . $dungeon['id'] . '" AND `time` > ' . (time() - 60 * 60 * 20) . ' LIMIT 1', 1);
if (isset($dungeon_timeout['id'])) // Кто-то передумал и не пойдет в пещеру, так-как уже там был.
{
$dungeonGo = 0;
if (isset($_GET['start'])) {
$error = 'До следующего похода осталось еще: ' . Conversion::secondsToTimeout(60 * 60 * 20 - time() + $dungeon_timeout['time']);
}
}
if (isset($_GET['start']) && $zv['uid'] == $u->info['id'] && $dungeonGo == 1) { //начинаем поход
//Генирируем случайный поход
//$level = $u->info['level'];
if ($zv['type'] == 0) {
$level = 5;
} elseif ($zv['type'] == 1) {
$level = 8;
} elseif ($zv['type'] == 2) {
$level = 10;
}
$k = floor(2.5 * $level); // k=maze size
$s = $k * 2 + 3; // s=array size
$r = 10; // r=cell size (in pixels)
$count = 1; // count=cells visited.
$a = []; // A [Row][Col] array of cells (0=open, 1=filled) of the maze.
for ($y = 0; $y < $s; $y++) { // Initialize array to all 1 (green).
for ($x = 0; $x < $s; $x++) {
$a[$y][$x] = 1;
}
}
for ($x = 0; $x < $s; $x++) { // Clear rim to 0, to serve as a barricade.
$a[0][$x] = 0;
$a[$s - 1][$x] = 0;
$a[$x][0] = 0;
$a[$x][$s - 1] = 0;
}
$x = $y = ($k - 1) >> 1;
$a[$y * 2 + 2][$x * 2 + 2] = 0; // start from center
while (1) { // Open paths for k^2 cells.
do { // Dig as far as possible until we reach a cul-de-sac.
$d = rand(0, 3); // Pick initial direction raqndomly.
for ($i = 0; $i < 4; $i++) { // Look for a good direction.
if ($d == 0 && $a[$y * 2 + 2][$x * 2 + 4]) { // right
$a[$y * 2 + 2][$x++ * 2 + 3] = 0;
$a[$y * 2 + 2][$x * 2 + 2] = 0;
$i = 5;
$count++;
break; // found
} elseif ($d == 1 && $a[$y * 2][$x * 2 + 2]) { // up
$a[$y-- * 2 + 1][$x * 2 + 2] = 0;
$a[$y * 2 + 2][$x * 2 + 2] = 0;
$i = 5;
$count++;
break; // found
} elseif ($d == 2 && $a[$y * 2 + 2][$x * 2]) { // left
$a[$y * 2 + 2][$x-- * 2 + 1] = 0;
$a[$y * 2 + 2][$x * 2 + 2] = 0;
$i = 5;
$count++;
break; // found
} elseif ($d == 3 && $a[$y * 2 + 4][$x * 2 + 2]) { // down
$a[$y++ * 2 + 3][$x * 2 + 2] = 0;
$a[$y * 2 + 2][$x * 2 + 2] = 0;
$i = 5;
$count++;
break; // found
}
$d = ($d + 1) % 4; // wrap right->up->left->down->right
} // for
} while ($i != 4); // i=4 means we are stuck
if ($count >= $k * $k) { // Did we visit k^2 cells?
break; // while(1) The entire maze has been created.
}
$x = rand(0, $k - 1);
$y = rand(0, $k - 1); // Pick random cell on maze.
// Scan left-to-right top-to-botton for a dug cell with at least
while ($a[$y * 2 + 2][$x * 2 + 2] || // one expandable neighbor
!$a[$y * 2 + 2][$x * 2 + 4] && !$a[$y * 2][$x * 2 + 2] &&
!$a[$y * 2 + 2][$x * 2] && !$a[$y * 2 + 4][$x * 2 + 2]) {
if (++$x >= $k) { // wrap right edge to left edge
$x = 0;
if (++$y >= $k) { // wrap bottom to top
$y = 0;
}
}
}
} // while(1)
$rnds = [
rand(1, 3), //start
rand(1, 3), //end
];
$srg = [];
$objects = [];
if ($rnds[0] == 1) {
//вход сверху
$a[2][1] = 0;
$a[2][2] = 0;
$srg = [2, 1];
$objects[2][1] = '
';
} elseif ($rnds[0] == 2) {
//вход по центру
$a[$k][1] = 0;
$a[$k][2] = 0;
$srg = [$k, 1];
$objects[$k][1] = '
';
} elseif ($rnds[0] == 3) {
//вход снизу
$a[$k * 2][1] = 0;
$a[$k * 2][2] = 0;
$srg = [$k * 2, 1];
$objects[$k * 2][1] = '
';
}
if ($rnds[1] == 1) {
//вход сверху
$a[2][$k * 2 + 1] = 0;
$a[2][$k * 2] = 0;
$objects[2][$k * 2 + 1] = '
';
} elseif ($rnds[1] == 2) {
//вход по центру
$a[$k][$k * 2 + 1] = 0;
$a[$k][$k * 2] = 0;
$objects[$k][$k * 2 + 1] = '
';
} elseif ($rnds[1] == 3) {
//вход снизу
$a[$k * 2][$k * 2 + 1] = 0;
$a[$k * 2][$k * 2] = 0;
$objects[$k * 2][$k * 2 + 1] = '
';
}
//$a[1][2]=0;
//$a[$k*2+1][$k*2]=0; // Draw entrance and exit.
?>
1 && $j > 1 && $i <= $k * 2 && $j <= $k * 2) {
$map[] = [$i, $j];
}
$j++;
}
$i++;
}
//Раскидываем обьекты (XX %)
/*
$proc1 = 10; //Сколько % занимают сундуки
$proc2 = 15; //Сколько % занимают монстры
$proc3 = 10; //Сколько % занимают хилки
$proc4 = 5; //Сколько % занимают ловушки
$proc5 = 2; //Сколько % занимают пандоры*/
$proc1 = round(1.7 * $level); //Сколько % занимают сундуки
$proc2 = round(2.5 * $level); //Сколько % занимают монстры
$proc3 = round(1.35 * $level); //Сколько % занимают хилки
$proc4 = round(0.5 * $level); //Сколько % занимают ловушки
$proc5 = round(0.1 * $level); //Сколько % занимают пандоры
//
$proc1 = round($proc1 / 2);
$proc1 = round(count($map) / 100 * $proc1);
$proc2 = round($proc2 / 2);
$proc2 = round(count($map) / 100 * $proc2);
$proc3 = round($proc3 / 2);
$proc3 = round(count($map) / 100 * $proc3);
$proc4 = round($proc4 / 2);
$proc4 = round(count($map) / 100 * $proc4);
$proc5 = round($proc5 / 2);
$proc5 = round(count($map) / 100 * $proc5);
//
//if( $u->info['id'] == 1002 ) {
$usi = 0;
//Сохраняем карту
mysql_query(
'INSERT INTO `laba_now` ( `time`,`uid`,`users`,`map_id`,`end`,`type` ) VALUES (
"' . time() . '","' . $u->info['id'] . '","-1","0","0","' . $zv['type'] . '"
)'
);
$ding = mysql_insert_id();
$sp = mysql_query('SELECT `id`,`dn` FROM `stats` WHERE `dn` = "' . $zv['id'] . '" LIMIT 4');
while ($pl = mysql_fetch_array($sp)) {
$u->addAction(time(), 'psh102', '', $pl['id']);
mysql_query('UPDATE `users` SET `room` = "370" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
mysql_query(
'UPDATE `stats` SET `dn` = "0",`dnow` = "' . $ding . '",`x` = "' . $srg[0] . '",`y` = "' . $srg[1] . '",`res_x` = "' . $srg[0] . '",`res_y` = "' . $srg[1] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
$usi++;
}
mysql_query('UPDATE `laba_now` SET `users` = "' . $usi . '" WHERE `id` = "' . $ding . '" LIMIT 1');
mysql_query(
'INSERT INTO `laba_map` ( `id`,`data`,`update` ) VALUES (
"' . $ding . '","' . json_encode($a) . '","' . time() . '"
)'
);
mysql_query('DELETE FROM `dungeon_zv` WHERE `id` = "' . $zv['id'] . '" LIMIT 1');
//}
//
$i = 1;
while ($i <= 5) {
if (${'proc' . $i} > 0) {
$j = 0;
while ($j < ${'proc' . $i}) {
$cord = $map[rand(0, count($map) - 1)];
$obj = '';
if ($i == 1) {
//сундуки
$obj = 'ddp1s';
} elseif ($i == 2) {
//монстры
$obj = 'ddp1m';
} elseif ($i == 3) {
//хилки
$obj = 'ddp1h';
} elseif ($i == 4) {
//ловушки
$obj = 'ddp1l';
} elseif ($i == 5) {
//пандора
$obj = 'ddp1p';
}
$test = mysql_fetch_assoc(
mysql_query(' SELECT id FROM `laba_obj` WHERE `img`="' . $obj . '" AND `x`= "' . $cord[0] . '" AND `y`= "' . $cord[1] . '" AND `lib` = "' . $ding . '" ')
);
if (!isset($test['id'])) {
mysql_query(
'INSERT INTO `laba_obj` ( `lib`,`x`,`y`,`type`,`img`,`name`,`time`,`use` ) VALUES (
"' . $ding . '","' . $cord[0] . '","' . $cord[1] . '","' . $i . '","' . $obj . '","{standart}","' . time() . '","0"
)'
);
$j++;
}
//$objects[$cord[0]][$cord[1]] = $obj;
}
}
$i++;
}
die('');
//Генирация карты
/*
$i = 1;
while( $i < count($a) - 1 ) {
$j = 1;
while( $j < count($a[$i]) - 1 ) {
if( $a[$i][$j] == 0 ) {
echo ''.$objects[$i][$j].'
';
}else{
echo '
';
}
$j++;
}
echo ' ';
$i++;
}
*/
} elseif (isset($_POST['go'], $_POST['goid']) && $dungeonGo == 1) {
if (!isset($zv['id'])) {
$zv = mysql_fetch_array(
mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "' . $u->info['city'] . '" AND `id`="' . mysql_real_escape_string($_POST['goid']) . '" AND `delete` = "0" LIMIT 1')
);
if (isset($zv['id']) && $u->info['dn'] == 0) {
if ($zv['pass'] != '' && $_POST['pass_com'] != $zv['pass']) {
$error = 'Вы ввели неправильный пароль';
} elseif ($u->info['level'] > 3 && $u->info['level'] == $zv['lvlmin']) {
$row = 0;
if (4 > $row) {
$upd = mysql_query('UPDATE `stats` SET `dn` = "' . $zv['id'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
if (!$upd) {
$error = 'Не удалось вступить в эту группу';
unset($zv);
} else {
$u->info['dn'] = $zv['id'];
}
} else {
$error = 'В группе нет места';
unset($zv);
}
} else {
$error = 'Вы не подходите по уровню';
unset($zv);
}
} else {
$error = 'Заявка не найдена';
}
} else {
$error = 'Вы уже находитесь в группе';
}
} elseif (isset($_POST['leave']) && isset($zv['id']) && $dungeonGo == 1) {
if ($zv['uid'] == $u->info['id']) {
//ставим в группу нового руководителя
$ld = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dn` = "' . $zv['id'] . '" AND `id` != "' . $u->info['id'] . '" LIMIT 1'));
if (isset($ld['id'])) {
$zv['uid'] = $ld['id'];
mysql_query('UPDATE `dungeon_zv` SET `uid` = "' . $zv['uid'] . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
$u->info['dn'] = 0;
unset($zv);
} else {
//удаляем группу целиком
mysql_query('UPDATE `dungeon_zv` SET `delete` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
$u->info['dn'] = 0;
unset($zv);
}
} else {
//просто выходим с группы
mysql_query('UPDATE `stats` SET `dn` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
$u->info['dn'] = 0;
unset($zv);
}
} elseif (isset($_POST['add']) && $u->info['level'] > 1 && $dungeonGo == 1) {
if ($u->info['dn'] == 0) {
if ($_POST['type_gors'] == 1) {
$_POST['type_gors'] = 1;
} elseif ($_POST['type_gors'] == 2) {
$_POST['type_gors'] = 2;
} else {
$_POST['type_gors'] = 0;
}
if ($_POST['type_gors'] == 2 && ($u->info['level'] < 9 || $u->rep['rep3'] < 20000)) {
$error = 'Создавать турниры для Легендарных могут персонажи страше 8-го уровня Так-же у персонажа должно быть более 20000 воинственности!';
} elseif ($_POST['type_gors'] == 1 && $u->info['level'] < 8) {
$error = 'Создавать турниры для Опытных могут персонажи страше 7-го уровня';
} elseif ($_POST['type_gors'] == 0 && $u->info['level'] > 7) {
$error = 'Создавать турниры для Новичков могут персонажи младше 8-го уровня';
} else {
$ins = mysql_query(
'INSERT INTO `dungeon_zv`
(`city`,`time`,`uid`,`dun`,`pass`,`com`,`lvlmin`,`lvlmax`,`team_max`,`type`) VALUES
("' . $u->info['city'] . '","' . time() . '","' . $u->info['id'] . '","' . $dungeon['id'] . '",
"' . mysql_real_escape_string($_POST['pass']) . '",
"' . mysql_real_escape_string($_POST['text']) . '",
"' . $u->info['level'] . '",
"21",
"5",
"' . mysql_real_escape_string($_POST['type_gors']) . '")'
);
if ($ins) {
$u->info['dn'] = mysql_insert_id();
$zv['id'] = $u->info['dn'];
$zv['uid'] = $u->info['id'];
mysql_query('UPDATE `stats` SET `dn` = "' . $u->info['dn'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
$error = 'Вы успешно создали группу';
} else {
$error = 'Не удалось создать группу';
}
}
} else {
$error = 'Вы уже находитесь в группе';
}
}
//Генерируем список групп
$pltype = [
0 => 'Новичок',
1 => 'Опытный',
2 => 'Старый',
];
$sp = mysql_query(
'SELECT * FROM `dungeon_zv` WHERE `city` = "' . $u->info['city'] . '" AND `lvlmin` = "' . $u->info['level'] . '" AND `dun` = "' . $dungeon['id'] . '" AND `delete` = "0" AND `time` > "' . (time(
) - 60 * 60 * 2) . '"'
);
while ($pl = mysql_fetch_array($sp)) {
$dungeonGroupList .= '';
if ($u->info['dn'] == 0) {
$dungeonGroupList .= '
';
}
$dungeonGroupList .= '
' . date('H:i', $pl['time']) . ' ';
$dungeonGroupList .= 'Тип:
' . $pltype[$pl['type']] . ' | ';
$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) . ''
);
while ($pu = mysql_fetch_array($su)) {
$pus .= '
' . $pu['login'] . ' [' . $pu['level'] . ']
';
$pus .= ', ';
}
$pus = trim($pus, ', ');
$dungeonGroupList .= $pus;
unset($pus);
if ($pl['pass'] != '' && $u->info['dn'] == 0) {
$dungeonGroupList .= '
';
}
if ($pl['com'] != '') {
$dl = '';
// Если модератор, даем возможность удалять комментарий к походу.
$moder = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1'));
if (($moder['boi'] == 1 || $u->info['admin'] > 0) && $pl['dcom'] == 0) {
$dl .= ' (
удалить комментарий )';
if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $u->newAct($_GET['key']) == true) {
mysql_query('UPDATE `dungeon_zv` SET `dcom` = "' . $u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
$pl['dcom'] = $u->info['id'];
}
}
$pl['com'] = htmlspecialchars($pl['com'], null);
if ($pl['dcom'] > 0) {
$dl = '
комментарий удален модератором ';
}
if ($pl['dcom'] > 0) {
if ($moder['boi'] == 1 || $u->info['admin'] > 0) {
$pl['com'] = '
' . $pl['com'] . ' ';
} else {
$pl['com'] = '';
}
}
$dungeonGroupList .= '
| ' . $pl['com'] . '' . $dl . ' ';
}
$dungeonGroupList .= '
';
}
?>
error != '') {
echo '' . $u->error . ' ';
} elseif ($re != '') {
echo '' . $re . ' ';
}
?>
= $u->room['name']; ?>
Если вы не найдете выход из пещеры, то любые найденные вами ресурсы (даже в предыдущих походах) - исчезнут. То же самое, если вы умрёте 3 раза.
' . $error . ' ';
}
//отображаем
if ($dungeonGroupList == '') {
$dungeonGroupList = '';
} else {
if (!isset($zv['id']) || $u->info['dn'] == 0) {
if ($dungeonGo == 1 || $u->info['dn'] == 0) {
$pr = ' ';
}
$dungeonGroupList = '';
}
$dungeonGroupList .= ' ';
}
if ($roomSection == 0) {
echo $dungeonGroupList;
}
if ($roomSection == 1) {
?>
rep['add_stats'] * 100);
$cur_price = ['price' => 0];
if (25 - $u->rep['add_stats'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Характеристики!
foreach ($dungeon['list'] as $key => $val) {
if (!($cur_price['price'] >= $price)) {
if ($u->rep['rep' . $val] - $u->rep['nu_' . $val] > $price) {
$cur_price['price'] = $price;
$cur_price['nu_' . $val] = $price;
} elseif ($u->rep['rep' . $val] - $u->rep['nu_' . $val] < $price) {
$cur_price['price'] += $cur = ($price > ($cur_price['price'] + ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) ? ($u->rep['rep' . $val] - $u->rep['nu_' . $val]) : (($u->rep['rep' . $val] - $u->rep['nu_' . $val]) - ((($price - $cur_price['price']) - ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) * -1)));
$cur_price['nu_' . $val] = $cur;
}
}
}
if ($price == $cur_price['price']) {
foreach ($dungeon['list'] as $key => $val) {
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 ($rt == 1) {
$u->info['ability'] += 1;
$u->rep['add_stats'] += 1;
mysql_query('UPDATE `rep` SET `add_stats` = "' . $u->rep['add_stats'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `ability` = "' . $u->info['ability'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
echo '
Вы успешно приобрели 1 способность за ' . $price . ' ед. награды ';
} else {
echo '
Ничего не получилось... ';
}
} else {
echo 'Недостаточно репутации.';
}
} else {
echo '
Ничего не получилось... ';
}
} elseif ($_GET['buy1'] == 2) { // Умения!
$price = 2000 + (2000 * $u->rep['add_skills']);
$cur_price = ['price' => 0];
if (10 - $u->rep['add_skills'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Умения!
foreach ($dungeon['list'] as $key => $val) {
if (!($cur_price['price'] >= $price)) {
if ($u->rep['rep' . $val] - $u->rep['nu_' . $val] > $price) {
$cur_price['price'] = $price;
$cur_price['nu_' . $val] = $price;
} elseif ($u->rep['rep' . $val] - $u->rep['nu_' . $val] < $price) {
$cur_price['price'] += $cur = ($price > ($cur_price['price'] + ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) ? ($u->rep['rep' . $val] - $u->rep['nu_' . $val]) : (($u->rep['rep' . $val] - $u->rep['nu_' . $val]) - ((($price - $cur_price['price']) - ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) * -1)));
$cur_price['nu_' . $val] = $cur;
}
}
}
if ($price == $cur_price['price']) {
foreach ($dungeon['list'] as $key => $val) {
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 ($rt == 1) {
$u->info['skills'] += 1;
$u->rep['add_skills'] += 1;
mysql_query('UPDATE `rep` SET `add_skills` = "' . $u->rep['add_skills'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `skills` = "' . $u->info['skills'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
echo '
Вы успешно приобрели 1 умение за ' . $price . ' ед. награды ';
} else {
echo '
Ничего не получилось... ';
}
} else {
echo 'Недостаточно репутации.';
}
} else {
echo '
Ничего не получилось... ';
}
} elseif ($_GET['buy1'] == 3) { // Кредиты
$price = 100;
$cur_price = ['price' => 0];
if ($u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Покупаем кредиты
foreach ($dungeon['list'] as $key => $val) {
if (!($cur_price['price'] >= $price)) {
if ($u->rep['rep' . $val] - $u->rep['nu_' . $val] > $price) {
$cur_price['price'] = $price;
$cur_price['nu_' . $val] = $price;
} elseif ($u->rep['rep' . $val] - $u->rep['nu_' . $val] < $price) {
$cur_price['price'] += $cur = ($price > ($cur_price['price'] + ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) ? ($u->rep['rep' . $val] - $u->rep['nu_' . $val]) : (($u->rep['rep' . $val] - $u->rep['nu_' . $val]) - ((($price - $cur_price['price']) - ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) * -1)));
$cur_price['nu_' . $val] = $cur;
}
}
}
if ($price == $cur_price['price']) {
foreach ($dungeon['list'] as $key => $val) {
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 ($rt == 1) {
$u->info['money'] += 10;
$u->rep['add_money'] += 10;
mysql_query('UPDATE `rep` SET `add_money` = "' . $u->rep['add_money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
echo '
Вы успешно приобрели 10 кр. за ' . $price . ' ед. награды ';
} else {
echo '
Ничего не получилось... ';
}
} else {
echo 'Недостаточно репутации.';
}
} else {
echo '
Ничего не получилось... ';
}
} elseif ($_GET['buy1'] == 4) { // Особенности
$price = 3000;
$cur_price = ['price' => 0];
if (5 - $u->rep['add_skills2'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Особенности
foreach ($dungeon['list'] as $key => $val) {
if (!($cur_price['price'] >= $price)) {
if ($u->rep['rep' . $val] - $u->rep['nu_' . $val] > $price) {
$cur_price['price'] = $price;
$cur_price['nu_' . $val] = $price;
} elseif ($u->rep['rep' . $val] - $u->rep['nu_' . $val] < $price) {
$cur_price['price'] += $cur = ($price > ($cur_price['price'] + ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) ? ($u->rep['rep' . $val] - $u->rep['nu_' . $val]) : (($u->rep['rep' . $val] - $u->rep['nu_' . $val]) - ((($price - $cur_price['price']) - ($u->rep['rep' . $val] - $u->rep['nu_' . $val])) * -1)));
$cur_price['nu_' . $val] = $cur;
}
}
}
if ($price == $cur_price['price']) {
foreach ($dungeon['list'] as $key => $val) {
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 ($rt == 1) {
$u->info['sskills'] += 1;
$u->rep['add_skills2'] += 1;
mysql_query('UPDATE `rep` SET `add_skills2` = "' . $u->rep['add_skills2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `sskills` = "' . $u->info['sskills'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
echo '
Вы успешно приобрели 1 особенность за ' . $price . ' ед. награды ';
} else {
echo '
Ничего не получилось... ';
}
} else {
echo 'Недостаточно репутации.';
}
} else {
echo '
Ничего не получилось... ';
}
}
}
?>
Награда: = ($u->rep['allrep'] - $u->rep['allnurep']) ?> ед.
info['id'] . '" LIMIT 1000'
)
);
if (isset($_GET['buy777']) && $chk[0] > 0) {
$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++;
$prc += $chk_pl['price1'];
}
}
$u->info['money'] += $prc;
mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
echo 'Вы успешно сдали чеки в количестве ' . $x . ' шт. на сумму ' . $prc . ' кр. ';
$chk[0] = 0;
}
if ($chk[0] > 0) {
?>
Репутация в Dragons city:
= $u->rep['repdragonscity'] ?> ед.
Репутация в Capital city:
= $u->rep['repcapitalcity'] ?> ед.
Репутация в Demons city:
= $u->rep['repdemonscity'] ?> ед.
Репутация в Angels city:
= $u->rep['repangelscity'] ?> ед.
Текущая репутация:
info['dn'] == 0) {
?>
info['id']) {
$psh_start = ' ';
}
echo ' ';
}
}
} else {
echo 'Поход в пещеры разрешен один раз в двадцать часов. Осталось еще: ' . Conversion::secondsToTimeout(
60 * 60 * 20 - time() + $dungeon_timeout['time']
) . 'Но Вы всегда можете приобрести ключ от прохода у любого "копателя пещер" в Торговом зале ;) ';
}
}
}