Файл: b_av_kick.php
Строк: 220
<?
define('PROTECTOR', 1);
$textl='Битва';
include('files/db.php');
include($path.'files/auth.php');
include($path.'files/syst.php');
if ($user_id==0){
header('location: index.php');exit;
}
$bat=mysql_query("SELECT * FROM `avan_usr` WHERE `usr`='".$udata['id']."'");
$bt=mysql_fetch_array($bat);
$av=mysql_fetch_array(mysql_query("SELECT * FROM `avan` WHERE `id`='".$bt['arr']."'"));
$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'"));
$enemy=mysql_num_rows(mysql_query("SELECT * FROM `avan_mob` WHERE `arr`='".$bt['arr']."' and `id`='".$bt['enemy']."'"));
if($enemy==0)
{
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;
}
}
else
{
$sila=$bt['sila'];
if($bt['time_us']>time())
{
$t_r=$bt['time_us']-time();
if($t_r>=5)
{
$prom=1;
}
$sila=$sila-round($sila/100*rand(70,90));
}
if($prom==1)
{
$lg='<img src=img/main/b1.png> <font color=#999999>Промах</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."'
");
}
else
{
if($bt['sfer_m']>=time())
{
$mobs=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$udata['id']."' and `mag`='3' and `status`='on'");
$skill=mysql_fetch_array($mobs);
if($skill['lvl']==1)
{$sk=3;}
if($skill['lvl']==2)
{$sk=6;}
if($skill['lvl']==3)
{$sk=9;}
if($skill['lvl']==4)
{$sk=12;}
if($skill['lvl']==5)
{$sk=15;}
if($skill['lvl']==6)
{$sk=18;}
if($skill['lvl']==7)
{$sk=21;}
if($skill['lvl']==8)
{$sk=24;}
if($skill['lvl']==9)
{$sk=27;}
if($skill['lvl']==10)
{$sk=30;}
$sila=round($sila+$sila/100*$sk);
}
$arm=$bts['arm'];
if($bts['sfer_d']>=time())
{
$arm=round($arm-$arm/100*$bts['sfer_dp']);
}
if($bts['mag_sr_time']>=time())
{
$arm=round($arm-$arm/100*$bts['mag_sr']);
}
$sila=$sila-$arm;
if($sila<$udata['sila']/100*10)
{
$sila=round($udata['sila']/100*10);
}
if($bts['tip']==2)
{
$sila=round($sila*2);
}
if($bts['tip']==3)
{
$sila=round($sila/2);
}
$rk=rand(1,3);
if($rk==1)
{
$kz='ударил';
}
if($rk==2)
{
$kz='пронзил';
}
if($rk==3)
{
$kz='двинул';
}
$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 `avan_mob` SET `sfer_so`='".$ogl."' WHERE `id`='".$bts['id']."'");
}
else
{
$lo='';
}
}
else
{
$lo='';
}
$k=rand(1,100);
if($k<=$udata['krit'])
{
$sila=$sila*2;
$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 `avan_usr` SET `hp`='".$bthp."' WHERE `id`='".$bt['id']."'");
}
else
{
$live=0;
$ll='';
}
$lg='<img src=img/main/b8.png><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#ff0000>
наносит сокрушительный удар '.$bts['name'].' -<b>'.$sila.'</b>'.$lm.''.$ll.''.$lo.'</font>';
}
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 `avan_usr` SET `hp`='".$bthp."' WHERE `id`='".$bt['id']."'");
}
else
{
$live=0;
$ll='';
}
$lg='<img src=img/main/b8.png><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#00cc00>
'.$kz.' '.$bts['name'].' -<b>'.$sila.'</b>'.$lm.''.$ll.''.$lo.'</font>';
}
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."', `arr`='".$av['id']."'
");
$hp=$bts['hp']-$sila-$moln;
if($hp<=0)
{
$lg2='<img src=img/main/b17.png><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#ff0000>
сокрушает '.$bts['name'].'</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg2."', `arr`='".$av['id']."'
");
$dm=date('m');
$dd=date('d');
$dc=$dm.''.$dd;
if($dc>='306' and $dc<='320')
{
if($udata['pol']==1){$rand=rand(1,10);}
elseif($udata['pol']==2){$rand=rand(1,7);}
if($rand==1)
{
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e28.png><font color=#00ff00>Вы получили <img src=img/main/23f.png>1</font>',
`arr`='".$av['id']."'
");
$god=$udata['tank']+1;
mysql_query("UPDATE `users` SET `tank`='".$god."' WHERE `id`='".$udata['id']."'");
}
}
$nai=$udata['reit_oh']+1;
if($udata['lvl']>$udata['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=$udata['exp_rang']+$rang;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `exp_rang`='".$rang."' 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']."'");
$ra=rand(1,3);
if($ra==1)
{
$kl=$udata['kl']+1;
mysql_query("UPDATE `users` SET `kl`='".$kl."' WHERE `id`='".$udata['id']."'");
$lg3='<img src=img/main/p12.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#00ff00>
получает <img src=img/main/r16.png>1</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg3."', `arr`='".$av['id']."'
");
}
if($ra==2)
{
$kl=$udata['kl']+1;
$fm=$udata['fm']+1;
mysql_query("UPDATE `users` SET `kl`='".$kl."', `fm`='".$fm."' WHERE `id`='".$udata['id']."'");
$lg3='<img src=img/main/p12.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#00ff00>
получает <img src=img/main/r16.png>1 <img src=img/main/r17.png>1</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg3."'
");
}
mysql_query("UPDATE `avan_usr` SET `enemy`='0' WHERE `id`='".$bt['id']."'");
$tim=time()+7;
$ur=$bt['ur']+$bts['hp'];
mysql_query("UPDATE `avan_usr` SET `time_us`='".$tim."', `att`='".$sila."', `ur`='".$ur."' WHERE `id`='".$bt['id']."'");
$exp=$bts['hp'];
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']."'");
mysql_query("DELETE FROM `avan_mob` WHERE `id`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `avan_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
$exp=$sila;
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;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$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;}
}
$ur=$bt['ur']+$sila;
mysql_query("UPDATE `avan_usr` SET `time_us`='".$t."', `att`='".$sila."', `ur`='".$ur."' WHERE `id`='".$bt['id']."'");
}
}
}
header('location: b_av.php');exit;
?>