Вход Регистрация
Файл: public_html/coliseum.php
Строк: 894
<?
/*
*
Create 18.06.2017
Author: XxxDIABLOxxX
*
*/
        
    
foreach(array('common''functions''user''h') as $cat) {
         
         
$title 'Колизей';
         include 
'./system/'.$cat.'.php';
    
    }
    
    if(!
$user OR $user['level'] < 3) {
        exit(
header('location: /'));
    }
  
 
if(
$user['level'] > 9) {
    
     
/* Number star rang */
    
     
$_rang = array(25 => 324 => 323 => 322 => 421 => 420 => 419 => 518 => 517 => 516 => 615 => 614 => 613 => 712 => 711 => 7,  10 => 8=> 8=> 8=> 9=> 9=> 9=> 9=> 10=> 10=> 10);
     
       
/* User */
     
         
$member mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `user` = "'.$user['id'].'" ORDER BY `time` DESC LIMIT 1'));
         
         if(
$member) {
             
             
$battle mysql_fetch_array(mysql_query('SELECT * FROM `coliseum` WHERE `id` = "'.$member['battle'].'"'));
         }
         
         
$list_dead mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0"'),0);
              
              
$_list_rows = array(=> 1=> 2=> 3=> 4=> 5);
              
    if(
$member['exit'] == && $battle['start'] == && $battle['end'] == 0) {
        
        if(
mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0"'),0) == 1) {
            
                    
/* Result win */
             
        
$tops mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead_coll` = 0');
             while(
$row mysql_fetch_array($tops)) {
                 
mysql_query("UPDATE `coliseum_member` SET `dead_coll` = 5 WHERE `battle` = ".$battle['id']." AND `user` = ".$row['user']." ");
        }
        
         
$_stars mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" ORDER BY `dead_coll` DESC LIMIT '.mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0).'');
         
         while(
$row mysql_fetch_array($_stars)) { 
         
         
$_star_clones++;
         
         
$coliseum_users mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"'));
             
             if(
$_star_clones == 1$_stt = ($coliseum_users['rang_star'] + 1);
            if(
$_star_clones == 2$_stt = ($coliseum_users['rang_star'] + '0.5');
            if(
$_star_clones == 3$_stt = ($coliseum_users['rang_star'] + 0);
            if(
$_star_clones == 4$_stt = ($coliseum_users['rang_star'] - '0.5');
            if(
$_star_clones == 5$_stt = ($coliseum_users['rang_star'] - 1);
    
         if(
$coliseum_users['rang'] == 25) {
         
mysql_query('UPDATE `users` SET `rang_star` = "'.($_stt '0' ''.$_stt.'').'" WHERE `id` = "'.$coliseum_users['id'].'"');
         }else{
         
mysql_query('UPDATE `users` SET `rang_star` = "'.$_stt.'" WHERE `id` = "'.$coliseum_users['id'].'"');
         }
         if(
$row['kills'] > 2) {
               
mysql_query('UPDATE `users` SET `rang_star` = `rang_star` + 1 WHERE `id` = "'.$coliseum_users['id'].'"');
         }
        

        }
              
          
mysql_query('UPDATE `coliseum` SET `end` = "1" WHERE `id` = "'.$battle['id'].'"');
        
         exit(
header('location: /coliseum/'));
  
}

/* Journal */

    
function Journal($battle$user$object$log$show) {
        
mysql_query('INSERT INTO `coliseum_log` (`battle`,
                                                 `user`,
                                                 `object`,
                                                 `text`,
                                                 `show`) VALUES ("'
.$battle.'","'.$user.'","'.$object.'","'.$log.'","'.$show.'")');
    }
  
  
    
/* Global associative massive ability */
  
   
$_ability = array(
  
  
'a_1_bonus' => array(25252530354045455055656570758085859095100105105145165165),
  
'a_1_chanse' => array(5555558888111111111114141414141717202323),
  
  
'a_2_bonus' => array(25252530354045455055656570758085859095100105105145165165),
  
'a_2_chanse' => array(5555558888111111111114141414141717202323),
  
  
'a_3_bonus' => array(5,5,8,11,14,17,17,20,23,26,29,29,32,35,38,41,41,44,47,50,53,53,77,89,89),
  
'a_3_crit_chanse' => array(5,5,5,5,5,5,7,7,7,7,7,9,9,9,9,9,11,11,11,11,11,13,15,17,17),
  
'a_3_chanse' => array(20,20,20,20,20,20,25,25,25,25,25,30,30,30,30,30,35,35,35,35,35,40,45,50,50),
  
  
'a_4_bonus' => array(20,20,22,24,26,28,28,30,32,34,36,36,36,38,40,42,44,44,46,48,50,52,52,68,76,76),
  
'a_4_chanse' => array(5,5,5,5,5,5,10,10,10,10,10,15,15,15,15,15,20,20,20,20,20,25,30,35,35),
  
  
'a_5_bonus' => array(2,2.5,3,3.5,4,4.5,5,6,6.6,7,7.7,8,8.8,9,9.9,10,10.5,11,11.5,12,13,14,15,18,20),
  
'a_5_chanse' => array(5,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,10,11,13,15)
  
  );
  
    
/* Global associative massive color ability */
  
  
$_color = array (=> '#908060'=> '#60c030'=> '#6090c0'=> '#c060f0'=> '#f06000'=> '#909090'=> '#909090');
  
  
/* Battle bots */

  
if(!$_GET['attack'] == true) {
  
$_battleBots mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `bot` = "1" AND `user` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1'));
  
 if(
$_battleBots['object'] > 0) {
  
  if(
$_SESSION['time_bot'] < time()) {
       
        
$us mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$_battleBots['user'].'"'));     // я  
        
$opp mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$_battleBots['object'].'"')); // Противник
           
      
$dmg_bot 0
      
$ability_1_1 false
      
$ability_2_2 false
      
$ability_3_3 false
      
$ability_4_4 false;
      
$ability_5_5 false;        
        
        if(
$us['ability_1'] > 0) if(mt_rand(0100) <= $_ability['a_1_chanse'][$us['ability_1']]) $ability_1_1 true;
         if(
$us['ability_2'] > 0) if(mt_rand(0100) <= $_ability['a_2_chanse'][$us['ability_2']]) $ability_2_2 true;
          if(
$us['ability_3'] > 0) if(mt_rand(0100) <= $_ability['a_3_chanse'][$us['ability_3']]) $ability_3_3 true;
           if(
$us['ability_4'] > 0) if(mt_rand(0100) <= $_ability['a_4_chanse'][$us['ability_4']]) $ability_4_4 true;
            if(
$us['ability_5'] > 0) if(mt_rand(0100) <= $_ability['a_5_chanse'][$us['ability_5']]) $ability_5_5 true;
            
            
$dmg_bot += ceil (rand(($us['str']/6), ($us['str']/4)));
            
             if (
$ability_1_1 == true$dmg_bot += ceil (($dmg_bot 100) * $_ability['a_1_bonus'][$us['ability_1']]);
             
            
$dmg_bot -= ceil (rand(($opp['def']/12), ($opp['def']/7)));        
            
             if (
$dmg_bot 0$dmg_bot rand(0,20);
             
            
$crit $ability_3_3 == true ? ((rand (1,2)*($us['agi']/100) + $_ability['a_3_crit_chanse'][$us['ability_3']])-(rand (1,2) * ($opp['agi']/100))):((rand (1,2)*($us['agi']/100))-(rand (1,2)*($opp['agi']/100)));
            
             if (
mt_rand(0100) <= $crit) {   
             
             
$dmg_bot *= 2;
             
             if(
$ability_3_3 == true$dmg_bot += ceil (($dmg_bot/100) * $_ability['a_3_bonus'][$us['ability_3']]);                                
             
             
$log_crit true;
             
             }
             
            
$dodge = ((rand (1,2) * ($us['agi']/100)) - (rand (1,2) * ($us['agi']/100)));
            
             if(
mt_rand(0100) <= $dodgerand(0,10);
             
             if(
$ability_5 == true) {
                 
mysql_query('UPDATE `users` SET `hp` = "'.($us['hp'] + round(($us['vit']/ 100) * $_ability['a_5_bonus'][$us['ability_5']])).'" WHERE `id` = "'.$us['id'].'"');
                 
            }
            
            if(
$dmg_bot 5$dmg_bot += rand(1,20);
            
            
    if(
$ability_1 == true) {
                
                
$logs '<img src='/images/icon/race/'.$us['r'].'.png' alt=''/> <b>'.$us['login'].'</b> применил <img src='/images/icon/quality/'.$us['ability_1_quality'].'.png'> <font color=''.$_color[$us['ability_1_quality']].''>Ярость титана</font>';
                
                
Journal($battle['id'], $us['id'], $opp['id'], $logs0);                
                
    }

    if(
$ability_3 == true) {
                   
               
$logs '<img src='/images/icon/race/'.$us['r'].'.png' alt=''/> <b>'.$us['login'].'</b> применил <img src='/images/icon/quality/'.$us['ability_3_quality'].'.png'> <font color=''.$_color[$us['ability_3_quality']].''>Вихрь критов</font>';  
               
               
Journal($battle['id'], $us['id'], $opp['id'], $logs0);               
                                                    
    }
        
 
    if(
$dmg_bot 0) {
      
          
$logs '<img src='/images/icon/race/'.$us['r'].'.png' alt=''/> <b>'.$us['login'].'</b> ударил <img src='/images/icon/race/'.$opp['r'].'.png' alt='*'/> <b>'.$opp['login'].'</b> на <b>'.$dmg_bot.'</b> '.($log_crit == true '(крит)':'');  
          
          
Journal($battle['id'], $us['id'], $opp['id'], $logs0);          
          
    }
    
    
    
mysql_query('UPDATE `users` SET `hp` = "'.($opp['hp'] - $dmg_bot).'" WHERE `id` = "'.$opp['id'].'"');
    if(
$dmg_bot >= $opp['hp']) {
         
mysql_query('UPDATE `users` SET `hp` = "0" WHERE `id` = "'.$opp['id'].'"');
    }

    if(
$dmg_bot >= $opp['hp']) {

      
$logs '<img src='/images/icon/race/'.$us['r'].'.png' alt=''/> <b>'.$us['login'].'</b> убил <img src='/images/icon/rip.png' alt='*'/> <b>'.$opp['login'].'</b>';  
      
      
Journal($battle['id'], $us['id'], $opp['id'], $logs0);
    
      
mysql_query('UPDATE `coliseum_member` SET `dead` = "1", `dead_coll` = '.$_list_rows[$list_dead].' WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$opp['id'].'"');
      
mysql_query('UPDATE `coliseum_member` SET `kills` = `kills` + 1 WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$us['id'].'"');

 
      
    }
    
    
    
$rand_object mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$us['id'].'" ORDER BY RAND() LIMIT 1'));

     
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_object['user'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$us['id'].'"');
    
    
    
$_SESSION['time_bot'] = time() + 1;
    
  }
  }
  }
  
  if(
$member['dead'] == 1) {
        
     if(
$_GET['end_fight'] == true) {
            
            
mysql_query('DELETE FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
            
            if(
mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `bot` = "0"'),0) == 0) {
            
mysql_query('DELETE FROM `coliseum_member` WHERE `bot` = "1" AND WHERE `battle` = "'.$battle['id'].'"');
            }
            
            
mysql_query('UPDATE `users` SET `rang_star` = "'.($user['rang_star'] < '0' ''.($user['rang_star'] - 1).'').'" WHERE `id` = "'.$user['id'].'"');
            if(
ceil($user['rang_star']) < 0) {
                
                if(
$user['rang'] != 25){
                    
mysql_query('UPDATE `users` SET `rang` = `rang` + 1, `rang_star` = 0 WHERE `id` = "'.$user['id'].'"'); 
                }
            
            
            exit(
header('Location: /coliseum/'));
            
     }
     }
        
?> 
     <div class='mini-line'></div>
         <div class='main' align='center'>
             <font color='#999'>Вы были убиты во время сражения, ожидайте окончания боя</font>
                 <br>В бою <img src="/images/icon/race/0.png" alt=""><img src="/images/icon/race/1.png" alt=""> 
                     <?=mysql_num_rows(mysql_query('SELECT * FROM `coliseum_member` WHERE `dead` = "0" AND `battle` = '.$battle['id'].''));?> титана <br />
                             <a class="btn" href="/coliseum/"><span class="end"><span class="label">Обновить</span></span></a> 
                                 <a class="btn" href="/coliseum/?end_fight=true"><span class="end"><span class="label">Закончить бой</span></span></a>
                                     <div class="separ"></div><table width="70%" border="0" cellpadding="0" cellspacing="0" align="center"><tbody><tr>
<?
$q 
mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" ORDER BY `dead_coll`');

     while(
$row mysql_fetch_array($q)) {
           
             
$_rows mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"'));
     
?>
         <td align="left">
             <img src="/images/icon/race/<?=$_rows['r'];?>.png" alt="*"> <?=$_rows['login'];?></td>
                 <td width="100px" align="left">
                     <?=($row['dead'] == '<img src="/images/icon/health.png" alt="hp"> '.$_rows['hp'].'' 'Убит в бою');?></td></tr></tr>

<?
}
?>
         </tbody>
             </table>
                 </div>
                     </div>
                         <div class="mini-line"></div>
<?
}

if(
$member['dead'] == 0) {
    
    if(isset(
$_GET['out_gate'])) {
        
?>
              <div class="main" align="center">
                 Ваш персонаж сейчас находится в бою, хотите туда вернуться?
                     <div class="separ"></div>
                         <a class="button" href="/coliseum/?">
                             <img src="/images/icon/2hit.png" alt=""> Вернуться в бой!</a>         
                                 <a class="button" href="/coliseum/?exit=true">выйти из боя</a></div>
        <?
        
include './system/f.php';
        exit;
}
    
    
if(
$_GET['exit'] == true) {
           
         
$log '<img src='/images/icon/race/'.$user['r'].'.png' alt=''/> <b>'.$user['login'].'</b> покидает бой';  
             
             
Journal($battle['id'], $user['id'], $object['id'], $log0);
             
        
mysql_query('UPDATE `coliseum_member` SET `dead` = "1", `dead_coll` = '.$_list_rows[$list_dead].' WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
        
        if(
$user['skull'] > 0) {
            
mysql_query("UPDATE `users` SET ".($user['skull'] <= '`skull` = 0' '`skull` = `skull` - 5')." WHERE `id` = ".$user['id']."");
        }
  
  
    exit(
header('location: /coliseum/'));
  
}
  
if(
$member['object'] == 0) {
  
    
$rand_object mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1'));
    
    
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_object['id'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');

}

if(
$member['object']) {

if(
$_GET['last'] == true) {
                 
         
$rand_object mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1'));
               
            
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_object['id'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
            
            exit(
header('location: /coliseum/'));

}


     
$member_object mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `id` = "'.$member['object'].'"'));

         
$object mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$member_object['user'].'"'));

              
              
$_memb mysql_fetch_array(mysql_query("SELECT * FROM `coliseum_member` WHERE `battle` = ".$battle['id']." AND `user` = ".$object['id'].""));
        
        
        if(
$object['hp'] < ( ( ($object['vit'] * 2) / 100 ) * 10 ) ) {
        
mysql_query("UPDATE `coliseum_member` SET `heal` = ".(time() + 90)." WHERE `battle` = ".$battle['id']." AND `user` = ".$object['id']."");
        
mysql_query("UPDATE `users` SET `hp` = ".($object['vit'] * 2)." WHERE `id` = ".$object['id']."");
       }
       
    
if(
$_GET['attack'] == true) {
  
      
$dmg 0
      
$ability_1 false
      
$ability_2 false
      
$ability_3 false
      
$ability_4 false;
      
$ability_5 false;
                
        
        if(
$user['ability_1'] > 0) if(mt_rand(0100) <= $_ability['a_1_chanse'][$user['ability_1']]) $ability_1 true;
         if(
$user['ability_2'] > 0) if(mt_rand(0100) <= $_ability['a_2_chanse'][$user['ability_2']]) $ability_2 true;
          if(
$user['ability_3'] > 0) if(mt_rand(0100) <= $_ability['a_3_chanse'][$user['ability_3']]) $ability_3 true;
           if(
$user['ability_4'] > 0) if(mt_rand(0100) <= $_ability['a_4_chanse'][$user['ability_4']]) $ability_4 true;
            if(
$user['ability_5'] > 0) if(mt_rand(0100) <= $_ability['a_5_chanse'][$user['ability_5']]) $ability_5 true;
            
            
$dmg += ceil (rand(($user['str']/6), ($user['str']/4)));
            
             if (
$ability_1 == true$dmg += ceil (($dmg 100) * $_ability['a_1_bonus'][$user['ability_1']]);
             
            
$dmg -= ceil (rand(($object['def']/12), ($object['def']/7)));        
            
             if (
$dmg 0$dmg 0;
             
            
$crit $ability_3 == true ? ((rand (1,2)*($user['agi']/100) + $_ability['a_3_crit_chanse'][$user['ability_3']])-(rand (1,2) * ($object['agi']/100))):((rand (1,2)*($user['agi']/100))-(rand (1,2)*($object['agi']/100)));
            
             if (
mt_rand(0100) <= $crit) {   
             
             
$dmg *= 2;
             
             if(
$ability_3 == true$dmg += ceil (($dmg/100) * $_ability['a_3_bonus'][$user['ability_3']]);                                
             
             
$log_crit true;
             
             }
             
            
$dodge = ((rand (1,2) * ($object['agi']/100)) - (rand (1,2) * ($user['agi']/100)));
            
             if(
mt_rand(0100) <= $dodge$dmg 0;
             
             if(
$ability_5 == true) {
                 
mysql_query('UPDATE `users` SET `hp` = "'.($user['hp'] + round(($user['vit']/ 100) * $_ability['a_5_bonus'][$user['ability_5']])).'" WHERE `id` = "'.$user['id'].'"');
                 
            }
            
            if(
$member['stone'] > time()) $dmg += ceil (($dmg 100) * 35);
            
            
            
$dmg_time time() - $member['time'];
            if(
$dmg_time 2$dmg 0;
            
    if(
$ability_1 == true) {
                
                
$log 'Вы применили <img src='/images/icon/quality/'.$user['ability_1_quality'].'.png'> <font color=''.$_color[$user['ability_1_quality']].''>Ярость титана</font>';    
                
                
Journal($battle['id'], $user['id'], 0$log$user['id']);
               
                
$log '<img src='/images/icon/race/'.$user['r'].'.png' alt=''/> <b>'.$user['login'].'</b> применил <img src='/images/icon/quality/'.$user['ability_1_quality'].'.png'> <font color=''.$_color[$user['ability_1_quality']].''>Ярость титана</font>';  
                
                
Journal($battle['id'], $user['id'], 0$log0);
    }

    if(
$ability_3 == true) {
    
               
$log 'Вы применили <img src='/images/icon/quality/'.$user['ability_3_quality'].'.png'> <font color=''.$_color[$user['ability_3_quality']].''>Вихрь критов</font>';    
               
               
Journal($battle['id'], $user['id'], 0$log$user['id']);
               
               
$log '<img src='/images/icon/race/'.$user['r'].'.png' alt=''/> <b>'.$user['login'].'</b> применил <img src='/images/icon/quality/'.$user['ability_3_quality'].'.png'> <font color=''.$_color[$user['ability_3_quality']].''>Вихрь критов</font>';    
               
               
Journal($battle['id'], $user['id'], 0$log0);
                                                        
    }
    
    if(
$dmg == 0) {
               
               
$log 'Вы промахнулись';
               
    }
    else
    {
      
         
$log 'Вы ударили <img src='/images/icon/race/'.$object['r'].'.png' alt='*'/> <b>'.$object['login'].'</b> на <b>'.$dmg.'</b> '.($log_crit == true '(крит)':''); 
      
    }
    
         
Journal($battle['id'], $user['id'], ($dmg $object['id']:0), $log$user['id']);
         
    if(
$dmg 0) {
             
             
$log '<img src='/images/icon/race/'.$user['r'].'.png'/> <b>'.$user['login'].'</b> ударил Вас на <b>'.$dmg.'</b> '.($log_crit == true '(крит)':'');    
             
            
Journal($battle['id'], $object['id'], $user['id'], $log$object['id']);
    
    }

    if(
$dmg 0) {
        
          
          
$log '<img src='/images/icon/race/'.$user['r'].'.png' alt=''/> <b>'.$user['login'].'</b> ударил <img src='/images/icon/race/'.$object['r'].'.png' alt='*'/> <b>'.$object['login'].'</b> на <b>'.$dmg.'</b> '.($log_crit == true '(крит)':'');    
          
          
Journal($battle['id'], $user['id'], $object['id'], $log0);

    }
    
    
mysql_query('UPDATE `users` SET `hp` = "'.($object['hp'] - $dmg).'" WHERE `id` = "'.$object['id'].'"');
    
mysql_query('UPDATE `coliseum_member` SET `time` = "'.time().'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');

    if(
$dmg >= $object['hp']) {

         
$log 'Вы убили <img src='/images/icon/race/'.$object['r'].'.png' alt='*'/> <b>'.$object['login'].'</b>'
         
             
Journal($battle['id'], $user['id'], $object['id'], $log$user['id']);

             
         
$log '<img src='/images/icon/race/'.$user['r'].'.png' alt='*'/> <b>'.$user['login'].'</b> убил Вас';    
         
             
Journal($battle['id'], $object['id'], $user['id'], $log$object['id']);
            
             
                  
$log '<img src='/images/icon/race/'.$user['r'].'.png' alt=''/> <b>'.$user['login'].'</b> убил <img src='/images/icon/rip.png' alt='*'/> <b>'.$object['login'].'</b>';  
             
             
Journal($battle['id'], $user['id'], $object['id'], $log0);
      
      
mysql_query('UPDATE `coliseum_member` SET `dead` = "1", `dead_coll` = '.$_list_rows[$list_dead].' WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$object['id'].'"');
      
mysql_query('UPDATE `coliseum_member` SET `kills` = `kills` + 1 WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');


      
$rand_object mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1'));

      
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_object['id'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
      
      
// Черепа выпадают за первые 15 убийств и начиная с 23 ранга
      
if($user['rang'] <= 23 OR $user['skull'] <= 1000) {
          
          if(
$user['skull'] <= 15 OR date('N') == OR date('N') == OR date('N') == OR date('N') == OR date('N') == 3) {
              
$_rands rand(0,1); // типо выпадет не выпадет что бы не было такого мол убил и сразу выпало тип как в тивар
              
if($_rands == 1) {
              
mysql_query("UPDATE `users` SET `skull` = `skull` + 1 WHERE `id` = ".$user['id']."");
              
$_SESSION['skull'] = 1// Если выпал череп но игрок тупо обновляет страницу покажем ему что он выиграл череп
              
}
          }elseif(
$user['skull'] > 14) {
              
// Черепа падают рандомно чем сильнее противник тем больше черепов
              
if( ($object['str'] + $object['vit'] + $object['agi'] + $object['def']) > $user['str'] + $user['vit'] + $user['agi'] + $user['def']) {
                  
mysql_query("UPDATE `users` SET `skull` = `skull` + 1 WHERE `id` = ".$user['id']."");
                  
$_SESSION['skull'] = 1;
              }else{
                    
$w_chanse rand(1,100);
                    
$chanse rand(1,10) * rand(1,70);
                    if(
$chanse $w_chanse) {
                    
                    
mysql_query("UPDATE `users` SET `skull` = `skull` + 1 WHERE `id` = ".$user['id']."");
                    
$_SESSION['skull'] = 1;

                    }
                    
              } 
          }
          
      }
      
      
$_SESSION['dead'] = 1;
      
    }
    

  }  
  
    
    
if(
$_SESSION['dead'] == 1) {
?>  
    
     <div class='block'><center>
     <img src="/images/icon/rip.png" alt="*"> Вы убили: <img src='/images/icon/race/<?=$object['r'];?>.png' alt='*'/> <b><?=$object['login'];?> 
     <?=($_SESSION['skull'] == '→ <img src="/images/rang/skull.png" alt="*">' '');?></center>
     </b>

<?
unset($_SESSION['dead'], $_SESSION['skull']);

}else{
?>  
<style>
     .life_bar{
         max-width:50%;
             border:#c90 solid 1px;
                 margin:5px auto
    }
    
    .life_bar-green{
          background-color:#393
    }
    
    .life_bar,.life_bar-green{
          
          height:3px;
             padding:0
    }
</style>

         <div class='block'><center>Цель: <img src='/images/icon/race/<?=$object['r'];?>.png' alt='*'/> <b><?=$object['login'];?></b> 
             <img src='/images/icon/health.png' alt='*'/> <?=$object['hp']?></center>
                 <div class="life_bar">
                     <div class="life_bar-green" style="width: <?=@round(100/( ($object['vit'] * 2) ) * $object['hp']);?>%"></div></div>

<?
}
      
if(
$ability_1 == true OR $ability_2 == true OR $ability_3 == true OR $ability_4 == true OR $ability_5 == true) {  
      
      echo 
"<div class='separ'></div><center>";
      
      if(
$ability_1 == true) echo ' <img src='/images/ability/1.'.$user['ability_1_quality'].'.png' width='25px' height='25px' alt='*'/> ';
         if(
$ability_2 == true) echo ' <img src='/images/ability/2.'.$user['ability_2_quality'].'.png' width='25px' height='25px' alt='*'/> ';
             if(
$ability_3 == true) echo ' <img src='/images/ability/3.'.$user['ability_3_quality'].'.png' width='25px' height='25px' alt='*'/> ';
                 if(
$ability_4 == true) echo ' <img src='/images/ability/4.'.$user['ability_4_quality'].'.png' width='25px' height='25px' alt='*'/> ';
                     if(
$ability_5 == true) echo ' <img src='/images/ability/5.'.$user['ability_5_quality'].'.png' width='25px' height='25px' alt='*'/></center>';

}

echo 
"</div>";

}

if(
$_memb['dead'] == 1) {
    
          
$rand_object mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1'));

          
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_object['id'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
}
  
     if(
$_memb['bot'] == && $_SESSION['target_bot_time'] < time()) {    
         
         
$opponent_dmg += round(rand(($object['str']/6),($object['str']/4)));
             if(
$ability_2 == true$dmg -= round(($opponent_dmg 100) * $_ability['a_2_bonus'][$user['ability_2']]);
                 
$opponent_dmg -= round(rand(($user['def']/12),($user['def']/7)));
                     if(
$opponent_dmg 0$opponent_dmg rand(0,20);
                         
$opponent_crit = ( (rand(1,2) * ($object['agi'] / 100) ) - (rand(1,2) * ($user['agi'] / 100)));
                         if(
mt_rand(0100) <= $opponent_crit) {
                             
                             
$opponent_dmg *= 2;
                             if(
$ability_4 == true) {
                                 
$opponent_dmg -= round(($opponent_dmg 100) * $_ability['a_4_bonus'][$user['ability_4']]);
                             }
                             
                             
$log_crit_opp true;
    
     }    
    
         
$opponent_dodge = ( (rand(1,2) * ($user['agi'] / 100) ) - (rand(1,2) * ($object['agi'] / 100)));
         
             if(
mt_rand(0100) <= $opponent_dodge$opponent_dmg rand(0,20);

                 if((
time() - $member['time']) > 14) {
                         
                         
$_b_time time() - $member['time'];
                             
                             
$opponent_dmg += ceil(($_b_time 5) * 2);
              
                 }
                 
                 if(
$member['grass'] > time())  $opponent_dmg -= ceil (($opponent_dmg 100) * 35);

         
        
        
mysql_query('UPDATE `users` SET `hp` = "'.($user['hp'] - $opponent_dmg).'" WHERE `id` = "'.$user['id'].'"');
        
        
/* Journal */
        
        
$log '<font color='#c06060'><img src='/images/icon/race/'.$object['r'].'.png'/> <b>'.$object['login'].'</b> ударил Вас на <b>'.$opponent_dmg.'</b> '.($log_crit_opp == true ? '(крит)':'</font>');    
         
             
Journal($battle['id'], $object['id'], $user['id'], $log$user['id']);
        
        if(
$opponent_dmg >= $user['hp']) {
                    
                 
$log '<font color='#c06060'><img src='/images/icon/race/'.$object['r'].'.png'/> <b>'.$object['login'].'</b> убил вас!<b></font>'; 
                    
                     
Journal($battle['id'], $object['id'], $user['id'], $log$user['id']);

         
mysql_query('UPDATE `coliseum_member` SET `dead` = "1", `dead_coll` = '.$_list_rows[$list_dead].' WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
         
         
mysql_query('UPDATE `coliseum_member` SET `kills` = `kills` + 1 WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$object['id'].'"');
         
             
$log '<img src='/images/icon/rip.png' alt='*'/> <img src='/images/icon/race/'.$object['r'].'.png' alt='*'/> <b>'.$object['login'].'</b> убил <img src='/images/icon/race/'.$user['r'].'.png' alt='*"'> <b>'.$user['login'].'</b>';    
          
                 Journal(
$battle['id'], $user['id'], $object['id'], $log, 0);
             
             
$_SESSION['dead_us'] = 1; /* Dead my user */
                                                                                     
        }
        
        
$_SESSION['target_bot_time'] = time() + 3;
        
    }

?>

     <div class='main' align='center'>
     
    <?
if(
$_SESSION['dead_us'] == 0) {
    
    ?>
    <br />
         <a href='/coliseum/?attack=true' class='btn'><span class="
end">
         <span class="
label"><?=(($dmg >= $object['hp']) ? 'Бить любого' : 'Атаковать');?></span></a> 
         
    <?
    
    }else{
    
    ?>
    
             <a href='/coliseum/?' class='btn'><span class="
end">
         <span class="
label">Закончить бой</span></span></a>
    
    <?
    unset(
$_SESSION['dead_us']);
}
?>
             <a href='/coliseum/?last=true' class='btn'><span class="
end">
         <span class="
label">Сменить цель</span></span></a></li>
    <div class='separ' align='center'></div>
<?    
if(isset(
$_GET['dodge']) && $member['uv'] < time()) {
    
        mysql_query("
UPDATE `coliseum_memberSET `uv` = ".(time() + 20)." WHERE `battle` = ".$battle['id']." AND `user` = ".$user['id']."");
        
        
$rand_bot = mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$object['id'].'" ORDER BY RAND() LIMIT 1'));
        
        mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_bot['
user'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$object['id'].'"');
        
        exit(header('Location: /coliseum/'));
        
}
    
?>

         <a href='/coliseum/?dodge' class='btn'><span class="
end">
         <span class="
label">
         Уворот <?=(
$member['uv'] > time() ? '  <span id="time_'.($member['uv'] - time()).'000">'._time($member['uv'] - time()).'</span> ' : ' ');?></span></span></a>                     
<?
if(isset(
$_GET['heal']) && $member['heal'] < time()) {
    
        mysql_query("
UPDATE `coliseum_memberSET `heal` = ".(time() + 90)." WHERE `battle` = ".$battle['id']." AND `user` = ".$user['id']."");
        mysql_query("
UPDATE `usersSET `hp` = ".($user['vit'] * 2)." WHERE `id` = ".$user['id']."");
        exit(header('Location: /coliseum/'));

}

      if(
$_GET['startMaking'] == 'stone' OR $_GET['startMaking'] == 'grass') {
        
         if(
$user[$_GET['startMaking']] >= 1 and $member[$_GET['startMaking']] < time()){
    
      mysql_query("
UPDATE `coliseum_memberSET  `".$_GET['startMaking']."` = ".(time() + 59)." WHERE `battle` = ".$battle['id']." AND `user`= ".$user['id']."");    
      mysql_query("
UPDATE `usersSET  `".$_GET['startMaking']."` = '".($user[$_GET['startMaking']] - 1)."' WHERE `id`='".$user['id']."'");    
                     
    }
        exit(header('location: /coliseum/'));
    }
    
    
?>

         <a href='/coliseum/?heal' class='btn'><span class="
end">
         <span class="
label">
         Настойка <?=(
$member['heal'] > time() ? ' <span id="time_'.($member['heal'] - time()).'000">'._time($member['heal'] - time()).'</span> ' : ' ');?></span></span></a>
         <div class='separ' align='center'></div>
         <table border="
0" cellpadding="0" cellspacing="0" align="center"><tbody><tr><td style="border-right:1px solid #3e3d36;padding:0px 10px;">
         
<class="btn" href="?startMaking=stone">
         <
span class="end">
         <
span class="label">
         <
img src="/images/res/stone_1.png" alt=""Камень</span></span></a><br
        <?
         if(
$user['stone'] > 0) {
        
?>
        
        <?=($member['stone'] > time() ? '<span id="time_'.($member['stone'] - time()).'000">'._time($member['stone'] - time()).'</span>' '+35% урон');?>
        
        <?
        
}elseif($member['stone'] > time()) {
        
?>
        
        <?=($member['stone'] > time() ? '<span id="time_'.($member['stone'] - time()).'000">'._time($member['stone'] - time()).'</span>' '+35% урон');?>
        
        <?
        
}else{
            
            if(
$_GET['buyStone'] == true && $user['g'] > && $member['stone'] < time()) {
                    
                
mysql_query("UPDATE `coliseum_member` SET  `stone` = ".(time() + 59)." WHERE `battle` = ".$battle['id']." AND `user`= ".$user['id']."");    
                
                
mysql_query("UPDATE `users` SET  `g` = `g` - 6 WHERE `id`='".$user['id']."'");    
                 exit(
header('Location: /coliseum/'));
      
            }
            
            
?>
            <a href='?buyStone=true'>Купить за <img src="/images/icon/gold.png" alt="*"> 6 золота</a>
            <?
        
}
        
?>
         </td>
         
         <td style="border-left:1px solid #1f1f1a;padding:0px 0px 0px 10px;">
         <a class="btn" href="?startMaking=grass">
         <span class="end">
         <span class="label">
         <img src="/images/res/grass_2.png" alt=""> Трава</span></span></a><br> 
         <?
         
if($user['grass'] > 0) {
        
?>
        
        <?=($member['grass'] > time() ? '<span id="time_'.($member['grass'] - time()).'000">'._time($member['grass'] - time()).'</span>' '-35% урон');?>
        
        <?
        
}elseif($member['grass'] > time()) {
        
?>
        
        <?=($member['grass'] > time() ? '<span id="time_'.($member['grass'] - time()).'000">'._time($member['grass'] - time()).'</span>' '-35% урон');?>
        
        <?
        
}else{
            
              if(
$_GET['buyGrass'] == true && $user['g'] > && $member['grass'] < time()) {
                                  
                
mysql_query("UPDATE `coliseum_member` SET  `grass` = ".(time() + 59)." WHERE `battle` = ".$battle['id']." AND `user`= ".$user['id']."");    
                
                
mysql_query("UPDATE `users` SET  `g` = `g` - 6 WHERE `id`='".$user['id']."'");
                  
                 exit(
header('Location: /coliseum/'));                  
      
            }
            
            
?>
            <a href='?buyGrass=true'>Купить за <img src="/images/icon/gold.png" alt="*"> 6 золота</a>
            <?
        
}
        
?>
         </td></tr></tbody></table></div>

         <div class='mini-line'></div>
             <div class='main'>В бою: 
<?

$q 
mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" ORDER BY `dead_coll`');

     while(
$row mysql_fetch_array($q)) {
         
         
$_row_i++;
      
         
/* Search opponent */
         
         
if($row['bot'] == && $row['object'] <= 0) {
               
                 
$rand_bot mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$row['user'].'" ORDER BY RAND() LIMIT 1'));
                 
        if(!
mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `object` = '.$rand_bot['user'].' AND `battle` = "'.$battle['id'].'"'))) {        
                
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_bot['user'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$row['user'].'"');
        
        }else{
            
             
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$user['id'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$row['user'].'"');
        
        }
        }
      
      
$_list_user mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"'));
      
      
      if(
$row['dead'] == 0) {
      
?>
      <img src="/images/icon/<?=(($row['user'] == $user['id']) ? 'health' '/race/'.$_list_user['r'].'');?>.png" alt="*"> <?=$_list_user['hp'];?><?=($_row_i ',' '');?>
      <?
      
}else{
      
?>
      <img src="/images/icon/rip.png" alt="*"> <?=($_row_i ',' '');?>
      <?
      
}
      }
      }
?>
</div>
<?
  
     $count 
mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_log` WHERE `battle` = "'.$battle['id'].'"'),0);
     if(
$count 0) {
?>
     <div class='mini-line'></div>
         <div class='main'>

<?

$q 
mysql_query('SELECT * FROM `coliseum_log` WHERE `battle` = "'.$battle['id'].'" ORDER BY `id` DESC LIMIT 15');

  while(
$row mysql_fetch_array($q)) {

if(
$row['user'] == $user['id'] && $row['show'] == $user['id'] OR $row['object'] == $user['id'] && $row['show'] == $user['id']) {
  
      echo 
''.$row['text'].'<br/>';
  
    }
    elseif(
$row['show'] == 0)
    {
    
    if(
$row['user'] == $user['id']) {
        

    }
    else
    {

    if(
$row['object'] == $user['id']) {
    
    }
    else
    {
    
      echo 
$row['text'].'<br/>';
  
    }
  
    }
    }
    } 
     
echo 
"</div>";

  }else{
     
    
?>
     
     <div class='mini-line'></div><div class='main'>Сражение началось!</div>
     
    <?     
     
     
}
     
    
?>
         <div class='mini-line'></div>
         <div class='foot center'>
             <?=$user['login']?>
                 <div align='center'><img src='/images/icon/level.png' alt='*'/> <?=$user['level']?> | <img src='/images/icon/gold.png' alt='*'/> <?=n_f($user['g'])?> | <img src='/images/icon/silver.png' alt='*'/> <?=n_f($user['s'])?></div>
                     </div><br />
    <?
    
    
if($member['dead'] == 0) {
        
    
?>
    
    <center><a href='/coliseum/?out_gate'> Покинуть бой</a></center>
    
    <?

}
 
     exit;
  
    }else{
        
    if(
$member['exit'] == && $battle['start'] == && $battle['end'] == 1) {
         
         
$q mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" ORDER BY `dead_coll` DESC LIMIT '.mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0).'');
             
             while(
$row mysql_fetch_array($q)) {
                 
                 
$top++;
     
    if(
$top == 1) {
    
     
$best mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"'));
     
    }
  
  if(
$row['user'] == $user['id']) {
  
      
$place $top;
      
  
  }
  }

  
$_s round(rand(1,100) + (100 $place) + (100 $member['kills']));

  
$_exp round(rand(1,100) + (100 $place) + (25 $member['kills']));
    
  if(
$clan_memb && $clan_memb['v'] > 0$_exp += round($_exp/100) * $_clan_memb['v'];
  
  if(
$premium$_exp+= round($_exp100) * 25;
    
  
mysql_query('UPDATE `users` SET `s` =   `s` + '.$_s.', `exp` = `exp` + '.$_exp.' WHERE `id` = "'.$user['id'].'"');
  
  if(
$clan) {
      
      
mysql_query('UPDATE `clans`     SET `exp` = `exp` + '.$_exp.' WHERE `id` = "'.$clan['id'].'"');
      
mysql_query('UPDATE `clan_memb` SET `exp` = `exp` + '.$_exp.' WHERE `clan` = "'.$clan['id'].'" AND `user` = "'.$user['id'].'"');

   }

?>
         
     <div class='main' align='center'>
         <img src='/images/icon/2hit.png' alt='*'/> <font color='#90c090'><b>Бой окончен!</b></font> <img src='/images/icon/2hit.png' alt='*'/>                  <br />
         <?
         $_stars 
mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" ORDER BY `dead_coll` DESC LIMIT '.mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0).'');
         
         while(
$row mysql_fetch_array($_stars)) { 
         
         
$_star_clone++;
         
                  
$coliseum_users mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"'));
         
         if(
$row['user'] == $user['id']) {
             
              if(
ceil($user['rang_star']) >= $_rang[$user['rang']]){
                  if(
$user['rang'] == 1){
                  }else{
                  
?>
                  <img src="/images/rang/ic_r.png" alt=""> Ты получил новый ранг <img src="/images/rang/ic_r.png" alt=""><br />
                  <img src="/images/rang/<?=($user['rang'] + 1);?>.png" alt="*"><br />
                  <font color="#9C9">+10 <img src="/images/icon/gold.png" alt=""> золота за ранг</font><br />
                   <?                   
                  
if($_star_clone == 1) {
                  echo 
'<font color="#9C9">+ 1 золото <img src="/images/icon/gold.png" alt=""> за открытие <img src="/images/stars/1.png" alt=""> + 1 новая звезда!</font>';
                  
mysql_query("UPDATE `users` SET `g` = `g` + 1 WHERE `id` = ".$user['id']."");
                  }
                  
                  if(
$_star_clone == 2) {
                  echo 
'<font color="#9C9">+  ½ <img src="/images/stars/0.5.png" alt=""> звезд</font>';
                  }
                  
                  if(
$_star_clone == 3) {
                  echo 
'+ 0 <img src="/images/stars/0.png" alt=""> звезд';
                  }
                  
                  if(
$_star_clone == 4) {
                  echo 
'<font color="#9C9">-  ½ <img src="/images/stars/0.5.png" alt=""> звезд</font>';
                  }
                  
                 if(
$_star_clone == 5) {
                  echo 
'<font color="#9C9">- 1<img src="/images/stars/1.png" alt=""> звезда</font>';
                  }
              
                 echo 
'<br />';
                
                }
                   
              }else{ 
                               
             
?>
              <div class='separ'></div>
              <img src="/images/rang/<?=$user['rang'];?>.png" alt="*">
              <div class='separ'></div>
              <?
              
if($_star_clone == 1) {
              echo 
'<font color="#9C9">+ 1 золото <img src="/images/icon/gold.png" alt=""> за открытие <img src="/images/stars/1.png" alt=""> + 1 новая звезда!</font>';
              
mysql_query("UPDATE `users` SET `g` = `g` + 1 WHERE `id` = ".$user['id']."");
              }
              if(
$_star_clone == 2) {
                  echo 
'<font color="#9C9">+  ½ <img src="/images/stars/0.5.png" alt=""> звезд</font>';
              }
              if(
$_star_clone == 3) {
                  echo 
'+ 0 <img src="/images/stars/0.png" alt=""> звезд';
              }
              if(
$_star_clone == 4) {
                  echo 
'<font color="#9C9">-  ½ <img src="/images/stars/0.5.png" alt=""> звезд</font>';
              }
              if(
$_star_clone == 5) {
                  echo 
'<font color="#9C9">- 1<img src="/images/stars/1.png" alt=""> звезда</font>';
              }
              
              echo 
'<br />';
              
              for(
$r 1$r <= $_rang[$user['rang']]; $r++) {
                
                if(
$user['rang_star'] == '0.5' && $r == 1) {
                      echo 
"<img src='/images/stars/0.5.png' alt=''/>";
                      for(
$n 1$n <= ($_rang[$user['rang']] - 1); $n++) echo "<img src='/images/stars/0.png' alt=''/>";
                 }
                 
                 if(
$user['rang_star'] >= $r) echo "<img src='/images/stars/1.png' alt=''/>";
                 
                 if(
$user['rang_star'] == $r.'.5') {
                     echo 
"<img src='/images/stars/0.5.png' alt=''/>"
                     for(
$n 1$n <= ($_rang[$user['rang']] - 1); $n++) if($user['rang_star'] >= $n) echo ''; else echo "<img src='/images/stars/0.png' alt=''/>"
                }
                
                if(
$user['rang_star'] == $r) for($n 1$n <= $_rang[$user['rang']]; $n++) if($user['rang_star'] >= $n) echo ''; else echo "<img src='/images/stars/0.png' alt=''/>"
                
                if(
$user['rang_star'] <= 0) echo "<img src='/images/stars/0.png' alt=''/>"
             }
            
        if(
$row['kills'] > 2) {
        
?>
        <br />
        <font color='#9C9'>+1<img src="/images/stars/1.png" alt=""> звезда за серию побед!</font>
        <?
        
}
        
?>
        <div class='separ'></div>
        <? 
         
}
         }
         
         
        if(
ceil($coliseum_users['rang_star']) >= $_rang[$coliseum_users['rang']]){
                
        if(
$coliseum_users['rang'] != 1){

            
mysql_query('UPDATE `users` SET `rang` = `rang` - 1, `rang_star` = 0, `g` = `g` + 10 WHERE `id` = "'.$coliseum_users['id'].'"'); 
        
        }
        
    }elseif(
ceil($coliseum_users['rang_star']) < 0) {
        if(
$coliseum_users['rang'] != 25){
            
        
mysql_query('UPDATE `users` SET `rang` = `rang` + 1, `rang_star` = 0 WHERE `id` = "'.$coliseum_users['id'].'"'); 
        
        }
        }
         
         
         }
         
?> 
                 <font color='#90b0c0'>Награда за <b><?=$place;?></b> место:</font><br />
                     <img src='/images/icon/silver.png' alt='*'/> <?=$_s;?> серебра <img src='/images/icon/exp.png' alt='*'/> <?=$_exp;?> опыта
                         </div>
                             <div class='content' align='center'>
                                 <b>Лучший: <img src='/images/icon/race/<?=$best['r'];?>.png' alt='*'/> <?=$best['login'];?></b> <img src='/images/icon/premium.png' alt='*'/>
                                     <div class='separ'></div>
                                         <b>Итог боя:</b><br/>
<?

$q 
mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" ORDER BY `dead_coll` DESC LIMIT '.mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0).'');
    
    while(
$row mysql_fetch_array($q)) {    
             
             
$_top_star++;
  
    
$coliseum_user mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"'));
    
    if(
$_top_star == 1) {
    
?>
    <img src='/images/icon/race/<?=$coliseum_user['r'];?>.png' alt='*'/> <a href='/user/<?=$coliseum_user['id'];?>'><?=$coliseum_user['login'];?></a> 
    <font color='#9C9'>+ 1 <img src="/images/stars/1.png" alt=""> звезда</font>
    <br />
    <?
    
}
  
    if(
$_top_star == 2) {
    
?>
    <img src='/images/icon/race/<?=$coliseum_user['r'];?>.png' alt='*'/> <a href='/user/<?=$coliseum_user['id'];?>/'><?=$coliseum_user['login'];?></a> 
    <font color='#9C9'>+  ½ <img src="/images/stars/0.5.png" alt=""> звезд</font>
    <br />
    <?
    
}
  
    if(
$_top_star == 3) {
    
?>
    <img src='/images/icon/race/<?=$coliseum_user['r'];?>.png' alt='*'/> <a href='/user/<?=$coliseum_user['id'];?>/'><?=$coliseum_user['login'];?></a>
    + 0 <img src="/images/stars/0.png" alt=""> звезд
    <br />
    <?
    
}
  
    if(
$_top_star == 4) {
    
?>
    <img src='/images/icon/race/<?=$coliseum_user['r'];?>.png' alt='*'/> <a href='/user/<?=$coliseum_user['id'];?>/'><?=$coliseum_user['login'];?></a> 
    <font color='#9C9'>-  ½ <img src="/images/stars/0.5.png" alt=""> звезд</font>
    <br />
    <?
    
}
  
    if(
$_top_star == 5) {
    
?>
    <img src='/images/icon/race/<?=$coliseum_user['r'];?>.png' alt='*'/> <a href='/user/<?=$coliseum_user['id'];?>/'><?=$coliseum_user['login'];?></a> 
    <font color='#9C9'>- 1<img src="/images/stars/1.png" alt=""> звезда</font>
    <br />
    <?
    
}
    }
    
?>
  </div>
<?
    mysql_query
('UPDATE `coliseum_member` SET `exit` = "1" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
    
mysql_query("DELETE FROM `coliseum_log` WHERE `battle` = ".$battle['id']."");

    
?>
    <div class='mini-line'></div>
         <div class='content' align='center'>
             <a class='btn' href='?enter=true' ><span class='end'><span class='label'>Начать новый бой</a>
                 <a class='btn' href='/coliseum/' ><span class='end'><span class='label'>Вернуться в колизей</a>
                     </div>
                         <div class='mini-line'></div>
    <?
  
include './system/f.php';
  exit;
  
  }else{  
  
?>
 <div class='mini-line'></div>
  <?
  
}
  
  if(
mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum` WHERE `start` = "0"'),0) == 0) {

  
mysql_query('INSERT INTO `coliseum` (`start`, `end`, `time`) VALUES ("0", "0", "'.(time() + 60).'")');
  
  }

  
$battle mysql_fetch_array(mysql_query('SELECT * FROM `coliseum` WHERE `start` = "0"'));
  
?>
  <div class='main' align='center'>
         <img src='/images/icon/race/0.png' alt='*'/>
             <img src='/images/icon/race/1.png' alt='*'/> 
                 Титанов в очереди: <b><?=mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0)?></b> из <b>5</b>
<?
if(mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0) < && mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"'),0) == 0) {

if(
$_GET['enter'] == true && mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0) < 5) {
            
            
    if(
$user['hp'] < (($user['vit'] / 100) * 10)) {
        
        
$_SESSION['err'] = "<div class='mini-line'></div><div class='content' align='center'><font color='#c06060'>Для нападения надо минимум <img src='/images/icon/health.png' alt='*'/> 10% жизни и <img src='/images/icon/mana.png' alt='*'/> 50 маны</font><div class='separ'></div><table cellpadding='0' cellspacing='0'><tr><td><img src='/images/alchemy/potion.png' alt='*'/></td><td valign='top' style='padding-left: 5px;' align='left'><b>Настойка бодрости</b><br/><small><small>+100% маны и жизни</small></small></td></tr></table><div class='separ'></div><div align='center'><a href='/lab/wiz/?potion=true&referal=/coliseum/' class='button'>Купить</a><br/><br/><font color='#909090'>Цена: <img src='/images/icon/gold.png' alt='*'/> 15 золота</font></div></div>";
        exit(
header('Location: /coliseum/'));
    }
    
      
mysql_query('INSERT INTO `coliseum_member` (`battle`, `user`, `time`) VALUES ("'.$battle['id'].'", "'.$user['id'].'", "'.time().'")');

      exit(
header('location: /coliseum/'));
      
   }

?>
                     <br /><a class='btn' href='?enter=true'><span class='end'><span class='label'>Встать в очередь</a>
                     </div>
<?
}else{

if(
$_GET['exit'] == true && mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0) < 5) {

    
mysql_query('DELETE FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
   
        exit(
header('location: /coliseum/'));
}
  

if(
mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0) > 4) {
  
  if(
$battle['time'] > time()) {
  
?>

<br /><font color='#909090'>До начала боя: <span id="time_<?=($battle['time'] - time());?>000"><?=_time($battle['time'] - time());?></span></font>

<?
  
  
}else{

    
mysql_query('UPDATE `coliseum` SET `start` = "1" WHERE `id` = "'.$battle['id'].'"');
    exit(
header('location: /coliseum/'));
  
  }
  
  }else{
  
  if(
$battle['time'] < time()) {      
      
mysql_query('UPDATE `coliseum` SET `time` = "'.(time() + rand(520)).'" WHERE `id` = "'.$battle['id'].'"');
  }
  }
    
/* Start bots */
    
    
$m_ mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'));
         
         if(
$_SESSION['bot'] < time()) {
             
             if(
mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0) < 5) {
                 
                 if(
$user['rang'] > 22) {
                 
$opponents mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `str` + `vit` + `agi` + `def` <= "'.($user['str'] + $user['vit'] + $user['agi'] + $user['def']).'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1'));
                 }else{
                
$opponents mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `str` + `vit` + `agi` + `def` >= "'.(($user['str'] + $user['vit'] + $user['agi'] + $user['def']) / 2).'" AND `str` + `vit` + `agi` + `def` <= "'.($user['str'] + $user['vit'] + $user['agi'] + $user['def']).'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1'));
                
                if(!
$opponents) {
                    
$opponents mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `str` + `vit` + `agi` + `def` <= "'.($user['str'] + $user['vit'] + $user['agi'] + $user['def']).'" AND `id` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1'));
                }
                
                }
         
         if(!
mysql_fetch_array(mysql_query('SELECT * FROM `coliseum_member` WHERE `user` = '.$opponents['id'].' AND `battle` = "'.$battle['id'].'"'))) {    
                                            
                                            
mysql_query('INSERT INTO `coliseum_member` (`battle`,`user`,`time`,`bot`) VALUES ("'.$battle['id'].'", "'.$opponents['id'].'", "'.time().'", "1")');
                                            
                                            
mysql_query("UPDATE `users` SET `hp` = ".($opponents['vit'] * 2)." WHERE `id` = ".$opponents['id']."");
                                            
                                            
$_SESSION['bot'] = time() + 2;
    
    }
    }
    }
?>
     </div>
         <div class='main' align='center'>
                     <a class='btn'  href='?' ><span class='end'><span class='label'>Обновить</a> 
                         <a class='btn'  href='/coliseum/?exit=true' ><span class='end'><span class='label'>Выйти из очереди</a>
                         </div>
<?
}
}

?>
     <div class="mini-line">
         </div>
             <div class='content' align='center'>
                 <table width="50%" border="0" cellpadding="0" cellspacing="0" align="center">
                     <tbody>
                         <tr>
                             <td width="20%">
                                 <img src="/images/rang/<?=$user['rang'];?>.png" alt="">
                                     </td>
                                     <?=($user['rang'] < 15 ?'<td width="60%">' '<td width="20%">');?>
<?
for($r 1$r <= $_rang[$user['rang']]; $r++) {
         
         if(
$user['rang_star'] == '0.5' && $r == 1) {
             echo 
"<img src='/images/stars/0.5.png' alt=''/>";
                 for(
$n 1$n <= ($_rang[$user['rang']] - 1); $n++) echo "<img src='/images/stars/0.png' alt=''/>";
        }
                     
                     if(
$user['rang_star'] >= $r) echo "<img src='/images/stars/1.png' alt=''/>";
                          
                          if(
$user['rang_star'] == $r.'.5') {
                                 
                                 echo 
"<img src='/images/stars/0.5.png' alt=''/>";
                                      
                                      for(
$n 1$n <= ($_rang[$user['rang']] - 1); $n++) if($user['rang_star'] >= $n) echo ''; else echo "<img src='/images/stars/0.png' alt=''/>"
                    }
                    
         if(
$user['rang_star'] == $r) for($n 1$n <= $_rang[$user['rang']]; $n++) if($user['rang_star'] >= $n) echo ''; else echo "<img src='/images/stars/0.png' alt=''/>"
                         
         if(
$user['rang_star'] <= 0) echo "<img src='/images/stars/0.png' alt=''/>"
}
echo 
"</td>";

if(
$user['rang'] != 1) {
?>
     <td width="5%">
         <img src="/images/rang/<?=($user['rang'] - 1);?>.png" alt="">
             </td>
             </tr>
             <tr align="center" valign="top">
             <td>
             <span style="color:#999999;" class="medium">Твой ранг</span></td><td></td><td><font color='#9C9'>Твоя цель</font></td></tr>
<?
}
?>
     </tbody>
         </table>
            <div class="separ"></div>
<a class='btn' href="/rating_coliseum.php"><span class='end'><span class='label'><img src="/images/rang/ic_r.png" alt=""> Рейтинг колизея</a> 
<a class='btn' href="/lab/merchant/"><span class='end'><span class='label'><img src="/images/icon/str.png" alt=""> Боевые усиления</a><br>
Боевые усиления увеличивают твою атаку и защиту
                             
                                 <div class="mini-line"></div>
                                 
                                 <?
                                 
if(date('N') == OR date('N') == OR date('N') == OR date('N') == OR date('N') == 3) {
                                 
?>
                                         <img src="/images/icon/2hit.png" alt="*"> Турнир колизея! 
                                             <img src="/images/icon/2hit.png" alt="*"><br />
                                             <div class="separ"></div>
                                                 Черепа: <img src="/images/rang/skull.png" alt="*"> <?=$user['skull'];?> из 
<?
if($user['skull'] <= 25) echo 25; elseif($user['skull'] < 249) echo 125; elseif($user['skull'] <= 250) echo 250;
?>
     <br />
     Накопи 25 черепов и прими участие в розыгрыше 500 золота!<br />
         Если накопишь 125 черепов, то примешь участие в розыгрыше 750 золота!<br />
             А если соберёшь 250 черепов, то примешь участие в розыгрыше 1000 золота!<br />
                 Конец турнира в: Среду!
                     <div class="separ"></div>
                     <?
                                 
}else{
    
?>
    
    <div class="main" align="center"><img src="/images/icon/2hit.png" alt=""> <font color='#9C9'>Турнир колизея!</font> <img src="/images/icon/2hit.png" alt=""><br><div class="separ"></div>
    Начало турнира в: Субботу<br />
    
    <?
                                 
}
                     
?>
                         <a class='btn'  href="/common.php?action=cz"><span class='end'><span class='label'>подробней</a>
                             <div class="mini-line"></div>
                               
                                      Ранги: За 3 и больше победы подряд ты будешь получать дополнительную <img src='/images/stars/1.png' alt='*'> звезду Черепа выпадают начиная с 23 ранга и только за первые 15 боев
                                     </div>
<?
}else{
?>
     <div class='main' align='center'>
         Для участии в <img src='/images/icon/coliseum.png' alt='*'/> Колизее требуется 
             <img src='/images/icon/level.png' alt='*'/> 10 уровень
                 </div>
<?
}
include 
'./system/f.php';
?>
Онлайн: 1
Реклама