<?php
include 'inc/mysql.php';//инклуд
include 'inc/check.php';//инклуд
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
include 'inc/shapka.php';//инклуд
echo'<div class="menudiv">Арена</div>';//титл
$kount = mysql_num_rows(mysql_query("SELECT * FROM `account`"
);
$hp = rand(1,$account['lvl']);
if(isset($_GET['attack'])){
if($account['hp'] < 20){
header('Location: ?');
die();
}
if($account['mp'] < 50){
header('Location: ?');
exit;
}
$ank = mysql_fetch_array(mysql_query("select * from `account` where `id` = '".abs(intval($_GET['attack']))."'"
);
$ank_param = $ank['ataka'] + $ank['hp'] + $ank['zahita'];
$user_param = $account['ataka'] + $account['hp'] + $account['zahita'];
if($ank_param > $user_param){
mysql_query("UPDATE `account` SET `arena2c` = `arena2c` - 1, `money` = `money` + 10, `exp` = `exp` + 1, `mp` = `mp` - '50', `hp` = `hp` - '30' WHERE `id` = '".$account['id']."' LIMIT 1"
;
$_SESSION['finish']="<font color='red'>Ты проиграл. +10 серебра и +1 опыта.</font>";
header('Location: ?');
die();
}
else{
$serebro = rand(10,30);//серебро за победу
$exp = rand(10,30);//опыт за победу
mysql_query("UPDATE `account` SET `arena2c` = `arena2c` - 1, `money` = `money` + ".$serebro.", `exp` = `exp` + ".$exp.", `mp` = `mp` - 50, `hp` = `hp` - 7 WHERE `id` = ".$account['id']." LIMIT 1"
;
$_SESSION['finish']="<font color='green'>Ты выйграл. +$serebro серебра и +$exp опыта.</font>";
header('Location: ?');
die();
}
}
if(isset($_SESSION['finish'])){
echo $_SESSION['finish'];
unset($_SESSION['finish']);
echo"<center><a class='menu_j' href='/arena2.php' ><span class='end'><span class='label'><img src='pic/main/boy.png' alt='' style='border:1px solid #131313;border-radius:1px;height:15px;width:16px'/>Еще бой</span></span></a></center>";
include 'inc/nogi.php';
die();
}
echo "<br><div class='player center red'><b>Побеждай врагов и становись сильнее!За победу ты получишь серебро и опыт.</b></div>
<div class='mini-line'></div>";
echo "<div class='player'>
<h3><span class='red'><font color='red'>Доступный противник:</h3></font>
</div>";
$opponent = mysql_fetch_assoc(mysql_query("SELECT * FROM `account` ORDER BY RAND() LIMIT 1"
);
$opponent_param = $opponent['ataka'] + $opponent['hp'] + $opponent['zahita'];
$user_param = $account['ataka'] + $account['hp'] + $account['zahita'];
echo "<div class='block_zero'><div class='float-left'><img src='pic/avatar/paren.png' alt=''/></div>
".$opponent['login']."
<br><br>
<img src='/pic/main/attack_total.png' alt='str'/> Сила: ".$opponent['ataka']."
<br>
<img src='/pic/main/hp.png' alt='vit'/> Здоровье: ".$opponent['hp']."
<br>
<img src='/pic/main/defence_total.png' alt='def'/> Защита: ".$opponent['zahita']."
<br>
".$opponent_param." <img src='pic/main/man.png'> VS <img src='pic/main/man.png'> ".$user_param."
<br>
<br>
<center><a class='menu_j' href='/arena2.php?attack=".$opponent['id']."' ><span class='end'><span class='label'><img src='pic/main/boy.png' alt='' style='border:1px solid #131313;border-radius:1px;height:15px;width:16px'/>Атакoвать</span></span></a></center>
<br>
<div style='clear:both;'></div>
</div>";
echo '<div class="rzd"></div>';
echo '<div class="">';
$cfg = mysql_query("SELECT * FROM `config`"
;
$configs = mysql_fetch_array($cfg);
echo "<div class='dot-line'></div>
<div class='player center'>
<center><a class='menu_j' href='/arena2.php'><span class='end'><span class='label'><img src='pic/main/boy.png' alt='' style='border:1px solid #131313;border-radius:1px;height:15px;width:16px'/>Другие противники</span></span></a></center>
</div>";
echo '<div class="rzd"></div>';
echo '<div class="">';
$cfg = mysql_query("SELECT * FROM `config`"
;
$configs = mysql_fetch_array($cfg);
echo "<div class='mini-line'></div>
<div class='player'>
Ваши параметры:
<br>
<img src='/pic/main/attack_total.png' alt='str'/> ".$account['ataka']." <img src='/pic/main/hp.png' alt='vit'/> ".$account['hp']." <img src='/pic/main/defence_total.png' alt='def'/>".$account['zahita']."
</div><br/>
<div class='mini-line'></div>";
}
include 'inc/nogi.php';
?>