View file sdark.mobi/attack/index.php

File size: 24.12Kb
<?
require_once'../core/system.php';
echo only_reg();
echo ban();
echo blok();
mysql_query("UPDATE `user` set `mesto` = 'Бой' WHERE `id` = '".$user['id']."'");

$header='Нападение Демона';
require_once'../core/head.php';
$timer=$_SERVER['REQUEST_TIME']+300;

$req = mysql_query("SELECT * from `at_bat` where `usr` = '$user[id]'");
$avto= mysql_num_rows($req);
if($avto==0){
mysql_query("INSERT INTO `at_bat` SET `usr` = '$user[id]'");
header("Location: /attack/");
exit();
}
$myuser = mysql_fetch_array(mysql_query("SELECT * FROM `at_bat` WHERE `status`='' and `usr`='".$user['id']."'"));
$kols = mysql_result(mysql_query("SELECT  COUNT(id)  FROM `attack` WHERE `status`='0'"),0);
$goldsk = mysql_result(mysql_query("SELECT  COUNT(id)  FROM `attack` WHERE `boss`='1' and `status`='1'"),0);
/* if($kols == 0 && $goldsk==4 && $myuser['fight']==1){
mysql_query("INSERT INTO `attack` set `name`='Дух смерти', `hp`='30000000', `hpmax`='30000000', `sila`='5000', `prot`='23000', `boss`='1'");
}  */	 

$ureq = mysql_query("SELECT * FROM `attack` WHERE `id`='1'");
$mobc = mysql_fetch_array($ureq);

if($kols == 0 && $goldsk>=1  && $myuser['fight']==1){ 	

$_SESSION['light']="<span class='blue'>Награда:</span> <img src='/images/icon/exp.png' alt=''/> ".floor($exp*0.2)." ";
mysql_query("UPDATE `user` SET `exp`=`exp`+'".floor($exp*0.5)."' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `at_bat` SET `status`='1' WHERE `usr`=".$user['id']."");
header ("Location: /attack/");
	exit;
}
if($mobc['hp']==0){
	
$_SESSION['light']='<font color="CDCDCD">Демон был <img src="/images/icon/dead.png"> убит, но за ним придут другие! </font>';
header ("Location: /");
exit;
} 

if($user['battle']==0){
$t=$_SERVER['REQUEST_TIME']+3600;
$nextudar=rand(3,12);
$nextud=$_SERVER['REQUEST_TIME']+$nextudar;
mysql_query("DELETE FROM `battle` WHERE `usr`='".$user['nick']."'");
mysql_query("DELETE FROM `link` WHERE `usr`='".$user['id']."'");
mysql_query("DELETE FROM `duellog` WHERE `usr`='".$user['nick']."'");
mysql_query("UPDATE `at_bat` SET `wins`='', `exp`='', `fight`='1' WHERE `usr`='".$user['id']."'");
mysql_query("UPDATE `user` SET `battle`='1' WHERE `id`='".$user['id']."'");
mysql_query("INSERT INTO `link` SET `usr`='".$user['id']."',`timer`='".$t."', `link`='".$_SERVER['PHP_SELF']."'");
header ("Location: ?");
exit;
}
if($goldsk == 4){
$kala=rand(1,7);
} else {
$kala=rand(1,40);
}
if($kala=='2'){
$renq = mysql_query("SELECT * FROM `attack` WHERE `nextud`<='".$_SERVER['REQUEST_TIME']."' and `status`='' LIMIT 1");
while($mobuk = mysql_fetch_array($renq)){
$summastag = $user['max_health']+$user['sila']+$user['zashit']; 
$cp=$user['zashit']/$summastag;
$ym=1-$cp;
$um=rand($mobuk['sila']-$mobuk['sila']/8,$mobuk['sila']);
$mudar=$um*$ym;
$muron=round($mudar,0);
$vrud=rand(1,6); 
if($vrud==1){$vrud='использует пламя';}
if($vrud==2){$vrud='поцарапал вас когтем';}
if($vrud==3){$vrud='слегка зацепил вас';}
if($vrud==4){$vrud='испепеляет всё';}
if($vrud==5){$vrud='бросился на вас';}
if($vrud==6){$vrud='использует тёмную магию';}
$vrutd=rand(1,4); 
if($vrutd==1){$vrutd='убил';}
if($vrutd==2){$vrutd='испепелил';}
if($vrutd==3){$vrutd='уничтожил';}
if($vrutd==4){$vrutd='растерзал';}
if($user['health']<$muron and $user['health']>0){
	
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',`text`='<font color=F26C13>".$mobuk['name']."</font> ".$vrud."', `uron`='".$muron."', `timer`='".$_SERVER['REQUEST_TIME']."'+'300',`kogo`='".$user['id']."', `umen`='".$um."'");
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',`text`='<font color=F26C13>".$mobuk['name']."</font> ".$vrutd."', `timer`='".$_SERVER['REQUEST_TIME']."'+'300', `dead`='1', `kogo`='".$user['id']."', `umen`='".$um."'");
mysql_query("UPDATE `user` SET `health` = '0', `loss`=`loss`+'1' WHERE `id`='".$user['id']."' LIMIT 1");
mysql_query("UPDATE`at_bat` SET `fight`='1' WHERE `usr`='".$user['id']."' and `status`='' LIMIT 1");
}

if($user['health']>$muron){
	
$nextudar=rand(1,10);
$nextud=$_SERVER['REQUEST_TIME']+$nextudar;
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',text='<font color=F26C13>".$mobuk['name']."</font> ".$vrud."', `kogo`='".$user['id']."', `uron`='".$muron."', `timer`='".$_SERVER['REQUEST_TIME']."'+'300', `umen`='".$um."'");
mysql_query("UPDATE `user` SET `health` = `health`-'".$muron."' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `attack` SET `nextud` = '".$nextud."' WHERE `nextud`<='".$_SERVER['REQUEST_TIME']."' and `status`='' and `name`='".$mobuk['name']."' LIMIT 1");

}
} 
} 
if(isset($_GET['healing'])){
$reqx = mysql_query("SELECT `sila`,`timer`,`time` FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='healing'");
$healing = mysql_fetch_array($reqx);
$vrem = $_SERVER['REQUEST_TIME']+$healing['time'];
if($healing['timer']>''.$_SERVER['REQUEST_TIME'].'' or $user['health']<=0){
$_SESSION['err'] = "Исцеление не сработало!";
header ("Location: ?");
exit;
}
if($mobc['hp']>=$mobc['hpmax']){
$_SESSION['err'] = "Исцеление Демону не требуется!";
header ("Location: ?");
exit;
} else {
	
$u=rand($user['sila']-$user['sila']/8,$user['sila']);
$kolhp=$u*$healing['sila'];
$kolhp=round($kolhp,0);
mysql_query("UPDATE `umen` SET `timer` = '".$vrem."' WHERE `usr`='".$user['id']."' and `img`='healing'");
$xphe=$user['health']+$kolhp;
if($xphe<=$mobc['hpmax']){
mysql_query("UPDATE `attack` SET `hp` = `hp`+'".$kolhp."' WHERE `id`='1'");
} else {
mysql_query("UPDATE `attack` SET `hp` = '".$mobc['hpmax']."' WHERE `id`='1'");
}
$_SESSION['message'] = 'Вы <img src=/images/umen/healing.png height=16 width=16> исцелили Демона на '.$kolhp.'';
header ("Location: ?");
exit;
}
}
/* if(isset($_GET['gift_of_the_Gods'])){
	
$reqxs = mysql_query("SELECT time,timer FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='gift_of_the_Gods'");
$gift = mysql_fetch_array($reqxs);
$vrem = $_SERVER['REQUEST_TIME']+$gift['time']+30;
if($gift['timer']>''.$_SERVER['REQUEST_TIME'].''){
$_SESSION['err'] = "Умение ещё не готово!";
header ("Location: ?");
exit;
}
$umen = mysql_fetch_array(mysql_query("SELECT * FROM `umen` WHERE `usr`='".$user['id']."' and `img`='gift_of_the_Gods'"));
$dar=100*$umen['sila'];
mysql_query("UPDATE `umen` SET `timer` = '".$vrem."' WHERE `usr`='".$user['id']."' and `img`='gift_of_the_Gods'");
mysql_query("UPDATE `attack` SET `sila` = `sila`+'5' WHERE `id`='1'");
$_SESSION['message'] = 'Вы <img src=/images/umen/gift_of_the_Gods.png height=16 width=16>усилили Демона!';
header ("Location: ?");
exit;
}  */
 if(isset($_GET['gift_of_the_Gods'])){
$reqxs = mysql_query("SELECT * FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='gift_of_the_Gods'");
$gift = mysql_fetch_array($reqxs);
$vrem = $_SERVER['REQUEST_TIME']+$gift['time']+30;
if($gift['timer']>''.$_SERVER['REQUEST_TIME'].''){
$_SESSION['err']="Промах";
header ("Location: ?");
exit;
}
$umen = mysql_fetch_array(mysql_query("SELECT * FROM `umen` WHERE `usr`='".$user['id']."' and `img`='gift_of_the_Gods'"));
$dar=100*$umen['sila'];
mysql_query("INSERT INTO `bonus` set `usr` = ".$user['id'].", `name` = 'Дар Богов',`kol`='$dar',`param`='sila', `time` = '$vrem'-'$gift[time]', `bonus`='+$dar% к урону', `image`='14',`typ`='0'");
mysql_query("UPDATE `umen` SET `timer` = '$vrem' WHERE `usr`='".$user['id']."' and `img`='gift_of_the_Gods'");
$_SESSION['message']="Вы использовали <img src='/images/umen/gift_of_the_Gods.png' height='16px' width='16px'> <font color='#3B9CF6'>Дар Богов</font> +".$dar."% к урону";
header ("Location: ?");
exit;
} 

if(isset($_GET['bottle'])){
$_SESSION['err']="У вас нет бутылок!";
header ("Location: ?");
exit;
}	
if(isset($_GET['udar']) and $user['health']>0){
	
if(empty($id)){
$_SESSION['err']="Не выбран противник";
header ("Location: ?");
exit;
}

if($mobc['hp']<=0){
	
$_SESSION['err']="Промах";
header ("Location: ?");
exit;

}
$req = mysql_query("SELECT * FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='whack'");
$umen = mysql_fetch_array($req);
$summastat = $mobc['hpmax']+$mobc['sila']+$mobc['prot'];
$p=$mobc['prot']/$summastat;
$y=1-$p;
$u=rand($user['sila']-$user['sila']/8,$user['sila']);
$udar=$u*$y;
if(isset($_GET['whack'])){$udar=$udar*$umen['sila'];}else{$udar=$u*$y;}
$udar=round($udar,0);
$dar = mysql_query("SELECT * FROM `bonus` WHERE `usr`='".$user['id']."' and `time`>'$tm' and `name`='Дар Богов'");
$adar=mysql_num_rows($dar);
$kdar=mysql_fetch_array($dar);
if($adar>0){
$kolik=$kdar['kol']/100;
$udar=floor($udar+($udar*$kolik));}
$uron=$mobc['hp']-$udar;
/* 
$req = mysql_query("SELECT * FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='whack' LIMIT 1");
$umen = mysql_fetch_array($req);
$summastat = $mobc['hpmax']+$mobc['sila']+$mobc['prot'];
$p=$mobc['prot']/$summastat;
$y=1-$p;
$u=rand($user['sila']-$user['sila']/8,$user['sila']);
$udar=$u*$y;

if(isset($_GET['whack'])){
	
	$udar=0;
	
	} else {
		
		$udar=$u*$y;
		
	}
$udar=round($udar,0);
$uron=$mobc['hp']-$udar;
 */
$ool=$user['online']+300;
$sec=$timer-$ool;

if($sec<1){
$_SESSION['err']="Промах";
header ("Location: ?");
exit;
}

if($udar>$user['max_uron']){
mysql_query("UPDATE `user` SET `max_uron` = '".$udar."' WHERE `id`='".$user['id']."' LIMIT 1");
}
$ttur=rand(1,4); 

if($ttur==1){
	$ttur='ударил'; }
	
if($ttur==2){
	$ttur='коснулся';
}
if($ttur==3){
	$ttur='поцарапал';
}

if($ttur==4){
	$ttur='зацепил';
}

$sms = ''.$ttur.' Демона ';


if($uron<=0){
	
$ttud=rand(1,5);

if($ttud==1){
		$ttud='убил';
		}
	
if($ttud==2){
		$ttud='уничтожил';
		}
	
if($ttud==3){
	$ttud='разгромил';
	}
	
if($ttud==4){
	$ttud='сокрушил';
	}
	
if($ttud==5){
	$ttud='испепелил';
}

if($mobc['boss']==1){
	
mysql_query("UPDATE `attack` SET `kto` = '".$user['id']."' WHERE `id`='".$id."'");

if($user['clan'] > 0){

mysql_query("UPDATE `user` SET `rating`=`rating`+'5000' WHERE `id`='".$user['id']."'");//,`snow`=`snow`+'3'
mysql_query("UPDATE `clan` SET `rating`=`rating`+'5000' WHERE `id`='".$user['clan']."'");

}

$_SESSION['message'] = 'Вы убили Демона +<img src="/images/icon/gold.png">500  и +<img src="/images/icon/dost.png">50';// и +<img src="/images/icon/snowdrop.png">5
mysql_query("UPDATE `user` SET `gold`=`gold`+'50000', `snow`=`snow`+50 WHERE `id`='".$user['id']."'");//, `snow`=`snow`+5
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Демон', `time` = '".$_SERVER['REQUEST_TIME']."', `kol`='30000', `kto`='+'");

}

/* $sneg = rand(1,15);
if($sneg == 2){
$_SESSION['message'] = 'Вы получили +1 <img src="/images/icon/stgeorge.png">';
mysql_query("UPDATE `user` set  `snow`=`snow`+'1' WHERE `id`='".$user['id']."'");
}   */ 

mysql_query("UPDATE `user` SET `mob`='0', `snow`=`snow`+'1',  `wins`=`wins`+'1' WHERE `id`='".$user['id']."'");

if(isset($_GET['whack'])){
$vrem = $_SERVER['REQUEST_TIME']+$umen['time'];
if($umen['timer']>''.$_SERVER['REQUEST_TIME'].''){
$_SESSION['err'] = "Промах";
header ("Location: ?");
exit;
}
$_SESSION['message'] = "Демон уклонился от смертельного <img src=/images/umen/whack.png height=16 width=16> <font color=#FFBF00>Сильного Удара</font>";
} else {
mysql_query("INSERT INTO duellog SET usr='".$user['nick']."',text=' ".$sms." ',opon='',uron='".$udar."',timer='".$timer."', umen='".$um."'");
}
mysql_query("INSERT INTO duellog SET usr='".$user['nick']."',text=' ".$ttud."   ".$mobc['name']."',uron='".$udar."',timer='".$timer."', `dead`='1', `umen`='".$um."'");
if($setgame['exp']==1)$udar=$udar*2;
mysql_query("UPDATE `at_bat` SET `exp` = `exp`+".$udar.", `wins`=`wins`+'1'  WHERE `usr`='".$user['id']."' and `status`='0'");
mysql_query("UPDATE `attack` SET `status` = '1', `hp` = '0'  WHERE `id`='".$id."'");

} else {
	
if(isset($_GET['whack'])){
/* $vrem = $_SERVER['REQUEST_TIME']+$umen['time'];
if($umen['timer']>''.$_SERVER['REQUEST_TIME'].''){
$_SESSION['err'] = "Промах";
header ("Location: ?");
exit;
}
mysql_query("UPDATE `umen` SET `timer` = '$vrem' WHERE `usr`='".$user['id']."' and `img`='whack'");
$_SESSION['light']="Вы использовали <img src='/images/umen/whack.png' height='16px' width='16px'> <font color='#FFBF00'>Сильный Удар</font> против ".$mobc['name']." <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
 */
$_SESSION['err'] = "Демон неуязвим к <img src=/images/umen/whack.png height=16 width=16> <font color=#FFBF00>Сильному Удару</font>";
} else {
$_SESSION['light']="Ты <img src='/images/icon/stat/sila.png'>".$sms." <img src='/images/icon/stat/hp.png'><font color=#F5E17E>-".$udar."</font>";
}
mysql_query("UPDATE `attack` SET `hp` = '".$uron."' WHERE `id`='".$id."'");
}

$sneg = rand(1,240);
 if($sneg == 5){
$_SESSION['message'] = 'Вы получили +1 <img src="/images/icon/dost.png">';
mysql_query("UPDATE `at_bat` SET `wins` = `wins`+'1'  WHERE `usr`='".$user['id']."'  and `status`=''");
mysql_query("UPDATE `user` set  `snow`=`snow`+'1' WHERE `id`='".$user['id']."'");
} 
if($sneg == 51){
$slv = rand (1,30);
$_SESSION['message'] = 'Вы получили +'.$slv.' <img src="/images/icon/silver.png">';
mysql_query("UPDATE `user` set  `gold`=`gold`+'".$slv."' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `at_bat` SET `silver` = `silver`+'".$slv."'  WHERE `usr`='".$user['id']."'  and `status`=''");
}

$ud = mysql_num_rows(mysql_query("SELECT `id` FROM `bonus` WHERE `usr`='".$user['id']."' and `typ`='3'"));

if($ud>0){
	$udar=$udar*2;
} else {
	$udar=$udar;
	}
if($setgame['exp']==1)$udar=$udar*2;
mysql_query("UPDATE `user` SET `exp` = '".$user['exp']."'+".$udar.", `mob`='".$id."' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `at_bat` SET `exp` = `exp`+".$udar."  WHERE `usr`='".$user['id']."'  and `status`=''");
header ("Location: ?");
exit;
}





if($user['health']<=0){
	
?>
<div><div  class='but-list'>
<a href="?"> <img src='/images/icon/reload.png'> Обновить </a></font>
<a href="/"> <img src='/images/icon/error.png'> Покинуть бой </a></div></div>
<?

} else {
echo'<img src="/attack/attack.png" width="100%">';	
$ureq = mysql_query("SELECT * FROM `attack` WHERE `id`='".$user['mob']."' LIMIT 1");
$umob = mysql_fetch_array($ureq);
$avt = mysql_num_rows($ureq);

if($avt>0){
	
echo'<div class="foot"><table  width="100%">
<tbody>
<td class="center"><div class="empty2"></div> '.$umob['name'].'<div class="empty2"></div>';
$kol70=$umob['hpmax']*0.70;
$kol30=$umob['hpmax']*0.30;

if($umob['hp']>=$kol70){
	$health="green";
	}
	
if($umob['hp']>=$kol30 and $umob['hp']<$kol70){
	$health="orange";
	}
	
if($umob['hp']<$kol30){
	$health="red";
}

echo"<div class='hp'>
<div class='".$health."' style='width:".floor(100/($umob['hpmax']/$umob['hp']))."%'></div>
</div>";
echo'<div class="empty2"></div><div class="empty2"></div><font color="#CDC9C9"> ('.$umob['hp'].')</font></td>
</tbody></table></div><hr>
';

}
?>
<div class='head'><table  width='100%' border='0' cellpadding='5px' cellspacing='0' style='padding-top: 5px;'>
<tbody>
<?

$randomob = mysql_fetch_array(mysql_query("SELECT id FROM `attack` WHERE `status`='' ORDER BY RAND() LIMIT 1"),0);
 
if($kols==0){
	echo'<td width="45%"><a class="fight center" href="?">  Обновить  </a></div></td>';
	}
if($kols==1 and $mob['hp']>0){
	echo' <td width="45%"><a class="fight center" href="?udar&id='.$mob['id'].'">  Атаковать  </a></div></td>';
	}
if($kols==1 and $mob['hp']<=0){
	echo' <td width="45%"><a class="fight center" href="?udar&id='.$randomob['id'].'">  Атаковать  </a></div></td>';
	}
if($kols>1){
	
if($user['mob']>0 and $umob['hp'] > 0){
	echo' <td width="45%"><a class="fight center" href="?udar&id='.$umob['id'].'">  Атаковать  </a></div></td>';
	}
	
echo' <td width="45%"><a class="fight center" href="?udar&id='.$randomob['id'].'">  Бить любого  </a></div></td>';
}
echo"</tbody></table><table  width='100%' border='0' cellpadding='1px' cellspacing='0' style='padding-top: 5px;'>
<tbody>";
$req = mysql_query("SELECT timer FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='whack' LIMIT 1");
$umen = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto == 0){
echo"<td width='30%'><div class='big-but'><div class='imgwrap'><img src='/images/umen/whack_grey.png' height='20' width='20'></div><div class='empty'></div>Недоступно</td></div>"; 
}
if($avto > 0){
if($umen['timer']<= $_SERVER['REQUEST_TIME']){
if($umob['hp'] > 0){
echo"<td width='30%'>
<a class='big-but' href=\"?udar&whack&id=".$umob['id']."\">
<div class='imgwrap'><img src='/images/umen/whack.png' height='35' width='35'>
</div> 
<div class='empty'></div> 
</a>
</td>
</div>";
}
if($umob['hp'] <= 0){	
echo"<td width='30%'>
<a class='big-but' href=\"?udar&whack&id=".$randomob['id']."\"><div class='imgwrap'><img src='/images/umen/whack.png' height='35' width='35'>
</div> 
<div class='empty'>	</div> 
</a>
</td>
</div>";
} 
} else {
$recharge = $umen['timer'] - $_SERVER['REQUEST_TIME'];
echo"<td width='30%'><div class='big-but'><div class='imgwrap'><img src='/images/umen/whack_grey.png' height='20' width='20'></div>
<div class='empty'></div>".$recharge." сек</td>
</div>";
}
}
$req = mysql_query("SELECT timer FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='healing'");
$umen = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){
echo'<td width="30%"><div class="big-but"><div class="imgwrap"><img src="/images/umen/healing_grey.png" height="20" width="20"></div><div class="empty"></div>Недоступно</td></div>'; 
} else {
if($umen['timer'] <= $_SERVER['REQUEST_TIME']){
echo'<td width="30%"><a class="big-but" href=\'?healing\'><div class="imgwrap"><img src="/images/umen/healing.png" height="35" width="35"></div><div class="empty"></div></a></td></div>'; 
} else {
$recharge=$umen['timer']-$_SERVER['REQUEST_TIME'];
echo' <td width="30%"><div class="big-but"><div class="imgwrap"><img src="/images/umen/healing_grey.png" height="20" width="20"></div>
<div class="empty"></div>'.$recharge.' сек</td>
</div>';
}
}
$req = mysql_query("SELECT timer FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='gift_of_the_Gods'");
$umen = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){
echo'<td width="30%"><div class="big-but"><div class="imgwrap"><img src="/images/umen/gift_of_the_Gods_grey.png" height="20" width="20"></div><div class="empty"></div>Недоступно</td></div>'; 
} else {
if($umen['timer'] <= $_SERVER['REQUEST_TIME']){
echo'<td width="30%"><a class="big-but" href=\'?gift_of_the_Gods\'><div class="imgwrap"><img src="/images/umen/gift_of_the_Gods.png" height="35" width="35"></div><div class="empty"></div></a></td></div>'; 
} else {
$recharge=$umen['timer']-$_SERVER['REQUEST_TIME'];
echo'<td width="30%"><div class="big-but"><div class="imgwrap"><img src="/images/umen/gift_of_the_Gods_grey.png" height="20" width="20"></div>
<div class="empty"></div>'.$recharge.' сек</td>
</div>';
}
}

echo'</td>
</tbody>
</table><table width="100%" cellpadding="4px">
<tbody><tr><td width="30%">
<a class="inpc-ar center" href="?bottle=1"><div class="imgwrap"><img src="/images/icon/bottle/0.png">
</div> 
<div class="empty"></div> 
</a>
</td>
<td width="30%"><a class="inpc-ar center" href="?bottle=2"><div class="imgwrap"><img src="/images/icon/bottle/0.png"></div><div class="empty"></div></a></td>
<td width="30%"><a class="inpc-ar center" href="?bottle=3"><div class="imgwrap"><img src="/images/icon/bottle/0.png"></div><div class="empty"></div></a></td>
</tr></tbody>
</table>';
}




$requ = mysql_query("SELECT id FROM `attack` WHERE `status`=''");
$avto = mysql_num_rows($requ);
if($avto>0){
	
echo"</div><hr><div class='foot foot'><div class='center'>Противники</br><div class='empty2'></div></div>";

$req = mysql_query("SELECT DISTINCT `name` FROM `attack` WHERE `status`='' ");
while($mob = mysql_fetch_array($req)){
	
$randomobu = mysql_fetch_array(mysql_query("SELECT hp,id FROM `attack` WHERE `name`='".$mob['name']."' and `status`='' ORDER BY RAND() LIMIT 1"),0);
if($randomobu['hp'] >= $kol70){
	$health="green";
	$hp="<font color='green'>".$randomobu['hp']."</font>";
	}
if($randomobu['hp'] >= $kol30 and $randomobu['hp']<$kol70){
	$health="orange";
	$hp="<font color='orange'>".$randomobu['hp']."</font>";
	}
if($randomobu['hp'] < $kol30){
	$health="red";
	$hp="<font color='red'>".$randomobu['hp']."</font>";
	}
$koll = mysql_result(mysql_query("SELECT  COUNT(id)  FROM `attack` WHERE `name`='".$mob['name']."' and `status`=''"),0);

if($koll>1){
	
echo"<a class='fight' href='?udar&id=".$randomobu['id']."'>".$mob['name']." <font color='#CDC9C9'>(".$koll.")</font></a>";

} else {
echo"<a class='fight' href='?udar&id=".$randomobu['id']."'>".$mob['name']." (".$hp.")</a>";
}

}
echo'</div>';

}
$req = mysql_query("SELECT * FROM `duellog` WHERE `opon` = '".$user['nick']."' or `usr` = '".$user['nick']."' and `timer`>='".$_SERVER['REQUEST_TIME']."' ORDER BY `id` DESC LIMIT 9");
$avto = mysql_num_rows($req);

if($avto>=1){
	
echo"	<hr>
<div class='foot foot'>
<div class='center'>
Журнал боя
</br>
<div class='empty2'></div>
</div>	";

While($ilok = mysql_fetch_array($req)){
	
$timeudar=$_SERVER['REQUEST_TIME']-$ilok['timer']+300;
if($timeudar < 60){
	
$timeudar=''.$timeudar.' сек.';

}else{
	
$timeudar=round($timeudar/60);
$timeudar=''.$timeudar.' мин.';

}
	
if($ilok['kogo']>0){

if($ilok['dead']==1){
	echo '<img src="/images/icon/dead.png" height="16" width="16">
<font color="#AAAAAA"> '.$ilok['text'].' <img src=/images/icon/race/'.$plem.'.png><a href="/user/'.$user['id'].'/"><font color="'.$user['font'].'">'.$user['nick'].'</font></a></font><span class="mit">'.$timeudar.'</span> 
 <div class="empty"></div>';
 } else {
	 
echo'<font color="#AAAAAA"> '.$ilok['text'].' <img src="/images/icon/stat/hp.png">-<font color="F5E17E">'.$ilok['uron'].'</font></font><span class="mit">'.$timeudar.'</span>
  <div class="empty"></div>';
}
}
}
}

echo"</div><hr><div class='head'><div class='inpc-ar center'>Топ игроков</br></div></div>";

$sur = mysql_query("SELECT usr,exp,wins FROM `at_bat` WHERE `fight`='1' and `status`='0' ORDER BY `exp` DESC LIMIT 0, 5");
$at = mysql_num_rows($sur);
if($at>0){
	
while($sn = mysql_fetch_array($sur)) {
$qst = mysql_query("SELECT id,prava,nick,font,level FROM `user` WHERE `id` = '".$sn['usr']."'");
$ust = mysql_fetch_array($qst);

echo"<hr><div class='but-list-light'>";
if($ust['prava']=="5"){
	$status="<font color='ffc22b'>[A]</font>";
	$color="#F7990D";
	}
if($ust['prava']=="4"){
	$status="<font color='ffc22b'>[a]</font>";
	$color="EBC621";
	}
if($ust['prava']=="3"){
	$status="<font color='ffc22b'>[M]</font>";
	}
if($ust['prava']=="2"){
	$status="<font color='ffc22b'>[m]</font>";
	}
echo'<a href="/user/'.$ust['id'].'/">';
echo online($ust['id']);
echo '<font color="'.$ust['font'].'"> '.$ust['nick'].'</font>';
if($ust['prava']>"1"){
	echo' '.$status.'';
	}
	echo', <img src="/images/icon/level.png">'.$ust['level'].'  <span class="float-right">  <img src="/images/icon/exp.png" width="16" height="16"> '.$sn['exp'].'</span></a></div>';
}
$myser = mysql_fetch_array(mysql_query("SELECT exp,wins FROM `at_bat` WHERE `fight`='1' and `status`='0' and `usr`='".$user['id']."'"));
$enduser = mysql_fetch_array(mysql_query("SELECT exp FROM `at_bat` WHERE `fight`='1' and `status`='0' ORDER BY `exp` DESC LIMIT 5, 5"));
if($enduser['exp']>=$myser['exp'] and $user['health']>0){
	
echo"<hr><div class='head'><center>...</center></div><hr><div class='but-list-light'>";
if($user['prava']=="5"){
	$status="<font color='ffc22b'>[A]</font>";
$color="#F7990D";
}
if($user['prava']=="4"){
	$status="<font color='ffc22b'>[a]</font>";
$color="EBC621";
}
if($user['prava']=="3"){
	$status="<font color='ffc22b'>[M]</font>";
}
if($user['prava']=="2"){
	$status="<font color='ffc22b'>[m]</font>";
}
echo'<a href="/user/'.$user['id'].'/">';
echo online($user['id']);
echo '<font color="'.$user['font'].'"> '.$user['nick'].'</font>';
if($user['prava']>"1"){
	echo' '.$status.'';
	}
echo', <img src="/images/icon/level.png">'.$user['level'].'  <span class="float-right">  <img src="/images/icon/exp.png" width="16" height="16"> '.$myser['exp'].'</span></a></div>';

}
echo'</div>';

} else {
echo'<hr>
<div class="foot">
Пусто
</div>';
}

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