<?
include_once '../system/common.php';
    
include_once '../system/functions.php';
        
include_once '../system/user.php';

    $title = 'Боссы';

include_once '../system/h.php';
    
if(!$user) {

  header('location: /');
    
exit;

}


if($user[level] < 5){

echo "<div class='player center'><img src='/images/town/hellworld.png'>";
echo "<center>";
echo "<li><b>Для сражений с боссами требуется <img src='/images/icon/level.png'> 5 уровень.</b></li>";
echo "<li><b>Ваш уровень: <img src='/images/icon/level.png'> $user[level]</b></li>";
echo "</center>";



echo "</div>";
}


if($user[level] >= 5){

$kount = mysql_result(mysql_query("SELECT COUNT(*)  FROM `boss`"),0);

switch($act) {
case 'nagrada':
if($user[boss_mission] == 0){
if($user[boss_pobed] < 99){
$_SESSION['err'] = "Нужно 100 побед!";
header('Location: ?');
exit();
}else{
mysql_query("UPDATE `user` SET `exp` = '".($user['exp']+3000)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `boss_pobed` = '".($user['boss_pobed']-100)."' WHERE `id` = '$user[id]' LIMIT 1");
$_SESSION['message'] = "Награда получена!";
header('Location: ?');
exit();
}
}else{
$_SESSION['err'] = "Вы уже получили награду!";
header('Location: ?');
exit();
}
break;
default;

echo "<div class='player center'><img src='/images/town/hellworld.png'></div>";


echo "<div class='mini-line'></div>";
if($kount == 0)echo "<div class='player grey'>Нет боссов!</div><div class='mini-line'></div>";
$q = mysql_query("SELECT * FROM `boss` ORDER BY `lvl` ASC");
while($boss = mysql_fetch_assoc($q)) {

echo "<div  style='display:inline-block;white-space:nowrap;text-align:left;'>";
echo "<img src='/style/boss/$boss[image].png' style='margin-right:3px;float:left;'>";
            if ($boss['lvl'] == '1') {?><img src="/boss/img/grade/1.png"  height="11" alt="a"/> <?php }
	    if ($boss['lvl'] == '5') {?><img src="/boss/img/grade/2.png"  height="11" alt="d"/> <?php }
            if ($boss['lvl'] == '10' or $boss['lvl'] == '15') {?><img src="/boss/img/grade/3.png"  height="11" alt="d"/> <?php }
            if ($boss['lvl'] == '20' or $boss['lvl'] == '25') {?><img src="/boss/img/grade/4.png"  height="11" alt="a"/> <?php }
            if ($boss['lvl'] == '30' or $boss['lvl'] == '35') {?><img src="/boss/img/grade/5.png"  height="11" alt="d"/> <?php }
            if ($boss['lvl'] == '40') {?><img src="/boss/img/grade/6.png"  height="11" alt="a"/> <?php }
if($user[prava] == 3){
$boss[gold] = $boss[gold] * 2;
$boss[exp] = $boss[exp] * 2;
}
echo "<span class='yellow'> $boss[name]</span><br><img src='/images/icon/level.png'> $boss[lvl] Уровень<br><img src='/images/icon/gold.png'> $boss[gold], <img src='/images/icon/exp.png'> $boss[exp]";
echo "</div>";
echo "<div class='player'>";
echo "<a class='btn' href='boss.php?id=$boss[id]'><span class='end'><span class='label'>Выбрать</span></span></a>";
echo "</div>";
echo "<div class='mini-line'></div>";
}




echo "<ul class='hint'><li>За победу над монстром дается хорошая награда!</li></ul>";
}
}
include_once '../system/f.php';
?>