1089 lines
63 KiB
PHP
1089 lines
63 KiB
PHP
<?php
|
||
|
||
use Core\Config;
|
||
use Core\Db;
|
||
use Helper\Conversion;
|
||
use User\StatsModel;
|
||
|
||
if (!defined('GAME')) {
|
||
die();
|
||
}
|
||
|
||
if ($u->room['file'] != 'dungeon_enter_all') {
|
||
return;
|
||
}
|
||
$error = ''; // Собираем ошибки.
|
||
$dungeonGroupList = ''; // Сюда помещаем список Групп.
|
||
$dungeonGo = 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', 'Пещера Тысячи Проклятий'],
|
||
3 => ['demonscity', 'Катакомбы'],
|
||
101 => ['angelscity', 'Бездна'],
|
||
16 => ['sandcity', 'Пещеры Мглы'],
|
||
9 => ['emeraldscity', 'Потерянный вход'], //108
|
||
10 => ['suncity', 'Грибница'],
|
||
1 => ['dreamscity', 'Водосток'],
|
||
13 => ['abandonedplain', 'Гора Легиона'],
|
||
31 => ['devilscity', 'Туманные Низины'],
|
||
109 => ['izlom16', 'Излом Хаоса'],
|
||
444 => ['eastcity', 'Тропа Инквизиции'],
|
||
|
||
];
|
||
if ($u->isAdmin()) {
|
||
$dunname[999] = ['capitalcity', 'Тестовая локация'];
|
||
}
|
||
|
||
$roomSection = isset($_GET['rz']) ? 1 : 0;
|
||
// Собираем группу для похода
|
||
|
||
// Для названий репутаций в переменных $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 = 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;
|
||
}
|
||
}
|
||
|
||
$dungeon_timeout = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "psh0" AND `time` > ' . (time() - 60 * 60 * 2) . ' LIMIT 1', 1);
|
||
|
||
if ($u->isAdmin()) {
|
||
unset($dungeon_timeout);
|
||
} // $dungeon_timeout - задержка на посещение пещеры.
|
||
if (isset($dungeon_timeout['id'])) { // Кто-то передумал и не пойдет в пещеру, так-как уже там был.
|
||
$dungeonGo = 0;
|
||
if (isset($_GET['start'])) {
|
||
$error = 'До следующего похода осталось еще: ' . Conversion::secondsToTimeout(60 * 60 * 2 - time() + $dungeon_timeout['time']);
|
||
}
|
||
}
|
||
|
||
if (isset($_GET['start']) && $zv['uid'] == $u->info['id'] && $dungeonGo == 1) {
|
||
//перемещаем игроков в пещеру
|
||
$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();
|
||
|
||
Db::sql('delete from dungeon_zv where id = ?', [$zv['id']]);
|
||
//обновляем пользователей
|
||
$uids = Db::getColumn('select id from stats where dn = ?', [$zv['id']]);
|
||
|
||
$map_locs = [];
|
||
|
||
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'];
|
||
}
|
||
$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 {
|
||
$ml_arr[] = $ml;
|
||
}
|
||
}
|
||
if (empty($ml_arr)) {
|
||
$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++;
|
||
}
|
||
} 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'] . '"
|
||
)'
|
||
);
|
||
}
|
||
}
|
||
$i++;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
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'));
|
||
if (isset($zv['id']) && $u->info['dn'] == 0) {
|
||
if ($zv['pass'] != '' && $_POST['pass_com'] != $zv['pass']) {
|
||
$error = 'Вы ввели неправильный пароль';
|
||
} elseif ($u->info['level'] > 7 && $zv['dun'] != 1) {
|
||
$row = 0;
|
||
if (5 > $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);
|
||
}
|
||
} elseif ($zv['dun'] == 1) {
|
||
//Канализация
|
||
$row_max = 5;
|
||
if ($u->info['level'] == 4) {
|
||
$row_max = 4;
|
||
} elseif ($u->info['level'] == 5) {
|
||
$row_max = 3;
|
||
} elseif ($u->info['level'] == 6) {
|
||
$row_max = 2;
|
||
} elseif ($u->info['level'] >= 7) {
|
||
$row_max = 1;
|
||
}
|
||
$row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dn` = "' . $zv['id'] . '" LIMIT 1'));
|
||
$row1 = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `dn` = "' . $zv['id'] . '" LIMIT 1'));
|
||
$row2 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $row1['id'] . '" LIMIT 1'));
|
||
$row = $row[0];
|
||
if ($row2['level'] != $u->info['level']) {
|
||
$error = 'Вы не подходите по уровню';
|
||
} elseif ($row_max > $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);
|
||
}
|
||
} elseif ($u->info['level'] < 4 && $zv['dun'] == 104) {
|
||
//Шахты
|
||
$row_max = 3;
|
||
if ($u->info['level'] > 3) {
|
||
$row_max = 1;
|
||
}
|
||
$row = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `dn` = "' . $zv['id'] . '" LIMIT 1'));
|
||
$row1 = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `dn` = "' . $zv['id'] . '" LIMIT 1'));
|
||
$row2 = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $row1['id'] . '" LIMIT 1'));
|
||
$row = $row[0];
|
||
if ($row2['level'] != $u->info['level'] && $u->info['level'] > 3) {
|
||
$error = 'Вы не подходите по уровню';
|
||
} elseif ($row_max > $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) {
|
||
$dun5 = $dungeon['id'];
|
||
//
|
||
if (isset($_POST['rpmg1'])) {
|
||
if ($_POST['rpmg1'] == 2) {
|
||
$dun5 = 101; //Бездна
|
||
} elseif ($_POST['rpmg1'] == 8) {
|
||
$dun5 = 12; //ПТП
|
||
} elseif ($_POST['rpmg1'] == 10) {
|
||
$dun5 = 1; //Водосток
|
||
} elseif ($_POST['rpmg1'] == 16) {
|
||
$dun5 = 16; //Пещера Мглы
|
||
} elseif ($_POST['rpmg1'] == 4) {
|
||
$dun5 = 3; //Катакомбы
|
||
} elseif ($_POST['rpmg1'] == 5) {
|
||
$dun5 = 9; //Потерянный вход
|
||
} elseif ($_POST['rpmg1'] == 444) {
|
||
$dun5 = 444; //Тропа Инквизиции
|
||
} elseif ($_POST['rpmg1'] == 6) {
|
||
$dun5 = 10; //Грибница
|
||
} elseif ($_POST['rpmg1'] == 11) {
|
||
$dun5 = 13; //Гора легиона
|
||
} elseif ($_POST['rpmg1'] == 106) {
|
||
$dun5 = 31; //Низины
|
||
} elseif ($_POST['rpmg1'] == 999) {
|
||
$dun5 = 999; //Тестовая локация
|
||
} elseif ($_POST['rpmg1'] == 9) {
|
||
$dun5 = 9; //Потеряный вход
|
||
} else {
|
||
$dun5 = 12; //ПТП
|
||
}
|
||
} else {
|
||
$dun5 = 12; //ПТП
|
||
}
|
||
//
|
||
$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")'
|
||
);
|
||
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 = 'Вы уже находитесь в группе';
|
||
}
|
||
}
|
||
|
||
//Генерируем список групп
|
||
$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'] . '" />';
|
||
}
|
||
$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) . ''
|
||
);
|
||
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 .= ', ';
|
||
}
|
||
$pus = trim($pus, ', ');
|
||
|
||
$dungeonGroupList .= $pus;
|
||
unset($pus);
|
||
|
||
if ($pl['pass'] != '' && $u->info['dn'] == 0) {
|
||
$dungeonGroupList .= ' <small><input type="password" name="pass_com" value=""></small>';
|
||
}
|
||
|
||
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 .= ' (<a href="?delcom=' . $pl['id'] . '&key=' . $u->info['nextAct'] . '&rnd=' . $code . '">удалить комментарий</a>)';
|
||
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 = ' <font color="grey"><i>комментарий удален модератором</i></font>';
|
||
}
|
||
if ($pl['dcom'] > 0) {
|
||
if ($moder['boi'] == 1 || $u->info['admin'] > 0) {
|
||
$pl['com'] = '<font color="red">' . $pl['com'] . '</font>';
|
||
} else {
|
||
$pl['com'] = '';
|
||
}
|
||
}
|
||
$dungeonGroupList .= '<small> | ' . $pl['com'] . '' . $dl . '</small>';
|
||
}
|
||
$dungeonGroupList .= '</div>';
|
||
}
|
||
|
||
$paths = [];
|
||
|
||
?>
|
||
|
||
<?php if ($roomSection == 0): ?>
|
||
<h3>Вход в подземелье</h3>
|
||
<?php elseif ($roomSection == 1): ?>
|
||
<h3>Рыцарский Магазин</h3>
|
||
<?php endif; ?>
|
||
<?php if ($roomSection == 0): ?>
|
||
<div style="text-align: right;">
|
||
<button onclick="location.href='/main.php?loc=1.180.0.353'" class="btn">
|
||
<img src="<?= Config::img() ?>/i/city/fo11.gif" alt="">
|
||
Излом Хаоса
|
||
</button>
|
||
<button onclick="location.href='/main.php?loc=<?php
|
||
if ($u->info['room'] == 188) {
|
||
echo '1.180.0.4';
|
||
} elseif ($u->info['room'] == 393) {
|
||
echo '1.180.0.2';
|
||
} elseif ($u->info['room'] == 372) {
|
||
echo '1.180.0.323';
|
||
} elseif ($u->info['room'] == 395) {
|
||
echo '2.180.0.231';
|
||
} elseif ($u->info['room'] == 397) {
|
||
echo '2.180.0.229';
|
||
} elseif ($u->info['room'] == 242) {
|
||
echo '2.180.0.236';
|
||
} elseif ($u->info['room'] == 321) {
|
||
echo '1.180.0.9';
|
||
} else {
|
||
echo '1.180.0.321';
|
||
} ?>&rnd=<?= $code; ?>'" class="btn btn-success">
|
||
<?php
|
||
if ($u->info['room'] == 188) {
|
||
echo "Зал воинов";
|
||
} elseif ($u->info['room'] == 393) {
|
||
echo "Зал воинов 2";
|
||
} elseif ($u->info['room'] == 372) {
|
||
echo "Большая парковая улица";
|
||
} elseif ($u->info['room'] == 395) {
|
||
echo "Зал воинов";
|
||
} elseif ($u->info['room'] == 397) {
|
||
echo "Зал воинов 2";
|
||
} elseif ($u->info['room'] == 242) {
|
||
echo "Большая торговая улица";
|
||
} elseif ($u->info['room'] == 321) {
|
||
echo "Центральная площадь";
|
||
} else {
|
||
echo "Магический Портал";
|
||
}
|
||
?>
|
||
</button>
|
||
<button onclick="location.href='/main.php?rz=1'" class="btn btn-success">Рыцарский магазин</button>
|
||
<button onclick="location.href='/main.php'" class="btn">Обновить</button>
|
||
</div>
|
||
<?php else: ?>
|
||
<div style="text-align: right;">
|
||
<button onclick="location.href='/main.php?rz=1'" class="btn">Обновить</button>
|
||
<button onclick="location.href='/main.php'" class="btn">Вернуться</button>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php
|
||
if (!empty($error)) {
|
||
echo '<b style="color: red;">' . $error . '</b>br>';
|
||
}
|
||
|
||
//отображаем
|
||
if ($dungeonGroupList == '') {
|
||
$dungeonGroupList = '';
|
||
} else {
|
||
if (!isset($zv['id']) || $u->info['dn'] == 0) {
|
||
if ($dungeonGo == 1 || $u->info['dn'] == 0) {
|
||
$pr = '<input name="go" type="submit" value="Вступить в группу">';
|
||
}
|
||
$dungeonGroupList = '<form autocomplete="off" action="main.php?rnd=' . $code . '" method="post">' . $pr . '<br>' . $dungeonGroupList . '' . $pr . '</form>';
|
||
}
|
||
$dungeonGroupList .= '<hr>';
|
||
}
|
||
|
||
if ($roomSection == 0) {
|
||
echo $dungeonGroupList;
|
||
}
|
||
if ($roomSection == 1) {
|
||
# endQuest завершаем задание по нажатию.
|
||
if (!empty($_GET['endQuest'])) {
|
||
$action = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = ' . $u->info['id'] . ' AND `id`="' . $_GET['endQuest'] . '" AND `vals` = "go" LIMIT 1'));
|
||
$quest = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . str_replace('start_quest', '', $action['vars']) . '" LIMIT 1'));
|
||
if ($q->questCheckEnd($quest) == 1) {
|
||
$q->questSuccesEnd($quest, $action);
|
||
}
|
||
}
|
||
?>
|
||
<div>
|
||
<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
|
||
);
|
||
$qc = 0; // Quest Count
|
||
$qcc = [];
|
||
//Генерируем список текущих квестов
|
||
$sp = mysql_query('SELECT * FROM `actions` WHERE `vars` LIKE "%start_quest%" AND `vals` = "go" AND `uid` = "' . $u->info['id'] . '" LIMIT 100');
|
||
while ($pl = mysql_fetch_array($sp)) {
|
||
if ($pl['room'] == $u->info['room']) {
|
||
$pq = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . str_replace('start_quest', '', $pl['vars']) . '" LIMIT 1'));
|
||
if ($q->questCheckEnd($pq) == 1 or $u->info['login'] == 'тест1') {
|
||
if ($u->info['login'] == 'тест1') {
|
||
print_r($pl['id'] . ' ');
|
||
}
|
||
$qsee2 = '<input style="margin-top:6px;" type="button" value="Завершить задание" onclick="location=\'main.php?rz=1&endQuest=' . $pl['id'] . '\'">';
|
||
} else {
|
||
$qsee2 = '';
|
||
}
|
||
|
||
$qsee .= '
|
||
<a href="main.php?rz=1&end_qst_now=' . $pq['id'] . '"><img src="//img.new-combats.tech/i/clear.gif" title="Отказаться от задания"></a>
|
||
<b>' . $pq['name'] . '</b>
|
||
<div style="padding-left:15px;padding-bottom:5px;border-bottom:1px solid grey"><small>' . $pq['info'] . '<br>' . $q->info($pq) . '' . $qsee2 . ' </small></div>
|
||
<br>';
|
||
#
|
||
$qcc[$pq['line']]++;
|
||
#
|
||
$qc++;
|
||
}
|
||
}
|
||
|
||
if (isset($_GET['add_quest'])) {
|
||
$qst_city = $_GET['city_quest'];
|
||
//
|
||
if ($qst_city == 'angelscity') {
|
||
$dun5 = 101; //Бездна
|
||
} elseif ($qst_city == 'sandcity') {
|
||
$dun5 = 16; //Пещера Мглы
|
||
} elseif ($qst_city == 'demonscity') {
|
||
$dun5 = 3; //Катакомбы
|
||
} elseif ($qst_city == 'suncity') {
|
||
$dun5 = 10; //Грибница
|
||
} elseif ($qst_city == 'dreamscity') {
|
||
$dun5 = 1; //Водосток
|
||
} elseif ($qst_city == 'abandonedplain') {
|
||
$dun5 = 13; //Гора легиона
|
||
} elseif ($qst_city == 'izlom16') {
|
||
$dun5 = 109; //Излом
|
||
} elseif ($qst_city == 'emeraldscity') {
|
||
$dun5 = 9; //Потерянный вход
|
||
} elseif ($qst_city == 'eastcity') {
|
||
$dun5 = 444; //Тропа Инквизиции
|
||
} elseif ($qst_city == 'devilscity') {
|
||
$dun5 = 31; //Низины
|
||
} else {
|
||
$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
|
||
);
|
||
//$qcc
|
||
if ($qcc[$dun5] > 0) {
|
||
echo '<font color="red"><b>У Вас уже есть задание, завершите его или отмените для получения нового.</b></font><br>';
|
||
} elseif ($qst_city != 'capitalcity' && $qst_city != 'angelscity' && $qst_city != 'suncity' && $qst_city != 'demonscity' && $qst_city != 'dreamscity' && $qst_city != 'abandonedplain' && $qst_city != 'izlom16' && $qst_city != 'sandcity' && $qst_city != 'emeraldscity' && $qst_city != 'devilscity') {
|
||
echo '<font color="red"><b>Для этой пещеры еще нет заданий</b></font><br>';
|
||
} elseif (isset($hgo['id'])) {
|
||
echo '<font color="red"><b>Нельзя получать задания чаще одного раза в сутки</b></font><br>';
|
||
} else {
|
||
$sp = mysql_query('SELECT * FROM `quests` WHERE `line` = ' . $dun5 . '');
|
||
$dq_add = [];
|
||
while ($pl = mysql_fetch_array($sp)) {
|
||
if ($u->rep['rep' . $qst_city] == 24999) {
|
||
//квет, рыцарского задания
|
||
if ($pl['kin'] == 2) {
|
||
$dq_add = [0 => $pl];
|
||
}
|
||
} else {
|
||
if ($pl['kin'] == 0) {
|
||
$dq_add[count($dq_add)] = $pl;
|
||
}
|
||
}
|
||
}
|
||
$dq_add = $q->onlyOnceQuest($dq_add, $u->info['id']);
|
||
$dq_add = $dq_add[rand(0, count($dq_add) - 1)];
|
||
|
||
if ($q->testGood($dq_add) == 1 && $dq_add > 0 && $u->rep['rep' . $qst_city] < 25000) {
|
||
$q->startq_dn($dq_add['id']);
|
||
echo '<font color="red"><b>Вы успешно получили новое задание "' . $dq_add['name'] . '".</b></font><br>';
|
||
$u->addAction(time(), 'psh_qt_' . $qst_city, $dq_add['id']);
|
||
} else {
|
||
if ($u->rep['rep' . $qst_city] >= 24999) {
|
||
//квест, рыцарского задания
|
||
echo '<font color="red"><b>Вы завершили квестовую линию, ожидайте новых заданий!</b></font><br>';
|
||
} else {
|
||
echo '<font color="red"><b>Не удалось получить задание "' . $dq_add['name'] . '". Попробуйте еще...</b></font><br>';
|
||
}
|
||
}
|
||
unset($dq_add);
|
||
}
|
||
} elseif (isset($_GET['add_quest']) && $qc > 0) {
|
||
echo '<font color="red"><b>Что-то пошло не так... осторожнее.. <br/><br/></b></font><br>';
|
||
}
|
||
if ($qsee == '') {
|
||
$qsee = 'К сожалению у вас нет ни одного задания<br/><br/>';
|
||
}
|
||
?>
|
||
<Br/>
|
||
<style>
|
||
.btnnewred {
|
||
background-color: #ca726d;
|
||
color: #f8d2d0;
|
||
border-color: #b44039;
|
||
cursor: default;
|
||
}
|
||
|
||
.btnnewred:hover {
|
||
background-color: #ca726d;
|
||
cursor: default;
|
||
}
|
||
</style>
|
||
<FIELDSET>
|
||
<LEGEND style="color: maroon; font-weight: bold;">Текущие задания:</LEGEND>
|
||
<?= $qsee ?>
|
||
<span style="padding-left: 10px;"><strong>Получить задание:</strong><br>
|
||
<?php
|
||
$hgo1 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_capitalcity" LIMIT 1', 1);
|
||
$hgo2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_angelscity" LIMIT 1', 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
|
||
);
|
||
$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);
|
||
$hgo10 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `room` = "' . $u->info['room'] . '" AND `time` >= ' . (time() - 60 * 60 * 24) . ' AND `vars` = "psh_qt_devilscity" LIMIT 1', 1);
|
||
|
||
|
||
if (!isset($hgo1['id'])) { ?>
|
||
<button class="btn btn-success" onclick="location.href='/main.php?rz=1&add_quest=1&city_quest=capitalcity'">Пещера Тысячи Проклятий</button>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(
|
||
60 * 60 * 24 + $hgo1['time'] - time()
|
||
) ?> (Пещера Тысячи Проклятий)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=capitalcity"'/>
|
||
<?php }
|
||
if (!isset($hgo2['id'])) { ?>
|
||
<input class="btn btn-success" type='button' value='Бездна' onclick='location="main.php?rz=1&add_quest=1&city_quest=angelscity"'/>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo2['time'] - time()) ?> (Бездна)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=angelscity"'/>
|
||
<?php }
|
||
if (!isset($hgo3['id'])) { ?>
|
||
<input class="btn btn-success" type='button' value='Грибница' onclick='location="main.php?rz=1&add_quest=1&city_quest=suncity"'/>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo3['time'] - time()) ?> (Грибница)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=suncity"'/>
|
||
<?php }
|
||
if (!isset($hgo4['id'])) { ?>
|
||
<input class="btn btn-success" type='button' value='Катакомбы' onclick='location="main.php?rz=1&add_quest=1&city_quest=demonscity"'/>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo4['time'] - time()) ?> (Катакомбы)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=demonscity"'/>
|
||
<?php }
|
||
if (!isset($hgo5['id'])) { ?>
|
||
<input class="btn btn-success" type='button' value='Водосток' onclick='location="main.php?rz=1&add_quest=1&city_quest=dreamscity"'/>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo5['time'] - time()) ?> (Водосток)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=dreamscity"'/>
|
||
<?php }
|
||
if (!isset($hgo6['id'])) { ?>
|
||
<input class="btn btn-success" type='button' value='Гора Легиона' onclick='location="main.php?rz=1&add_quest=1&city_quest=abandonedplain"'/>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo6['time'] - time()) ?> (Гора Легиона)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=abandonedplain"'/>
|
||
<?php }
|
||
if (!isset($hgo7['id'])) { ?>
|
||
<input class="btn btn-success" type='button' value='Излом Хаоса' onclick='location="main.php?rz=1&add_quest=1&city_quest=izlom16"'/>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo7['time'] - time()) ?> (Излом Хаоса)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=izlom16"'/>
|
||
<?php }
|
||
if (!isset($hgo8['id'])) { ?>
|
||
<input class="btn btn-success" type='button' value='Пещеры Мглы' onclick='location="main.php?rz=1&add_quest=1&city_quest=sandcity"'/>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo8['time'] - time()) ?> (Пещера Мглы)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=sandcity"'/>
|
||
<?php }
|
||
if (!isset($hgo9['id'])) { ?>
|
||
<input class="btn btn-success" type='button' value='Потерянный Вход' onclick='location="main.php?rz=1&add_quest=1&city_quest=emeraldscity"'/>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo9['time'] - time()) ?> (Потерянный Вход)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=emeraldscity"'/>
|
||
<?php }
|
||
if (!isset($hgo10['id'])) { ?>
|
||
<input class="btn btn-success" type='button' value='Туманные Низины' onclick='location="main.php?rz=1&add_quest=1&city_quest=devilscity"'/>
|
||
<?php } else { ?>
|
||
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo10['time'] - time()) ?> (Туманные Низины)'
|
||
onclick='location="main.php?rz=1&add_quest=1&city_quest=devilscity"'/>
|
||
<?php }
|
||
?>
|
||
</span>
|
||
</FIELDSET>
|
||
</form>
|
||
<br/>
|
||
<?php
|
||
|
||
//Начисление бонуса награды
|
||
if (isset($_GET['buy1'])) {
|
||
$rt = 1;
|
||
if ($_GET['buy1'] == 1) {
|
||
//покупаем статы
|
||
$price = 2000;
|
||
$cur_price = ['price' => 0];
|
||
if (50 - $u->rep['add_stats'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Характеристики!
|
||
foreach ($dungeon['list'] as $key => $val) {
|
||
if (!($cur_price['price'] >= $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');
|
||
$rt = $r ? 1 : 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 '<font color="red"><b>Вы успешно приобрели 1 способность за ' . $price . ' ед. награды</b></font><br>';
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
} else {
|
||
echo 'Недостаточно репутации.';
|
||
}
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
} elseif ($_GET['buy1'] == 2) { // Умения!
|
||
$price = 5000;
|
||
$cur_price = ['price' => 0];
|
||
if (15 - $u->rep['add_skills'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Умения!
|
||
foreach ($dungeon['list'] as $key => $val) {
|
||
if (!($cur_price['price'] >= $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');
|
||
$rt = $r ? 1 : 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 '<font color="red"><b>Вы успешно приобрели 1 умение за ' . $price . ' ед. награды</b></font><br>';
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
} else {
|
||
echo 'Недостаточно репутации.';
|
||
}
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
} 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)) {
|
||
$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');
|
||
$rt = $r ? 1 : 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 '<font color="red"><b>Вы успешно приобрели 10 кр. за ' . $price . ' ед. награды</b></font><br>';
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
} else {
|
||
echo 'Недостаточно репутации.';
|
||
}
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
} 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)) {
|
||
$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 '<font color="red"><b>Вы успешно приобрели 1 особенность за ' . $price . ' ед. награды</b></font><br>';
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
} else {
|
||
echo 'Недостаточно репутации.';
|
||
}
|
||
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
} elseif ($_GET['buy1'] == 5) {
|
||
//покупаем слоты
|
||
$price = 2000 + ($u->rep['add_slot'] * 2000);
|
||
$price_kr = 500 + ($u->rep['add_slot'] * 500);
|
||
$cur_price = ['price' => 0];
|
||
if ($price_kr > $u->info['money']) {
|
||
echo '<font color=red><b>Недостаточно денег</b></font><br>';
|
||
} elseif (4 - $u->rep['add_slot'] > 0 && $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Характеристики!
|
||
foreach ($dungeon['list'] as $key => $val) {
|
||
if (!($cur_price['price'] >= $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) {
|
||
//echo '['.$val.'->'.$cur_price['nu_'.$val].'->'.$u->rep['nu_'.$val].'->'.$rt.']';
|
||
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['priemslot'] += 1;
|
||
$u->rep['add_slot'] += 1;
|
||
$u->info['money'] -= $price_kr;
|
||
mysql_query('UPDATE `rep` SET `add_slot` = "' . $u->rep['add_slot'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
|
||
mysql_query('UPDATE `stats` SET `priemslot` = "' . $u->info['priemslot'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
|
||
mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
|
||
echo '<font color="red"><b>Вы успешно приобрели 1 слот для приема за ' . $price . ' награды и ' . $price_kr . ' кр.</b></font><br>';
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
} else {
|
||
echo 'Недостаточно репутации.';
|
||
}
|
||
} else {
|
||
echo '<font color="red"><b>Ничего не получилось...</b></font><br>';
|
||
}
|
||
}
|
||
}
|
||
//цена на слоты
|
||
?>
|
||
<fieldset>
|
||
<legend style="color: brown; font-weight: bold;">
|
||
Наград:
|
||
<span style="color: green;">
|
||
<?= (isset($rt) && $rt == 1 ? ($u->rep['allrep'] - $u->rep['allnurep']) - $cur_price['price'] : ($u->rep['allrep'] - $u->rep['allnurep'])); ?>
|
||
</span>
|
||
ед.
|
||
</legend>
|
||
<table>
|
||
<?php if ((50 - $u->rep['add_stats']) > 0) { ?>
|
||
<tr>
|
||
<td>Способность (еще <?= (50 - $u->rep['add_stats']) ?>)</td>
|
||
<td style='padding-left: 10px'>за<b> 2000</b> ед.</td>
|
||
<td style='padding-left: 10px'><input class="btn" type='button' value='Купить'
|
||
onclick="if (confirm('Купить: Способность?\n\nКупив способность, Вы сможете увеличить характеристики персонажа.\nНапример, можно увеличить силу.')) {location='main.php?rz=1&buy1=1'}"/>
|
||
</td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if ((15 - $u->rep['add_skills']) > 0) { ?>
|
||
<tr>
|
||
<td>Умение (еще <?= (15 - $u->rep['add_skills']) ?>)</td>
|
||
<td style='padding-left: 10px'>за<b> 5000</b> ед.</td>
|
||
<td style='padding-left: 10px'><input class="btn" type='button' value='Купить'
|
||
onclick="if (confirm('Купить: Умение?\n\nУмение даёт возможность почуствовать себя мастером меча, топора, магии и т.п.')) {location='main.php?rz=1&buy1=2'}"/>
|
||
</td>
|
||
</tr>
|
||
<?php } ?>
|
||
<tr>
|
||
<td>Деньги (10 кр.)</td>
|
||
<td style='padding-left: 10px'>за<b> 100</b> ед.</td>
|
||
<td style='padding-left: 10px'><input class="btn" type='button' value='Купить'
|
||
onclick="if (confirm('Купить: Деньги (10 кр.)?\n\nНаграду можно получить полновесными кредитами.')) {location='main.php?rz=1&buy1=3'}"/></td>
|
||
</tr>
|
||
<?php if ((4 - $u->rep['add_slot']) > 0) { ?>
|
||
<tr>
|
||
<td>Слоты (еще <?= (4 - $u->rep['add_slot']) ?>)</td>
|
||
<td style='padding-left: 10px'>за <b><?= 2000 + ($u->rep['add_slot'] * 2000); ?></b> ед. и <b><?= 500 + ($u->rep['add_slot'] * 500); ?></b> кр.</td>
|
||
<td style='padding-left: 10px'><input class="btn" type='button' value='Купить'
|
||
onclick="if (confirm('Купить: слоты?\n\n+1 дополнительный слот для приема')) {location='main.php?rz=1&buy1=5'}"/></td>
|
||
</tr>
|
||
<?php } ?>
|
||
</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'
|
||
)
|
||
);
|
||
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'
|
||
);
|
||
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 '<font color="red"><b>Вы успешно сдали чеки в количестве ' . $x . ' шт. на сумму ' . $prc . ' кр.</b></font><br>';
|
||
$chk[0] = 0;
|
||
?>
|
||
</span></p>
|
||
</fieldset><?php
|
||
}
|
||
if ($chk[0] > 0) {
|
||
?>
|
||
<input class="btnnew" type='button' value='Сдать чеки'
|
||
onclick="if (confirm('Сдать все чеки (<?= $chk[0] ?> шт.) находящиеся у Вас в инвентаре за <?= $chk[1] ?> кр. ?')) {location='main.php?rz=1&buy777=1'}"/>
|
||
<?php } ?>
|
||
<fieldset style='margin-top:15px;'>
|
||
<table>
|
||
<?php
|
||
foreach ($dungeon['list'] as $key => $val) {
|
||
if ($u->rep['rep' . $val] > 0) {
|
||
echo '<tr>
|
||
<td width="200">' . ucfirst(str_replace('city', ' city', $val)) . ':</td>
|
||
<td>' . $u->rep['rep' . $val] . ' ед. </td>
|
||
</tr>';
|
||
}
|
||
}
|
||
?>
|
||
</table>
|
||
<legend>Текущая репутация:</legend>
|
||
</fieldset>
|
||
</div>
|
||
<?php
|
||
} else {
|
||
if ($dungeonGo == 1) {
|
||
if ($u->info['dn'] == 0) {
|
||
?>
|
||
<table width="400" border="0" cellspacing="0" cellpadding="0">
|
||
<tr>
|
||
<td valign="top">
|
||
<form id="from" autocomplete="0" name="from" action="main.php?pz1=<?= $code; ?>" method="post">
|
||
<fieldset style='padding-left: 5; width=50%'>
|
||
<legend><b> Группа </b></legend>
|
||
<font color=green><b> Выберите пещеру:</b></font>
|
||
<hr/>
|
||
|
||
<label><input type="radio" name="rpmg1" id="rpmg1" value="10"/>
|
||
<img style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/dreamscity.gif" width="34" height="19"/> Водосток [8]</label><br/>
|
||
<hr>
|
||
|
||
<label><input type="radio" name="rpmg1" id="rpmg1" checked="checked" value="1"/>
|
||
<img style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/capitalcity.gif" width="34" height="19"/> Пещера Тысячи Проклятий[9]</label><br/>
|
||
<hr>
|
||
<label><input type="radio" name="rpmg1" id="rpmg1" value="2"/>
|
||
<img style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/angelscity.gif" width="34" height="19"/> Бездна[8]</label><br/>
|
||
<hr>
|
||
<label><input type="radio" name="rpmg1" id="rpmg1" value="6"/>
|
||
<img style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/suncity.gif" width="34" height="19"/> Грибница[8]</label>
|
||
<br/>
|
||
<hr>
|
||
<label><input type="radio" name="rpmg1" id="rpmg1" value="4"/>
|
||
<img style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/demonscity.gif" width="34" height="19"/>Катакомбы[10]</label><br/>
|
||
<hr>
|
||
<label><input type="radio" name="rpmg1" id="rpmg1" value="11"/>
|
||
<img style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/abandonedplain.gif" width="34" height="19"/>Гора Легиона[10]</label><br/>
|
||
<hr/>
|
||
<label><input type="radio" name="rpmg1" id="rpmg1" value="16"/>
|
||
<img style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/sandcity.gif" width="34" height="19"/>Пещера Мглы[10]</label><br/>
|
||
<hr>
|
||
<?php if ($u->info['level'] == 12) { ?>
|
||
<label><input type="radio" name="rpmg1" id="rpmg1" value="5"/>
|
||
<img style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/emeraldscity.gif" width="34" height="19"/>Потерянный вход[11-12]</label><br/>
|
||
<hr>
|
||
<?php } ?>
|
||
<label><input type="radio" name="rpmg1" id="rpmg1" value="106"/>
|
||
<img style="vertical-align:bottom" src="//img.new-combats.tech/i/city_ico2/devilscity.gif" width="34" height="19"/>Туманные Низины v.2.0</label><br/>
|
||
<hr/>
|
||
|
||
<br/>
|
||
Пароль
|
||
<input autocomplete="off" type="password" name="pass" maxlength="25" size="25"/>
|
||
<br/>
|
||
|
||
<input class="btn btn-success" type="submit" name="add" value="Создать группу"/>
|
||
<br/>
|
||
|
||
</fieldset>
|
||
</form>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<?php
|
||
} else {
|
||
$psh_start = '';
|
||
if (isset($zv['id'])) {
|
||
if ($zv['uid'] == $u->info['id']) {
|
||
$psh_start = '<INPUT class="btn" type=\'button\' name=\'start\' value=\'Начать\' onClick="top.frames[\'main\'].location = \'main.php?start=1&rnd=' . $code . '\'"> ';
|
||
}
|
||
echo '<br><FORM autocomplete="off" id="REQUEST" method="post" style="width:210px;" action="main.php?rnd=' . $code . '">
|
||
<FIELDSET style=\'padding-left: 5; width=50%\'>
|
||
<LEGEND><B> Группа </B> </LEGEND>
|
||
' . $psh_start . '
|
||
<INPUT class="btn" type=\'submit\' name=\'leave\' value=\'Покинуть группу\'>
|
||
</FIELDSET>
|
||
</FORM>';
|
||
}
|
||
}
|
||
} else {
|
||
echo 'Поход в пещеры разрешен один раз в два часа. Осталось еще: ' . Conversion::secondsToTimeout(
|
||
60 * 60 * 2 - time() + $dungeon_timeout['time']
|
||
) . '<br><small style="color:grey">Но Вы всегда можете приобрести ключ от прохода у любого "копателя пещер" в Торговом зале ;)</small>';
|
||
|
||
}
|
||
}
|