<?
require_once'../core/system.php';
echo only_reg();
echo ban();
echo blok();
if($user['mesto']!='Бой'){header ("Location: ?");}
mysql_query("UPDATE `user` set `mesto` = 'Бой', `battle`='1' where `id` = '".$user['id']."'");
$reqa = mysql_query("SELECT * FROM `duel` WHERE (`usr` = '".$user['id']."' or `who`='".$user['id']."') and `status`=''");
$avto = mysql_num_rows($reqa);
$duel = mysql_fetch_array($reqa);
if($avto==0){header ("Location: /");exit;}
$header='Дуэль';
require_once'../core/head.php';
$timer=$_SERVER['REQUEST_TIME']+300;
$tutu=$_SERVER['REQUEST_TIME']+45;
$time=$_SERVER['REQUEST_TIME'];
$rqb = mysql_query("SELECT * FROM `duel` WHERE `usr` = '".$user['id']."' and `status`=''");
$ya = mysql_num_rows($rqb);
$rdb = mysql_query("SELECT * FROM `duel` WHERE `who` = '".$user['id']."' and `status`=''");
$kogo = mysql_num_rows($rdb);
$zaydav = mysql_fetch_array($rqb);
$ja = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".$zaydav['usr']."'"));
$zaydv = mysql_fetch_array($rdb);
$menja = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".$zaydv['who']."'"));
if($ya>0){
$yjo=$zaydav['id'];
$ureq = mysql_query("SELECT * FROM `user` WHERE `id`='".$zaydav['who']."'");
$umob = mysql_fetch_array($ureq);
if($umob['plem']=='ogn'){$race=0;}
if($umob['plem']=='mol'){$race=1;}
$rem = mysql_query("SELECT * FROM `duel_bat` WHERE `usr`='".$zaydav['usr']."' and `who`='".$zaydav['who']."' and `status`=''");
$avo = mysql_num_rows($rem);
if($avo==0){mysql_query("INSERT INTO `duel_bat` SET `usr`='".$zaydav['usr']."', `who`='".$zaydav['who']."', `time`='".$tutu."', `fight`='".$zaydav['id']."'");}
$reqn = mysql_query("SELECT * FROM `duel_bat` WHERE `usr`='".$user['id']."' and `wusr`='1' and `status`=''");
$avtod = mysql_num_rows($reqn);
if($avtod==0 and $user['health']>0){
mysql_query("DELETE FROM `battle` WHERE `usr`='".$user['nick']."'");
mysql_query("DELETE FROM `duellog` WHERE `usr`='".$user['nick']."'");
mysql_query("DELETE FROM `link` WHERE `usr`='".$user['id']."'");
mysql_query("UPDATE `duel` SET `fight1`='1' WHERE `usr` = '".$user['id']."' and `status`=''");
mysql_query("INSERT INTO `link` SET `usr`='".$user['id']."',`timer`='".$_SERVER['REQUEST_TIME']."'+'3600', `link`='".$_SERVER['PHP_SELF']."'");
mysql_query("UPDATE `duel_bat` SET `wusr`='1' WHERE `fight`='".$zaydav['id']."' and `status`=''");
header ("Location: ?");exit;}
/* $pobeda = mysql_fetch_array(mysql_query("SELECT * FROM `duel_bat` WHERE `wusr`>'0' and `wwho`='0'"));
if($pobeda['time']<$time){
mysql_query("UPDATE `user` SET `mob`='0', `wins`=`wins`+'1' WHERE `id`='".$user['id']."'");
if($user['clan']>0){
mysql_query("UPDATE `user` SET `rating`=`rating`+'2', `duel`=`duel`+'1' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `clan` SET `rating`=`rating`+'2' WHERE `id`='$user[clan]'");}
mysql_query("UPDATE `user` SET `health`='0', `loss`=`loss`+'1' WHERE `id`='$zaydav[who]'");
mysql_query("INSERT INTO dlogi SET usr='".$user['id']."',text=' победил ',uron='".$udar."',timer='".$timer."', `dead`='1', `kogo`='$zaydav[who]'");
mysql_query("UPDATE `duel` set `status`='1' WHERE `id` = '$zaydav[id]'");
mysql_query("UPDATE `duel_bat` set `status`='1' WHERE `fight` = '$zaydav[id]'");
$_SESSION['message'] = ' Противник не появился. Вы победили!';
header ("Location: /duel/");exit;} */
}
if($kogo>0){
/* $pobeda = mysql_fetch_array(mysql_query("SELECT * FROM `duel_bat` WHERE `wusr`='0' and `wwho`>'0'"));
if($pobeda['time']<$time){
mysql_query("UPDATE `user` SET `mob`='0', `wins`=`wins`+'1' WHERE `id`='".$user['id']."'");
if($user['clan']>0){
mysql_query("UPDATE `user` SET `rating`=`rating`+'2', `duel`=`duel`+'1' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `clan` SET `rating`=`rating`+'2' WHERE `id`='$user[clan]'");}
mysql_query("UPDATE `user` SET `health`='0', `loss`=`loss`+'1' WHERE `id`='$zaydv[usr]'");
mysql_query("INSERT INTO dlogi SET usr='".$user['id']."',text=' победил ',uron='".$udar."',timer='".$timer."', `dead`='1', `kogo`='$zaydv[usr]'");
mysql_query("UPDATE `duel` set `status`='1' WHERE `id` = '$zaydv[id]'");
mysql_query("UPDATE `duel_bat` set `status`='1' WHERE `fight` = '$zaydv[id]'");
$_SESSION['message'] = ' Противник не появился. Вы победили!';
header ("Location: /duel/");exit;} */
$yjo=$zaydv['id'];
$ureq = mysql_query("SELECT * FROM `user` WHERE `id`='".$zaydv['usr']."'");
$umob = mysql_fetch_array($ureq);
if($umob['plem']=='ogn'){$race=0;}
if($umob['plem']=='mol'){$race=1;}
$rem = mysql_query("SELECT * FROM `duel_bat` WHERE `usr`='".$zaydv['usr']."' and `who`='".$zaydv['who']."' and `status`=''");
$avo = mysql_num_rows($rem);
if($avo==0){mysql_query("INSERT INTO `duel_bat` SET `usr`='".$zaydv['usr']."', `who`='".$zaydv['who']."', `time`='".$time."', `fight`='".$zaydv['id']."'");}
$reqn = mysql_query("SELECT * FROM `duel_bat` WHERE `who`='".$user['id']."' and `wwho`='1' and `status`=''");
$avtod = mysql_num_rows($reqn);
if($avtod==0 and $user['health']>0){
mysql_query("DELETE FROM `battle` WHERE `usr`='".$user['nick']."'");
mysql_query("DELETE FROM `duellog` WHERE `usr`='".$user['nick']."'");
mysql_query("DELETE FROM `link` WHERE `usr`='".$user['id']."'");
mysql_query("UPDATE `duel` SET `fight2`='1' WHERE `who` = '".$user['id']."' and `status`=''");
mysql_query("INSERT INTO `link` SET `usr`='".$user['id']."',`timer`='".$_SERVER['REQUEST_TIME']."'+'3600', `link`='".$_SERVER['PHP_SELF']."'");
mysql_query("UPDATE `duel_bat` SET `wwho`='1' WHERE `fight`='".$zaydv['id']."' and `status`=''");
header ("Location: ?");exit;}
}
if($user['battle']==0){
$_SESSION['err'] = ' Вы не находитесь в бою';
header ("Location: /");exit;}
if(isset($_GET['healing'])){
$reqx = mysql_query("SELECT * 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($user['health']>=$user['max_health']){$_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;
$um = mysql_num_rows(mysql_query("SELECT * FROM `bonus` WHERE `usr`='".$user['id']."' and `typ`='3'"));
if($um>0){$kolexp=$kolhp*2;}else{$kolexp=$kolhp;}
if($setgame['exp']==1)$kolexp=$kolexp*2;
if($xphe<=$user['max_health']){mysql_query("UPDATE `user` SET `health` = `health`+'".$kolhp."', `exp` = `exp`+'".$kolexp."' WHERE `id`='".$user['id']."'");}else{
mysql_query("UPDATE `user` SET `health` = '".$user['max_health']."', `exp` = `exp`+'".$kolhp."' WHERE `id`='".$user['id']."'");}
$_SESSION['message']="Вы использовали <img src='/images/umen/healing.png' height='16px' width='16px'> <font color='#FFBF00'>Исцеление</font> <img src='/images/icon/stat/hp.png'>+".$kolhp."";
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($umob['health']<=0){
$whack = mysql_num_rows(mysql_query("SELECT id FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='11'"));
if($whack>0){mysql_query("UPDATE `task` SET `min` = `min`+'1' WHERE `usr`='".$user['id']."' and `status`='2' and `task`='11'");}
$sart = mysql_num_rows(mysql_query("SELECT id FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='4'"));
if($sart>0){mysql_query("UPDATE `task` SET `min` = `min`+'1' WHERE `usr`='".$user['id']."' and `status`='2' and `task`='4'");}
$task = mysql_num_rows(mysql_query("SELECT id FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='14'"));
if($task>0){mysql_query("UPDATE `task` SET `min` = `min`+'1' WHERE `usr`='".$user['id']."' and `status`='2' and `task`='14'");}
mysql_query("UPDATE `user` SET `mob`='0', `wins`=`wins`+'1' ,`duel`=`duel`+'1' WHERE `id`='".$user['id']."'");
if($user['clan']>0){
mysql_query("UPDATE `user` SET `rating`=`rating`+'2' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `clan` SET `rating`=`rating`+'2' WHERE `id`='".$user['clan']."'");
}
mysql_query("UPDATE `user` SET `health`='0', `loss`=`loss`+'1' WHERE `id`='".$umob['id']."'");
mysql_query("INSERT INTO dlogi SET usr='".$user['id']."',text=' победил ',uron='".$udar."',timer='".$timer."', `dead`='1', `kogo`='".$umob['id']."'");
mysql_query("UPDATE `duel` set `status`='1' WHERE `id` = '".$yjo."'");
mysql_query("UPDATE `duel_bat` set `status`='1' WHERE `fight` = '".$yjo."'");
$_SESSION['message'] = ' Вы победили противника';
header ("Location: /duel/");exit;
}
if(isset($_GET['udar'])){
if(empty($id)){$_SESSION['err']="Не выбран противник";
header ("Location: ?");exit;}
if($umob['health']<=0 or $user['health']<=0 or $user['plem']==$umob['plem']){$_SESSION['err']="Промах";
header ("Location: ?");exit;}
$req = mysql_query("SELECT * FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='whack'");
$umen = mysql_fetch_array($req);
$summastat = $umob['max_health']+$umob['sila']+$umob['zashit'];
$p=$umob['zashit']/$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=$umob['health']-$udar;
$ool=$user['online']+300;
$sec=$timer-$ool;
if($sec<=0.8){$_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='победил';}
$whack = mysql_num_rows(mysql_query("SELECT id FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='11'"));
if($whack>0){mysql_query("UPDATE `task` SET `min` = `min`+'1' WHERE `usr`='".$user['id']."' and `status`='2' and `task`='11'");}
$sart = mysql_num_rows(mysql_query("SELECT id FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='4'"));
if($sart>0){mysql_query("UPDATE `task` SET `min` = `min`+'1' WHERE `usr`='".$user['id']."' and `status`='2' and `task`='4'");}
$task = mysql_num_rows(mysql_query("SELECT id FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='14'"));
if($task>0){mysql_query("UPDATE `task` SET `min` = `min`+'1' WHERE `usr`='".$user['id']."' and `status`='2' and `task`='14'");}
mysql_query("UPDATE `user` SET `mob`='0', `wins`=`wins`+'1' ,`duel`=`duel`+'1' WHERE `id`='".$user['id']."'");
if($user['clan']>0){
mysql_query("UPDATE `user` SET `rating`=`rating`+'2' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `clan` SET `rating`=`rating`+'2' WHERE `id`='".$user['clan']."'");
}
mysql_query("UPDATE `user` SET `health`='0', `loss`=`loss`+'1' WHERE `id`='".$umob['id']."'");
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> против <img src='/images/icon/race/".$race.".png'><font color='".$umob['font']."'>".$umob['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',`text`=' использовал <img src=/images/umen/whack.png height=16 width=16> <font color=#FFBF00>Сильный Удар</font> против',`uron`='".$udar."',`timer`='".$timer."', `kogo`='".$umob['id']."'");
}else{
$_SESSION['light']="Вы <img src='/images/icon/stat/sila.png'>".$sms."и <img src='/images/icon/race/".$race.".png'><font color='".$umob['font']."'>".$umob['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO duellog SET usr='".$user['nick']."',text=' ".$sms."и ',opon='',uron='".$udar."',timer='".$timer."', `kogo`='".$umob['id']."'");
}
$_SESSION['light']="Вы <img src='/images/icon/dead.png'>".$ttud."и <img src='/images/icon/race/".$race.".png'><font color='".$umob['font']."'>".$umob['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO duellog SET usr='".$user['nick']."',text=' ".$ttud." ',uron='".$udar."',timer='".$timer."', `dead`='1', `kogo`='".$umob['id']."'");
mysql_query("INSERT INTO dlogi SET usr='".$user['id']."',text=' ".$ttud." ',uron='".$udar."',timer='".$timer."', `dead`='1', `kogo`='".$umob['id']."'");
mysql_query("UPDATE `duel` set `status`='1' WHERE `id` = '".$yjo."'");
mysql_query("UPDATE `duel_bat` set `status`='1' WHERE `fight` = '".$yjo."'");
$_SESSION['message'] = ' Вы победили противника';
header ("Location: /duel/");exit;
}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> против <img src='/images/icon/race/".$race.".png'><font color='".$umob['font']."'>".$umob['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',`text`=' использовал <img src=/images/umen/whack.png height=16 width=16> <font color=#FFBF00>Сильный Удар</font> против',`uron`='".$udar."',`timer`='".$timer."', `kogo`='".$umob['id']."'");
}else{
$_SESSION['light']="Вы <img src='/images/icon/stat/sila.png'>".$sms."и <img src='/images/icon/race/".$race.".png'><font color='".$umob['font']."'>".$umob['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',`text`=' ".$sms." ',`uron`='".$udar."',`timer`='".$timer."', `kogo`='".$umob['id']."'");
}mysql_query("UPDATE `user` SET `health` = '".$uron."' WHERE `id`='".$umob['id']."'");}
$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']."'");
header ("Location: ?");exit;
}
if($user['health']<=0){
echo"</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{
$avt = mysql_num_rows($ureq);
if($avt>0){
echo'<div class="foot"><table width="100%">
<tbody>
<td class="center"><div class="empty2"></div> '.$umob['nick'].'<div class="empty2"></div>';
$kol70=$umob['max_health']*0.70;
$kol30=$umob['max_health']*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['max_health']/$umob['health']))."%'></div>
</div>";
echo'<div class="empty2"></div><div class="empty2"></div><font color="#CDC9C9"> ('.$umob['health'].'/'.$umob['max_health'].')</font></td>
</tbody></table></div><hr>
';}
echo"<div class='head'><table width='100%' border='0' cellpadding='5px' cellspacing='0' style='padding-top: 5px;'>
<tbody>";
/*
if($kols==0){echo'<td width="45%"><a class="fight center" href="?"> Обновить </a></div></td>';} */
echo' <td width="45%"><a class="fight center" href="?udar&id='.$umob['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>";
} else {
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=".$umob['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></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></div>';
}
$req = mysql_query("SELECT * FROM `duellog` WHERE (`kogo` = '".$user['id']."' and `del2`!='1') or (`usr` = '".$user['nick']."' and `del1`!='1') and `timer`>='".$_SERVER['REQUEST_TIME']."' ORDER BY `id` DESC LIMIT 9");
$avto = mysql_num_rows($req);
if($user['plem']=='ogn'){$race=0;$pik='ogn';$race2=1;$pik2='mol';}
if($user['plem']=='mol'){$race=1;$pik='mol';$race2=0;$pik2='ogn';}
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.' мин.';
}
$fed = mysql_query("SELECT plem,prava,id,font,nick FROM `user` WHERE `id` = '".$ilok['kogo']."' LIMIT 1");
$us = mysql_fetch_array($fed);
$fe = mysql_query("SELECT plem,prava,id,font,nick FROM `user` WHERE `nick` = '".$ilok['usr']."' LIMIT 1");
$mu = mysql_fetch_array($fe);
if($mu['plem']=='ogn'){$plem='0';}
if($mu['plem']=='mol'){$plem='1';}
if($us['plem']=='ogn'){$plem2='0';}
if($us['plem']=='mol'){$plem2='1';}
if($mu['prava']=="5"){$status="<font color='ffc22b'>[A]</font>";}
if($mu['prava']=="4"){$status="<font color='ffc22b'>[a]</font>";}
if($mu['prava']=="3"){$status="<font color='ffc22b'>[M]</font>";}
if($mu['prava']=="2"){$status="<font color='ffc22b'>[M]</font>";}
if($ilok['kogo']>0){
if($mu['plem']=='ogn'){$plem='0';}
if($mu['plem']=='mol'){$plem='1';}
if($user['clan']>0){$rate='<img src=/images/icon/rating_'.$race.'.png><font color="CDC9C9">+2</font>'; $rate2='<img src=/images/icon/rating_'.$race.'.png><font color="CDC9C9">+10</font>';}
if($ilok['dead']==1){echo '<img src="/images/icon/dead.png" height="16" width="16">
<font color="#AAAAAA"> <img src=/images/icon/race/'.$plem.'.png><a href="/user/'.$mu['id'].'/"><font color="'.$mu['font'].'">'.$mu['nick'].'</font>'; if($mu['prava']>=2){echo' '.$status.'';} echo'</a> '.$ilok['text'].' <img src=/images/icon/race/'.$plem2.'.png><a href="/user/'.$us['id'].'/"><font color="'.$us['font'].'">'.$us['nick'].'</font>';if($us['prava']>=2){echo' '.$status2.'';} echo'</a></font> '.$rate.'<span class="mit">'.$timeudar.'</span> <div class="empty"></div>';}else{
echo'<font color="#AAAAAA"> <img src=/images/icon/race/'.$plem.'.png><a href="/user/'.$mu['id'].'/"><font color="'.$mu['font'].'">'.$mu['nick'].'</font>';if($mu['prava']>=2){echo' '.$status.'';} echo'</a> '.$ilok['text'].' <img src=/images/icon/race/'.$plem2.'.png><a href="/user/'.$us['id'].'/"><font color="'.$us['font'].'">'.$us['nick'].'</font>'; if($us['prava']>=2){echo' '.$status2.'';}echo'</a> на <font color="F5E17E">'.$ilok['uron'].'</font> урона</font><span class="mit">'.$timeudar.'</span> <div class="empty"></div>';}}
}}
echo"</div>";
require_once'../core/foot.php';
?>