<?php
include_once '../core/system.php';
$header = 'Задания';
include_once '../core/head.php';
switch($act) {
case 'nagrada':
if($user[boss_mission] == 0){
if($user[boss_pobed] < 300){
$_SESSION['err'] = "Нужно 300 побед!";
header('Location: ?');
exit();
}else{
mysql_query("UPDATE `user` SET `keys` = '".($user['boss_pobed']-300)."', `keys` = '".($user['keys']+10)."' WHERE `id` = '$user[id]' LIMIT 1");
$_SESSION['message'] = "Награда получена!";
header('Location: ?');
exit();
}
}else{
$_SESSION['err'] = "Вы уже получили награду!";
header('Location: ?');
exit();
}
break;
case 'nagrada1':
if($user[duel_mission] == 0){
if($user[duel_rating] < 999){
$_SESSION['err'] = "Нужно 1000 рейтинга!";
header('Location: ?');
exit();
}else{
mysql_query("UPDATE `user` SET `duel_rating` = '".($user['duel_rating']-1000)."', `silver` = '".($user['silver']+1000)."', `gold` = '".($user['gold']+100)."' WHERE `id` = '$user[id]' LIMIT 1");
$_SESSION['message'] = "Награда получена!";
header('Location: ?');
exit();
}
}else{
$_SESSION['err'] = "Вы уже получали награду!";
header('Location: ?');
exit();
}
break;
case 'nagrada2':
if($user[arenal_mission] == 0){
if($user[arena_rating] < 999){
$_SESSION['err'] = "Нужно 1000 рейтинга!";
header('Location: ?');
exit();
}else{
mysql_query("UPDATE `user` SET `arena_rating` = '".($user['arena_rating']-1000)."', `silver` = '".($user['silver']+1500)."', `exp` = '".($user['exp']+500)."', `gold` = '".($user['gold']+50)."' WHERE `id` = '$user[id]' LIMIT 1");
$_SESSION['message'] = "Награда получена!";
header('Location: ?');
exit();
}
}else{
$_SESSION['err'] = "Вы уже получали награду!";
header('Location: ?');
exit();
}
break;
case 'nagrada3':
if($user[arena_mission] == 0){
if($user[arena_pobed] < 1000){
$_SESSION['err'] = "Нужно 1000 побед!";
header('Location: ?');
exit();
}else{
mysql_query("UPDATE `user` SET `arena_pobed` = '".($user['arena_pobed']-1000)."', `exp` = '".($user['exp']+5000)."' WHERE `id` = '$user[id]' LIMIT 1");
$_SESSION['message'] = "Награда получена!";
header('Location: ?');
exit();
}
}else{
$_SESSION['err'] = "Вы уже получили награду!";
header('Location: ?');
exit();
}
break;
case 'nagrada4':
if($user[boss_mission] == 0){
if($user[boss_pobed] < 50){
$_SESSION['err'] = "Нужно 50 побед!";
header('Location: ?');
exit();
}else{
mysql_query("UPDATE `user` SET `boss_pobed` = '".($user['boss_pobed']-50)."', `exp` = '".($user['exp']+100)."',  `gold` = '".($user['gold']+3)."' WHERE `id` = '$user[id]' LIMIT 1");
$_SESSION['message'] = "Награда получена!";
header('Location: ?');
exit();
}
}else{
$_SESSION['err'] = "Вы уже получили награду!";
header('Location: ?');
exit();
}
break;
default;
echo "<div class='player center blue'>";
echo "Выполняй задания и получай отличную награду";
echo "</div>";
echo "<div class='mini-line'></div>";
echo "<div class='block_zero'>";
echo "<b class='dgreen'>Сокрушитель боссов!</b><br/><span class='medium'>Победи боссов 300 раз<br/><span class='blue'>Прогресс:</span> $user[boss_pobed] из 300";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(300/($user[boss_pobed]+0)))."%'></div>";
echo "</div>";
echo "<span class='blue'>Награда:</span> 10 ключей для Сокровищ Арены<br>";
if($user[boss_pobed] > 300)echo "<a class='btn' href='?act=nagrada'><span class='end'><span class='label'>Получить награду</span></span></a>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='block_zero'>";
echo "<b class='dgreen'>Дуэлянт!</b><br/><span class='medium'>Набери с побед в дуэлях 1000 рейтинга!<br/><span class='blue'>Прогресс:</span> $user[duel_rating] из 1000";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(1000/($user[duel_rating]+1)))."%'></div>";
echo "</div>";
echo "<span class='blue'>Награда:</span> <img src='/images/icon/gold.png'> 100 <img src='/images/icon/silver.png'> 1000<br>";
if($user[duel_rating] > 1000)echo "<a class='btn' href='?act=nagrada1'><span class='end'><span class='label'>Получить награду</span></span></a>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='block_zero'>";
echo "<b class='dgreen'>Боец арены!</b><br/><span class='medium'>Набери с побед на арене 1000 рейтинга!<br/><span class='blue'>Прогресс:</span> $user[arena_rating] из 1000";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(1000/($user[arena_rating]+1)))."%'></div>";
echo "</div>";
echo "<span class='blue'>Награда:</span> <img src='/images/icon/gold.png'> 50 <img src='/images/icon/silver.png'> 1500 <img src='/images/icon/exp.png'> 500<br>";
if($user[arena_rating] > 1000)echo "<a class='btn' href='?act=nagrada2'><span class='end'><span class='label'>Получить награду</span></span></a>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='block_zero'>";
echo "<b class='dgreen'>Лидер арены!</b><br/><span class='medium'>Победи на арене 1000 раз<br/><span class='blue'>Прогресс:</span> $user[arena_pobed] из 1000";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(1000/($user[arena_pobed]+0)))."%'></div>";
echo "</div>";
echo "<span class='blue'>Награда:</span> <img src='/images/icon/exp.png'> 5000<br>";
if($user[arena_pobed] > 1000)echo "<a class='btn' href='?act=nagrada3'><span class='end'><span class='label'>Получить награду</span></span></a>";
echo "</div>";
echo "<div class='dot-line'></div>";
echo "<div class='block_zero'>";
echo "<b class='dgreen'>Только победы!</b><br/><span class='medium'>Победи боссов 300 раз<br/><span class='blue'>Прогресс:</span> $user[boss_pobed] из 300";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(30/($user[boss_pobed]+0)))."%'></div>";
echo "</div>";
echo "<span class='blue'>Награда:</span> <img src='/images/icon/exp.png'> 100 <img src='/images/icon/gold.png'> 3<br>";
if($user[boss_pobed] > 300)echo "<a class='btn' href='?act=nagrada4'><span class='end'><span class='label'>Получить награду</span></span></a>";
echo "</div>";
echo "<div class='mini-line'></div>";
echo "<div class='menuList'><li><a href='/sage/'><img src='/images/icon/arrow.png'>Вернуться в хижину мудреца</a></li></div>";
echo "</div>";
}

include_once '../core/foot.php';
?>