Вход Регистрация
Файл: titwar.ru/element_arena.php
Строк: 695
<?php
require_once './element_options/element_options.php';
if (!
$user) { header('Location: /'); exit; }

    function 
new_microtime() {
        
$explode explode(' 'microtime());
        
$explode1 explode('.'$explode[0]);
        
$explode[1] = $explode[1] - 127064063;
        return 
$explode[1].$explode1[1];
    }

///////// Золотая лига!!!
if (isset($_GET['pvp'])) {    

    if (
$user['lost_level'] < 5) {
        
$title 'Золотая лига';
        
$error1 'Вход в золотую лигу доступен с 5-го уровня';
        require_once 
'element_error_page.php';
        exit;
    }

    
// ID моей арены, если активный бой, переадресацию делаем
    
$my_pvp_id readcache('element_users'.$user['lost_id'].'arena_pvp');
        if (
$my_pvp_id) {
            
$my_pvp readcache('element_arena_pvp_teamid'.$my_pvp_id);
            
            if (
$my_pvp['other']['active'] == true) {
                
header('Location: /arena/pvp/battle');
                exit;
            }
        }
    
    
// Массив. Кэш очереди играков на бой
    
$arena_pvp readcache('element_arena_pvp_ochered');
    if (!
is_array($cache_chat)) $cache_chat = array(10 => array(), 50 => array(), 100 => array());
    
//$arena_pvp[100][4] = 4;
    
    
    // Массив. Игроки, которые в бою, записываем золото
    
$cache_gold readcache('element_arena_pvp_gold');
    if (!
is_array($cache_gold)) $cache_gold = array();
    
    
// Массив. Кэш чата
    
$cache_chat readcache('element_chat_arena_gold');
    if (!
is_array($cache_chat)) $cache_chat = array();
    
         if (!empty(
$arena_pvp[10][$user['lost_id']]))  $game 10;
    else if (!empty(
$arena_pvp[50][$user['lost_id']]))  $game 50;
    else if (!empty(
$arena_pvp[100][$user['lost_id']])) $game 100;
    else 
$game false;
    
//$user['lost_money_gold'] = 50;
    
    
$ban BanUserCountActive($user['lost_id']);
    
$chat_lvl element_settings_game('lost_chat_min_level');
    
    
// Добавление комментария в чат
    
if ($go == 'add') {
        
$error '';
        
$text trim($_POST['text']);
        if (empty(
$text)) $error 'Поле 'text' обязательно для ввода';
        if (
$user['lost_level'] < $chat_lvl$error 'Вы не можете комментировать чат';
        if (
$ban 0$error 'Вы не можете комментировать чат';    
            
            if (empty(
$error)) {
            
$text addslashes(htmlspecialchars($text));
            
$send = array('user_id' => $user['lost_id'], 'text' => $text'time' => time());
            
array_push($cache_chat$send);
            if (
count($cache_chat) > element_settings_game('lost_chat_max_count')) array_shift($cache_chat);
            
writecache('element_chat_arena_gold',$cache_chat);
            
header('Location: /arena?pvp');
            exit;
        }
    }
    
    
// Удаление комментария с чата
    
if (isset($_GET['delete'])) {
        if (
$user['lost_privilege'] > 0) {
            
$delete = ($_GET['delete']) ? (int)$_GET['delete'] : 0;
            unset(
$cache_chat[$delete]); 
            
writecache('element_chat_arena_gold',$cache_chat); 
        }
    }
    
    
$title 'Арена: Золотая лига';  
    if (
readcache('element_user_mesto'.$user['lost_id']) != $titlewritecache('element_user_mesto'.$user['lost_id'], $title);
    require_once 
'./element_include/element_head.php';
    require_once 
'./element_include/element_header_user_true.php';

    
// Встаем в очередь
    
if ($go == 'start') {
        if (!
$game) {
            if (
$id == 10 OR $id == 50 OR $id == 100) {
                if (
$user['lost_money_gold'] < $id$error 'Вам нехватает <img src="/images/icons/gold.png">'.($id $user['lost_money_gold']).' золота<br/><a class="button w50 mt3" href="/payment">Купить золото</a>';
                
                if (!isset(
$error)) {
                    
$arena_pvp[$id][$user['lost_id']] = $user['lost_id']; 
                    
update_money_exp($user000, -$id);
                        
// Начинаем бой
                        
if (count($arena_pvp[$id]) >= 2) {
                        require_once 
'./element_function/element_function_battle.php';
                        
$ttt time() + 10;
                        
                        
$rand_number_arena rand(1000999999999999);
                        
                        
$journal = array('other' => array(KeyJournalMassiv($ttt) => '<span class="lngreen bold">Бой начался</span>'));
                        
                        
// Массив с данными боя
                        
$array = array('other' => array('gold' => $id'timer' => $ttt'active' => true));
                            
$i 1;
                            foreach(
array_slice($arena_pvp[$id], 02true) as $value) {
                                
// Кэш юзера
                                
$cache_user cache_user($value);
                                
                                
// Макс. здоровье юзера
                                
$arena_user_hp GenerationMaxHeatpoints($cache_user['lost_params_heatpoints']);
                                
                                
// Обнуляем умения
                                
ResetAbilitiesUser($value);    
                                
                                
// Записываем золото
                                
$cache_gold[$user['lost_id']] = $id;
                                
                                
// Параметры юзера в бою
                                
$array['user_'.$i] = array('user'         => $value,
                                                           
'battle_hp'  => $arena_user_hp,
                                                           
'other_hp'         => $arena_user_hp,
                                                           
'time_udar'    => false,
                                                           
'uron'        => 0,
                                                           
'battle_uron'=> 0);
                                
                                
writecache('element_users_battle'.$value'/arena/pvp/battle');            // Ссылка вернуться в бой юзеру
                                
writecache('element_users'.$value.'arena_pvp'$rand_number_arena);        // ID арены
                                
unset($arena_pvp[$id][$value]);
                                
$journal[$value] = array();
                            
$i++;
                            }
                        
                        
writecache('element_arena_pvp_ochered'$arena_pvp);
                        
writecache('element_arena_pvp_teamid'.$rand_number_arena.'journal'$journal);
                        
writecache('element_arena_pvp_teamid'.$rand_number_arena$array);
                        
header('Location: /arena/pvp/battle');
                        exit;
                        }
                    
                    
writecache('element_arena_pvp_ochered'$arena_pvp);
                    
header('Location: /arena?pvp');
                    exit;
                } else echo 
'<div class="nfl p5 mt5 mb5 cntr small mlra error1">'.$error.'</div>';
            }
        } else {
            unset(
$arena_pvp[$game][$user['lost_id']]);
            
update_money_exp($user000$game);
            
writecache('element_arena_pvp_ochered'$arena_pvp);
            
header('Location: /arena?pvp');
            exit;
        }
    }
    
    echo 
'<div class="nfl p5 mb5 mt5 small mlra">';
    echo 
'<div class="yellow1 mb5 cntr bold"><a href="/arena">К списку локациий</a></div>';

    if (
$game) {
        echo 
'<div class="yellow1 cntr">Вы находитесь в очереди на бой за <img src="/images/icons/gold.png">'.$game.' золота. Ожидайте пожалуйста противника</div>';
        echo 
'<div class="cntr mt5"><a class="button w60 mt5 mb5" href="/arena?pvp">Обновить</a></div>';
        echo 
'<div class="cntr mb5"><a class="button w60 mt5 mb5" href="/arena?pvp&go=start">Покинуть очередь</a></div>';
        echo 
'<div class="hr w90 mlra mt5 mb5"></div>';
    } else {

        echo 
'<div class="white cntr">';
        echo 
'Ставка: <img src="/images/icons/gold.png">10 золота.<br/>';
        echo 
'<a class="button w40 mt5 mb5" href="/arena?pvp&go=start&id=10">В очередь: '.count($arena_pvp[10]).'</a>';
        echo 
'</div>';
        
        echo 
'<div class="hr w90 mlra mt5 mb5"></div>';
        echo 
'<div class="white cntr">';
        echo 
'Ставка: <img src="/images/icons/gold.png">50 золота.<br/>';
        echo 
'<a class="button w40 mt5 mb5" href="/arena?pvp&go=start&id=50">В очередь: '.count($arena_pvp[50]).'</a>';
        echo 
'</div>';
        
        echo 
'<div class="hr w90 mlra mt5 mb5"></div>';
        echo 
'<div class="white cntr">';
        echo 
'Ставка: <img src="/images/icons/gold.png">100 золота.<br/>';
        echo 
'<a class="button w40 mt5 mb5" href="/arena?pvp&go=start&id=100">В очередь: '.count($arena_pvp[100]).'</a>';
        echo 
'</div>';
        echo 
'<div class="hr w90 mlra mt5 mb5"></div>';
    }
    
    echo 
'<div class="yellow1 mt5 cntr">Мой рейтинг: <span class="lngreen bold">'.$user['lost_arena_pvp_rating'].'</span></div>';
    echo 
'<div class="white mt5 cntr"><span class="bold">Золотая лига</span> - сражение 1х1 между случайными игроками с очереди на золото. Победитель получает 90% ставки.</div>';
    echo 
'</div>';
    
    echo 
'<div class="nfl p5 mt5 mb5 small mlra">';
    
    
$chat_to_user = (isset($_GET['to'])) ? $_GET['to'].', ' '';    
    
    if (
$user['lost_level'] < $chat_lvl) {
        echo 
'<div class="cntr small mb5 error1">Комментировать чат можно с '.$chat_lvl.' уровня</div>';
    } else if (
$ban 0) {
        echo 
'<div class="cntr small mb5"><a class="error1" href="/ban/list?id='.$user['lost_id'].'">Вы не можете комментировать чат, так как находитесь в бане</a></div>';
    } else {
        echo 
'<form method="post" action="/arena?pvp&go=add">
            <input class="fdark w98 mb10" type="text" name="text" value="'
.$chat_to_user.'" size="20" maxlength="255">
            <span class="button w30 mt3"><input type="submit" class="ttl" name="submit" value="Отправить"/></span>
            <a class="small ccc" href="/arena?pvp">Обновить</a>
          </form>'
;
    }
    
    if (empty(
$cache_chat)) 
    {
    echo 
'<div class="p5 cntr"><span class="small ccc">В чате нету сообщений</span></div>';
    echo 
'</div>';
    } else {
        
krsort($cache_chat);
        require_once 
'./element_function/element_function_pagination.php';
        
$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
        
$pagination pagination(10$pagecount($cache_chat));
        
        foreach(
array_slice($cache_chat$pagination['start'], $pagination['num'], true) as $k => $massiv) {
            
$chat_user cache_user($massiv['user_id']);
            
$on_off = (!empty($online[$massiv['user_id']])) ? 'online' 'offline';
            
$text Color_Privilege($chat_user['lost_privilege'], ReplaceText($user['lost_login'], $massiv['text']));
            
$text Smiles($texttrue);
            
            echo 
'
            <div class="mt5">
            <a class="yellow1 sndr bl" href="/user?id='
.$massiv['user_id'].'">
                <span class="small fr pt2 lngreen">'
.Timer($massiv['time']).'</span>
                '
.ikonka_user($chat_user['lost_race'], $on_off).' <span class="small">'.$chat_user['lost_login'].'</span>
            </a>'
;
            echo 
'<span class="small">'.$text.'</span>';
            echo 
'<br/><a class="ccc small" href="/arena?pvp&to='.$chat_user['lost_login'].'">[Ответить]</a>';
            echo (
$user['lost_privilege'] > 0) ? ' <a class="red small" href="/arena?pvp&delete='.$k.'">[X]</a> <a class="red small" href="/ban/list?id='.$massiv['user_id'].'&to='.$massiv['text'].'">[Бан]</a>' '';
            echo 
'<br/> </div>';
        }
        echo 
'</div>';
        echo 
pagination_echo($pagination['page'],$pagination['total'],'/arena?pvp&page=');
    }
    
require_once 
'./element_include/element_foot_user_true.php';
exit;
}
    
if (isset(
$_GET['tvt'])) {
    
// Кэш, очередь игроков в бой
    
$ochered_user readcache('element_arena_tvt_ochered_user');
    if (!
is_array($ochered_user)) $ochered_user = array();
    
    
// Если я состою/состоял в бое
    
$my_arena readcache('element_users'.$user['lost_id'].'arena_tvt');
        if (
$my_arena) {
            
$arenka readcache('element_arena_tvt_teamid'.$my_arena);
            if (
$arenka) {
                if (
$arenka['other']['active'] == 0) {
                    
header('Location: /arena/tvt/battle');
                    exit;
                }
            }
        }
    
    
//$ochered_user[1] = 1;
    //$ochered_user[17] = 17;
    //$ochered_user[3] = 3;
    //$ochered_user[7] = 7;
    //$ochered_user[5] = 5;
    //$ochered_user[6] = 6;
    //$ochered_user[4] = 4;
    
    // Кэш чата
    
$cache_chat readcache('element_chat_arena_tvt');
    if (!
is_array($cache_chat)) $cache_chat = array();    

    
// Встаем/Уходим с очереди
    
if ($go == 'start') {
        
// Если я в очереди, убираем иначе встаем
        
if (!empty($ochered_user[$user['lost_id']])) {
            unset(
$ochered_user[$user['lost_id']]);
            
writecache('element_arena_tvt_ochered_user'$ochered_user);
            
header('Location: /arena?tvt');
            exit;
        } else {
            
$ochered_user[$user['lost_id']] = $user['lost_id'];
            
            
// Если достаточно игроков, начинаем бой
            
if (count($ochered_user) >= 8) {
                require_once 
'./element_function/element_function_battle.php';
                
$ttt time() + 10;
                
                
$array = array('other'  => array('timer' => $ttt'active' => 0),
                               
'team_1_kick' => array(), 'team_2_kick' => array());
                    
                
$rand_number_arena rand(100999999999999);    
                    
                
$journal = array('other' => array(KeyJournalMassiv($ttt) => '<span class="lngreen bold">Бой начался</span>'));
                
                
$i 1;    
                foreach(
array_slice($ochered_user08true) as $value) {
                    
$team = (($i 2) ? 'team_1' 'team_2');
                    
$arena_user cache_user($value);
                    
$arena_user_hp GenerationMaxHeatpoints($arena_user['lost_params_heatpoints']);
                    
ResetAbilitiesUser($value);
                    
                    
$array[$team][$value] = array('battle_hp'     => $arena_user_hp
                                                  
'other_hp'      => $arena_user_hp
                                                  
'target'         => 0,
                                                  
'time_udar'     => false,
                                                  
'uron'             => 0,
                                                  
'battle_uron'    => 0);
                    
writecache('element_users_battle'.$value'/arena/tvt/battle');            // Ссылка вернуться в бой юзеру
                    
writecache('element_users'.$value.'arena_tvt'$rand_number_arena);        // ID арены
                    
$journal[$value] = array();
                    unset(
$ochered_user[$value]);
                
$i++;
                }
                
writecache('element_arena_tvt_ochered_user'$ochered_user);
                
writecache('element_arena_tvt_teamid'.$rand_number_arena.'journal'$journal);
                
writecache('element_arena_tvt_teamid'.$rand_number_arena$array);
                
header('Location: /arena/tvt/battle');
                exit;
            }
            
            
writecache('element_arena_tvt_ochered_user'$ochered_user);
            
header('Location: /arena?tvt');
            exit;
        }
    
    }
    
    
$ban BanUserCountActive($user['lost_id']);
    
$chat_lvl element_settings_game('lost_chat_min_level');
    
    
// Добавление комментария в чат
    
if ($go == 'add') {
        
$error '';
        
$text trim($_POST['text']);
        if (empty(
$text)) $error 'Поле 'text' обязательно для ввода';
        if (
$user['lost_level'] < $chat_lvl$error 'Вы не можете комментировать чат';
        if (
$ban 0$error 'Вы не можете комментировать чат';    
            
            if (empty(
$error)) {
            
$text addslashes(htmlspecialchars($text));
            
$send = array('user_id' => $user['lost_id'], 'text' => $text'time' => time());
            
array_push($cache_chat$send);
            if (
count($cache_chat) > element_settings_game('lost_chat_max_count')) array_shift($cache_chat);
            
writecache('element_chat_arena_tvt',$cache_chat);
            
header('Location: /arena?tvt');
            exit;
        }
    }
    
    
// Удаление комментария с чата
    
if (isset($_GET['delete'])) {
        if (
$user['lost_privilege'] > 0) {
            
$delete = ($_GET['delete']) ? (int)$_GET['delete'] : 0;
            unset(
$cache_chat[$delete]); 
            
writecache('element_chat_arena_tvt',$cache_chat); 
        }
    }
    
    
    
$title 'Арена: Лига стихий';  
    if (
readcache('element_user_mesto'.$user['lost_id']) != $titlewritecache('element_user_mesto'.$user['lost_id'], $title);
    require_once 
'./element_include/element_head.php';
    require_once 
'./element_include/element_header_user_true.php';
    
    echo 
'<div class="nfl p5 mb5 mt5 small mlra">';
    echo 
'<div class="yellow1 mb5 cntr bold"><a href="/arena">К списку локациий</a></div>';
    echo 
'<div class="yellow1 mb5 mt5 cntr">Игроков в очереди: '.count($ochered_user).' из 8</div>';

    echo 
'<div class="yellow1 mb5 cntr mt5">';    
    echo 
'<a class="button w60 mb5" href="/arena?tvt">Обновить</a><br/>';
    echo (empty(
$ochered_user[$user['lost_id']])) ? '<a class="button w60" href="/arena?tvt&go=start">Встать в очередь</a>' '<a class="button w60" href="/arena?tvt&go=start">Покинуть очередь</a>';
    echo 
'</div>';

    echo 
'<div class="white mt5 cntr">Мой рейтинг: <span class="lngreen bold">'.$user['lost_arena_tvt_rating'].'</span></div>';
    echo 
'</div>';
    
    echo 
'<div class="nfl p5 mt5 mb5 small mlra">';
    
$chat_to_user = (isset($_GET['to'])) ? $_GET['to'].', ' '';    
    
    if (
$user['lost_level'] < $chat_lvl) {
        echo 
'<div class="cntr small mb5 error1">Комментировать чат можно с '.$chat_lvl.' уровня</div>';
    } else if (
$ban 0) {
        echo 
'<div class="cntr small mb5"><a class="error1" href="/ban/list?id='.$user['lost_id'].'">Вы не можете комментировать чат, так как находитесь в бане</a></div>';
    } else {
        echo 
'<form method="post" action="/arena?tvt&go=add">
            <input class="fdark w98 mb10" type="text" name="text" value="'
.$chat_to_user.'" size="20" maxlength="255">
            <span class="button w30 mt3"><input type="submit" class="ttl" name="submit" value="Отправить"/></span>
            <a class="small ccc" href="/arena?tvt">Обновить</a>
          </form>'
;
    }
    
    if (empty(
$cache_chat)) 
    {
    echo 
'<div class="p5 cntr"><span class="small ccc">В чате нету сообщений</span></div>';
    echo 
'</div>';
    } else {
        
krsort($cache_chat);
        require_once 
'./element_function/element_function_pagination.php';
        
$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
        
$pagination pagination(10$pagecount($cache_chat));
        
        foreach(
array_slice($cache_chat$pagination['start'], $pagination['num'], true) as $k => $massiv) {
            
$chat_user cache_user($massiv['user_id']);
            
$on_off = (!empty($online[$massiv['user_id']])) ? 'online' 'offline';
            
$text Color_Privilege($chat_user['lost_privilege'], ReplaceText($user['lost_login'], $massiv['text']));
            
$text Smiles($texttrue);
            
            echo 
'
            <div class="mt5">
            <a class="yellow1 sndr bl" href="/user?id='
.$massiv['user_id'].'">
                <span class="small fr pt2 lngreen">'
.Timer($massiv['time']).'</span>
                '
.ikonka_user($chat_user['lost_race'], $on_off).' <span class="small">'.$chat_user['lost_login'].'</span>
            </a>'
;
            echo 
'<span class="small">'.$text.'</span>';
            echo 
'<br/><a class="ccc small" href="/arena?tvt&to='.$chat_user['lost_login'].'">[Ответить]</a>';
            echo (
$user['lost_privilege'] > 0) ? ' <a class="red small" href="/arena?tvt&delete='.$k.'">[X]</a> <a class="red small" href="/ban/list?id='.$massiv['user_id'].'&to='.$massiv['text'].'">[Бан]</a>' '';
            echo 
'<br/> </div>';
        }
        echo 
'</div>';
        echo 
pagination_echo($pagination['page'],$pagination['total'],'/arena?tvt&page=');
    }

require_once 
'./element_include/element_foot_user_true.php';
exit;
} else if (isset(
$_GET['tvt2'])) {
    
// Кэш, очередь игроков в бой
    
$ochered_user readcache('element_arena_tvt2_ochered_user');
    if (!
is_array($ochered_user)) $ochered_user = array();
    
    
// Если я состою/состоял в бое
    
$my_arena readcache('element_users'.$user['lost_id'].'arena_tvt2');
        if (
$my_arena) {
            
$arenka readcache('element_arena_tvt2_teamid'.$my_arena);
            if (
$arenka) {
                if (
$arenka['other']['active'] == 0) {
                    
header('Location: /arena/tvt2/battle');
                    exit;
                }
            }
        }
    
    
//$ochered_user[1] = 1;
    //$ochered_user[17] = 17;
    //$ochered_user[3] = 3;
    //$ochered_user[7] = 7;
    //$ochered_user[5] = 5;
    //$ochered_user[6] = 6;
    //$ochered_user[4] = 4;
    
    // Кэш чата
    
$cache_chat readcache('element_chat_arena_tvt2');
    if (!
is_array($cache_chat)) $cache_chat = array();    

    
// Встаем/Уходим с очереди
    
if ($go == 'start') {
        
// Если я в очереди, убираем иначе встаем
        
if (!empty($ochered_user[$user['lost_id']])) {
            unset(
$ochered_user[$user['lost_id']]);
            
writecache('element_arena_tvt2_ochered_user'$ochered_user);
            
header('Location: /arena?tvt2');
            exit;
        } else {
            
$ochered_user[$user['lost_id']] = $user['lost_id'];
            
            
// Если достаточно игроков, начинаем бой
            
if (count($ochered_user) >= 4) {
                require_once 
'./element_function/element_function_battle.php';
                
$ttt time() + 10;
                
                
$array = array('other'  => array('timer' => $ttt'active' => 0),
                               
'team_1_kick' => array(), 'team_2_kick' => array());
                    
                
$rand_number_arena rand(100999999999999);    
                    
                
$journal = array('other' => array(KeyJournalMassiv($ttt) => '<span class="lngreen bold">Бой начался</span>'));
                
                
$i 1;    
                foreach(
array_slice($ochered_user04true) as $value) {
                    
$team = (($i 2) ? 'team_1' 'team_2');
                    
$arena_user cache_user($value);
                    
$arena_user_hp GenerationMaxHeatpoints($arena_user['lost_params_heatpoints']);
                    
ResetAbilitiesUser($value);
                    
                    
$array[$team][$value] = array('battle_hp'     => $arena_user_hp
                                                  
'other_hp'      => $arena_user_hp
                                                  
'target'         => 0,
                                                  
'time_udar'     => false,
                                                  
'uron'             => 0,
                                                  
'battle_uron'    => 0);
                    
writecache('element_users_battle'.$value'/arena/tvt2/battle');            // Ссылка вернуться в бой юзеру
                    
writecache('element_users'.$value.'arena_tvt2'$rand_number_arena);        // ID арены
                    
$journal[$value] = array();
                    unset(
$ochered_user[$value]);
                
$i++;
                }
                
writecache('element_arena_tvt2_ochered_user'$ochered_user);
                
writecache('element_arena_tvt2_teamid'.$rand_number_arena.'journal'$journal);
                
writecache('element_arena_tvt2_teamid'.$rand_number_arena$array);
                
header('Location: /arena/tvt2/battle');
                exit;
            }
            
            
writecache('element_arena_tvt2_ochered_user'$ochered_user);
            
header('Location: /arena?tvt2');
            exit;
        }
    
    }
    
    
$ban BanUserCountActive($user['lost_id']);
    
$chat_lvl element_settings_game('lost_chat_min_level');
    
    
// Добавление комментария в чат
    
if ($go == 'add') {
        
$error '';
        
$text trim($_POST['text']);
        if (empty(
$text)) $error 'Поле 'text' обязательно для ввода';
        if (
$user['lost_level'] < $chat_lvl$error 'Вы не можете комментировать чат';
        if (
$ban 0$error 'Вы не можете комментировать чат';    
            
            if (empty(
$error)) {
            
$text addslashes(htmlspecialchars($text));
            
$send = array('user_id' => $user['lost_id'], 'text' => $text'time' => time());
            
array_push($cache_chat$send);
            if (
count($cache_chat) > element_settings_game('lost_chat_max_count')) array_shift($cache_chat);
            
writecache('element_chat_arena_tvt2',$cache_chat);
            
header('Location: /arena?tvt2');
            exit;
        }
    }
    
    
// Удаление комментария с чата
    
if (isset($_GET['delete'])) {
        if (
$user['lost_privilege'] > 0) {
            
$delete = ($_GET['delete']) ? (int)$_GET['delete'] : 0;
            unset(
$cache_chat[$delete]); 
            
writecache('element_chat_arena_tvt2',$cache_chat); 
        }
    }
    
    
    
$title 'Арена: Лига стихий2';  
    if (
readcache('element_user_mesto'.$user['lost_id']) != $titlewritecache('element_user_mesto'.$user['lost_id'], $title);
    require_once 
'./element_include/element_head.php';
    require_once 
'./element_include/element_header_user_true.php';
    
    echo 
'<div class="nfl p5 mb5 mt5 small mlra">';
    echo 
'<div class="yellow1 mb5 cntr bold"><a href="/arena">К списку локациий</a></div>';
    echo 
'<div class="yellow1 mb5 mt5 cntr">Игроков в очереди: '.count($ochered_user).' из 4</div>';

    echo 
'<div class="yellow1 mb5 cntr mt5">';    
    echo 
'<a class="button w60 mb5" href="/arena?tvt2">Обновить</a><br/>';
    echo (empty(
$ochered_user[$user['lost_id']])) ? '<a class="button w60" href="/arena?tvt2&go=start">Встать в очередь</a>' '<a class="button w60" href="/arena?tvt2&go=start">Покинуть очередь</a>';
    echo 
'</div>';

    echo 
'<div class="white mt5 cntr">Мой рейтинг: <span class="lngreen bold">'.$user['lost_arena_tvt2_rating'].'</span></div>';
    echo 
'</div>';
    
    echo 
'<div class="nfl p5 mt5 mb5 small mlra">';
    
$chat_to_user = (isset($_GET['to'])) ? $_GET['to'].', ' '';    
    
    if (
$user['lost_level'] < $chat_lvl) {
        echo 
'<div class="cntr small mb5 error1">Комментировать чат можно с '.$chat_lvl.' уровня</div>';
    } else if (
$ban 0) {
        echo 
'<div class="cntr small mb5"><a class="error1" href="/ban/list?id='.$user['lost_id'].'">Вы не можете комментировать чат, так как находитесь в бане</a></div>';
    } else {
        echo 
'<form method="post" action="/arena?tvt2&go=add">
            <input class="fdark w98 mb10" type="text" name="text" value="'
.$chat_to_user.'" size="20" maxlength="255">
            <span class="button w30 mt3"><input type="submit" class="ttl" name="submit" value="Отправить"/></span>
            <a class="small ccc" href="/arena?tvt2">Обновить</a>
          </form>'
;
    }
    
    if (empty(
$cache_chat)) 
    {
    echo 
'<div class="p5 cntr"><span class="small ccc">В чате нету сообщений</span></div>';
    echo 
'</div>';
    } else {
        
krsort($cache_chat);
        require_once 
'./element_function/element_function_pagination.php';
        
$page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
        
$pagination pagination(10$pagecount($cache_chat));
        
        foreach(
array_slice($cache_chat$pagination['start'], $pagination['num'], true) as $k => $massiv) {
            
$chat_user cache_user($massiv['user_id']);
            
$on_off = (!empty($online[$massiv['user_id']])) ? 'online' 'offline';
            
$text Color_Privilege($chat_user['lost_privilege'], ReplaceText($user['lost_login'], $massiv['text']));
            
$text Smiles($texttrue);
            
            echo 
'
            <div class="mt5">
            <a class="yellow1 sndr bl" href="/user?id='
.$massiv['user_id'].'">
                <span class="small fr pt2 lngreen">'
.Timer($massiv['time']).'</span>
                '
.ikonka_user($chat_user['lost_race'], $on_off).' <span class="small">'.$chat_user['lost_login'].'</span>
            </a>'
;
            echo 
'<span class="small">'.$text.'</span>';
            echo 
'<br/><a class="ccc small" href="/arena?tvt2&to='.$chat_user['lost_login'].'">[Ответить]</a>';
            echo (
$user['lost_privilege'] > 0) ? ' <a class="red small" href="/arena?tvt2&delete='.$k.'">[X]</a> <a class="red small" href="/ban/list?id='.$massiv['user_id'].'&to='.$massiv['text'].'">[Бан]</a>' '';
            echo 
'<br/> </div>';
        }
        echo 
'</div>';
        echo 
pagination_echo($pagination['page'],$pagination['total'],'/arena?tvt2&page=');
    }

require_once 
'./element_include/element_foot_user_true.php';
exit;
} else if (!
$go) {
$title 'Арена';  
if (
readcache('element_user_mesto'.$user['lost_id']) != $titlewritecache('element_user_mesto'.$user['lost_id'], $title);
require_once 
'./element_include/element_head.php';
require_once 
'./element_include/element_header_user_true.php';
echo 
'<div class="nfl p5 mb5 mt5 small mlra">';
echo 
'<div class="yellow1 mb5 cntr bold">Выберите локацию:</div>';

echo 
'<div class="ml5 mr5">';
    
echo 
'<a class="bl mb5 mt5 block" href="/arena?pvp">';
echo 
'<table class=""><td><img width="40" height="40" src="/images/arena.gif" alt=""/></td>';
echo 
'<td class="small" valign="top"><span class="yellow1 ml5">Золотая лига</span><br/>';
echo 
'<span class="white ml5">Бои 1х1 со ставками на золото, доступно с 5-го уровня</span>';
echo 
'</td></table></a>';    
        
echo 
'<a class="bl mb5 mt5 block odd" href="/arena?tvt">';
echo 
'<table><td><img width="40" height="40" src="/images/arena.gif" alt=""/></td>';
echo 
'<td class="small" valign="top"><span class="yellow1 ml5">Лига стихий</span><br>';
echo 
'<span class="white ml5">Командные бои 4х4';
echo 
'</td></table></span></div></div></a>';


echo 
'</div>';
// <img width="40" height="40" src="/images/arena.gif" alt=""/>
echo '</div>';
require_once 
'./element_include/element_foot_user_true.php';
exit;
}
Онлайн: 0
Реклама