Файл: element_quests.php
Строк: 115
<?php
require_once './element_options/element_options.php';
if (!$user) { header('Location: /'); exit; }
$user_quests = user_quests($user['lost_id']);
if ($go == 'nagrada' AND $id) {
$query = mysql_fetch_array(mysql_query("SELECT * FROM `element_quests` WHERE `lost_id` = '$id' LIMIT 1"));
if ($query) {
if ($user_quests[$query['lost_quests']] == $query['lost_count']) {
$header = 1;
if ($query['lost_nagrada_gold'] > 0) $n_gold = $query['lost_nagrada_gold']; else $n_gold = 0;
if ($query['lost_nagrada_cristalls'] > 0) $n_crist = ($query['lost_nagrada_cristalls'] * $user['lost_level']); else $n_crist = 0;
if ($query['lost_nagrada_exp'] > 0) $n_exp = ($query['lost_nagrada_exp'] * $user['lost_level']); else $n_exp = 0;
$user_quests[$query['lost_quests']] = $user_quests[$query['lost_quests']] + 1;
$user_quests['lost_vipolneno'] = $user_quests['lost_vipolneno'] + 1;
$user_quests['lost_new'] = $user_quests['lost_new'] - 1;
if ($user_quests['lost_new'] < 0) $user_quests['lost_new'] = 0;
update_money_exp($user, $n_exp, $n_crist, 0, $n_gold);
writecache('element_quests_user'.$user['lost_id'], $user_quests);
quests_list_update($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 mt5 mb5 cntr small mlra">';
echo '<span class="lngreen">Задание выполнено, награда Ваша</span>';
echo '</div>';
}
}
}
if (!isset($header)) {
$title = 'Задания';
require_once './element_include/element_head.php';
require_once './element_include/element_header_user_true.php';
}
$count_quests = mysql_result($query = mysql_query("SELECT COUNT(lost_id) FROM `element_quests`"), 0);
echo '<div class="nfl p5 mt5 mb5 cntr small mlra">';
echo '<span class="ccc">Выполняй заданий каждый день и получай за них награды! <br/><br/>Сегодня выполнено заданий: '.$user_quests['lost_vipolneno'].' из '.$count_quests.'</span>';
$query = mysql_query("SELECT * FROM `element_quests`");
while ($myrrow = mysql_fetch_array($query)) {
if ($user_quests[$myrrow['lost_quests']] <= $myrrow['lost_count']) {
echo '<div class="nfl p5 mt5 mb5 cntr small mlra">';
echo '<span class="lngreen bold">'.$myrrow['lost_name'].'</span><br/>';
echo '<span class="white">'.$myrrow['lost_sub_name'].'</span><br/>';
echo '<span class="bl mt5 mb5 prg-bar">
<span class="bl fl prg-blue" style="width:'.ceil(($user_quests[$myrrow['lost_quests']] / $myrrow['lost_count']) * 100).'%"> </span>
</span>';
echo '<span class="ccc">Прогресс: '.$user_quests[$myrrow['lost_quests']].' из '.$myrrow['lost_count'].'</span><br/>';
echo '<span class="ccc">Награда: <span class="lngreen">';
echo ($myrrow['lost_nagrada_gold'] > 0) ? '<img src="/images/icons/gold.png">'.$myrrow['lost_nagrada_gold'] : '';
echo ($myrrow['lost_nagrada_cristalls'] > 0) ? ' <img src="/images/icons/cristall.png">'.($myrrow['lost_nagrada_cristalls'] * $user['lost_level']) : '';
echo ($myrrow['lost_nagrada_exp'] > 0) ? ' <img width="13" height="11" src="/images/icons/experience.png">'.($myrrow['lost_nagrada_exp'] * $user['lost_level']) : '';
echo '</span></span>';
if ($user_quests[$myrrow['lost_quests']] == $myrrow['lost_count']) echo '<br/><a class="button mt5 w50" href="/quests?go=nagrada&id='.$myrrow['lost_id'].'">Получить награду</a>';
echo '</div>';
}
}
echo '<span class="ccc">Каждые сутки в 00:00 по серверу задания обнуляются</span>';
echo '</div>';
require_once './element_include/element_foot_user_true.php';
?>