Файл: pdz_bt_kick.php
Строк: 133
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$bt=mysql_fetch_array(mysql_query("SELECT * FROM `pdz_usr` WHERE `usr`='".$udata['id']."'"));
$pdz_komn=mysql_fetch_array(mysql_query("SELECT * FROM `pdz_kom` WHERE `id`='".$bt['arr']."'"));
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `pdz_mob` WHERE `id`='".$bt['enemy']."'"));
$bts_num=mysql_num_rows(mysql_query("SELECT * FROM `pdz_mob` WHERE `id`='".$bt['enemy']."'"));
$en_name='<font color=#ff9900>'.$bts['name'].'</font>';
if($bt['status']==0 and $bt['enemy']!=0)
{
if($bts_num==0)
{
mysql_query("UPDATE `pdz_usr` SET `enemy`='0' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Нет противника!</font>',
`pdz`='".$pdz_kom['id']."'
");
header('location: pdz_bt.php');exit;
}
if($bt['sfer_5_time']>time())
{
$s=$bt['sfer_5_time']-time();
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Вы оглушены! Еще ".$s."с.</font>',
`pdz`='".$pdz_kom['id']."'
");
header('location: pdz_bt.php');exit;
}
$max_sila=$udata['sila'];
$min_sila=round($max_sila/100*10);if($min_sila<1){$min_sila=1;}
$blok=0;
$krit=$udata['krit'];
$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_11_time']>=time())
{$baf_11=$bt['sfer_11_ef'];}else{$baf_11=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($prom==1)
{
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Промах!</font>',
`pdz`='".$pdz_kom['id']."'
");
}
else
{
$sila=$max_sila;
$sila=round($sila+$sila/100*$baf_3);
$sila=round($sila-$sila/100*$baf_11);
$arm=round($arm-$arm/100*$baf_4);
$sila=$sila-$arm;
if($sila<$min_sila){$sila=round($min_sila-$min_sila/100*$baf_11);}
$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;}
if($blok_us==1)
{
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b23.png>".$en_name."<font color=#990000> заблокировал вашу атаку</font>',
`pdz`='".$pdz_kom['id']."'
");
$att=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 `pdz_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 `pdz_mob` SET `sfer_5_time`='".$ogl."' WHERE `id`='".$bts['id']."'");
}
else
{
$lo='';
}
}
else
{
$lo='';
}
if($k_sila==1)
{
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#ff0000>Вы наносите критический удар ".$en_name." <b>-".$sila."".$lm."</b>".$ll."".$lo."</font>',
`pdz`='".$pdz_kom['id']."'
");
}
else
{
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#00ff99>Вы наносите удар ".$k." ".$en_name." -".$sila."".$lm."".$ll."".$lo."</font>',
`pdz`='".$pdz_kom['id']."'
");
}
$att=$sila+$moln;
$att2=$sila+$moln;
$hp=$bts['hp']-$sila-$moln;
if($hp<=0)
{
$exp=$bts['hp'];
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$bts['name']."</font>',
`pdz`='".$pdz_kom['id']."'
");
$nai=$udata['reit_oh']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['hunter_exp']+1;
mysql_query("UPDATE `users_dost` SET `hunter_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
mysql_query("DELETE FROM `pdz_mob` WHERE `id`='".$bts['id']."'");
$yr=$bts['hp'];
}
else
{
$exp=$sila;
$hp=$hp;
$yr=$sila;
mysql_query("UPDATE `pdz_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$yr=$bt['yr']+$yr;
mysql_query("UPDATE `pdz_usr` SET `att`='".$att."', `yr`='".$yr."' WHERE `id`='".$bt['id']."'");
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 `pdz_usr` SET `time_us`='".$t."', `att`='".$att."' WHERE `id`='".$bt['id']."'");
}
header('location: pdz_bt.php');exit;
?>