Файл: public_html/element_include/element_header_user_true.php
Строк: 280
<?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;
$_items_quality = false;
if ( ! empty($user['lost_id']))
{
require_once './element_function/element_function_item.php';
$_items_store = array();
$_items_apply = users_wear_item($user['lost_id']);
foreach (users_shoot_item($user['lost_id']) as $_item)
{
$_item = cache_item($_item);
if ( ! isset($_items_apply[$_item['lost_mesto']]))
{
$_items_quality = true;
break;
}
$_item_p = item_generation_params($_item['lost_strlen'], $_item['lost_heatpoints'], $_item['lost_protection'], $_item['lost_comparison']);
if ( ! isset($_items_store[$_item['lost_mesto']]))
{
$_items_store[$_item['lost_mesto']] = cache_item($_items_apply[$_item['lost_mesto']]);
}
$_apply_p = item_generation_params($_items_store[$_item['lost_mesto']]['lost_strlen'], $_items_store[$_item['lost_mesto']]['lost_heatpoints'], $_items_store[$_item['lost_mesto']]['lost_protection'], $_items_store[$_item['lost_mesto']]['lost_comparison']);
if ($_apply_p['summa'] < $_item_p['summa'])
{
$_items_quality = true;
break;
}
}
}
?>
<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').' '.($_items_quality ? '<a href="/bag"><img src="/images/icons/arena.gif"></a> ' : '').''.$user['lost_login'].', <b>'.$user['lost_level'].' ур.</b> '; ?><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>';
}
if ( ! in_array(ltrim($_SERVER['SCRIPT_NAME'], '/'), array('cave_battle.php', 'cave.php')))
{
$monsters = mysql_query("SELECT * FROM `cave_monsters`");
while ($pers = mysql_fetch_assoc($monsters))
{
$list = mysql_fetch_assoc(mysql_query("SELECT * FROM `cave_list` WHERE `user`='".mysql_real_escape_string($user['lost_id'])."' AND `monster`='".mysql_real_escape_string($pers['id'])."' LIMIT 1"));
$list_all = mysql_result(mysql_query("SELECT COUNT(*) FROM `cave_list` WHERE `action`='0' AND `monster`='".mysql_real_escape_string($pers['id'])."'"), 0);
if ( ! empty($list))
{
if ($list_all >= $pers['players'] or $list['action'] == '1')
{
echo '<div class="mt5 cntr small">Битва с <a href="/cave/battle/'.$pers['id'].'">'.$pers['name'].'</a> начата!</div>';
}
else
{
if ((int) $list['next_battle'] < time())
{
echo '<div class="mt5 cntr small">Вы в очереди на <a href="/cave">'.$pers['name'].'</a> (Очередь: '.$list_all.' чел. из '.$pers['players'].')</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
if (count(users_shoot_item($user['lost_id'])) > 19)
{
echo' <div class="nfl p5 mt5 cntr mlra"><div class="small ml5 lngreen">У Вас заполнен рюкзак! Вы не можете получать награду.</div></div>';
}
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 = mysql_fetch_assoc(mysql_query("SELECT * FROM `town_announce` WHERE `user`='{$user['lost_id']}' AND `anons`='{$user_town['lost_other_announce']}' LIMIT 1"));
if (empty($announce))
{
if (isset($_GET['delete_announce']))
{
mysql_query("INSERT INTO `town_announce` (`user`, `anons`) VALUES ('{$user['lost_id']}', '{$user_town['lost_other_announce']}')");
}
else
{
$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>';
}
}
}
}
?>