room['file'] == 'newtower') { require_once('_incl_data/class/__zv.php'); $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "'.$u->info['inTurnir'].'" LIMIT 1')); $bmid = 0; if(!isset($bs['id']) || $bs['status'] == 0) { die('Турнир не найден.'); } function b_act($uid, $val, $time) { global $bs; $ins = mysql_query('INSERT INTO `bs_actions` (`bid`,`count`,`time`,`uid`,`val`) VALUES ( "'.$bs['id'].'","'.$bs['count'].'","'.$time.'","'.$uid.'","'.$val.'" )'); return $ins; } function test_users_life() { global $u,$bs; //Проверка бага с юзерами и архивариусами $sp = mysql_query('SELECT `id`,`lose`,`nich` FROM `users` WHERE `inTurnir` = "'.$bs['id'].'"'); $users = 0; $arhiv = 0; while( $pl = mysql_fetch_array($sp) ) { $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "'.$pl['id'].'" AND `real` > 0 AND `inUser` > 0 LIMIT 1')); if(isset($test['id'])) { //Игрок $users++; }else{ //Архив $arhiv++; } } if( ($bs['users'] - $bs['users_finish']) != $users || $bs['arhiv'] != $arhiv ) { $bs['users_finish'] = $bs['users'] - $users; $bs['arhiv'] = $arhiv; mysql_query('UPDATE `bs_turnirs` SET `users_finish` = "'.$bs['users_finish'].'", `arhiv` = "'.$bs['arhiv'].'" WHERE `id` = "'.$bs['id'].'" LIMIT 1'); } } test_users_life(); function b_test($uid,$val,$count = false,$sort = 'ORDER BY `id` DESC') { global $bs; if($count == false ) { $r = mysql_fetch_array(mysql_query('SELECT * FROM `bs_actions` WHERE `bid` = "'.$bs['id'].'" AND `count` = "'.$bs['count'].'" AND `uid` = "'.$uid.'" AND `val` = "'.$val.'" '.$sort.' LIMIT 1')); }else{ $r = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `bs_actions` WHERE `bid` = "'.$bs['id'].'" AND `count` = "'.$bs['count'].'" AND `uid` = "'.$uid.'" AND `val` = "'.$val.'" '.$sort.' LIMIT 1')); $r = $r[0]; } return $r; } //ПОднять предмет if( isset($_GET['takeit']) ) { $itm = mysql_fetch_array(mysql_query('SELECT * FROM `bs_items` WHERE `bid` = "'.$bs['id'].'" AND `count` = "'.$bs['count'].'" AND `id` = "'.mysql_real_escape_string($_GET['takeit']).'" LIMIT 1')); if( isset($itm['id']) ) { if( $itm['x'] == 0 && $itm['y'] == 0 ) { $itm['x'] = $u->info['x']; $itm['y'] = $u->info['y']; } if( $itm['x'] == $u->info['x'] && $itm['y'] == $u->info['y'] ) { $itmb = mysql_fetch_array(mysql_query('SELECT `id`,`img`,`name` FROM `items_main` WHERE `id` = "'.$itm['item_id'].'" LIMIT 1')); if( isset($itmb['id']) ) { $tact = b_test($u->info['id'],'take_itm'); if( $tact['time'] > time() ) { $error2 = 'Нельзя поднимать предметы так часто, ждите еще '.($tact['time'] - time()).' сек.'; }else{ b_act($u->info['id'],'take_itm',time()+3); $error2 = 'Вы подняли предмет "'.$itmb['name'].'"'; $u->addItem( $itmb['id'] , $u->info['id'] ); mysql_query('DELETE FROM `bs_items` WHERE `id` = "'.$itm['id'].'" LIMIT 1'); } }else{ $error2 = 'Предмет не найден...'; } }else{ $error2 = 'Предмет не найден в комнате с вами...'; } }else{ $error2 = 'Предмет не найден, кто-то оказался быстрее...'; } } //Предметы БС $bs_items = ''; $sp = mysql_query('SELECT * FROM `bs_items` WHERE `bid` = "'.$bs['id'].'" AND `count` = "'.$bs['count'].'" AND `x` = "'.$u->info['x'].'" AND `y` = "'.$u->info['y'].'"'); while( $pl = mysql_fetch_array($sp) ) { $itm = mysql_fetch_array(mysql_query('SELECT `id`,`img`,`name` FROM `items_main` WHERE `id` = "'.$pl['item_id'].'" LIMIT 1')); if( isset($itm['id']) ) { $bs_items .= ''; } } if( $bs_items != '' ) { $bs_items = '
Предметы в комнате:

'.$bs_items.'
'; } //Данные комнаты $map = array( 'name' => 'Название локации', 'up' => array( 'i' => 'i' , 'js' => 'onclick="return false"' ), 'left' => array( 'i' => 'i' , 'js' => 'onclick="return false"' ), 'right' => array( 'i' => 'i' , 'js' => 'onclick="return false"' ), 'down' => array( 'i' => 'i' , 'js' => 'onclick="return false"' ) ); $title_locs = array( 'up' => '', 'left' => '', 'right' => '', 'down' => '' ); if( isset($_GET['attack']) ) { $usr = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_GET['attack']).'" AND `inUser` = 0 AND `room` = "362" LIMIT 1')); if( isset($usr['id']) ) { $usr_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `login` = "'.mysql_real_escape_string($_GET['attack']).'" AND `inUser` = "'.$usr['id'].'" LIMIT 1')); if( !isset($usr_real['id']) ) { $usr_real = $usr; } $sts = mysql_fetch_array(mysql_query('SELECT `id`,`x`,`y`,`team`,`hpNow` FROM `stats` WHERE `id` = "'.$usr['id'].'" LIMIT 1')); if( $sts['x'] != $u->info['x'] || $sts['y'] != $u->info['y'] ) { $error = 'Вы должны находиться в одной комнате'; }elseif( $usr_real['login'] == $u->info['login'] ) { $error = 'Нельзя нападать на самого себя'; }else{ $tbtl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$usr['battle'].'" AND `team_win` = "-1" LIMIT 1')); if( !isset($tbtl['id']) && $usr['battle'] > 0 ) { $usr['battle'] = 0; $sts['team'] = 0; mysql_query('UPDATE `users` SET `battle` = 0 WHERE `id` = "'.$usr['id'].'" LIMIT 1'); if( $sts['hpNow'] < 1 ) { mysql_query('UPDATE `stats` SET `hpNow` = 1 WHERE `id` = "'.$usr['id'].'" LIMIT 1'); } } $btl_id = $magic->atackUser($u->info['id'],$usr['id'],$sts['team'],$usr['battle']); if( $btl_id > 0 ) { mysql_query('UPDATE `battle` SET `inTurnir` = "'.$bs['id'].'",`timeout` = "30" WHERE `id` = "'.$btl_id.'" LIMIT 1'); } $me_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "'.$u->info['id'].'" AND `login` = "'.$u->info['login'].'" LIMIT 1')); if( $usr['battle'] > 0 ) { $usr['battle'] = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "'.$usr['battle'].'" AND `team_win` = "-1" LIMIT 1')); if( isset($usr['battle']['id']) ) { $usr['battle'] = $usr['battle']['id']; }else{ $usr['battle'] = 0; } } if( $usr['battle'] > 0 ) { //Заносим в лог БС if( $u->info['sex'] == 0 ) { $text = '{u1} вмешался в поединок против {u2} »»'; }else{ $text = '{u1} вмешалась в поединок против {u2} »»'; } }else{ //Заносим в лог БС if( $u->info['sex'] == 0 ) { $text = '{u1} напал на {u2} завязался бой »»'; }else{ $text = '{u1} напала на {u2} завязался бой »»'; } } if( isset($usr_real['id'])) { $usrreal = ''; if( $usr_real['align'] > 0 ) { $usrreal .= ''; } if( $usr_real['clan'] > 0 ) { $usrreal .= ''; } $usrreal .= ''.$usr_real['login'].'['.$usr_real['level'].']'; }else{ $mereal = 'Невидимка[??]'; } if( isset($me_real['id']) ) { $mereal = ''; if( $me_real['align'] > 0 ) { $mereal .= ''; } if( $me_real['clan'] > 0 ) { $mereal .= ''; } $mereal .= ''.$me_real['login'].'['.$me_real['level'].']'; }else{ $mereal = 'Невидимка[??]'; } $text = str_replace('{u1}',$mereal,$text); $text = str_replace('{u2}',$usrreal,$text); //Добавляем в лог БС mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( "1", "'.mysql_real_escape_string($text).'", "'.time().'", "'.$bs['id'].'", "'.$bs['count'].'", "'.$bs['city'].'", "'.round($bs['money']*0.85,2).'","'.$i.'" )'); // unset($text,$usrreal,$mereal,$usr_real,$me_real); // header('location: main.php'); } }else{ $error = 'Персонаж не найден в этом турнире'; } } $box = mysql_fetch_array(mysql_query('SELECT * FROM `bs_map` WHERE `mid` = "'.mysql_real_escape_string($bmid).'" AND `x` = "'.$u->info['x'].'" AND `y` = "'.$u->info['y'].'" LIMIT 1')); if( !isset($box['id']) ) { $box2 = mysql_fetch_array(mysql_query('SELECT * FROM `bs_map` WHERE `mid` = "'.mysql_real_escape_string($bmid).'" AND `y` = "'.$u->info['x'].'" AND `x` = "'.$u->info['y'].'" LIMIT 1')); if( isset($box2['id']) ) { $u->info['x'] = $box2['y']; $u->info['y'] = $box2['x']; mysql_query('UPDATE `stats` SET `x` = "'.$u->info['x'].'",`y` = "'.$u->info['y'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); $bot = $box2; } unset($box2); } if( !isset($box['id']) ) { //Клетка не найдена $map['name'] = 'Неизвестная локация: '.$u->info['x'].' . '.$u->info['y']; if( $u->info['x'] == 0 && $u->info['y'] == 0 ) { mysql_query('UPDATE `stats` SET `x` = "-3",`y` = "-8" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); header('location: main.php'); die(); } }else{ //Действия на клетке $goto = false; if( isset($_GET['up']) ) { if( $box['up'] == 0 ) { $error = 'Проход не существует'; }else{ if( $box['up'] > 1 ) { $goto = mysql_fetch_array(mysql_query('SELECT `id` FROM `bs_map` WHERE `mid` = "'.mysql_real_escape_string($bmid).'" AND `id` = "'.mysql_real_escape_string($box['up']).'" LIMIT 1')); if( isset($goto['id']) ) { $goto = array( $goto['x'], $goto['y'] ); } }else{ $goto = array( $box['x'] - 1, $box['y'] ); } } }elseif( isset($_GET['down']) ) { if( $box['down'] == 0 ) { $error = 'Проход не существует'; }else{ if( $box['down'] > 1 ) { $goto = mysql_fetch_array(mysql_query('SELECT `id` FROM `bs_map` WHERE `mid` = "'.mysql_real_escape_string($bmid).'" AND `id` = "'.mysql_real_escape_string($box['down']).'" LIMIT 1')); if( isset($goto['id']) ) { $goto = array( $goto['x'], $goto['y'] ); } }else{ $goto = array( $box['x'] + 1, $box['y'] ); } } }elseif( isset($_GET['left']) ) { if( $box['left'] == 0 ) { $error = 'Проход не существует'; }else{ if( $box['left'] > 1 ) { $goto = mysql_fetch_array(mysql_query('SELECT `id` FROM `bs_map` WHERE `mid` = "'.mysql_real_escape_string($bmid).'" AND `id` = "'.mysql_real_escape_string($box['left']).'" LIMIT 1')); if( isset($goto['id']) ) { $goto = array( $goto['x'], $goto['y'] ); } }else{ $goto = array( $box['x'] , $box['y'] - 1); } } }elseif( isset($_GET['right']) ) { if( $box['right'] == 0 ) { $error = 'Проход не существует'; }else{ if( $box['right'] > 1 ) { $goto = mysql_fetch_array(mysql_query('SELECT `id` FROM `bs_map` WHERE `mid` = "'.mysql_real_escape_string($bmid).'" AND `id` = "'.mysql_real_escape_string($box['right']).'" LIMIT 1')); if( isset($goto['id']) ) { $goto = array( $goto['x'], $goto['y'] ); } }else{ $goto = array( $box['x'] , $box['y'] + 1); } } } if( $goto != false ) { $stop_s = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `id_eff` = 2 AND `timeUse` > "'.time().'" LIMIT 1')); if($u->info['timeGo'] < time() ) { if(!$stop_s['id']) { $trap = mysql_fetch_array(mysql_query('SELECT * FROM `bs_trap` WHERE `bid` = "'.$bs['id'].'" AND `login` != "'.$u->info['login'].'" AND `count` = "'.$bs['count'].'" AND `x` = "'.$goto[0].'" AND `y` = "'.$goto[1].'" LIMIT 1')); if( isset($trap['id']) ) { if(rand(0, 100) < $trap['chance'] || $trap['chance'] == 0 ) { //Добавляем эффект и отнимаем НР $ptntew = rand(1, 10)*60; mysql_query('INSERT INTO `eff_users` (`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`img2`) VALUES ( "2","'.$u->info['id'].'","Путы (Ловушка '.$trap['login'].')","puti='.(time()+$ptntew).'","1","'.(time()+$ptntew).'","chains.gif" ) '); if( $u->stats['hpNow'] > floor($u->stats['hpAll']/100*33)) { $trap_hpmin = round($u->stats['hpNow']/2); $u->stats['hpNow'] = $u->stats['hpNow']-$trap_hpmin; mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->stats['hpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); } if( $u->stats['hpNow'] < 0 ) { $u->stats['hpNow'] = 0; }elseif( $u->stats['hpNow'] > $u->stats['hpAll'] ) { $u->stats['hpNow'] = $u->stats['hpAll']; } //Заносим в чат $rtxt = '[img[items/trap.gif]] Персонаж "'.$u->info['login'].'" угодил в ловушку поставленную "'.$trap['login'].'". -'.$trap_hpmin.' ['.round($u->stats['hpNow']).'/'.round($u->stats['hpAll']).']'; mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('".$u->info['city']."','".$u->info['room']."','','','".$rtxt."','".time()."','6','0','1','1')"); //Заносим в лог БС $me_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "'.$u->info['id'].'" AND `login` = "'.$u->info['login'].'" LIMIT 1')); //Заносим в лог БС if( $u->info['sex'] == 0 ) { $text = '{u1} угодил в ловушку поставленную {u2}'; }else{ $text = '{u1} угодила в ловушку поставленную {u2}'; } if( isset($trap['id'])) { $usrreal = ''; if( $trap['align'] > 0 ) { $usrreal .= ''; } if( $trap['clan'] > 0 ) { $usrreal .= ''; } $usrreal .= ''.$trap['login'].'['.$trap['level'].']'; }else{ $mereal = 'Невидимка[??]'; } if( isset($me_real['id']) ) { $mereal = ''; if( $me_real['align'] > 0 ) { $mereal .= ''; } if( $me_real['clan'] > 0 ) { $mereal .= ''; } $mereal .= ''.$me_real['login'].'['.$me_real['level'].']'; }else{ $mereal = 'Невидимка[??]'; } $text = str_replace('{u1}',$mereal,$text); $text = str_replace('{u2}',$usrreal,$text); //Добавляем в лог БС mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( "2", "'.mysql_real_escape_string($text).'", "'.time().'", "'.$bs['id'].'", "'.$bs['count'].'", "'.$bs['city'].'", "'.round($bs['money']*0.85,2).'","'.$i.'" )'); // unset($text,$usrreal,$mereal,$usr_real,$me_real); //Удаляем ловушку mysql_query('DELETE FROM `bs_trap` WHERE `id` = "'.$trap['id'].'" LIMIT 1'); } } mysql_query('UPDATE `stats` SET `x` = "'.$goto[0].'" , `y` = "'.$goto[1].'" , `timeGo` = "'. ( time() + $box['timeGo'] ) .'" , `timeGoL` = "'. ( time() ) .'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); header('location: /main.php'); die(); } else { $error = "Вы в ловушке..."; } }else{ $error = 'Вы не можете так быстро перемещаться...'; } } //Данные клетки $map['name'] = $box['name']; if( $box['up'] > 0 ) { $map['up']['i'] = ''; $map['up']['js'] = ''; } if( $box['left'] > 0 ) { $map['left']['i'] = ''; $map['left']['js'] = ''; } if( $box['right'] > 0 ) { $map['right']['i'] = ''; $map['right']['js'] = ''; } if( $box['down'] > 0 ) { $map['down']['i'] = ''; $map['down']['js'] = ''; } } if( $box['up'] > 0 ) { if( $box['up'] > 1 ) { $title_locs['up'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "'.$box['mid'].'" AND `id` = "'.$box['up'].'" LIMIT 1')); }else{ $title_locs['up'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "'.$box['mid'].'" AND `x` = "'.($box['x']-1).'" AND `y` = "'.$box['y'].'" LIMIT 1')); } $title_locs['up'] = $title_locs['up']['name']; } if( $box['down'] > 0 ) { if( $box['down'] > 1 ) { $title_locs['down'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "'.$box['mid'].'" AND `id` = "'.$box['down'].'" LIMIT 1')); }else{ $title_locs['down'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "'.$box['mid'].'" AND `x` = "'.($box['x']+1).'" AND `y` = "'.$box['y'].'" LIMIT 1')); } $title_locs['down'] = $title_locs['down']['name']; } if( $box['left'] > 0 ) { if( $box['left'] > 1 ) { $title_locs['left'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "'.$box['mid'].'" AND `id` = "'.$box['left'].'" LIMIT 1')); }else{ $title_locs['left'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "'.$box['mid'].'" AND `y` = "'.($box['y']-1).'" AND `x` = "'.$box['x'].'" LIMIT 1')); } $title_locs['left'] = $title_locs['left']['name']; } if( $box['right'] > 0 ) { if( $box['right'] > 1 ) { $title_locs['right'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "'.$box['mid'].'" AND `id` = "'.$box['right'].'" LIMIT 1')); }else{ $title_locs['right'] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `bs_map` WHERE `mid` = "'.$box['mid'].'" AND `y` = "'.($box['y']+1).'" AND `x` = "'.$box['x'].'" LIMIT 1')); } $title_locs['right'] = $title_locs['right']['name']; } ?>
error) && $u->error != ''){ ?>

 error)){ echo ''.$u->error.''; } ?>

'.$error2.''; } ?> userInfo(); $sp = mysql_query('SELECT * FROM `bs_trap` WHERE `bid` = "'.$bs['id'].'" AND `count` = "'.$bs['count'].'" AND `login` = "'.$u->info['login'].'" AND `x` = "'.$u->info['x'].'" AND `y` = "'.$u->info['y'].'"'); while($pl = mysql_fetch_array($sp)) { echo ''; } if(isset($u->stats['puti'])) { echo '
Вы не можете передвигаться еще '.$u->timeOut($u->stats['puti']-time()).' '; } echo ''; echo $bs_items; ?>
'.$error.''; } ?>

   

'; } ?>
href="?left">
href="?up">
href="?down">
href="?right">
Всего живых участников на данный момент: 0) { ?> + ...
Тип турнира: , История текущего турнира.