Файл: b_av.php
Строк: 578
<?
define('PROTECTOR', 1);
$textl='Битва';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$lv=time();
$last=date('d.m.Y - H:i:s');
mysql_query("UPDATE `users` SET
`lv`='".$lv."',
`last`='".$last."',
`mesto`='".$textl."'
WHERE `id`='".$udata['id']."'");
$mobs=mysql_query("SELECT * FROM `craft` WHERE `usr`='".$udata['id']."'");
$rows=mysql_num_rows($mobs);
if($rows!=0)
{
header('location: work.php');exit;
}
$t=time();
$bat=mysql_query("SELECT * FROM `avan_usr` WHERE `usr`='".$udata['id']."'");
$num=mysql_num_rows($bat);
if($num==0)
{
header('location: avan.php');exit;
}
else
{
$bt=mysql_fetch_array($bat);
$av=mysql_fetch_array(mysql_query("SELECT * FROM `avan` WHERE `id`='".$bt['arr']."'"));
if($av['open']>time())
{
header('location: avan.php');exit;
}
$lvlz=$udata['lvl']+1;
$exzn=mysql_num_rows(mysql_query("SELECT * FROM `lvl` WHERE `lvl`='".$lvlz."'"));
if($exzn!=0)
{
$ex=mysql_fetch_array(mysql_query("SELECT * FROM `lvl` WHERE `lvl`='".$lvlz."'"));
if($udata['exp']>=$ex['exp'])
{
$klz=$udata['lvl']+1;
if($udata['klass']==1)
{
$hp=$udata['hp1']+2;
$sila=$udata['sila1']+3;
$arm=$udata['arm1']+1;
}
elseif($udata['klass']==2)
{
$hp=$udata['hp1']+3;
$sila=$udata['sila1']+1;
$arm=$udata['arm1']+2;
}
elseif($udata['klass']==3)
{
$hp=$udata['hp1']+1;
$sila=$udata['sila1']+2;
$arm=$udata['arm1']+3;
}
mysql_query("UPDATE `users` SET `lvl`='".$klz."', `hp1`='".$hp."', `sila1`='".$sila."', `arm1`='".$arm."' WHERE `id`='".$udata['id']."'");
mysql_query("UPDATE `avan_usr` SET `hp`='".$udata['hp']."', `arm`='".$udata['arm']."', `sila`='".$udata['sila']."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='Ваш уровень повысился до ".$lvlz."!', `arr`='".$av['id']."'
");
header('location: ?');exit;
}}
if($bt['status']==0)
{
if($udata['kv']==30 and $udata['kv_s']==12)
{
mysql_query("UPDATE `users` SET `kv_s_n`='".$av['volna']."' WHERE `id`='".$udata['id']."'");
}
if($udata['kv']==30 and $udata['kv_s']==19)
{
if($av['volna']==12)
{
mysql_query("UPDATE `users` SET `kv_s_n`='12' WHERE `id`='".$udata['id']."'");
}
}
if($udata['kv']==30 and $udata['kv_d']==6)
{
if($av['volna']==6)
{
mysql_query("UPDATE `users` SET `kv_d_n`='6' WHERE `id`='".$udata['id']."'");
}
}
if($udata['kv']==30 and $udata['kv_d']==7)
{
if($av['volna']==12)
{
mysql_query("UPDATE `users` SET `kv_d_n`='12' WHERE `id`='".$udata['id']."'");
}
}
}
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `avan_mob` WHERE `id`='".$bt['enemy']."'"));
$bts_n=mysql_num_rows(mysql_query("SELECT * FROM `avan_mob` WHERE `id`='".$bt['enemy']."'"));
$bts_num=mysql_num_rows(mysql_query("SELECT * FROM `avan_mob` WHERE `arr`='".$bt['arr']."'"));
$us_num=mysql_num_rows(mysql_query("SELECT * FROM `avan_usr` WHERE `arr`='".$av['id']."' and `status`='0' and `tip`='usr'"));
$en=mysql_num_rows(mysql_query("SELECT * FROM `avan_mob` WHERE `arr`='".$bt['arr']."' and `time_us`<'".time()."'"));
if($en!=0)
{
$ed=mysql_query("SELECT * FROM `avan_mob` WHERE `arr`='".$bt['arr']."' and `time_us`<'".time()."'");
while($ens=mysql_fetch_array($ed))
{
if($ens['sfer_so']>time())
{
}
else
{
$bnt=mysql_result(mysql_query("SELECT COUNT(*) FROM `avan_usr` WHERE `arr`='".$ens['arr']."' and `status`='0'"),0);
if($bnt==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `avan_usr` WHERE `status`='0' and `arr`='".$ens['arr']."' ORDER BY `id` DESC"));
}
else
{
$r=rand(0,$bnt);
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `avan_usr` WHERE `status`='0' and `arr`='".$ens['arr']."' ORDER BY `id` DESC LIMIT ".$r.",1"));
}
if($btt['tip']=='usr')
{
$ssb=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$btt['usr']."'"));
$en_namet=' <img src=img/main/c'.$ssb['klass'].'.png> <img src=img/main/r'.$ssb['rasa'].'.png><font color=#ff0000>'.$ssb['usr'].'</font>';
}
if($btt['tip']=='pit')
{
$ssb=mysql_fetch_array(mysql_query("SELECT * FROM `pit` WHERE `id`='".$btt['pit']."' and `usr`='".$btt['usr']."'"));
$en_namet=' <font color=#ff9900>'.$ssb['name'].'</font>';
}
$blok=rand(1,100);
if($ssb['blok']>=$blok and $btt['tip']=='usr')
{
$lg12='<img src=img/main/b23.png> Вы заблокировали атаку <font color=#ffff00><font color=#00ff99>'.$ens['name'].'</font></font>.';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$ssb['id']."',
`text`='".$lg12."', `arr`='".$av['id']."'
");
$tim=time()+10;
mysql_query("UPDATE `avan_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
else
{
if($btt['tip']=='pit')
{
if($btt['mag_ney_time']>time())
{
$lg='<img src=img/main/b1.png> '.$en_namet.' уклонился от атаки <font color=#00ff99>'.$ens['name'].'</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."', `arr`='".$av['id']."'
");
}
}
$dmg=$ens['sila'];
if($ens['sfer_r']>=time())
{
$dmg=round($dmg-$dmg/100*$ens['sfer_rp']);
}
$armr=$btt['arm'];
$dmg=$dmg-$armr;
if($btt['sfer_sh']>=time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$btt['usr']."' and `mag`='6' and `status`='on'");
$skills=mysql_fetch_array($mobss);
if($skills['lvl']==1)
{$sks=10;}
if($skills['lvl']==2)
{$sks=15;}
if($skills['lvl']==3)
{$sks=20;}
if($skills['lvl']==4)
{$sks=25;}
if($skills['lvl']==5)
{$sks=30;}
if($skills['lvl']==6)
{$sks=35;}
if($skills['lvl']==7)
{$sks=45;}
if($skills['lvl']==8)
{$sks=55;}
if($skills['lvl']==9)
{$sks=65;}
if($skills['lvl']==10)
{$sks=75;}
$dmg=round($dmg-$dmg/100*$sks);
if($dmg<$ens['sila']/100*5)
{
$dmg=round($ens['sila']/100*5);
}
}
else
{
if($dmg<$ens['sila']/100*10)
{
$dmg=round($ens['sila']/100*10);
}
}
$m_dmg=round($ens['sila']/2);
$h_us=$btt['hp']-$dmg-$m_dmg;
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> ударил '.$en_namet.' -'.$dmg.' -<font color=#ff00ff>'.$m_dmg.'</font></font>.';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."', `arr`='".$av['id']."'
");
if($h_us<=0)
{
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> сокрушил '.$en_namet.'</font>.';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."', `arr`='".$av['id']."'
");
if($btt['tip']!='pit')
{
mysql_query("UPDATE `avan_usr` SET `hp`='0', `att2`='".$dmg."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
mysql_query("DELETE FROM `avan_usr` WHERE `id`='".$btt['id']."'");
}
}
else
{
$att2=$dmg+$m_dmg;
mysql_query("UPDATE `avan_usr` SET `hp`='".$h_us."', `att2`='".$att2."' WHERE `id`='".$btt['id']."'");
if($btt['sfer_p']>=time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$btt['usr']."' and `mag`='10' and `status`='on'");
$skills=mysql_fetch_array($mobss);
if($skills['lvl']==1)
{$sks=5;}
if($skills['lvl']==2)
{$sks=10;}
if($skills['lvl']==3)
{$sks=15;}
if($skills['lvl']==4)
{$sks=20;}
if($skills['lvl']==5)
{$sks=25;}
if($skills['lvl']==6)
{$sks=30;}
if($skills['lvl']==7)
{$sks=35;}
if($skills['lvl']==8)
{$sks=40;}
if($skills['lvl']==9)
{$sks=45;}
if($skills['lvl']==10)
{$sks=50;}
$yrs=round(($dmg+$m_dmg)/100*$sks);
if($yrs<1)
{
$yrs=1;
}
if($ens['tip']==2)
{
$yrs=round($yrs/2);
}
if($ens['tip']==3)
{
$yrs=round($yrs*2);
}
if($ens['tip']==4)
{
$yrs=0;
}
$hpz=$ens['hp']-$yrs;
$lgz='<img src=img/main/b10.png> <font color=#00ff00>заклинание возврата обожгло</font>
<font color=#00ff99>'.$ens['name'].'</font> <font color=#00ff00>-'.$yrs.'</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lgz."', `arr`='".$av['id']."'
");
if($hpz<=0)
{
$lg2='<img src=img/main/b17.png>'.$en_namet.'</a> <font color=#ff0000>
сокрушает '.$bts['name'].'</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."', `arr`='".$av['id']."'
");
$nai=$ssb['reit_oh']+1;
$ds=$ssb['dost2a']+1;
if($ssb['lvl']>$ssb['rang'])
{
$rang=3;
}
else
{
$rang=0;
}
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$ssb['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$rang=$rang*2;
}
$rang=$ssb['exp_rang']+$rang;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."', `exp_rang`='".$rang."' WHERE `id`='".$ssb['id']."'");
$ra=rand(1,3);
if($ra==1)
{
$kl=$ssb['kl']+1;
mysql_query("UPDATE `users` SET `kl`='".$kl."' WHERE `id`='".$ssb['id']."'");
$lg3='<img src=img/main/p12.png>
<a href=info.php?id='.$ssb['id'].'><font color=#ffff00>'.$ssb['usr'].'</font></a> <font color=#00ff00>
получает <img src=img/main/r16.png>1</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg3."', `arr`='".$av['id']."'
");
}
if($ra==2)
{
$kl=$ssb['kl']+1;
$fm=$ssb['fm']+1;
mysql_query("UPDATE `users` SET `kl`='".$kl."', `fm`='".$fm."' WHERE `id`='".$ssb['id']."'");
$lg3='<img src=img/main/p12.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$ssb['usr'].'</font></a> <font color=#00ff00>
получает <img src=img/ssb/r16.png>1 <img src=img/main/r17.png>1</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg3."', `arr`='".$av['id']."'
");
}
mysql_query("DELETE FROM `avan_mob` WHERE `id`='".$ens['id']."'");
}
else
{
mysql_query("UPDATE `avan_mob` SET `hp`='".$hpz."' WHERE `id`='".$ens['id']."'");
}
mysql_query("UPDATE `avan_usr` SET `att`='".$yrs."' WHERE `id`='".$btt['id']."'");
}
}
$tim=time()+10;
mysql_query("UPDATE `avan_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
}
}
if($bts_num!=0)
{
}
else
{
$rty=$av['volna']*$av['etap'];
if($us_num<=3 and $rty>=12)
{
$usr=mysql_query("SELECT * FROM `avan_usr` WHERE `arr`='".$av['id']."' and `status`='0' and `tip`='usr'");
while($usz=mysql_fetch_array($usr))
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$usz['usr']."'"));
if($av['gorod']==2)
{
$ngr='Деревянный Сундук';
$img=1;
}
if($av['gorod']==3)
{
$ngr='Волшебный Сундук';
$img=2;
}
if($av['gorod']==4)
{
$ngr='Мифический Сундук';
$img=3;
}
mysql_query("INSERT INTO `item` SET
`id`='',
`usr`='".$us['id']."',
`name`='<font color=#998800>".$ngr."</font>',
`cena`='0',
`lvl`='0',
`img`='".$img."',
`tip`='syndyk',
`lic`='1',
`status`='off',
`item`='1'
");
$gi=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$us['clan']."'"));
$gus=mysql_fetch_array(mysql_query("SELECT * FROM `clan_users` WHERE `clan`='".$gi['id']."' and `usr`='".$us['id']."'"));
if($gus['kv_s']==7 and $gus['kv_s_n']<1)
{
$rand=rand(1,5);
if($rand<=1)
{
$nd=$gus['kv_s_n']+1;
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$us['id']."'"));
$dk=$dost['avan_exp']+1;
mysql_query("UPDATE `users_dost` SET `avan_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
if($us['lvl']>$us['rang'])
{
$rt=50;
$ysl=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `tip`='rang'"));
if($ysl!=0)
{
$rt=$rt*2;
}
}
else{
$rt=0;
}
$exp=$us['exp_rang']+$rt;
mysql_query("UPDATE `users` SET `exp_rang`='".$exp."' WHERE `id`='".$us['id']."'");
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$usz['usr']."'"));
$lg='Вы успешно прошли аванпост. В награду вы получаете: <font color=#998800>'.$ngr.'</font>';
mysql_query("INSERT INTO `user_log` SET
`id`='',
`usr`='".$us['id']."',
`text`='".$lg."'
");
}
mysql_query("DELETE FROM `avan_usr` WHERE `arr`='".$av['id']."'");
}
else
{
if($bts_num==0)
{
if($av['volna']==0 or $av['volna']==12)
{$hp=100;$arm=5;$sila=25;$kol=$us_num*3;$name='Попрашайка';}
if($av['volna']==1)
{$hp=120;$arm=7;$sila=33;$kol=$us_num*3;$name='Разбойник';}
if($av['volna']==2)
{$hp=160;$arm=9;$sila=45;$kol=$us_num*3;$name='Шпион';}
if($av['volna']==3)
{$hp=230;$arm=12;$sila=57;$kol=$us_num*3;$name='Солдат';}
if($av['volna']==4)
{$hp=320;$arm=15;$sila=70;$kol=$us_num*3;$name='Страж Ворот';}
if($av['volna']==5)
{$hp=3000;$arm=25;$sila=250;$kol=1;$name='Крепкие Ворота';}
if($av['volna']==6)
{$hp=500;$arm=18;$sila=86;$kol=$us_num*3;$name='Лучник';}
if($av['volna']==7)
{$hp=650;$arm=21;$sila=90;$kol=$us_num*3;$name='Мечник Рекрут';}
if($av['volna']==8)
{$hp=830;$arm=25;$sila=104;$kol=$us_num*3;$name='Мечник Наставник';}
if($av['volna']==9)
{$hp=1100;$arm=30;$sila=120;$kol=$us_num*3;$name='Советник';}
if($av['volna']==10)
{$hp=1500;$arm=35;$sila=140;$kol=$us_num*3;$name='Телохранитель';}
if($av['volna']==11)
{$hp=5000;$arm=50;$sila=400;$kol=1;$name='Хозяин Башни';}
$volna=$av['volna']+1;
if($av['volna']==13)
{
$etap=$av['etap']+1;
$volna='1';
}
else
{
$etap=$av['etap'];
}
if($av['gorod']==2)
{
$hp=$hp;
$arm=$arm;
$sila=$sila;
}
elseif($av['gorod']==3)
{
$hp=round($hp+$hp/100*10);
$arm=round($arm+$arm/100*20);
$sila=round($sila+$sila/100*20);
}
elseif($av['gorod']==4)
{
$hp=round($hp+$hp/100*25);
$arm=round($arm+$arm/100*35);
$sila=round($sila+$sila/100*35);
}
if($etap>1)
{
$et=$etap*10;
$hp=$hp;
$sila=round($sila+$sila/100*$et);
$arm=round($arm+$arm/100*$et);
}
for($bts_num=0; $bts_num++<$kol;)
{
$tip=rand(1,4);
mysql_query("INSERT INTO `avan_mob` SET
`id`='',
`arr`='".$av['id']."',
`tip`='".$tip."',
`name`='".$name."',
`hp`='".$hp."',
`arm`='".$arm."',
`sila`='".$sila."'
");
}
mysql_query("UPDATE `avan` SET `volna`='".$volna."', `etap`='".$etap."' WHERE `id`='".$av['id']."'");
}
}
header('location: ?');exit;
}
if($bts_n==0 and $bts_num!=0 and $bt['status']==0)
{
if($bts_num>1)
{
$bts1=mysql_fetch_array(mysql_query("SELECT * FROM `avan_mob` WHERE `arr`='".$bt['arr']."' ORDER BY `id` ASC"));
$bts2=mysql_fetch_array(mysql_query("SELECT * FROM `avan_mob` WHERE `arr`='".$bt['arr']."' ORDER BY `id` DESC"));
$r=rand($bts1['id'],$bts2['id']);
$bts_en=mysql_fetch_array(mysql_query("SELECT * FROM `avan_mob` WHERE `arr`='".$bt['arr']."' and `id`='".$r."' ORDER BY `id` DESC"));
}
else
{
$bts_en=mysql_fetch_array(mysql_query("SELECT * FROM `avan_mob` WHERE `arr`='".$bt['arr']."'"));
}
mysql_query("UPDATE `avan_usr` SET `enemy`='".$bts_en['id']."' WHERE `id`='".$bt['id']."'");
header('location: ?');exit;
}
if(isset($_GET['elic']))
{
$els=mysql_real_escape_string($_GET['elic']);
$elic=mysql_query("SELECT * FROM `elic` WHERE `id`='".$els."' and `usr`='".$udata['id']."' and `status`='on'");
$cd=mysql_num_rows($elic);
if($cd==0)
{
header('location: ?');exit;
}
else
{
$el=mysql_fetch_array($elic);
if($el['time']>time())
{
$lg='<img src=img/main/e22.png> <font color=#999999>Зелье еще не готово.</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."', `arr`='".$av['id']."'
");
header('location: ?');exit;
}
if($bt['hp']==$udata['hp'] or $bt['hp']==0)
{
$lg='<img src=img/main/e22.png> <font color=#999999>нет эффекта.</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."', `arr`='".$av['id']."'
");
header('location: ?');exit;
}
$hp=$bt['hp']+$el['ef'];
if($hp>$udata['hp'])
{
$hp=$udata['hp'];
}
mysql_query("UPDATE `avan_usr` SET `hp`='".$hp."' WHERE `id`='".$bt['id']."'");
$elk=$el['kol']-1;
if($elk==0)
{
mysql_query("DELETE FROM `elic` WHERE `id`='".$el['id']."'");
}
else
{
$time=time()+$el['rest'];
mysql_query("UPDATE `elic` SET `kol`='".$elk."', `time`='".$time."' WHERE `id`='".$el['id']."'");
}
if($el['ef']!=20000)
{
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и исцелился +".$el['ef']." <img src=img/main/p6.png></font>', `arr`='".$av['id']."'
");
}
else
{
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и ваше здоровье востановилось <img src=img/main/p6.png></font>', `arr`='".$av['id']."'
");
}
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['elic_exp']+1;
mysql_query("UPDATE `users_dost` SET `elic_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
header('location: ?');exit;
}
}
if(isset($_GET['leave']))
{
if($bt['status']==2)
{
mysql_query("DELETE FROM `avan_usr` WHERE `usr`='".$udata['id']."'");
mysql_query("DELETE FROM `log_avan` WHERE `usr`='".$udata['id']."'");
mysql_query("UPDATE `mag` SET
`time`='0' WHERE `usr`='".$udata['id']."'");
}
else
{
$lg='<img src=img/main/p11.png> <font color=#999999>Вы неможете покинуть бой. Страж загородил проход.</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."', `arr`='".$av['id']."'
");
}
header('location: ?');exit;
}
include('b_av2.php');
include('files/head.php');
echo '
<div class="head brs bls v8 bts bbs p v12"><font color=#00ccff>
<img src=img/main/p6.png>'.$bt['hp'].' | '.$hpw.'
<font color=#ff0000>'.$bt['att'].'</font> | <font color=#ff0000>'.$bt['att2'].'</font>';
if($bt['enemy']!=0)
{
echo' | '.$bts['name'].' <img src=img/main/p6.png>'.$bts['hp'].'';
}
$q = mysql_query("SELECT COUNT(*) FROM `msg_kont` WHERE `usr1` = '".$udata['id']."' AND `read` = '1';");
$new_mail = mysql_result($q, 0);
if($new_mail > 0)
{
echo"
<a href="mail.php"><img src=img/main/e1.png></a>";
}
if($udata['clan']!=0)
{
$fridaa=mysql_query("SELECT * FROM `sectors` WHERE `clan`='".$udata['clan']."' and `att_clan`!='0'");
$fra=mysql_num_rows($fridaa);
if($fra!=0)
{
echo'<a href=clan.php?gi=ter><img src=img/main/st.png></a>';
}
}
$t=$av['close']-time();
if($t>=60)
{
$t=round($t/60).'м';
}
else
{
$t=$t.'с';
}
echo'<br>Состояние: </font> <font color=#00ff99>Этап:</font> '.$av['etap'].', <font color=#00ff99>Волна:</font> '.$av['volna'].' <img src=img/main/e12.png>'.$t.'</div>';
$giza=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$udata['clan']."'"));
if($giza['gorn_time']>time() and $udata['gorn']==1)
{
echo '<div class="v6 rr rt rl p">'.$giza['gorn'].'<br>
<img src=img/main/e55.png><a href=clan.php?gorn_def>Закрыть</a>
</div>';
}
echo '<div class=v8><div class="line bbs m bts brs bls b p v12">Бой</div><div class="box bts brs bls bbs p m">';
if($bt['status']==0)
{
if($bt['enemy']==0)
{
echo '<table>
<tr>
<td><img src=img/mob/0.jpg></td>
<td> -<i>Нет противника.</i></td>
</tr>
</table>';
}
else
{
echo '<table>
<tr>
<td> <i>'.$bts['name'].'</i>
<img src=img/main/p6.png>'.$bts['hp'].'<br>
<font color=#00ff99>Тип: </font>';
if($bts['tip']==1)
{
echo '<font color=#999999>Универсал</font>';
}
if($bts['tip']==2)
{
echo '<font color=#999999>Уязвимость к физ. атакам</font>';
}
if($bts['tip']==3)
{
echo '<font color=#999999>Уязвимость к заклинаниям</font>';
}
if($bts['tip']==4)
{
echo '<font color=#999999>Устойчивость к заклинаниям</font>';
}
echo'</td>
</tr>
</table>';
}
echo '</div><div class="bat p bts bbs brs bls">';
if($bt['time_us']<time())
{
echo'<a href=b_av_kick.php><div style="position: relative;
font-weight: bold;
margin-top: 2px;
margin-bottom: 4px;
color: #ffff00;
text-decoration: none;
text-shadow: 0 -1px 1px #cc5500;
user-select: none;
padding: 5px;
outline: none;
border-radius: 1px;
background: rgb(128,60,60);
background-size: 100% 100%, auto;
background-position: 50% 50%;
box-shadow: inset rgb(188,60,60) 0 -1px 1px, inset 0 1px 1px rgb(188,60,60), rgb(188,60,60) 0 0 0 1px, #000 0 10px 15px -10px; text-align: center">Атака</div></a>';
}
else
{
$time=$bt['time_us']-time();
$h=floor($time/3600);
$m=floor(($time-($h*3600))/60);
$s=$time-($h*3600)-($m*60);
$tim_boss=$h.':'.$m.':'.$s;
echo'<a href=b_av_kick.php><div style="position: relative;
font-weight: bold;
color: #ffff00;
margin-top: 2px;
margin-bottom: 4px;
text-decoration: none;
text-shadow: 0 -1px 1px #cc5500;
user-select: none;
padding: 5px;
outline: none;
border-radius: 1px;
background: rgb(128,60,60);
background-size: 100% 100%, auto;
background-position: 50% 50%;
box-shadow: inset rgb(188,60,60) 0 -1px 1px, inset 0 1px 1px rgb(188,60,60), rgb(188,60,60) 0 0 0 1px, #000 0 10px 15px -10px; text-align: center; opacity: 0.7">До полного удара: '.$tim_boss.'</div></a>';
}
echo '<table width=100%>';
echo '<tr>';
$tn=time();
$mobs=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$udata['id']."' and `status`='on' ORDER BY `id`");
while($mag=mysql_fetch_array($mobs))
{
echo '<td align=center>';
if($mag['mag']==1)
{
$sn=1;
$name='заклинание удара';
}
if($mag['mag']==2)
{
$sn=14;
$name='заклинание случайности';
}
if($mag['mag']==3)
{
$sn=3;
$name='заклинание усиления';
}
if($mag['mag']==4)
{
$sn=9;
$name='заклинание пробивания';
}
if($mag['mag']==5)
{
$sn=13;
$name='заклинание стана';
}
if($mag['mag']==6)
{
$sn=2;
$name='заклинание обороны';
}
if($mag['mag']==7)
{
$sn=5;
$name='заклинание молний';
}
if($mag['mag']==8)
{
$sn=4;
$name='заклинание исцеления';
}
if($mag['mag']==9)
{
$sn=11;
$name='заклинание вампира';
}
if($mag['mag']==10)
{
$sn=10;
$name='заклинание возврата';
}
if($mag['mag']==11)
{
$sn=12;
$name='заклинание ослабления';
}
if($mag['mag']==12)
{
$sn=7;
$name='заклинание барьера';
}
if($mag['mag']==13)
{
$sn=8;
$name='заклинание сингулярности';
}
if($mag['mag']==14)
{
$sn=6;
$name='заклинание хаоса';
}
if($mag['time']<=$tn)
{
echo '<a href=b_av_mag.php?mag='.$mag['mag'].'>
<div class="mag p" style=" margin-top: 3px;
margin-bottom: 4px;"><img src=img/mag/sfera_'.$sn.'.jpg></div></a>';
}
else
{
$mag['time']=$mag['time']-time();
$mag['time']=$mag['time']." с.";
echo '<a href=b_av_mag.php?mag='.$mag['mag'].'>
<div class="mag p m" style="opacity: 0.8; margin-top: 3px;
margin-bottom: 4px;"><img src=img/mag/sfera_'.$sn.'.jpg>'.$mag['time'].'</div></a>';
}
echo '</td>';
}
echo '</tr>';
echo '</table>';
echo '<table width=100%>';
echo '<tr>';
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `status`='on'");
while($el=mysql_fetch_array($eq))
{
echo '<td align=center>';
if($el['time']<=$tn)
{
echo '<a href=?elic='.$el['id'].'>
<div class="p elic" style=" margin-top: 3px;
margin-bottom: 4px;">
<img src=img/elic/'.htmlspecialchars($el['tip']).''.$el['ef'].'.png></div></a> ';
}
else
{
$el['time']=$el['time']-time();
if($el['time']<60){
$el['time']=$el['time']." с.</font>";
}
echo '<div style="opacity: 0.8; margin-top: 3px;
margin-bottom: 4px;" class="p elic"><img src=img/elic/'.htmlspecialchars($el['tip']).''.$el['ef'].'.png> '.$el['time'].'</div>';
}
echo '</td>';
}
echo '</tr>';
echo '</table>';
}
}
if($bt['status']==2)
{
echo '<div align=center><font color=#ff0000>Вы пали в этом бою!</font><br>
<a href=?leave>Покинуть бой</a>
</div>';
}
echo '</div></div>';
echo '<div class="v8"><div class="line bbs m bts brs bls b p v12">Союзники</div><div class="bat bts brs bls bbs p t1">';
$aq=mysql_query("SELECT * FROM `avan_usr` WHERE `arr`='".$av['id']."'");
while($arrs=mysql_fetch_array($aq))
{
if($arrs['tip']=='usr')
{
$usrz=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$arrs['usr']."'"));
echo ' <img src=img/main/c'.$usrz['klass'].'.png> <img src=img/main/r'.$usrz['rasa'].'.png>
<font color=#ffff00>'.$usrz['usr'].'</font> [<img src=img/main/p3.png><font color=#ff0000>'.$arrs['hp'].'</font>] ['.$arrs['ur'].'],';
}
else
{
$usrz=mysql_fetch_array(mysql_query("SELECT * FROM `pit` WHERE `id`='".$arrs['pit']."'"));
echo ' <font color=#ff9900>'.$usrz['name'].'</font> [<img src=img/main/p3.png><font color=#ff0000>'.$arrs['hp'].'</font>] ['.$arrs['ur'].'],';
}
}
echo '</div></div>';
echo '<div class="v8"><div class="line bbs m bts brs bls b p v12">Противники</div><div class="bat bts brs bls bbs p t1">';
$aqs=mysql_query("SELECT * FROM `avan_mob` WHERE `arr`='".$av['id']."'");
while($mob=mysql_fetch_array($aqs))
{
echo ' <font color=#999999>'.$mob['name'].'</font> [<img src=img/main/p3.png><font color=#ff0000>'.$mob['hp'].'</font>],';
}
echo '</div></div>';
$mobs=mysql_query("SELECT * FROM `log_avan` WHERE `usr`='".$udata['id']."' ORDER BY `id` DESC LIMIT 10");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
}
else
{
echo '<div class=v8><div class="line bbs m bts brs bls b p v12">Лог боя:</div><div class="bat bts brs bls bbs p t2">';
while($log=mysql_fetch_array($mobs))
{
echo $log['text'].'<br>';
}
}
echo '</div></div>';
include('files/dwn.php');
?>