Файл: b_str.php
Строк: 661
<?
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;
}
$mobs1=mysql_query("SELECT * FROM `arena_usr` WHERE `usr`='".$udata['id']."'");
$rows1=mysql_num_rows($mobs1);
if($rows1!=0)
{
header('location: arena.php');exit;
}
$mobs2=mysql_query("SELECT * FROM `avan_usr` WHERE `usr`='".$udata['id']."'");
$rows2=mysql_num_rows($mobs2);
if($rows2!=0)
{
header('location: avan.php');exit;
}
$mobs3=mysql_query("SELECT * FROM `battle` WHERE `usr`='".$udata['id']."'");
$rows3=mysql_num_rows($mobs3);
if($rows3!=0)
{
header('location: battle.php');exit;
}
$mobs4=mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$udata['id']."'");
$rows4=mysql_num_rows($mobs4);
if($rows4!=0)
{
header('location: b_oh.php');exit;
}
$mobs7=mysql_query("SELECT * FROM `terr_usr` WHERE `usr`='".$udata['id']."'");
$rows7=mysql_num_rows($mobs7);
if($rows7!=0)
{
header('location: terr_b.php');exit;
}
$bat=mysql_query("SELECT * FROM `stt_usr` WHERE `usr`='".$udata['id']."' and `tip`!='pit'");
$num=mysql_num_rows($bat);
if($num==0)
{
header('location: game.php');exit;
}
else
{
$bt=mysql_fetch_array($bat);
$lvl=$udata['lvl']+1;
$exzn=mysql_num_rows(mysql_query("SELECT * FROM `lvl` WHERE `lvl`='".$lvl."'"));
if($exzn!=0)
{
$ex=mysql_fetch_array(mysql_query("SELECT * FROM `lvl` WHERE `lvl`='".$lvl."'"));
if($udata['exp']>=$ex['exp'])
{
$kl=$udata['lvl']+1;
if($udata['klass']==1)
{
$hp=$udata['hp1']+2;
$sila=$udata['sila1']+3;
$arm=$udata['arm1']+1;
}
if($udata['klass']==2)
{
$hp=$udata['hp1']+3;
$sila=$udata['sila1']+1;
$arm=$udata['arm1']+2;
}
if($udata['klass']==3)
{
$hp=$udata['hp1']+1;
$sila=$udata['sila1']+2;
$arm=$udata['arm1']+3;
}
mysql_query("UPDATE `users` SET `lvl`='".$kl."', `hp1`='".$hp."', `sila1`='".$sila."', `arm1`='".$arm."' WHERE `id`='".$udata['id']."'");
mysql_query("UPDATE `stt_usr` SET `hp`='".$udata['hp']."', `arm`='".$udata['arm']."', `sila`='".$udata['sila']."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='Ваш уровень повысился до ".$lvl."!'
");
if($kl==16 or $kl==31 or $kl==39)
{
mysql_query("DELETE FROM `stt_usr` WHERE `usr`='".$udata['id']."'");
mysql_query("UPDATE `mag` SET
`time`='0' WHERE `usr`='".$udata['id']."'");
mysql_query("DELETE FROM `log_str` WHERE `usr`='".$udata['id']."'");
}
header('location: ?');exit;
}}
$prettty=mysql_query("SELECT * FROM `straz` WHERE `rasa`!='0'");
while($vpras=mysql_fetch_array($prettty))
{
if($vpras['time']<=time())
{
$prana=mysql_fetch_array(mysql_query("SELECT * FROM `prana` WHERE `rasa`='".$vpras['rasa']."' and `gorod`='".$vpras['arr']."'"));
$pra=$prana['prana']+3;
$t=time()+20;
mysql_query("UPDATE `prana` SET `prana`='".$pra."' WHERE `id`='".$prana['id']."'");
mysql_query("UPDATE `straz` SET `time`='".$t."' WHERE `id`='".$vpras['id']."'");
}
}
$prana_mob=mysql_fetch_array(mysql_query("SELECT * FROM `prana` WHERE `gorod`='".$bt['arr']."' and `rasa`='".$bt['kom']."'"));
if($prana_mob['time_mob']<time())
{
$enemy=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `status`='0' and `arr`='".$bt['arr']."' and `kom`!='".$bt['kom']."' and `tip`='mob'"));
if($enemy==0)
{
for($enemy=0; $enemy++<5;)
{
if($prana_mob['gorod']==1)
{
$hp=rand(250,400);
$sila=rand(40,100);
$arm=rand(10,40);
$b=rand(1,5);
}
if($prana_mob['gorod']==2)
{
$hp=rand(500,2100);
$sila=rand(90,190);
$arm=rand(40,80);
$b=rand(6,10);
}
if($prana_mob['gorod']==3)
{
$hp=rand(2000,3600);
$sila=rand(200,340);
$arm=rand(80,120);
$b=rand(11,15);
}
if($prana_mob['gorod']==4)
{
$hp=rand(7500,12000);
$sila=rand(320,760);
$arm=rand(120,150);
$b=rand(16,20);
}
$n=rand(1,5);
if($n==1)
{
$name='Грифон';
$img='hunt10';
}
if($n==2)
{
$name='Медведь';
$img='hunt5';
}
if($n==3)
{
$name='Броневик';
$img='hunt54';
}
if($n==4)
{
$name='Оборотень';
$img='hunt37';
}
if($n==5)
{
$name='Призрак';
$img='hunt31';
}
if($bt['kom']==1)
{
$kom=2;
}
elseif($bt['kom']==2)
{
$kom=1;
}
mysql_query("INSERT INTO `stt_usr` SET
`id`='',
`usr`='1',
`tip`='mob',
`arr`='".$bt['arr']."',
`b`='".$b."',
`hp`='".$hp."',
`hp_max`='".$hp."',
`sila`='".$sila."',
`arm`='".$arm."',
`kom`='".$kom."',
`name`='".$name."',
`img`='".$img."'
");
}
}
$time=time()+rand(45,90);
mysql_query("UPDATE `prana` SET `time_mob`='".$time."' WHERE `id`='".$prana_mob['id']."'");
}
if(isset($_GET['leave']))
{
if($bt['status']!=0)
{
if($udata['kv_d']==40)
{
$kol=$udata['kv_d_n']+$bt['ur'];
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
$stt=time()+30;
mysql_query("UPDATE `users` SET `stt`='".$stt."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `stt_usr` WHERE `usr`='".$udata['id']."'");
mysql_query("DELETE FROM `log_str` WHERE `usr`='".$udata['id']."'");
mysql_query("UPDATE `mag` SET
`time`='0' WHERE `usr`='".$udata['id']."'");
}
else
{
$sq=mysql_query("SELECT * FROM `straz` WHERE `arr`='".$bt['arr']."' and `id`='".$bt['b']."'");
$s=mysql_fetch_array($sq);
if($s['rasa']==$bt['kom'])
{
if($udata['kv_d']==18)
{
$kol=$udata['kv_d_n']+$bt['ur'];
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
if($udata['kv_d']==40)
{
$kol=$udata['kv_d_n']+$bt['ur'];
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
$stt=time()+30;
mysql_query("UPDATE `users` SET `stt`='".$stt."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `stt_usr` WHERE `usr`='".$udata['id']."'");
mysql_query("DELETE FROM `log_str` 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_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."'
");
}
}
header('location: ?');exit;
}
$enemy=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `status`='0' and `b`='".$bt['b']."' and `arr`='".$bt['arr']."' and `kom`!='".$bt['kom']."' and `id`='".$bt['enemy']."'"));
if($enemy==0 and $bt['enemy']!=0)
{
mysql_query("UPDATE `stt_usr` SET `enemy`='0' WHERE `id`='".$bt['id']."'");
if(isset($_GET['kick']))
{
header('location: ?kick');exit;
}
elseif(isset($_GET['mag']))
{
header('location: ?mag='.$_GET['mag'].'');exit;
}
header('location: ?');exit;
}
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `id`='".$bt['enemy']."'"));
if($bts['tip']=='str')
{
$ussb=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$en_name=' <img src=img/main/c'.$ussb['klass'].'.png> <img src=img/main/r'.$ussb['rasa'].'.png><font color=#ff0000>'.$ussb['usr'].'</font>';
if($ussb['ava']==0)
{
$img='<img src=img/pers/'.$ussb['klass'].''.$ussb['pol'].'.png>
';
}
else
{
$img='<img src=img/pers/ava/'.$ussb['ava'].'.png>';
}
}
if($bts['tip']=='pit')
{
$ussb=mysql_fetch_array(mysql_query("SELECT * FROM `pit` WHERE `id`='".$bts['pit']."' and `usr`='".$bts['usr']."'"));
$en_name=' <font color=#ff9900>'.$ussb['name'].'</font>';
$img='<img src=img/pit/'.$ussb['tip'].'/'.$ussb['img'].'.jpg width=90px>';
}
if($bts['tip']=='mob')
{
$en_name=' <font color=#00ff99>'.$bts['name'].'</font>';
$img='<img src=img/mob/'.$bts['img'].'.jpg>';
}
include('b_str2.php');
$en=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$bt['arr']."' and `b`='".$bt['b']."' and `tip`='mob' and `time_us`<'".time()."'"));
if($en!=0)
{
$ed=mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$bt['arr']."' and `b`='".$bt['b']."' and `tip`='mob' and `time_us`<'".time()."'");
while($ens=mysql_fetch_array($ed))
{
if($ens['sfer_5_time']>=time())
{$baf_5=$ens['sfer_5_time']-time();}else{$baf_5=0;}//стан
if($baf_5!=0)
{
}
else
{
$r=rand(1,8);
if($r==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `id` DESC"));
}
if($r==2)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `id`"));
}
if($r==3)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `hp` DESC"));
}
if($r==4)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `hp`"));
}
if($r==5)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `sila`"));
}
if($r==6)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `sila` DESC"));
}
if($r==7)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `arm` DESC"));
}
if($r==8)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `arm`"));
}
if($btt['tip']=='str')
{
$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>';
}
if($btt['tip']=='mob')
{
$en_namet=' <font color=#00ff99>'.$btt['name'].'</font>';
}
if($btt['sfer_4_time']>=time())
{$baf_4=$btt['sfer_4_ef'];}else{$baf_4=0;}//пробивание
if($btt['sfer_6_time']>=time())
{$baf_6=$btt['sfer_6_ef'];}else{$baf_6=0;}//оборона
if($btt['sfer_10_time']>=time())
{$baf_10=$btt['sfer_10_ef'];}else{$baf_10=0;}//пламя
if($ens['sfer_11_time']>=time())
{$baf_11=$ens['sfer_11_ef'];}else{$baf_11=0;}//ослабление
if($btt['tip']=='str')
{
$blok=rand(1,100);
if($ssb['blok']>=$blok)
{
$lg12='<img src=img/main/b23.png> Вы заблокировали атаку <font color=#ffff00><font color=#00ff99>'.$ens['name'].'</font></font>.';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
$tim=time()+10;
mysql_query("UPDATE `stt_usr` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
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_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."'
");
$tim=time()+10;
mysql_query("UPDATE `stt_usr` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
$dmg=$ens['sila'];
$dmg=round($dmg-$dmg/100*$baf_11);
$btt['arm']=round($btt['arm']-$btt['arm']/100*$baf_4);
$armr=$btt['arm'];
$dmg=$dmg-$armr;
if($baf_6!=0)
{
$dmg=round($dmg-$dmg/100*$baf_6);
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);
}
}
$h_us=$btt['hp']-$dmg;
if($btt['tip']!='mob')
{
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> ударил '.$en_namet.' -'.$dmg.'</font>.';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
}
if($h_us<=0)
{
if($btt['tip']!='mob')
{
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> сокрушил '.$en_namet.'</font>.';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
}
if($btt['tip']=='str')
{
mysql_query("UPDATE `stt_usr` SET `hp`='0', `att2`='".$dmg."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
mysql_query("DELETE FROM `stt_usr` WHERE `id`='".$btt['id']."'");
}
}
else
{
mysql_query("UPDATE `stt_usr` SET `hp`='".$h_us."', `att2`='".$dmg."' WHERE `id`='".$btt['id']."'");
if($baf_10!=0)
{
$yrs=round($dmg/100*$baf_10);
if($yrs<1)
{
$yrs=1;
}
$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_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lgz."'
");
if($hpz<=0)
{
$nai=$ssb['reit_oh']+1;
$ds=$ssb['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$ssb['id']."'");
$lg2='<img src=img/main/b17.png><font color=#ffff00>'.$ssb['usr'].'</font></a> <font color=#ff0000>
сокрушает <font color=#00ff99>'.$ens['name'].'</font></font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."'
");
$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/p5.png>1</font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg3."'
");
$mon=$ssb['money']+1;
$rang=1;
$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 `money`='".$mon."', `exp_rang`='".$rang."' WHERE `id`='".$ssb['id']."'");
$att2=$sila;
mysql_query("DELETE FROM `stt_usr` WHERE `id`='".$ens['id']."'");
}
else
{
mysql_query("UPDATE `stt_usr` SET `hp`='".$hpz."', `att2`='".$att2."' WHERE `id`='".$ens['id']."'");
}
mysql_query("UPDATE `stt_usr` SET `att`='".$att2."' WHERE `id`='".$btt['id']."'");
}
}
$tim=time()+10;
mysql_query("UPDATE `stt_usr` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
}
$ptr=mysql_query("SELECT * FROM `prana` WHERE `prana`>=100");
while($pranas=mysql_fetch_array($ptr))
{
$pras=0;
$ngz=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$pranas['gorod']."' and `kom`='".$pranas['rasa']."' and `ur`>'100' and `status`!='2' ORDER BY `ur` DESC LIMIT 1"));
if($ngz!=0)
{
$ng=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$pranas['gorod']."' and `kom`='".$pranas['rasa']."' and `ur`>'100' and `status`!='2' ORDER BY `ur` DESC LIMIT 1"));
$usa=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$ng['usr']."'"));
if($usa['lvl']>$usa['rang'])
{
$q=50;
$ysl=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$usa['id']."' and `tip`='rang'"));
if($ysl!=0)
{
$q=$q*2;
}
if($usa['vip_exp']>=2500)
{$q=$q*2;}
$r=$usa['exp_rang']+$q;
}
else
{
$r=$usa['exp_rang']+0;
}
if($usa['kv_d']==17)
{
$kol=$usa['kv_d_n']+1;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$usa['id']."'");
}
if($usa['kv_d']==18)
{
$kol=$usa['kv_d_n']+$ng['ur'];
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$usa['id']."'");
}
if($usa['kv_d']==40)
{
$kol=$usa['kv_d_n']+$ng['ur'];
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$usa['id']."'");
}
$date_m=date('m');
$date_d=date('d');
if($date_m==2)
{
if($date_d>=13 and $date_d<=17)
{
$day_vl=$usa['day_vl']+2;
mysql_query("UPDATE `users` SET `day_vl`='".$day_vl."' WHERE `id`='".$usa['id']."'");
}
}
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$usa['id']."'"));
$dk=$dost['str_exp']+1;
mysql_query("UPDATE `users_dost` SET `str_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
if($udata['vip_exp']>=2500){$j=2;}else{$j=1;}
$lg12z='<img src=img/main/e9.png> <font color=#00ff00>Вы получили <img src=img/main/r21.png>'.$j.'</font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$usa['id']."',
`text`='".$lg12z."'
");
$jet=$usa['jet']+$j;
$reit_sh=$usa['reit_sh']+1;
mysql_query("UPDATE `stt_usr` SET `ur`='0' WHERE `id`='".$ng['id']."'");
mysql_query("UPDATE `users` SET `exp_rang`='".$r."', `jet`='".$jet."', `reit_sh`='".$reit_sh."' WHERE `id`='".$usa['id']."'");
}
mysql_query("UPDATE `prana` SET `prana`='".$pras."' WHERE `id`='".$pranas['id']."'");
}
include('files/head.php');
echo '
<div class="head brs bls bts bbs p"><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' | '.$en_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>';
}
}
echo'</font> ';
$prana=mysql_fetch_array(mysql_query("SELECT * FROM `prana` WHERE `gorod`='".$bt['arr']."' and `rasa`='".$bt['kom']."'"));
echo '<img src=img/main/b49.png> '.$prana['prana'].'% ';
$k1=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `status`='0' and `b`='".$bt['b']."' and `arr`='".$bt['arr']."' and `kom`='1'"));
$k2=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `status`='0' and `b`='".$bt['b']."' and `arr`='".$bt['arr']."' and `kom`='2'"));
echo '<img src=img/main/r1.png><font color=#00ff00>('.$k1.')</font> - <img src=img/main/r2.png><font color=#ff0000>('.$k2.')</font><br>';
$sq=mysql_query("SELECT * FROM `straz` WHERE `arr`='".$bt['arr']."' and `id`='".$bt['b']."'");
$s=mysql_fetch_array($sq);
if($s['rasa']==1)
{
$col='#00ff00';
}
elseif($s['rasa']==2)
{
$col='#ff0000';
}
echo '<img src=img/main/r'.$s['rasa'].'.png> <font color='.$col.'>Страж</font> <img src=img/main/p6.png>'.$s['hp'].'<br>';
echo'</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="bat m p bts bbs bls brs">'.$giza['gorn'].'<br>
<img src=img/main/e55.png><a href=clan.php?gorn_def>Закрыть</a>
</div>';
}
if($s['rasa']!=$bt['kom'])
{
$n_s1=mysql_num_rows(mysql_query("SELECT * FROM `straz` WHERE `arr`='".$bt['arr']."' and `rasa`='".$bt['kom']."'"));
$n_s2=mysql_num_rows(mysql_query("SELECT * FROM `straz` WHERE `arr`='".$bt['arr']."' and `rasa`!='".$bt['kom']."'"));
if($n_s1>$n_s2)
{
$bon='<img src=img/main/b2.png><font color=#00ffff>+100%</font>';
}
else
{
$bon='<img src=img/main/b2.png><font color=#00ffff>+150%</font>';
}
echo '<a href=b_str_kick_str.php><div class="box bts bbs bls brs p m" align=center> <img src=img/main/b2.png> <font color=#ffff00>Бить Стража</font> '.$bon.'</div></a>';
}
echo '<table width=100%><tr><td width=65%>';
echo '<div class="line bts bbs brs bls p m" style="border-radius: 7px 0 0 7px">
Битва
</div>
</td>
<td>
<a href=?leave><div class="bts brs bbs p m" style="border-radius: 0 7px 7px 0; background: #660000" align=center>
Покинуть
</div></a>
</td></tr></table>
<div class="box m bts brs bls bbs p">';
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></div>';
}
else
{
$hpp=$bts['hp_max']/100;
$hpp=$bts['hp']/$hpp;
echo '<table>
<tr>
<td>'.$img.'</td>
<td> -<i>'.$en_name.'</i><br>
<table width=100%>
<tr>
<td width=80%><div class="bts bbs brs bls">
<div style="background: #990000; height: 20px; width:'.$hpp.'%">
</div></td>
<td width=20% align=right>'.round($hpp).'%</td>
</tr>
</table>
</td>
</tr>
</table></div>';
}
echo '<div class="bat p bts bbs brs bls">';
if($bt['time_us']<time())
{
echo'<a href=b_str_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_str_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_str_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_str_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=b_str_elic.php?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>';
}
echo '</div>';
$enemy=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `status`='0' and `b`='".$bt['b']."' and `arr`='".$bt['arr']."' and `kom`!='".$bt['kom']."'"));
if($enemy!=0)
{
echo '<div class="line m bts brs bls p">Противники</div><div class="bat bts brs bls bbs p">';
$eny=mysql_query("SELECT * FROM `stt_usr` WHERE `status`='0' and `b`='".$bt['b']."' and `arr`='".$bt['arr']."' and `kom`!='".$bt['kom']."'");
while($en=mysql_fetch_array($eny))
{
if($en['tip']=='str')
{
$uss=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$en['usr']."'"));
echo ' <img src=img/main/c'.$uss['klass'].'.png> <img src=img/main/r'.$uss['rasa'].'.png> <a href=b_str_enemy.php?enemy='.$en['id'].'><font color=#ffff00>'.$uss['usr'].'</font></a> [<img src=img/main/p6.png><font color=#ff0000>'.$en['hp'].'</font>] <img src=img/main/p10.png>'.$uss['lvl'].', ';
}
if($en['tip']=='pit')
{
$uss=mysql_fetch_array(mysql_query("SELECT * FROM `pit` WHERE `id`='".$en['pit']."' and `usr`='".$en['usr']."'"));
echo ' <a href=b_str_enemy.php?enemy='.$en['id'].'><font color=#ff9900>'.$uss['name'].'</font></a> [<img src=img/main/p6.png><font color=#ff0000>'.$en['hp'].'</font>] <img src=img/main/p10.png>'.$uss['lvl'].', ';
}
if($en['tip']=='mob')
{
echo ' <a href=b_str_enemy.php?enemy='.$en['id'].'><font color=#00ff99>'.$en['name'].'</font></a> [<img src=img/main/p6.png><font color=#ff0000>'.$en['hp'].'</font>], ';
}
}
echo '</div>';
}
echo '<div class="line m bts brs bls p">Башни</div><div class="bat bts brs bls bbs p">';
$strz=mysql_query("SELECT * FROM `straz` WHERE `arr`='".$bt['arr']."' ORDER BY `id` ASC");
while($sty=mysql_fetch_array($strz))
{
if($sty['id']==$bt['b'])
{
$color='#ff9900';
}
else
{
if($sty['rasa']==1)
{
$color='#00ff00';
}
elseif($sty['rasa']==2)
{
$color='#ff0000';
}
}
$kol1=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `status`='0' and `b`='".$sty['id']."' and `arr`='".$sty['arr']."' and `kom`='1'"));
$kol2=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `status`='0' and `b`='".$sty['id']."' and `arr`='".$sty['arr']."' and `kom`='2'"));
echo '<img src=img/main/r'.$sty['rasa'].'.png> <a href=b_str_bash.php?basn='.$sty['id'].'><font color='.$color.'>'.$sty['name'].'</font></a>
(<font color=#00ff00>'.$kol1.'</font>-<font color=#ff0000>'.$kol2.'</font>)<br>';
}
echo'</div>';
$mobs=mysql_query("SELECT * FROM `log_str` WHERE `usr`='".$udata['id']."' ORDER BY `id` DESC LIMIT 10");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
}
else
{
echo '<div class="line m bts brs bls p">Лог боя:</div><div class="bat bts brs bls bbs p ">';
while($log=mysql_fetch_array($mobs))
{
echo $log['text'].'<br>';
}
}
}
echo '</div>';
echo '<div class="line bts brs bls m p">Лог игроков:</div><div class="bat bts brs bls bbs p ">';
$mobsq=mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$bt['arr']."' and `kom`='".$bt['kom']."' and `usr`>'1' and `status`!='2' and `tip`!='pit' ORDER BY `ur` DESC LIMIT 5");
while($lus=mysql_fetch_array($mobsq))
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$lus['usr']."'"));
echo '<img src=img/main/c'.$us['klass'].'.png> <img src=img/main/r'.$us['rasa'].'.png> <a href=info.php?id='.$us['id'].'>'.$us['usr'].'</a>
['.$lus['ur'].']<br>';
}
echo '</div>';
include('files/dwn.php');
?>