if(!defined('GAME'))
{
die();
}
if($u->room['file']=='entercat')
{
if(isset($_GET['rz'])) {
$rz = 1;
}else{
$rz = 0;
}
$dun = 3; //для новичков 2-7 лвл
$er = '';
$dzs = '';
$g111 = 1;
$g11 = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "psh1" AND `time`>'.(time()-7200).' LIMIT 1',1);
$moder = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "'.$u->info['align'].'" LIMIT 1'));
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;
}
}
if(isset($g11['id']))
{
$g111 = 0;
if(isset($_GET['start']))
{
$re = 'Поход в пещеры разрешен один раз в два часа. Осталось еще: '.$u->timeOut(7200-time()+$g11['time']);
}
}
if(isset($_GET['start']) && $zv['uid']==$u->info['id'] && $g111 == 1)
{
//начинаем поход
//начинаем поход
$ig = 1;
if($ig>0)
{
//перемещаем игроков в пещеру
//$u->addAction(time(),'psh1','');
$ins = mysql_query('INSERT INTO `dungeon_now` (`city`,`uid`,`id2`,`name`,`time_start`)
VALUES ("'.$zv['city'].'","'.$zv['uid'].'","'.$dun.'","Катакомбы","'.time().'")');
if($ins)
{
$zid = mysql_insert_id();
//обновляем пользователей
$su = mysql_query('SELECT `u`.`id`,`st`.`dn` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`dn`="'.$zv['id'].'" LIMIT '.($zv['team_max']+1).'');
$ids = '';
while($pu = mysql_fetch_array($su))
{
$ids .= ' `id` = "'.$pu['id'].'" OR';
$u->addAction(time(),'psh1','',$pu['id']);
}
$ids = rtrim($ids,'OR');
$upd1 = mysql_query('UPDATE `stats` SET `s`="0",`res_s`="0",`x`="0",`y`="0",`res_x`="0",`res_y`="0",`dn` = "0",`dnow` = "'.$zid.'" WHERE '.$ids.' LIMIT '.($zv['team_max']+1).'');
if($upd1)
{
$upd2 = mysql_query('UPDATE `users` SET `room` = "19" WHERE '.$ids.' LIMIT '.($zv['team_max']+1).'');
//Добавляем ботов и обьекты в пещеру $zid с for_dn = $dun
//Добавляем ботов
$vls = '';
$sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `for_dn` = "'.$dun.'"');
while($pl = mysql_fetch_array($sp))
{
$vls .= '("'.$zid.'","'.$pl['id_bot'].'","'.$pl['colvo'].'","'.$pl['items'].'","'.$pl['x'].'","'.$pl['y'].'","'.$pl['dialog'].'","'.$pl['items'].'"),';
}
$vls = rtrim($vls,',');
$ins1 = mysql_query('INSERT INTO `dungeon_bots` (`dn`,`id_bot`,`colvo`,`items`,`x`,`y`,`dialog`,`atack`) VALUES '.$vls.'');
//Добавляем обьекты
$vls = '';
$sp = mysql_query('SELECT * FROM `dungeon_obj` WHERE `for_dn` = "'.$dun.'"');
while($pl = mysql_fetch_array($sp))
{
$vls .= '("'.$zid.'","'.$pl['name'].'","'.$pl['img'].'","'.$pl['x'].'","'.$pl['y'].'","'.$pl['action'].'","'.$pl['type'].'","'.$pl['w'].'","'.$pl['h'].'","'.$pl['s'].'","'.$pl['s2'].'","'.$pl['os1'].'","'.$pl['os2'].'","'.$pl['os3'].'","'.$pl['os4'].'","'.$pl['type2'].'","'.$pl['top'].'","'.$pl['left'].'","'.$pl['date'].'"),';
}
$vls = rtrim($vls,',');
if($vls!='')
{
$ins2 = mysql_query('INSERT INTO `dungeon_obj` (`dn`,`name`,`img`,`x`,`y`,`action`,`type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`) VALUES '.$vls.'');
}else{
$ins2 = true;
}
if($upd2 && $ins1 && $ins2)
{
mysql_query('UPDATE `dungeon_zv` SET `delete` = "'.time().'" WHERE `id` = "'.$zv['id'].'" LIMIT 1');
die('');
}else{
$re = 'Ошибка перехода в подземелье...';
}
}else{
$re = 'Ошибка перехода в подземелье...';
}
}else{
$re = 'Ошибка перехода в подземелье...';
}
}
}elseif(isset($_POST['go'],$_POST['goid']) && $g111==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']))
{
if($u->info['level']>7)
{
$row = 0;
if(5>$row)
{
$upd = mysql_query('UPDATE `stats` SET `dn` = "'.$zv['id'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
if(!$upd)
{
$re = 'Не удалось вступить в эту группу';
unset($zv);
}else{
$u->info['dn'] = $zv['id'];
}
}else{
$re = 'В группе нет места';
unset($zv);
}
}else{
$re = 'Вы не подходите по уровню';
unset($zv);
}
}else{
$re = 'Заявка не найдена';
}
}else{
$re = 'Вы уже находитесь в группе';
}
}elseif(isset($_POST['leave']) && isset($zv['id']) && $g111 == 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 && $g111 == 1)
{
if($u->info['dn']==0)
{
$ins = mysql_query('INSERT INTO `dungeon_zv`
(`city`,`time`,`uid`,`dun`,`pass`,`com`,`lvlmin`,`lvlmax`,`team_max`) VALUES
("'.$u->info['city'].'","'.time().'","'.$u->info['id'].'","'.$dun.'",
"'.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');
$re = 'Вы успешно создали группу';
}else{
$re = 'Не удалось создать группу';
}
}else{
$re = 'Вы уже находитесь в группе';
}
}
//Генерируем список групп
$sp = mysql_query('SELECT * FROM `dungeon_zv` WHERE `city` = "'.$u->info['city'].'" AND `dun` = "3" AND `delete` = "0" AND `time` > "'.(time()-60*60*2).'"');
while($pl = mysql_fetch_array($sp))
{
$dzs .= '
';
if($u->info['dn']==0)
{
$dzs .= '
';
}
$dzs .= '
'.date('H:i',$pl['time']).' ';
$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,', ');
$dzs .= $pus;
if($pl['com']!='')
{
$dl = '';
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'] = '';
}
}
$dzs .= '
| '.$pl['com'].''.$dl.' ';
}
$dzs .= '
';
}
?>
if($re!='')
{
echo ''.$re.' ';
}
//отображаем
if($dzs=='')
{
$dzs = '';
}else{
if(!isset($zv['id']))
{
if($g111==1)
{
$pr = ' ';
}
$dzs = '';
}
$dzs .= ' ';
}
if($rz==0) { echo $dzs; }
if($rz == 1) {
?>
//Начисление бонуса награды
if(isset($_GET['buy1'])) {
$dungeon = array(1=>'capitalcity',2=>'demonscity',3=>'angelscity');
if($_GET['buy1']==1) {
//покупаем статы
$price = 2000+($u->rep['add_stats']*100);
$cur_price = array('price'=>0);
if(25-$u->rep['add_stats']>0 && $u->rep['allrep']-$u->rep['allnurep']>=$price) { // Характеристики!
foreach($dungeon 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']) {
echo '
Вы успешно приобрели 1 способность за '.$price.' ед. награды ';
$u->info['ability'] += 1;
$u->rep['add_stats'] += 1;
foreach($dungeon as $key=>$val){
if($key!='price'){
$u->rep['nu_'.$val] += $cur_price['nu_'.$val];
mysql_query('UPDATE `rep` SET `nu_'.$val.'` = "'.$u->rep['nu_'.$val].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 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');
} else echo 'Недостаточно репутации.';
} else {
echo '
Ничего не получилось... ';
}
} elseif($_GET['buy1']==2) { // Умения!
$price = 2000+(2000*$u->rep['add_skills']);
$cur_price = array('price'=>0);
if(10-$u->rep['add_skills']>0 && $u->rep['allrep']-$u->rep['allnurep'] >= $price ) { // Умения!
foreach($dungeon 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']) {
echo '
Вы успешно приобрели 1 умение за '.$price.' ед. награды ';
$u->info['skills'] += 1;
$u->rep['add_skills'] += 1;
foreach($dungeon as $key=>$val){
if($key!='price'){
$u->rep['nu_'.$val] += $cur_price['nu_'.$val];
mysql_query('UPDATE `rep` SET `nu_'.$val.'` = "'.$u->rep['nu_'.$val].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 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');
} else echo 'Недостаточно репутации.';
} else {
echo '
Ничего не получилось... ';
}
}elseif($_GET['buy1']==3) { // Кредиты
$price = 100;
$cur_price = array('price'=>0);
if( $u->rep['allrep'] - $u->rep['allnurep'] >= $price) { // Покупаем кредиты
foreach($dungeon 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']) {
echo '
Вы успешно приобрели 10 кр. за '.$price.' ед. награды ';
$u->info['money'] += 10;
$u->rep['add_money'] += 10;
foreach($dungeon as $key=>$val){
if($key!='price'){
$u->rep['nu_'.$val] += $cur_price['nu_'.$val];
mysql_query('UPDATE `rep` SET `nu_'.$val.'` = "'.$u->rep['nu_'.$val].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}
}
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');
} else echo 'Недостаточно репутации.';
}else{
echo '
Ничего не получилось... ';
}
}elseif( $_GET['buy1'] == 4 ) { // Особенности
$price = 3000;
$cur_price = array('price'=>0);
if( 5 - $u->rep['add_skills2'] > 0 && $u->rep['allrep']-$u->rep['allnurep'] >= $price ) { // Особенности
foreach($dungeon 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']) {
echo '
Вы успешно приобрели 1 особенность за '.$price.' ед. награды ';
$u->info['nskills'] += 1;
$u->rep['add_skills2'] += 1;
foreach($dungeon as $key=>$val){
if($key!='price'){
$u->rep['nu_'.$val] += $cur_price['nu_'.$val];
mysql_query('UPDATE `rep` SET `nu_'.$val.'` = "'.$u->rep['nu_'.$val].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}
}
mysql_query('UPDATE `rep` SET `add_skills2` = "'.$u->rep['add_skills2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
mysql_query('UPDATE `stats` SET `nskills` = "'.$u->info['nskills'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
} 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) {
?>
Репутация в Capital city:
=$u->rep['repcapitalcity']?> ед.
Репутация в Demons city:
=$u->rep['repdemonscity']?> ед.
Репутация в Angels city:
=$u->rep['repangelscity']?> ед.
Текущая репутация:
}else{
if($g111 == 1)
{
if($u->info['dn']==0)
{
?>
}else{
$psh_start = '';
if(isset($zv['id']))
{
if($zv['uid']==$u->info['id'])
{
$psh_start = ' ';
}
echo ' ';
}
}
?>
}else{
echo 'Поход в пещеры разрешен один раз в два часа. Осталось еще: '.$u->timeOut(7200-time()+$g11['time']).'Но Вы всегда можете приобрести ключ от прохода у любого "копателя пещер" в Торговом зале ;) ';
}
}
}
?>