Просмотр файла sdark.mobi/capture/index.php

Размер файла: 33.65Kb
<?
require_once'../core/system.php';

$header='Захват';

require_once'../core/head.php';

mysql_query("DELETE FROM `duellog` WHERE `del1`='1' and `del2`='1'");

$req = mysql_query("SELECT * from `ban` where `id_us` = '".$user['id']."'  and `time`>'".$_SERVER['REQUEST_TIME']."'");
$ban = mysql_fetch_array($req);
if($ban['ban'] == 3){
	header('Location: /moduls/ban');
	}
if($ban['ban'] == 2){
	header('Location: /');
	$_SESSION['err'] = "Вы находитесь в бане!";
exit;
}

if(!isset($user['id'])) header('Location: /');

if($user['mesto']!='Бой') mysql_query("UPDATE `user` set `mesto` = 'Бой' where `id` = '".$user['id']."'");
if($user['level']<=20){ $zaxvat='15';}
if($user['level']>20 and $user['level']<=40){$zaxvat='30';}
if($user['level']>40 and $user['level']<=60){$zaxvat='45';}
if($user['level']>60 and $user['level']<=80){$zaxvat='60';}
if($user['level']>80 and $user['level']<=100){$zaxvat='75';}
if($user['level']>100 and $user['level']<=120){$zaxvat='90';}
if($user['level']>120 and $user['level']<=135){$zaxvat='135';}
if($user['level']>135){$zaxvat='150';}
if($user['plem']=='ogn'){$race=0;$pik='ogn';$race2=1;$pik2='mol';}
if($user['plem']=='mol'){$race=1;$pik='mol';$race2=0;$pik2='ogn';}

$req = mysql_query("SELECT `usr` FROM `capture` WHERE `bot`='1' and `status`='1' and `time`<'".time()."'");
while($pram = mysql_fetch_array($req)){
$hty = mysql_query("SELECT `max_health` FROM `user` WHERE `id`='".$pram['usr']."'");
$hehe = mysql_fetch_array($hty);
mysql_query("UPDATE `capture` set `status`='' WHERE `bot`='1' and `status`='1' and `time`<'".time()."'");
mysql_query("UPDATE `user` set  `health`='".$hehe['max_health']."', `online`='".time()."' WHERE `id`='".$pram['usr']."'");
}

$kala = rand(1,20);
if($kala=='2'){
$renq = mysql_query("SELECT `usr` FROM `capture` WHERE `nextud`<='".$tm."' and `status`='' and `city`='".$zaxvat."' and `bot`='1' and `race`!='".$race."' LIMIT 1");
while($mobuk = mysql_fetch_array($renq)){
$anti = mysql_fetch_array(mysql_query("SELECT `nick`,`health`,`sila` FROM `user` WHERE `id`='".$mobuk['usr']."' LIMIT 1")); 
$summastag = $user['max_health']+$user['sila']+$user['zashit']; 
$cp=$user['zashit']/$summastag;
$ym=1-$cp;
$um=rand($anti['sila']-$anti['sila']/8,$anti['sila']);
$mudar=$um*$ym;
$muron=round($mudar,0);
$vrud = rand(1,3); 
if($vrud==1){$vrud='поразили';}
if($vrud==2){$vrud='поцарапали';}
if($vrud==3){$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 $anti['health']>0){
mysql_query("INSERT INTO `duellog` SET `usr`='".$anti['nick']."',`text`=' ".$vrud."',`opon`='', `uron`='".$muron."', `timer`='".$_SERVER['REQUEST_TIME']."'+'300',`kogo`='".$user['id']."', `umen`='".$um."'");
mysql_query("INSERT INTO `duellog` SET `usr`='".$anti['nick']."',`text`='".$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']."'");
mysql_query("UPDATE`capture` SET `status`='1' WHERE `usr`='".$user['id']."' and `status`=''");
}
if($user['health']>$muron){
$nextudar=rand(10,45);
$nextud=$_SERVER['REQUEST_TIME']+$nextudar;
mysql_query("INSERT INTO `duellog` SET usr='".$anti['nick']."',text=' ".$vrud." ',opon='',uron='".$muron."',timer=('".$tm."'+'300'), `kogo`='".$user['id']."'");
mysql_query("UPDATE `user` SET `health` = '".$user['health']."'-'".$muron."' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `capture` SET `nextud` = '".$nextud."' WHERE `nextud`<='".$tm."' and `status`='' and `usr`='".$mobuk['usr']."'");
}
}
}


$ud = mysql_num_rows(mysql_query("SELECT `id` FROM `bonus` WHERE `usr`='".$user['id']."' and `name`='Бонус опыта'"));
$ut = mysql_num_rows(mysql_query("SELECT `id` FROM `bonus` WHERE `usr`='".$user['id']."' and `name`='Захват'"));
if($ud>0 OR $ut > 0){$udar=$udar*2;}
if($ut>0 && $ud>0){$udar=$udar*4;}
if($ut==0 and $ud==0){$udar=$udar;}
$reqm = mysql_query("SELECT * FROM `capture` WHERE `usr`='".$user['id']."'  and `city`='".$zaxvat."'");
$avtno = mysql_num_rows($reqm);
$gde = mysql_fetch_array($reqm);
if($avtno==0){
mysql_query("UPDATE `duellog` SET `del1`='1' WHERE `usr`='".$user['nick']."'");
mysql_query("UPDATE `duellog` SET `del2`='1' WHERE `kogo`='".$user['id']."'");
mysql_query("DELETE FROM `battle` WHERE `usr`='".$user['nick']."'");
mysql_query("DELETE FROM `link` WHERE `usr`='".$user['id']."'");
mysql_query("DELETE FROM `capture` WHERE `usr`='".$user['id']."'");
mysql_query("INSERT INTO `capture` SET `usr`='".$user['id']."', `city`='".$zaxvat."', `exp`='0', `wins`='0', `race`='".$race."'");
mysql_query("INSERT INTO `link` SET `usr`='".$user['id']."', `timer`='".$_SERVER['REQUEST_TIME']."'+'3600', `link`='".$_SERVER['PHP_SELF']."'");
mysql_query("UPDATE `user` SET `battle`='1', `stan`='', `mob`='' WHERE `id`='".$user['id']."'");
header ("Location: ?");exit;
}

$kols = mysql_result(mysql_query("SELECT  COUNT(*)  FROM `capture` WHERE `race`!='".$race."' and `usr`>'0' and `status`!='1' and `city`='".$zaxvat."'"),0);
$timer=$_SERVER['REQUEST_TIME']+300;
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 `id` FROM `bonus` WHERE `usr`='".$user['id']."' and `typ`='3'"));
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=16 width=16> <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(isset($_GET['stan']) && $gde['status'] == 0){
$stans = mysql_query("SELECT * FROM `city` WHERE `name`='".$zaxvat."'");
$stan = mysql_fetch_array($stans);
if(empty($id)){
$_SESSION['err']="Промах";
header ("Location: ?");
exit;
}
if($stan['hp']<=0 or $user['health']<=0  or $race==$stan['race']){
$_SESSION['err']="Промах";
header ("Location: ?");
exit;
}
/* if($mobc['health']<=0 or $user['health']<=0){$sms="Промах";
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',`text`='".$sms."',`timer`='".$timer."', `slip`='1'");
header ("Location: ?");exit;} */
$req = mysql_query("SELECT * FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='whack'");
$umen = mysql_fetch_array($req);

$p=9/10;
$y=$p;
$u=rand($user['sila']-$user['sila']/8,$user['sila']);
$udar=floor($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=$stan['hp']-$udar;

$sec=$tm-$user['online'];
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,3); 
if($ttur==1){$ttur='ударили'; }
if($ttur==2){$ttur='поразили';}
if($ttur==3){$ttur='зацепили';}

$sms="".$ttur."";
if($uron<=0){
$ttud=rand(1,3);
if($ttud==1){$ttud='уничтожили';}
if($ttud==2){$ttud='разгромили';}
if($ttud==3){$ttud='разрушили';}

$sgr = mysql_query("SELECT * FROM `capture` WHERE `city`='".$zaxvat."' and `status`!='1'  and `usr`>'0' ORDER BY `exp` DESC LIMIT 1");
$gr = mysql_fetch_array($sgr);
if($user['clan']>0){
mysql_query("UPDATE `user` SET `rating`=`rating`+'10' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `clan` SET `rating`=`rating`+'10' WHERE `id`='".$user['clan']."'");
}
mysql_query("UPDATE `user` SET `stan`='0', `wins`=`wins`+'1' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `capture` SET `wins` = '".$gde['wins']."'+'10' WHERE `usr`='".$user['id']."'");
if($gr['exp']>100000){mysql_query("UPDATE `city` SET `hp` = '100000',`hpmax`='100000', `race`='".$race."'  WHERE `name`='".$zaxvat."'");}
if($gr['exp']>1000 and $gr['exp']<100000){mysql_query("UPDATE `city` SET `hp` = '".$gr['exp']."',`hpmax`='".$gr['exp']."', `race`='".$race."'  WHERE `name`='".$zaxvat."'");}
if($gr['exp']<1000){mysql_query("UPDATE `city` SET `hp` = '1000',`hpmax`='1000', `race`='".$race."'  WHERE `name`='".$zaxvat."'");}

if($gde['wins']>$gde['max_wins']){mysql_query("UPDATE `capture` SET `max_wins` = '".$gde['max_wins']."'+'1' WHERE `usr`='".$user['id']."'");}
 
if(isset($_GET['whack'])){
$vrem = $_SERVER['REQUEST_TIME']+$umen['time'];
if($umen['timer']>''.$_SERVER['REQUEST_TIME'].''){
$_SESSION['err']="Промах";
header ("Location: ?");
exit;
}
 $sneg = rand(1,15);
if($sneg == 1){
$_SESSION['message'] = 'Вы получили +1 <img src="/images/icon/wins.png">';
mysql_query("UPDATE `user` set  `snow`=`snow`+'1' WHERE `id`='".$user['id']."'");
} 

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/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
} else {
$_SESSION['light']="Вы ".$sms." стену <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
}
$_SESSION['light']="Вы <img src='/images/icon/dead.png'>".$ttud." стену <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font> <img src=/images/icon/rating_".$race.".png><font color='CDC9C9'>+10</font>";

$req = mysql_query("SELECT * FROM `capture` WHERE `race`='".$race."'  and `city`='".$zaxvat."'");
While($komu = mysql_fetch_array($req)){
$ato = mysql_result(mysql_query("SELECT * FROM `bonus` WHERE `usr` = '".$komu['usr']."' and `name` = 'Захват' and `time`>'".$tm."'"),0);
if($ato==0){
$t=$_SERVER['REQUEST_TIME']+120;
mysql_query("INSERT INTO `bonus` set `usr` = ".$komu['usr'].", `name` = 'Захват',`kol`='',`param`='', `time` = '".$t."', `bonus`='опыт х2', `image`='15',`typ`='3'");
}mysql_query("UPDATE `user` set `stan` = '0' WHERE `id` = '".$komu['usr']."'");
}

} 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/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
} else {
$_SESSION['light']="Вы ".$sms." стену <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
}
mysql_query("UPDATE `city` SET `hp` = '".$uron."' WHERE  `name`='".$zaxvat."'");
}
$ud = mysql_num_rows(mysql_query("SELECT `id` FROM `bonus` WHERE `usr`='".$user['id']."' and `name`='Бонус опыта' and `typ`='3'"));
$udo = mysql_num_rows(mysql_query("SELECT `id` FROM `bonus` WHERE `usr`='".$user['id']."' and `name`='Захват' and `typ`='3'"));
if($ud>0 and $udo==0){$udar=$udar*2;}
if($udo>0 and $ud==0){$udar=$udar*2;}
if($udo==0 and $ud==0){$udar=$udar;}
if($udo>0 and $ud>0){$udar=$udar*4;}
if($setgame['exp']==1)$udar=$udar*2;
mysql_query("UPDATE `user` SET `exp` = '".$user['exp']."'+'".$udar."', `mob`='', `stan`='".$id."' WHERE `id`='".$user['id']."'");
if($gde['exp']>$gde['max_exp']){
mysql_query("UPDATE `capture` SET `max_exp` = '".$gde['max_exp']."'+'".$udar."' WHERE `usr`='".$user['id']."'");
}
mysql_query("UPDATE `capture` SET `exp` = '".$gde['exp']."'+'".$udar."' WHERE `usr`='".$user['id']."'");
header ("Location: ?");
exit;
}
////////////////////////////////////////////
if(isset($_GET['udar']) && $gde['status'] == 0){
$ureq = mysql_query("SELECT `usr` FROM `capture` WHERE `city`='".$zaxvat."' and `usr`='".$id."' LIMIT 1");
$mmc = mysql_fetch_array($ureq);
$mobca = mysql_query("SELECT * FROM `user` WHERE `id`='".$mmc['usr']."'");
$mobc = mysql_fetch_array($mobca);
if(empty($id)){
$_SESSION['err']="Не выбран противник";
header ("Location: ?");
exit;
}
if($mobc['health']<=0 || $user['health']<=0 || $user['plem']==$mobc['plem']){
$_SESSION['err']="Промах";
header ("Location: ?");
exit;
}
/* if($mobc['health']<=0 or $user['health']<=0){$sms="Промах";
mysql_query("INSERT INTO `duellog` SET `usr`='".$user['nick']."',`text`='".$sms."',`timer`='".$timer."', `slip`='1'");
header ("Location: ?");exit;} */
$req = mysql_query("SELECT `sila`,`time`,`timer` FROM `umen` WHERE `usr` = '".$user['id']."' and `img`='whack'");
$umen = mysql_fetch_array($req);
$summastat = $mobc['max_health']+$mobc['sila']+$mobc['zashit'];
$p=$mobc['zashit']/$summastat;
$y=1-$p;
$u=rand($user['sila']-$user['sila']/8,$user['sila']);
$udar=floor($u*$y);
if(isset($_GET['whack'])){$udar=$udar*$umen['sila'];}else{$udar=$u*$y;}
$udar=round($udar,0);
$dar = mysql_query("SELECT `kol` 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['health']-$udar;

$ool=$user['online']+300;
$sec=$time-$user['online'];
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']."'");}
$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`='3'"));
if($whack>0){mysql_query("UPDATE `task` SET `min` = `min`+'1'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='3'");}

$task = mysql_num_rows(mysql_query("SELECT `id` FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='10' LIMIT 1"));
if($task>0){mysql_query("UPDATE `task` SET `min` = `min`+'1'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='10'");}

$task2 = mysql_num_rows(mysql_query("SELECT `id` FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='24' LIMIT 1"));
if($task2>0){mysql_query("UPDATE `task` SET `min` = `min`+'1'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='24'");}

mysql_query("UPDATE `user` SET `mob`='', `stan`='', `wins`=`wins`+'1' WHERE `id`='".$user['id']."'");
if($user['clan'] > 0){
mysql_query("UPDATE `user` SET `rating`=`rating`+'1' WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `clan` SET `rating`=`rating`+'1' WHERE `id`='".$user['clan']."'");
}

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

mysql_query("UPDATE `user` SET `health`='0', `loss`=`loss`+'1' WHERE `id`='".$mobc['id']."'");
mysql_query("UPDATE `capture` SET `wins` = '".$gde['wins']."'+'1' WHERE `usr`='".$user['id']."'");
$randhp=$tm+(rand(15,20));
mysql_query("UPDATE `capture` SET `status` = '1', `wins`='', `exp`='', `time`='".$randhp."'  WHERE `usr`='".$mobc['id']."'");
if($gde['wins']>$gde['max_wins']){mysql_query("UPDATE `capture` SET `max_wins` = '".$gde['max_wins']."'+'1' WHERE `usr`='".$user['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/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
} else {
$_SESSION['light']="Вы  <img src='/images/icon/stat/sila.png'>".$sms." <img src='/images/icon/race/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
}
$_SESSION['light']="Вы  <img src='/images/icon/dead.png'>".$ttud." <img src='/images/icon/race/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font> <img src=/images/icon/rating_".$race.".png><font color='CDC9C9'>+1</font>";
} 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/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
} else {
$_SESSION['light']="Вы  <img src='/images/icon/stat/sila.png'>".$sms." <img src='/images/icon/race/".$race2.".png'><font color='".$mobc['font']."'>".$mobc['nick']."</font> <img src='/images/icon/stat/hp.png'><font color='#F5E17E'>-".$udar."</font>";
}
mysql_query("UPDATE `user` SET `health` = '".$uron."' WHERE `id`='".$mobc['id']."'");}
$ud = mysql_num_rows(mysql_query("SELECT `id` FROM `bonus` WHERE `usr`='".$user['id']."' and `name`='Бонус опыта' and `typ`='3'"));
$udo = mysql_num_rows(mysql_query("SELECT `id` FROM `bonus` WHERE `usr`='".$user['id']."' and `name`='Захват' and `typ`='3'"));
if($ud>0 and $udo==0){$udar=$udar*2;}
if($udo>0 and $ud==0){$udar=$udar*2;}
if($udo==0 and $ud==0){$udar=$udar;}
if($udo>0 and $ud>0){$udar=$udar*4;}
if($setgame['exp']==1)$udar=$udar*2;
mysql_query("UPDATE `user` SET `exp` = '".$user['exp']."'+'".$udar."',`stan`='', `mob`='".$id."' WHERE `id`='".$user['id']."'");
if($gde['exp']>$gde['max_exp']){mysql_query("UPDATE `capture` SET `max_exp` = '".$gde['max_exp']."'+'".$udar."' WHERE `usr`='".$user['id']."'");}
mysql_query("UPDATE `capture` SET `exp` = '".$gde['exp']."'+'".$udar."' WHERE `usr`='".$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 {
$urj = mysql_query("SELECT `hp`,`hpmax`,`id` FROM `city` WHERE `name`='".$zaxvat."' and `race`!='".$race."'");
$stan = mysql_fetch_array($urj);
$akt = mysql_num_rows($urj);
if($akt>0){
echo'<div class="head"><table  width="100%">
<tbody>
<td class="center"><div class="empty2"></div>';
echo"<font color='orange'>Стена</font>";
 echo'<div class="empty2"></div>';
echo"<div class='stan'><div class='progress' style='width:".floor(100/($stan['hpmax']/$stan['hp']))."%'></div>";
echo'<div class="empty2"></div><div class="empty2"></div><font color="#CDC9C9"> ('.$stan['hp'].'/'.$stan['hpmax'].')</font></td>
</tbody></table></br><div class="empty2"></div><div class="empty2"></div></div><hr>
';}
$urjb = mysql_query("SELECT `hp`,`hpmax` FROM `city` WHERE `name`='".$zaxvat."' and `race`!='".$race2."'");
$stanb = mysql_fetch_array($urjb);
if($akt==0){echo"<div class='foot'><div class='stan'><div class='progress' style='width:".floor(100/($stanb['hpmax']/$stanb['hp']))."%'></div></div></div><hr>";}
$ureq = mysql_query("SELECT `usr` FROM `capture` WHERE `city`='".$zaxvat."' and `usr`>'0' and `usr`='".$user['mob']."' and `race`!='".$race."'  and `status`!='1'");
$umo = mysql_fetch_array($ureq);
$mobca = mysql_query("SELECT * FROM `user` WHERE `id`='".$umo['usr']."' LIMIT 1");
$umob = mysql_fetch_array($mobca);
$avt = mysql_num_rows($ureq);
if($avt>0){
echo'<div class="foot"><table  width="100%">
<tbody>
<td class="center"><div class="empty2"></div>';
if($umob['plem']=='ogn'){$pic='0';}
if($umob['plem']=='mol'){$pic='1';}
if($umob['boss']=='1'){echo"<font color='orange'>".$umob['nick']."</font>";}
if($umob['boss']!='1'){echo"<img src='/images/icon/race/".$pic.".png'> <font color='".$umob['font']."'>".$umob['nick']."</font>";}
 echo'<div class="empty2"></div>';
$kol70=$umob['max_health']*0.70;
$kol30=$umob['max_health']*0.30;
if($umob['health']>=$kol70){$health="green";}
if($umob['health']>=$kol30 and $umob['health']<$kol70){$health="orange";}
if($umob['health']<$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($akt>0){echo'<a class="inpc-ar center" href="?stan&id='.$stan['id'].'"> Бить стену </a><tr>';}
$randomob = mysql_fetch_array(mysql_query("SELECT `usr` FROM `capture` WHERE  `race`!='".$race."' and `status`='0'  and `usr`>'0'  and `city`='".$zaxvat."' 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 $umob['health']>0){echo' <td width="45%"><a class="fight center" href="?udar&id='.$umob['id'].'">  Атаковать  </a></div></td>';}
if($kols==1 and $umob['health']<=0){echo' <td width="45%"><a class="fight center" href="?udar&id='.$randomob['usr'].'">  Атаковать  </a></div></td>';}
if($kols>1){
if($user['mob']>0 and $umob['health']>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['usr'].'">  Бить любого  </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'");
$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($user['mob']>0 OR $user['stan'] > 0){
if($umob['health']>0 and $user['stan']==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($stanb['hp']>0 and $user['stan']>0 and $stanb['race']!=$pic){echo"<td width='30%'><a class='big-but' href=\"?stan&whack&id=".$stan['id']."\"><div class='imgwrap'><img src='/images/umen/whack.png' height='35' width='35'></div> <div class='empty'></div> </a></td></div>";} 
if($umob['health']<=0 and $user['stan']==0){echo"<td width='30%'><a class='big-but' href=\"?udar&whack&id=".$user['mob']."\"><div class='imgwrap'><img src='/images/umen/whack.png' height='35' width='35'></div> <div class='empty'></div> </a></td></div>";} 
if($stanb['race']==$pic and $user['stan']>0){echo"<td width='30%'><a class='big-but' href=\"?udar&whack&id=".$randomob['usr']."\"><div class='imgwrap'><img src='/images/umen/whack.png' height='35' width='35'></div> <div class='empty'></div> </a></td></div>";} 
} else {
	echo"<td width='30%'><a class='big-but' href=\"?udar&whack&id=".$randomob['usr']."\"><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>';
}


echo"</div><hr><div class='foot foot'>";
$kadar = mysql_result(mysql_query("SELECT  COUNT(id)  FROM `capture` WHERE `city`='".$zaxvat."' and `usr`>'0' and `race`='0' and `status`!='1'"),0);
$sarma = mysql_result(mysql_query("SELECT  COUNT(id)  FROM `capture` WHERE `city`='".$zaxvat."' and `usr`>'0' and `race`='1' and `status`!='1'"),0);
echo"<div class='inpc-ar center'><font color='#CDC9C9'><img src='/images/icon/race/0.png'> $kadar vs $sarma <img src='/images/icon/race/1.png'></font></div></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($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.' мин.';
}

$fe = mysql_query("SELECT * FROM `user` WHERE `nick` = '".$ilok['usr']."'");
$mu = mysql_fetch_array($fe);

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($mu['clan']>0){$rate='<img src=/images/icon/rating_'.$race.'.png><font color="CDC9C9">+1</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']>1){echo''.$status.'';}echo'</a>  '.$ilok['text'].' вас '.$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']>1){echo''.$status.'';}echo'</a> '.$ilok['text'].' вас на <font color="F5E17E">'.$ilok['uron'].'</font> урона</font><span class="mit">'.$timeudar.'</span>  <div class="empty"></div>';
}
}


}
}
echo"</div>";

echo"<hr><div class='foot center'>Топ игроков</br></div>";
$sur = mysql_query("SELECT `exp`,`usr`,`wins`,`race` FROM `capture` WHERE `city`='".$zaxvat."' and `status`!='1' and `usr`>'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']."' LIMIT 1");
$ust = mysql_fetch_array($qst);
echo"<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'].', <img src="/images/icon/rating_'.$sn['race'].'.png">'.$sn['wins'].'</span></a></div>';
}
$enduser = mysql_fetch_array(mysql_query("SELECT `exp`,`wins`,`race` FROM `capture` WHERE `city`='".$zaxvat."' and `status`='0' and `usr`>'0' ORDER BY `exp` DESC LIMIT 5, 5"));
$myuser = mysql_fetch_array(mysql_query("SELECT `exp`,`wins`,`race` FROM `capture` WHERE `city`='".$zaxvat."' and `status`='0' and `usr`='".$user['id']."' LIMIT 1"));
if($enduser['exp']>=$myuser['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"> '.$myuser['exp'].',  <img src="/images/icon/rating_'.$myuser['race'].'.png">'.$myuser['wins'].'</span></a></div>';
}

echo'</div>';}else{echo'<div class="foot">Список пуст</div>';}
require_once'../core/foot.php';
?>