Файл: 3/basemen.php
Строк: 245
<?php
require_once ('system/func.php');
$title = 'Битва с нечистью';
require_once ('system/header.php');
auth(); // Закроем от гостей
if(isset($_SESSION['msg'])){
echo msg($_SESSION['msg']);
unset($_SESSION['msg']);
}
if($user['id_clan'] ==0){echo'<div class="block"><span class="btn_start"><span class="btn_end"> Для участия в боях с нечистью нужно состоять в клане. </div>';
require_once ('system/footer.php');
exit;}
$name_ar=array('',' Кменный голем',' Оборотень','Гиганская змея','Циклоп','Водяной','Мутант');
$param_ar=array('','8500000','16000000','32000000','64000000','100000000','200000000');
$basemen_boss = mysql_query("SELECT * FROM `basemen_boss` WHERE `clan` = '".$user['id_clan']."' ORDER BY `id` LIMIT 1");
$basemen_boss = mysql_fetch_array($basemen_boss);
if(!$basemen_boss and $user['clan_rang'] < 3){echo'<div class="block"><span class="btn_start"><span class="btn_end"> Начать бой с нежитью бой могут Лидер, Генерал и Офицер клана.</div> ';exit;}
if(isset($_GET['id'])){
if(($_GET['id']*10)<$user['level']){
mysql_query("INSERT INTO `basemen_boss` SET `clan` = '".$user['id_clan']."'
, `hp` = '".$param_ar[$_GET['id']]."',`boss` = '". intval($_GET['id'])."',`time` = '".(time()+(60*30))."'");
header('Location: /basemen.php');
}else{echo'<div class="block"><span class="btn_start"><span class="btn_end">Ваш уровень меньше уровня нечисти.</div> ';}
}
if(!$basemen_boss and $user['clan_rang'] > 1){
for ($a = 1; $a <= 6; $a++) {
?>
<div class="block">
<span> <img class="left mr8" src="/images/basement/<?echo $a;?>.jpg" width="50" height="50" alt=""> </span>
<img src="/images/icons/boss.png" width="16" alt="" hegiht="16"> <span><?echo $name_ar[$a];?></span>
<span class="white">
<img src="/images/icons/level.png" width="16" height="16" alt=""> <?echo $a*10;?> ур. </span>
<div class="m3" style="padding-left: 58px"> <div style="width: 100%; height: 4px"class="progress-grey">
<div style="width: 100%; height: 4px" class="progress-green"></div></div> </div> <div>
<img src="/images/icons/health.png" width="16" height="16" alt=""> <?echo $param_ar[$a];?>
<img src="/images/icons/dsword.png" width="16" height="16" alt=""> <?echo $param_ar[$a]/100;?>
<img src="/images/icons/def.png" width="16" height="16" alt=""> <?echo intval($param_ar[$a]/100);?> </div>
<div class="clear"></div>
<div class="block center">
<span class="btn_start"><span class="btn_end"><a class="btn" href="?id=<?echo $a;?>">Начать бой</a></span> </span> </div>
</div>
</div>
<?
}
require_once ('system/footer.php');
exit;
}
$basemen_us = mysql_query("SELECT * FROM `basemen_us` WHERE `user` = '".$user['id']."' ORDER BY `id` LIMIT 1");
$basemen_us = mysql_fetch_array($basemen_us);
if(!$basemen_us){
?>
<div class="content"><div class="block center color3 s125">Началось сражение</div>
<div class="line"></div><div class="block center s125">
Твой клан начал сражение с нечистью...
</div>
<div class="dotted"></div>
<div class="block">
<span> <img class="left mr8" src="/images/basement/<?echo $basemen_boss['boss'];?>.jpg" width="50" height="50" alt=""> </span>
<img src="/images/icons/boss.png" width="16" alt="" hegiht="16"> <span><?echo $name_ar[$basemen_boss['boss']];?> </span> <span class="white">
<img src="/images/icons/level.png" width="16" height="16" alt=""><?echo $basemen_boss['boss']*10;?> ур. </span>
<div class="m3" style="padding-left: 58px"> <div style="width: 100%; height: 4px"
class="progress-grey">
<div style="width: 100%; height: 4px" class="progress-green"></div></div> </div> <div>
<img src="/images/icons/health.png" width="16" height="16" alt=""> <?echo $basemen_boss['hp'];?>
<img src="/images/icons/dsword.png" width="16" height="16" alt=""> <?echo $param_ar[$basemen_boss['boss']]/100;?>
<img src="/images/icons/def.png" width="16" height="16" alt=""> <?echo intval($param_ar[$basemen_boss['boss']]/100);?> </div>
<div class="clear"></div>
</div> <div class="dotted"></div>
<div class="block center">
<span class="btn_start"><span class="btn_end"><a class="btn" href="?join">Атаковать</a></span> </span> </div>
</div>
<?
require_once ('system/footer.php');
if(isset($_GET['join'])){
if($user['level']>($basemen_boss['boss']*9)){
mysql_query("INSERT INTO `basemen_us` SET `user` = '".$user['id']."',`clan` = '".$user['id_clan']."'");
header('Location: /basemen.php');
}else{echo'В вас слабий уравень';}
}
exit;
}
$koll = mysql_result(mysql_query("SELECT COUNT(*) FROM `basemen_us` WHERE `clan` = '".$user['id_clan']."'"),0);
if($basemen_boss['hp']<=0){
$dfgdg=$basemen_boss['boss']*80;
mysql_query("UPDATE `users` SET `clan_exp` = '".($user[clan_exp]+$dfgdg*13)."',`exp` = `exp` + '".($dfgdg*13)."',`gold` = `gold` + '".($dfgdg)."' WHERE `id` = '".$myID."' LIMIT 1");
mysql_query("UPDATE `clans` SET `exp` = `exp` + '".($dfgdg*3)."' WHERE `id` = '".$user[id_clan]."' LIMIT 1");
$_SESSION['msg'] = "<font color='green'><b>Победа</b></font><hr>Награда ".($dfgdg*13)." ".ico('icons','exp.png')." опыта и ".($dfgdg)." ".ico('icons','gold.png')." золота";
mysql_query("TRUNCATE TABLE basemen_boss");
mysql_query("TRUNCATE TABLE basemen_us");
header('Location: /basemen.php');
}
if($basemen_boss['time']<=time()){
$_SESSION['msg'] = "<font color='green'><b>Поражение</b></font>";
mysql_query("TRUNCATE TABLE basemen_boss");
mysql_query("TRUNCATE TABLE basemen_us");
header('Location: /basemen.php');
}
if(isset($_GET['attack'])){
$_hp = ceil($user['max_health']*10/100);
if($user['energy'] < 10 or $user['health'] < $_hp){
$_SESSION['msg'] = "Для нападения необходимо минимум ".ico('icons','health.png')." 10% жизни и ".ico('icons','energy.png')." 10 энергии!<br><a href='/rinok?koldun&url=/basemen.php' class='btn2' data-ajax>Восстановить ".ico('icons','gold.png')." 15</a>";
}else{
mysql_query("UPDATE `users` SET `health` = `health`-'".($basemen_boss['boss']*100)."',`energy` = `energy`-'".(10)."' WHERE `id` = '".$myID."' LIMIT 1");
if($user['str']>$basemen_boss['hp']){$user['str']=$basemen_boss['hp'];}
mysql_query("UPDATE `basemen_boss` SET `hp` = `hp`-'".$user['str']."' WHERE `clan` = '".$user['id_clan']."' LIMIT 1");
}
header('Location: /basemen.php');
}
?>
<div class="block">
<div class="content"><div class="block center color3 s125">
<a href="?"><?echo $name_ar[$basemen_boss['boss']];?></a><span class="white">, <?echo tl($basemen_boss['time']-time());?></span></div>
<div class="center"> <a href="?attack"><img class="center " src="/images/basement/<?echo $basemen_boss['boss'];?>.jpg" width="50" height="50" alt=""></a> </div>
<img src="/images/icons/boss.png" width="16" alt="" hegiht="16"> <span class="center"> <?echo $name_ar[$basemen_boss['boss']];?> </span> <span class="white">
<img src="/images/icons/level.png" width="16" height="16" alt=""> <?echo $basemen_boss['boss']*10;?> ур. </span>
<div class="m3" style=""> <div style="width: 100%; height: 4px"
class="progress-grey">
<div style="width: 100%; height: 4px" class="progress-green"></div></div> </div> <div>
<img src="/images/icons/health.png" width="16" height="16" alt=""> <?echo $basemen_boss['hp'];?>
<img src="/images/icons/dsword.png" width="16" height="16" alt=""> <?echo $param_ar[$basemen_boss['boss']]/100;?>
<img src="/images/icons/def.png" width="16" height="16" alt=""> <?echo intval($param_ar[$basemen_boss['boss']]/100);?> </div>
<div class="clear"></div>
</div> <div class="dotted"></div>
<div class="block center">
<span class="btn_start"><span class="btn_end"><a class="btn" href="?attack">Ηaнеcти yдaр</a></span> </span> </div>
<div class="dotted"></div>
<div class="block">
<a href="/profile/1768700?nocache=1777367727"><span><?echo $user['login'];?></span></a> <span class="small green"> </span> <span class="white">
<img src="/images/icons/level.png" width="16" height="16" alt=""> <?echo $user['level'];?> ур. </span>
<div class="clear"></div>
</div> <div class="dotted"></div>
<div class="block">
<img src="/images/basement/members.png" width="16" height="16" alt=""> <span class="blue">Участники сражения:</span> (<?echo $koll;?>)
</div> <div class="block">
<?
$q = mysql_query("SELECT * FROM `basemen_us` WHERE `clan`=".$user['id_clan']." ORDER BY `id` DESC ");
while($post = mysql_fetch_assoc($q)) {
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = $post[user] LIMIT 1"));
echo ' '.$ank['login'];
}
?>
</div>
<div class="dotted"></div>
<?
require_once ('system/footer.php');
?>