Файл: b_terr_kick.php
Строк: 209
<?
define('PROTECTOR', 1);
$textl='Битва';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$bat=mysql_query("SELECT * FROM `terr_usr` WHERE `usr`='".$udata['id']."'");
$bt=mysql_fetch_array($bat);
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `terr_usr` WHERE `id`='".$bt['enemy']."' and `arr`='".$bt['arr']."' and `kom`!='".$bt['kom']."'"));
if($bts['tip']!='pit')
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
}
else
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `pit` WHERE `id`='".$bts['pit']."'"));
$us['usr']=$us['name'];
}
if($bts['tip']!='pit')
{
if($us['ava']==0)
{
$img='<img src=img/pers/'.$us['klass'].''.$us['pol'].'.png>
';
}
else
{
$img='<img src=img/pers/ava/'.$us['ava'].'.png>';
}
$en_name=' <img src=img/main/c'.$us['klass'].'.png> <img src=img/main/r'.$us['rasa'].'.png><font color=#ff9900>'.$us['usr'].'</font>';
}
else
{
$us['usr']=$us['name'];
$en_name=' <font color=#ff9900>'.$us['usr'].'</font>';
$img= '<img src=img/pit/'.$us['tip'].'/'.$us['img'].'.jpg width=90px><br>';
}
if($bt['status']==0 and $bt['enemy']!=0)
{
$max_sila=$udata['sila'];
$min_sila=round($max_sila/100*10);if($min_sila<1){$min_sila=1;}
$blok=$us['blok'];
$vital_light=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `tip`='vital' and `status`='on' and `img`='4'"));
if($vital_light!=0)
{
$blok=$blok-15;
if($blok<0){$blok=0;}
}
$krit=$udata['krit'];
$vital_haos=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$us['id']."' and `tip`='vital' and `status`='on' and `img`='5'"));
if($vital_haos!=0)
{
$krit=$krit-15;
if($krit<0){$krit=0;}
}
$arm=$bts['arm'];
if($bt['sfer_3_time']>=time())
{$baf_3=$bt['sfer_3_ef'];}else{$baf_3=0;}//усиление
if($bts['sfer_4_time']>=time())
{$baf_4=$bts['sfer_4_ef'];}else{$baf_4=0;}//пробивание
if($bt['sfer_5_time']>=time())
{$baf_5=$bt['sfer_5_time']-time();}else{$baf_5=0;}//стан
if($bts['sfer_6_time']>=time())
{$baf_6=$bts['sfer_6_ef'];}else{$baf_6=0;}//оборона
if($bts['sfer_10_time']>=time())
{$baf_10=$bts['sfer_10_ef'];}else{$baf_10=0;}//пламя
if($bt['sfer_11_time']>=time())
{$baf_11=$bt['sfer_11_ef'];}else{$baf_11=0;}//ослабление
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=0;}//барьер
$time=$bt['time_us'];
if($time>time())
{
$sek=$time-time();
if($sek>=5){$prom=1;}
elseif($sek==4){$prom=0;$max_sila=round($max_sila-$max_sila/100*rand(70,80));$min_sila=round($min_sila/4);}
elseif($sek==3){$prom=0;$max_sila=round($max_sila-$max_sila/100*rand(50,70));$min_sila=round($min_sila/3);}
elseif($sek==2 or $sek==1){$prom=0;$max_sila=round($max_sila-$max_sila/100*rand(20,50));$min_sila=round($min_sila/2);}
}
if($baf_5!=0)
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Вы оглушены еще ".$baf_5."сек.</font>',
`terr`='".$se['id']."'
");
}
else
{
if($prom==1)
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Промах!</font>',
`terr`='".$se['id']."'
");
}
else
{
$sila=$max_sila;
$sila=round($sila+$sila/100*$baf_3);
$arm=round($arm-$arm/100*$baf_4);
$sila=$sila-$arm;
if($sila<$min_sila){$sila=round($min_sila-$min_sila/100*$baf_11);}
$sila=round($sila-$sila/100*$baf_6);
if($sila<1){$sila=1;}
$kr=rand(1,100);if($kr<=$krit){$sila=$sila*2;$k_sila=1;}else{$k_sila=0;}
$bl=rand(1,100);if($bl<=$blok){$blok_us=1;}else{$blok_us=0;}
$sila=round($sila-$sila/100*$baf_11);
if($blok_us==1)
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b23.png>".$en_name."<font color=#990000> заблокировал вашу атаку</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b23.png><font color=#cccccc>Вы заблокировали атаку <img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font></font>',
`terr`='".$se['id']."'
");
$att=0;
$att2=0;
}
else
{
$vital_moln=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `tip`='vital' and `status`='on' and `img`='1'"));
if($vital_moln!=0)
{
$moln=round($sila/100*5);
$lm=' <font color=#ff00ff>-'.$moln.'</font>';
}
else
{
$moln=0;
$lm='';
}
$vital_life=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `tip`='vital' and `status`='on' and `img`='2'"));
if($vital_life!=0)
{
$live=round($sila/100*5);
$ll='; <font color=#00ff44>+'.$live.'хп</font>';
$bthp=$bt['hp']+$live;
if($bthp>=$udata['hp']){$bthp=$udata['hp'];}
mysql_query("UPDATE `terr_usr` SET `hp`='".$bthp."' WHERE `id`='".$bt['id']."'");
}
else
{
$live=0;
$ll='';
}
$vital_dark=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `tip`='vital' and `status`='on' and `img`='3'"));
if($vital_dark!=0)
{
$rog=rand(1,100);
if($rog<=15)
{
$ogl=time()+3;
$lo='; <font color=#999999>+3c. оглушение</font>';
mysql_query("UPDATE `terr_usr` SET `sfer_5_time`='".$ogl."' WHERE `id`='".$bts['id']."'");
}
else
{
$lo='';
}
}
else
{
$lo='';
}
if($k_sila==1)
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#ff0000>Вы наносите критический удар ".$en_name." <b>-".$sila."".$lm."</b>".$ll."".$lo."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b8.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> наносит вам критический удар <b>-".$sila."".$lm."".$lo."</b></font>'
");
}
else
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#00ff99>Вы наносите удар ".$k." ".$en_name." -".$sila."".$lm."".$ll."".$lo."</font>'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b8.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> наносит вам удар -".$sila."".$lm."".$lo."</font>'
");
}
$att=$sila+$moln;
$att2=$sila+$moln;
$hp=$bts['hp']-$sila-$moln;
if($hp<=0)
{
$exp=$bts['hp'];
$kill=$gus['reit_b']+1;
$hp=0;
mysql_query("UPDATE `terr_usr` SET `status`='2' WHERE `id`='".$bts['id']."'");
$err=time()+1800;
mysql_query("UPDATE `users` SET `err`='".$err."' WHERE `id`='".$bts['usr']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>',
`terr`='".$se['id']."'
");
if($bts['tip']=='usr')
{
$us1=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$us2=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bt['usr']."'"));
$us1['hp1']=$us1['hp1']+$us1['hp2'];
$us1['sila1']=$us1['sila1']+$us1['sila2'];
$us1['arm1']=$us1['arm1']+$us1['arm2'];
$ss1=$us1['hp1']+$us1['sila1']+$us1['arm1'];
$us2['hp1']=$us2['hp1']+$us2['hp2'];
$us2['sila1']=$us2['sila1']+$us2['sila2'];
$us2['arm1']=$us2['arm1']+$us2['arm2'];
$ss2=$us2['hp1']+$us2['sila1']+$us2['arm1'];
$lgf='<a href=info.php?id='.$us1['id'].'>'.$us1['usr'].'</a>('.$ss1.')<br>'.$us1['ip'].'</td><td align=center colspan=1><-</td><td colspan=2><a href=info.php?id='.$us1['id'].'>'.$us2['usr'].'</a>('.$ss2.')<br>'.$us2['ip'].'';
mysql_query("INSERT INTO `adm_res` SET
`id`='',
`usr`='".$bt['kod']."',
`tip`='terrs',
`text`='".$lgf."',
`time`='".time()."'
");
}
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['killer_exp']+1;
mysql_query("UPDATE `users_dost` SET `killer_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$exp=$sila;
$kill=$gus['reit_b']+0;
$hp=$hp;
if($baf_10!=0)
{
$yr=round($sila/100*$baf_10);
$yr=round($yr-$yr/100*$baf_12);
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#ff0000>Вас обожгло заклинание возврата -".$yr."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b8.png><font color=#00ff00>заклинание возврата обожгло <img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> -".$yr."</font>',
`terr`='".$se['id']."'
");
$hps=$bt['hp']-$yr;
if($hps<1){$hps=1;}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hps."', `att2`='".$yr."' WHERE `id`='".$bt['id']."'");
}
}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hp."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `clan_users` SET `reit_b`='".$kill."' WHERE `usr`='".$bt['usr']."'");
if($udata['lvl']<16)
{$vrs=15;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
if($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$vip_lvl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$vip_lvl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$vip_lvl=3;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$vip_lvl=4;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$vip_lvl=5;}
elseif($udata['vip_exp']>=5000){$vip_lvl=6;}
if($vip_lvl==1){$exp=$exp+$exp/100*5;}
if($vip_lvl==2){$exp=$exp+$exp/100*10;}
if($vip_lvl==3){$exp=$exp+$exp/100*15;}
if($vip_lvl==4){$exp=$exp+$exp/100*20;}
if($vip_lvl==5){$exp=$exp+$exp/100*30;}
if($vip_lvl==6){$exp=$exp+$exp/100*50;}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
$ezd=mysql_query("SELECT * FROM `users_ezd` WHERE `usr`='".$udata['id']."'");
$nez=mysql_num_rows($ezd);
if($nez==0)
{
$t=time()+7;
}
else
{
$ez=mysql_fetch_array($ezd);
if($ez['lvl']<20){$t=time()+7;}
elseif($ez['lvl']>=20 and $ez['lvl']<40){$t=time()+6;}
elseif($ez['lvl']>=40){$t=time()+5;}
}
mysql_query("UPDATE `terr_usr` SET `time_us`='".$t."', `att`='".$att."' WHERE `id`='".$bt['id']."'");
}
}
header('location: b_terr.php');exit;
?>