Файл: element_include/element_header_user_true.php
Строк: 244
<?php
$max_level = element_settings_game('lost_max_level');
$nex_level = ($max_level > $user['lost_level']) ? ($user['lost_level'] + 1) : $user['lost_level'];
$cache_level_nex = readcache('element_level_exp'.$nex_level);
if (empty($cache_level_nex)) {
$cache_level_nex = mysql_fetch_array(mysql_query("SELECT `lost_exp` FROM `element_level` WHERE `lost_level` = '$nex_level' LIMIT 1"));
writecache('element_level_exp'.$nex_level, $cache_level_nex);
}
$update_level = update_up_level($nex_level, $cache_level_nex['lost_exp'], $user);
if ($update_level[1] == 1) {
$user = $update_level[2];
writecache('element_users_id_'.$user['lost_id'],$user);
$lost_exp = explode(' ', $user['lost_exp']);
}
if ($user['lost_level'] < $max_level) $procent_level = ceil(($lost_exp[0] / $cache_level_nex['lost_exp']) * 100); else $procent_level = 0;
if ($procent_level > 100) $procent_level = 100;
?>
<body>
<div class="p5">
<div class="header p5 bl">
<span class="yellow1 small">
<div class="fr">
<img src="/images/icons/gold.png"><span><?php echo nmb_2($user['lost_money_gold']).' '; ?></span>
<img src="/images/icons/cristall.png"><span> <?php echo nmb_2($user['lost_resourse_cristalls']).' '; ?></span>
<img src="/images/icons/irridyi.png"><span> <?php echo nmb_2($user['lost_resourse_irridyi']); ?></span>
</div>
<?php echo ikonka_user($user['lost_race'], 'online').' '.$user['lost_login'].' '; ?><img src="/images/icons/energy.png"><span><?php echo $user_energy[0].(($user_energy[0] < $user_energy[1]) ? '<span class="ccc"> '.date("i:s", mktime(0, 0, $user_energy[2])).' </span>' : '').' '; ?></span>
<?php echo (($lost_other[2] > 0) ? ', <a class="small lngreen" href="/mail">Почта+'.$lost_other[2].'</a>' : '');
$battle_url = readcache('element_users_battle'.$user['lost_id']);
if (!empty($battle_url)) {
echo '<br/><div class="mt5 cntr small"><a href="'.$battle_url.'">Вернуться в бой</a></div>';
}
?>
</span>
</div>
<div style="margin: 0px -5px 0px -5px;">
<span class="bl prg-bar" style="height: 8px; ">
<span class="bl fl prg-blue" style="height: 6px; width:<?php echo $procent_level; ?>%"> </span>
</span>
</div>
<?php
echo (isset($title)) ? '<div class="title mt3 mb3">'.$title.'</div>' : '';
echo $update_level[0];
if ($go == 'v_town' AND !empty($user_prig_gorod) AND $user['lost_town'] == 0) {
$cache_town_pr = cache_town($user_prig_gorod['lost_town']);
$list_user = readcache('element_list_user_town'.$user_prig_gorod['lost_town']);
if (!empty($list_user)) {
$list_user[7][$user['lost_id']] = 0;
writecache('element_list_user_town'.$user_prig_gorod['lost_town'], $list_user);
}
$lost_exp[2] = 0;
$user['lost_town'] = $user_prig_gorod['lost_town'];
$user['lost_exp'] = implode(' ', $lost_exp);
$user['lost_town_other'] = '7:'.time();
$journal = '<span class="yellow1">[user]'.$user_prig_gorod['user_id_kto'].'[/user] пригласил в город [user]'.$user['lost_id'].'[/user]</span>';
mysql_query("INSERT INTO `element_town_journal` SET `lost_town` = '$user[lost_town]',
`lost_value` = '$journal',
`lost_time` = '".time()."'");
writecache('element_users_id_'.$user['lost_id'], $user);
user_list_update($user['lost_id']);
writecache('element_users_id_'.$user['lost_id'], $user);
deletecache('element_v_gorod_user'.$user['lost_id']);
header('Location: /town');
exit;
}
if ($go == 'no_town' AND !empty($user_prig_gorod) AND $user['lost_town'] == 0) {
$cache_town_pr = cache_town($user_prig_gorod['lost_town']);
deletecache('element_v_gorod_user'.$user['lost_id']);
$user_prig_gorod = '';
echo '<div class="nfl small p5 mb5 small cntr lngreen mlra">';
echo 'Вы отказались вступать в город <img src="/images/town/race_'.$cache_town_pr['lost_race'].'.png" alt=""/> <a href="/town?id='.$cache_town_pr['lost_id'].'">'.$cache_town_pr['lost_name'].'</a>';
echo '</div>';
}
if (!empty($user_prig_gorod) AND $user['lost_town'] == 0) {
$cache_user_pr = cache_user($user_prig_gorod['user_id_kto']);
$cache_town_pr = cache_town($user_prig_gorod['lost_town']);
echo '<div class="nfl small p5 mb5 small cntr lngreen mlra">';
echo ikonka_user($cache_user_pr['lost_race'], ((!empty($online[$cache_user_pr['lost_id']])) ? 'online' : 'offline')).' <a href="/user?id='.$cache_user_pr['lost_id'].'">'.$cache_user_pr['lost_login'].'</a> ';
echo 'приглашает Вас в город <img src="/images/town/race_'.$cache_town_pr['lost_race'].'.png" alt=""/> <a href="/town?id='.$cache_town_pr['lost_id'].'">'.$cache_town_pr['lost_name'].'</a><br/>';
echo '<a class="button mt5 w40" href="/?go=v_town">Вступить</a> <a class="button w40" href="/?go=no_town">Отказаться</a>';
echo '</div>';
}
if ($go == 'energy' AND $user_energy[0] == 0) {
$minus_gold = $user_energy[1] * 2;
if ($user['lost_money_gold'] < $minus_gold) $error = '<span class="red">Вам не хватает '.($minus_gold - $user['lost_money_gold']).' золота</span><br/><a class="button mt5 w40" href="/payment">Купить золото</a>';
if (!isset($error)) {
$user_energy[0] = $user_energy[1];
$user_energy[2] = time();
$user['lost_params_energy'] = implode(':', $user_energy);
update_money_exp($user, 0, 0, 0, -$minus_gold);
user_list_update($user['lost_id']);
//header('Location: '.$_SERVER['REQUEST_URI'].'');
exit;
} else echo '<div class="nfl small p5 mb5 small cntr mlra">'.$error.'</div>';
}
if ($user['lost_town'] > 0 AND !isset($town_announce)) {
if (!empty($user_town['lost_text_announce'])) {
$announce_view = readcache('element_town_announce'.$user_town['lost_id']);
if (!is_array($announce_view)) $announce_view = array();
if (isset($_GET['delete_announce']) AND empty($announce_view[$user['lost_id']])) {
$announce_view[$user['lost_id']] = '1';
writecache('element_town_announce'.$user_town['lost_id'], $announce_view);
}
if (empty($announce_view[$user['lost_id']])) {
$explode_t = explode('|||', $user_town['lost_other_announce']);
$cache_announce = cache_user($explode_t[0]);
echo '<div class="nfl small p5 mb5 small cntr lngreen mlra">';
echo '<div class="small yellow1 bold cntr">Объявление от '.ikonka_user($cache_announce['lost_race'], ((!empty($online[$explode_t[0]])) ? 'online' : 'offline')).' <a href="/user?id='.$explode_t[0].'">'.$cache_announce['lost_login'].'</a>:</div>';
echo '<div class="small moderator cntr">'.$user_town['lost_text_announce'].'</div>';
echo '<div class="small gray1 mt5 cntr">'.Timer($explode_t[1]).'</div>';
echo '<div class="mt5 cntr"><a class="w40" href="'.$_SERVER['REQUEST_URI'].(($_GET) ? '&delete_announce' : '?delete_announce').'">Скрыть объявление</a></div>';
echo '</div>';
}
}
}
?>