<?
require_once '../core/system.php';
echo only_reg();
$header = 'Боссы';
require_once '../core/head.php';
$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='/style/theme/images/200x80_pahan.gif'></div><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 class='player' style='display:inline-block;white-space:nowrap;text-align:left;'>";
echo "<img src='/style/boss/$boss[image]' style='margin-right:3px;float:left;'>";
echo "<img src='/images/icon/user.png'><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>";
}
if($user[boss_mission] == 0){
echo "<div class='block_zero'>";
echo "<b class='dgreen'>Гопник:</b><br/><span class='medium'>Убей 100 боссов и получи 3000 опыта!<br/><span class='blue'>Прогресс:</span> $user[boss_pobed] из 100";
echo "<div class='stat_bar' style='margin:2px 0px 2px'>";
echo "<div class='progress' style='width:".round(100/(100/($user[boss_pobed]+0)))."%'></div>";
echo "</div>";
echo "<a class='btn' href='?act=nagrada'><span class='end'><span class='label'>Получить награду</span></span></a>";
echo "</div>";
echo "<div class='mini-line'></div>";
}
echo "<ul class='hint'><li>За победу над боссом дается хорошая награда!</li></ul>";
}
require_once '../core/foot.php';
?>